| 1 | =begin comment | ||
| 2 | |||
| 3 | Fastly API | ||
| 4 | |||
| 5 | Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) | ||
| 6 | |||
| 7 | The version of the API Spec document: 1.0.0 | ||
| 8 | Contact: oss@fastly.com | ||
| 9 | |||
| 10 | =end comment | ||
| 11 | |||
| 12 | =cut | ||
| 13 | |||
| 14 | # | ||
| 15 | # NOTE: This class is auto generated. | ||
| 16 | # Do not edit the class manually. | ||
| 17 | # | ||
| 18 | package WebService::Fastly::BillingInvoicesApi; | ||
| 19 | |||
| 20 | require 5.6.0; | ||
| 21 | use strict; | ||
| 22 | use warnings; | ||
| 23 | use utf8; | ||
| 24 | use Exporter; | ||
| 25 | use Carp qw( croak ); | ||
| 26 | use Log::Any qw($log); | ||
| 27 | |||
| 28 | use WebService::Fastly::ApiClient; | ||
| 29 | |||
| 30 | use base "Class::Data::Inheritable"; | ||
| 31 | |||
| 32 | __PACKAGE__->mk_classdata('method_documentation' => {}); | ||
| 33 | |||
| 34 | sub new { | ||
| 35 | my $class = shift; | ||
| 36 | my $api_client; | ||
| 37 | |||
| 38 | if ($_[0] && ref $_[0] && ref $_[0] eq 'WebService::Fastly::ApiClient' ) { | ||
| 39 | $api_client = $_[0]; | ||
| 40 | } else { | ||
| 41 | $api_client = WebService::Fastly::ApiClient->new(@_); | ||
| 42 | } | ||
| 43 | |||
| 44 | bless { api_client => $api_client }, $class; | ||
| 45 | |||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | # | ||
| 50 | # get_invoice_by_invoice_id | ||
| 51 | # | ||
| 52 | # Get invoice by ID. | ||
| 53 | # | ||
| 54 | # @param int $invoice_id (required) | ||
| 55 | { | ||
| 56 | my $params = { | ||
| 57 | 'invoice_id' => { | ||
| 58 | data_type => 'int', | ||
| 59 | description => '', | ||
| 60 | required => '1', | ||
| 61 | }, | ||
| 62 | }; | ||
| 63 | __PACKAGE__->method_documentation->{ 'get_invoice_by_invoice_id' } = { | ||
| 64 | summary => 'Get invoice by ID.', | ||
| 65 | params => $params, | ||
| 66 | returns => 'EomInvoiceResponse', | ||
| 67 | }; | ||
| 68 | } | ||
| 69 | # @return EomInvoiceResponse | ||
| 70 | # | ||
| 71 | sub get_invoice_by_invoice_id { | ||
| 72 | my ($self, %args) = @_; | ||
| 73 | |||
| 74 | # verify the required parameter 'invoice_id' is set | ||
| 75 | unless (exists $args{'invoice_id'}) { | ||
| 76 | croak("Missing the required parameter 'invoice_id' when calling get_invoice_by_invoice_id"); | ||
| 77 | } | ||
| 78 | |||
| 79 | # parse inputs | ||
| 80 | my $_resource_path = '/billing/v3/invoices/{invoice_id}'; | ||
| 81 | |||
| 82 | my $_method = 'GET'; | ||
| 83 | my $query_params = {}; | ||
| 84 | my $header_params = {}; | ||
| 85 | my $form_params = {}; | ||
| 86 | |||
| 87 | # 'Accept' and 'Content-Type' header | ||
| 88 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 89 | if ($_header_accept) { | ||
| 90 | $header_params->{'Accept'} = $_header_accept; | ||
| 91 | } | ||
| 92 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 93 | |||
| 94 | # path params | ||
| 95 | if ( exists $args{'invoice_id'}) { | ||
| 96 | my $_base_variable = "{" . "invoice_id" . "}"; | ||
| 97 | my $_base_value = $self->{api_client}->to_path_value($args{'invoice_id'}); | ||
| 98 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 99 | } | ||
| 100 | |||
| 101 | my $_body_data; | ||
| 102 | # authentication setting, if any | ||
| 103 | my $auth_settings = [qw(token )]; | ||
| 104 | |||
| 105 | # make the API Call | ||
| 106 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 107 | $query_params, $form_params, | ||
| 108 | $header_params, $_body_data, $auth_settings); | ||
| 109 | if (!$response) { | ||
| 110 | return; | ||
| 111 | } | ||
| 112 | my $_response_object = $self->{api_client}->deserialize('EomInvoiceResponse', $response); | ||
| 113 | return $_response_object; | ||
| 114 | } | ||
| 115 | |||
| 116 | # | ||
| 117 | # get_month_to_date_invoice | ||
| 118 | # | ||
| 119 | # Get month-to-date invoice. | ||
| 120 | # | ||
| 121 | { | ||
| 122 | my $params = { | ||
| 123 | }; | ||
| 124 | __PACKAGE__->method_documentation->{ 'get_month_to_date_invoice' } = { | ||
| 125 | summary => 'Get month-to-date invoice.', | ||
| 126 | params => $params, | ||
| 127 | returns => 'MtdInvoiceResponse', | ||
| 128 | }; | ||
| 129 | } | ||
| 130 | # @return MtdInvoiceResponse | ||
| 131 | # | ||
| 132 | sub get_month_to_date_invoice { | ||
| 133 | my ($self, %args) = @_; | ||
| 134 | |||
| 135 | # parse inputs | ||
| 136 | my $_resource_path = '/billing/v3/invoices/month-to-date'; | ||
| 137 | |||
| 138 | my $_method = 'GET'; | ||
| 139 | my $query_params = {}; | ||
| 140 | my $header_params = {}; | ||
| 141 | my $form_params = {}; | ||
| 142 | |||
| 143 | # 'Accept' and 'Content-Type' header | ||
| 144 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 145 | if ($_header_accept) { | ||
| 146 | $header_params->{'Accept'} = $_header_accept; | ||
| 147 | } | ||
| 148 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 149 | |||
| 150 | my $_body_data; | ||
| 151 | # authentication setting, if any | ||
| 152 | my $auth_settings = [qw(token )]; | ||
| 153 | |||
| 154 | # make the API Call | ||
| 155 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 156 | $query_params, $form_params, | ||
| 157 | $header_params, $_body_data, $auth_settings); | ||
| 158 | if (!$response) { | ||
| 159 | return; | ||
| 160 | } | ||
| 161 | my $_response_object = $self->{api_client}->deserialize('MtdInvoiceResponse', $response); | ||
| 162 | return $_response_object; | ||
| 163 | } | ||
| 164 | |||
| 165 | # | ||
| 166 | # list_invoices | ||
| 167 | # | ||
| 168 | # List of invoices. | ||
| 169 | # | ||
| 170 | # @param string $billing_start_date (optional) | ||
| 171 | # @param string $billing_end_date (optional) | ||
| 172 | # @param string $limit Number of results per page. The maximum is 200. (optional, default to '100') | ||
| 173 | # @param string $cursor Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. (optional) | ||
| 174 | { | ||
| 175 | my $params = { | ||
| 176 | 'billing_start_date' => { | ||
| 177 | data_type => 'string', | ||
| 178 | description => '', | ||
| 179 | required => '0', | ||
| 180 | }, | ||
| 181 | 'billing_end_date' => { | ||
| 182 | data_type => 'string', | ||
| 183 | description => '', | ||
| 184 | required => '0', | ||
| 185 | }, | ||
| 186 | 'limit' => { | ||
| 187 | data_type => 'string', | ||
| 188 | description => 'Number of results per page. The maximum is 200.', | ||
| 189 | required => '0', | ||
| 190 | }, | ||
| 191 | 'cursor' => { | ||
| 192 | data_type => 'string', | ||
| 193 | description => 'Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty.', | ||
| 194 | required => '0', | ||
| 195 | }, | ||
| 196 | }; | ||
| 197 | __PACKAGE__->method_documentation->{ 'list_invoices' } = { | ||
| 198 | summary => 'List of invoices.', | ||
| 199 | params => $params, | ||
| 200 | returns => 'ListEomInvoicesResponse', | ||
| 201 | }; | ||
| 202 | } | ||
| 203 | # @return ListEomInvoicesResponse | ||
| 204 | # | ||
| 205 | sub list_invoices { | ||
| 206 | my ($self, %args) = @_; | ||
| 207 | |||
| 208 | # parse inputs | ||
| 209 | my $_resource_path = '/billing/v3/invoices'; | ||
| 210 | |||
| 211 | my $_method = 'GET'; | ||
| 212 | my $query_params = {}; | ||
| 213 | my $header_params = {}; | ||
| 214 | my $form_params = {}; | ||
| 215 | |||
| 216 | # 'Accept' and 'Content-Type' header | ||
| 217 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 218 | if ($_header_accept) { | ||
| 219 | $header_params->{'Accept'} = $_header_accept; | ||
| 220 | } | ||
| 221 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 222 | |||
| 223 | # query params | ||
| 224 | if ( exists $args{'billing_start_date'}) { | ||
| 225 | $query_params->{'billing_start_date'} = $self->{api_client}->to_query_value($args{'billing_start_date'}); | ||
| 226 | } | ||
| 227 | |||
| 228 | # query params | ||
| 229 | if ( exists $args{'billing_end_date'}) { | ||
| 230 | $query_params->{'billing_end_date'} = $self->{api_client}->to_query_value($args{'billing_end_date'}); | ||
| 231 | } | ||
| 232 | |||
| 233 | # query params | ||
| 234 | if ( exists $args{'limit'}) { | ||
| 235 | $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'}); | ||
| 236 | } | ||
| 237 | |||
| 238 | # query params | ||
| 239 | if ( exists $args{'cursor'}) { | ||
| 240 | $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'}); | ||
| 241 | } | ||
| 242 | |||
| 243 | my $_body_data; | ||
| 244 | # authentication setting, if any | ||
| 245 | my $auth_settings = [qw(token )]; | ||
| 246 | |||
| 247 | # make the API Call | ||
| 248 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 249 | $query_params, $form_params, | ||
| 250 | $header_params, $_body_data, $auth_settings); | ||
| 251 | if (!$response) { | ||
| 252 | return; | ||
| 253 | } | ||
| 254 | my $_response_object = $self->{api_client}->deserialize('ListEomInvoicesResponse', $response); | ||
| 255 | return $_response_object; | ||
| 256 | } | ||
| 257 | |||
| 258 | 1; |