| 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::DictionaryItemApi; | ||
| 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 | # bulk_update_dictionary_item | ||
| 51 | # | ||
| 52 | # Update multiple entries in a dictionary | ||
| 53 | # | ||
| 54 | # @param string $service_id Alphanumeric string identifying the service. (required) | ||
| 55 | # @param string $dictionary_id Alphanumeric string identifying a Dictionary. (required) | ||
| 56 | # @param BulkUpdateDictionaryListRequest $bulk_update_dictionary_list_request (optional) | ||
| 57 | { | ||
| 58 | my $params = { | ||
| 59 | 'service_id' => { | ||
| 60 | data_type => 'string', | ||
| 61 | description => 'Alphanumeric string identifying the service.', | ||
| 62 | required => '1', | ||
| 63 | }, | ||
| 64 | 'dictionary_id' => { | ||
| 65 | data_type => 'string', | ||
| 66 | description => 'Alphanumeric string identifying a Dictionary.', | ||
| 67 | required => '1', | ||
| 68 | }, | ||
| 69 | 'bulk_update_dictionary_list_request' => { | ||
| 70 | data_type => 'BulkUpdateDictionaryListRequest', | ||
| 71 | description => '', | ||
| 72 | required => '0', | ||
| 73 | }, | ||
| 74 | }; | ||
| 75 | __PACKAGE__->method_documentation->{ 'bulk_update_dictionary_item' } = { | ||
| 76 | summary => 'Update multiple entries in a dictionary', | ||
| 77 | params => $params, | ||
| 78 | returns => 'InlineResponse200', | ||
| 79 | }; | ||
| 80 | } | ||
| 81 | # @return InlineResponse200 | ||
| 82 | # | ||
| 83 | sub bulk_update_dictionary_item { | ||
| 84 | my ($self, %args) = @_; | ||
| 85 | |||
| 86 | # verify the required parameter 'service_id' is set | ||
| 87 | unless (exists $args{'service_id'}) { | ||
| 88 | croak("Missing the required parameter 'service_id' when calling bulk_update_dictionary_item"); | ||
| 89 | } | ||
| 90 | |||
| 91 | # verify the required parameter 'dictionary_id' is set | ||
| 92 | unless (exists $args{'dictionary_id'}) { | ||
| 93 | croak("Missing the required parameter 'dictionary_id' when calling bulk_update_dictionary_item"); | ||
| 94 | } | ||
| 95 | |||
| 96 | # parse inputs | ||
| 97 | my $_resource_path = '/service/{service_id}/dictionary/{dictionary_id}/items'; | ||
| 98 | |||
| 99 | my $_method = 'PATCH'; | ||
| 100 | my $query_params = {}; | ||
| 101 | my $header_params = {}; | ||
| 102 | my $form_params = {}; | ||
| 103 | |||
| 104 | # 'Accept' and 'Content-Type' header | ||
| 105 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 106 | if ($_header_accept) { | ||
| 107 | $header_params->{'Accept'} = $_header_accept; | ||
| 108 | } | ||
| 109 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); | ||
| 110 | |||
| 111 | # path params | ||
| 112 | if ( exists $args{'service_id'}) { | ||
| 113 | my $_base_variable = "{" . "service_id" . "}"; | ||
| 114 | my $_base_value = $self->{api_client}->to_path_value($args{'service_id'}); | ||
| 115 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 116 | } | ||
| 117 | |||
| 118 | # path params | ||
| 119 | if ( exists $args{'dictionary_id'}) { | ||
| 120 | my $_base_variable = "{" . "dictionary_id" . "}"; | ||
| 121 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_id'}); | ||
| 122 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 123 | } | ||
| 124 | |||
| 125 | my $_body_data; | ||
| 126 | # body params | ||
| 127 | if ( exists $args{'bulk_update_dictionary_list_request'}) { | ||
| 128 | $_body_data = $args{'bulk_update_dictionary_list_request'}; | ||
| 129 | } | ||
| 130 | |||
| 131 | # authentication setting, if any | ||
| 132 | my $auth_settings = [qw(token )]; | ||
| 133 | |||
| 134 | # make the API Call | ||
| 135 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 136 | $query_params, $form_params, | ||
| 137 | $header_params, $_body_data, $auth_settings); | ||
| 138 | if (!$response) { | ||
| 139 | return; | ||
| 140 | } | ||
| 141 | my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response); | ||
| 142 | return $_response_object; | ||
| 143 | } | ||
| 144 | |||
| 145 | # | ||
| 146 | # create_dictionary_item | ||
| 147 | # | ||
| 148 | # Create an entry in a dictionary | ||
| 149 | # | ||
| 150 | # @param string $service_id Alphanumeric string identifying the service. (required) | ||
| 151 | # @param string $dictionary_id Alphanumeric string identifying a Dictionary. (required) | ||
| 152 | # @param string $item_key Item key, maximum 255 characters. (optional) | ||
| 153 | # @param string $item_value Item value, maximum 8000 characters. (optional) | ||
| 154 | { | ||
| 155 | my $params = { | ||
| 156 | 'service_id' => { | ||
| 157 | data_type => 'string', | ||
| 158 | description => 'Alphanumeric string identifying the service.', | ||
| 159 | required => '1', | ||
| 160 | }, | ||
| 161 | 'dictionary_id' => { | ||
| 162 | data_type => 'string', | ||
| 163 | description => 'Alphanumeric string identifying a Dictionary.', | ||
| 164 | required => '1', | ||
| 165 | }, | ||
| 166 | 'item_key' => { | ||
| 167 | data_type => 'string', | ||
| 168 | description => 'Item key, maximum 255 characters.', | ||
| 169 | required => '0', | ||
| 170 | }, | ||
| 171 | 'item_value' => { | ||
| 172 | data_type => 'string', | ||
| 173 | description => 'Item value, maximum 8000 characters.', | ||
| 174 | required => '0', | ||
| 175 | }, | ||
| 176 | }; | ||
| 177 | __PACKAGE__->method_documentation->{ 'create_dictionary_item' } = { | ||
| 178 | summary => 'Create an entry in a dictionary', | ||
| 179 | params => $params, | ||
| 180 | returns => 'DictionaryItemResponse', | ||
| 181 | }; | ||
| 182 | } | ||
| 183 | # @return DictionaryItemResponse | ||
| 184 | # | ||
| 185 | sub create_dictionary_item { | ||
| 186 | my ($self, %args) = @_; | ||
| 187 | |||
| 188 | # verify the required parameter 'service_id' is set | ||
| 189 | unless (exists $args{'service_id'}) { | ||
| 190 | croak("Missing the required parameter 'service_id' when calling create_dictionary_item"); | ||
| 191 | } | ||
| 192 | |||
| 193 | # verify the required parameter 'dictionary_id' is set | ||
| 194 | unless (exists $args{'dictionary_id'}) { | ||
| 195 | croak("Missing the required parameter 'dictionary_id' when calling create_dictionary_item"); | ||
| 196 | } | ||
| 197 | |||
| 198 | # parse inputs | ||
| 199 | my $_resource_path = '/service/{service_id}/dictionary/{dictionary_id}/item'; | ||
| 200 | |||
| 201 | my $_method = 'POST'; | ||
| 202 | my $query_params = {}; | ||
| 203 | my $header_params = {}; | ||
| 204 | my $form_params = {}; | ||
| 205 | |||
| 206 | # 'Accept' and 'Content-Type' header | ||
| 207 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 208 | if ($_header_accept) { | ||
| 209 | $header_params->{'Accept'} = $_header_accept; | ||
| 210 | } | ||
| 211 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded'); | ||
| 212 | |||
| 213 | # path params | ||
| 214 | if ( exists $args{'service_id'}) { | ||
| 215 | my $_base_variable = "{" . "service_id" . "}"; | ||
| 216 | my $_base_value = $self->{api_client}->to_path_value($args{'service_id'}); | ||
| 217 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 218 | } | ||
| 219 | |||
| 220 | # path params | ||
| 221 | if ( exists $args{'dictionary_id'}) { | ||
| 222 | my $_base_variable = "{" . "dictionary_id" . "}"; | ||
| 223 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_id'}); | ||
| 224 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 225 | } | ||
| 226 | |||
| 227 | # form params | ||
| 228 | if ( exists $args{'item_key'} ) { | ||
| 229 | $form_params->{'item_key'} = $self->{api_client}->to_form_value($args{'item_key'}); | ||
| 230 | } | ||
| 231 | |||
| 232 | # form params | ||
| 233 | if ( exists $args{'item_value'} ) { | ||
| 234 | $form_params->{'item_value'} = $self->{api_client}->to_form_value($args{'item_value'}); | ||
| 235 | } | ||
| 236 | |||
| 237 | my $_body_data; | ||
| 238 | # authentication setting, if any | ||
| 239 | my $auth_settings = [qw(token )]; | ||
| 240 | |||
| 241 | # make the API Call | ||
| 242 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 243 | $query_params, $form_params, | ||
| 244 | $header_params, $_body_data, $auth_settings); | ||
| 245 | if (!$response) { | ||
| 246 | return; | ||
| 247 | } | ||
| 248 | my $_response_object = $self->{api_client}->deserialize('DictionaryItemResponse', $response); | ||
| 249 | return $_response_object; | ||
| 250 | } | ||
| 251 | |||
| 252 | # | ||
| 253 | # delete_dictionary_item | ||
| 254 | # | ||
| 255 | # Delete an item from a dictionary | ||
| 256 | # | ||
| 257 | # @param string $service_id Alphanumeric string identifying the service. (required) | ||
| 258 | # @param string $dictionary_id Alphanumeric string identifying a Dictionary. (required) | ||
| 259 | # @param string $dictionary_item_key Item key, maximum 255 characters. (required) | ||
| 260 | { | ||
| 261 | my $params = { | ||
| 262 | 'service_id' => { | ||
| 263 | data_type => 'string', | ||
| 264 | description => 'Alphanumeric string identifying the service.', | ||
| 265 | required => '1', | ||
| 266 | }, | ||
| 267 | 'dictionary_id' => { | ||
| 268 | data_type => 'string', | ||
| 269 | description => 'Alphanumeric string identifying a Dictionary.', | ||
| 270 | required => '1', | ||
| 271 | }, | ||
| 272 | 'dictionary_item_key' => { | ||
| 273 | data_type => 'string', | ||
| 274 | description => 'Item key, maximum 255 characters.', | ||
| 275 | required => '1', | ||
| 276 | }, | ||
| 277 | }; | ||
| 278 | __PACKAGE__->method_documentation->{ 'delete_dictionary_item' } = { | ||
| 279 | summary => 'Delete an item from a dictionary', | ||
| 280 | params => $params, | ||
| 281 | returns => 'InlineResponse200', | ||
| 282 | }; | ||
| 283 | } | ||
| 284 | # @return InlineResponse200 | ||
| 285 | # | ||
| 286 | sub delete_dictionary_item { | ||
| 287 | my ($self, %args) = @_; | ||
| 288 | |||
| 289 | # verify the required parameter 'service_id' is set | ||
| 290 | unless (exists $args{'service_id'}) { | ||
| 291 | croak("Missing the required parameter 'service_id' when calling delete_dictionary_item"); | ||
| 292 | } | ||
| 293 | |||
| 294 | # verify the required parameter 'dictionary_id' is set | ||
| 295 | unless (exists $args{'dictionary_id'}) { | ||
| 296 | croak("Missing the required parameter 'dictionary_id' when calling delete_dictionary_item"); | ||
| 297 | } | ||
| 298 | |||
| 299 | # verify the required parameter 'dictionary_item_key' is set | ||
| 300 | unless (exists $args{'dictionary_item_key'}) { | ||
| 301 | croak("Missing the required parameter 'dictionary_item_key' when calling delete_dictionary_item"); | ||
| 302 | } | ||
| 303 | |||
| 304 | # parse inputs | ||
| 305 | my $_resource_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'; | ||
| 306 | |||
| 307 | my $_method = 'DELETE'; | ||
| 308 | my $query_params = {}; | ||
| 309 | my $header_params = {}; | ||
| 310 | my $form_params = {}; | ||
| 311 | |||
| 312 | # 'Accept' and 'Content-Type' header | ||
| 313 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 314 | if ($_header_accept) { | ||
| 315 | $header_params->{'Accept'} = $_header_accept; | ||
| 316 | } | ||
| 317 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 318 | |||
| 319 | # path params | ||
| 320 | if ( exists $args{'service_id'}) { | ||
| 321 | my $_base_variable = "{" . "service_id" . "}"; | ||
| 322 | my $_base_value = $self->{api_client}->to_path_value($args{'service_id'}); | ||
| 323 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 324 | } | ||
| 325 | |||
| 326 | # path params | ||
| 327 | if ( exists $args{'dictionary_id'}) { | ||
| 328 | my $_base_variable = "{" . "dictionary_id" . "}"; | ||
| 329 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_id'}); | ||
| 330 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 331 | } | ||
| 332 | |||
| 333 | # path params | ||
| 334 | if ( exists $args{'dictionary_item_key'}) { | ||
| 335 | my $_base_variable = "{" . "dictionary_item_key" . "}"; | ||
| 336 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_item_key'}); | ||
| 337 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 338 | } | ||
| 339 | |||
| 340 | my $_body_data; | ||
| 341 | # authentication setting, if any | ||
| 342 | my $auth_settings = [qw(token )]; | ||
| 343 | |||
| 344 | # make the API Call | ||
| 345 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 346 | $query_params, $form_params, | ||
| 347 | $header_params, $_body_data, $auth_settings); | ||
| 348 | if (!$response) { | ||
| 349 | return; | ||
| 350 | } | ||
| 351 | my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response); | ||
| 352 | return $_response_object; | ||
| 353 | } | ||
| 354 | |||
| 355 | # | ||
| 356 | # get_dictionary_item | ||
| 357 | # | ||
| 358 | # Get an item from a dictionary | ||
| 359 | # | ||
| 360 | # @param string $service_id Alphanumeric string identifying the service. (required) | ||
| 361 | # @param string $dictionary_id Alphanumeric string identifying a Dictionary. (required) | ||
| 362 | # @param string $dictionary_item_key Item key, maximum 255 characters. (required) | ||
| 363 | { | ||
| 364 | my $params = { | ||
| 365 | 'service_id' => { | ||
| 366 | data_type => 'string', | ||
| 367 | description => 'Alphanumeric string identifying the service.', | ||
| 368 | required => '1', | ||
| 369 | }, | ||
| 370 | 'dictionary_id' => { | ||
| 371 | data_type => 'string', | ||
| 372 | description => 'Alphanumeric string identifying a Dictionary.', | ||
| 373 | required => '1', | ||
| 374 | }, | ||
| 375 | 'dictionary_item_key' => { | ||
| 376 | data_type => 'string', | ||
| 377 | description => 'Item key, maximum 255 characters.', | ||
| 378 | required => '1', | ||
| 379 | }, | ||
| 380 | }; | ||
| 381 | __PACKAGE__->method_documentation->{ 'get_dictionary_item' } = { | ||
| 382 | summary => 'Get an item from a dictionary', | ||
| 383 | params => $params, | ||
| 384 | returns => 'DictionaryItemResponse', | ||
| 385 | }; | ||
| 386 | } | ||
| 387 | # @return DictionaryItemResponse | ||
| 388 | # | ||
| 389 | sub get_dictionary_item { | ||
| 390 | my ($self, %args) = @_; | ||
| 391 | |||
| 392 | # verify the required parameter 'service_id' is set | ||
| 393 | unless (exists $args{'service_id'}) { | ||
| 394 | croak("Missing the required parameter 'service_id' when calling get_dictionary_item"); | ||
| 395 | } | ||
| 396 | |||
| 397 | # verify the required parameter 'dictionary_id' is set | ||
| 398 | unless (exists $args{'dictionary_id'}) { | ||
| 399 | croak("Missing the required parameter 'dictionary_id' when calling get_dictionary_item"); | ||
| 400 | } | ||
| 401 | |||
| 402 | # verify the required parameter 'dictionary_item_key' is set | ||
| 403 | unless (exists $args{'dictionary_item_key'}) { | ||
| 404 | croak("Missing the required parameter 'dictionary_item_key' when calling get_dictionary_item"); | ||
| 405 | } | ||
| 406 | |||
| 407 | # parse inputs | ||
| 408 | my $_resource_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'; | ||
| 409 | |||
| 410 | my $_method = 'GET'; | ||
| 411 | my $query_params = {}; | ||
| 412 | my $header_params = {}; | ||
| 413 | my $form_params = {}; | ||
| 414 | |||
| 415 | # 'Accept' and 'Content-Type' header | ||
| 416 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 417 | if ($_header_accept) { | ||
| 418 | $header_params->{'Accept'} = $_header_accept; | ||
| 419 | } | ||
| 420 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 421 | |||
| 422 | # path params | ||
| 423 | if ( exists $args{'service_id'}) { | ||
| 424 | my $_base_variable = "{" . "service_id" . "}"; | ||
| 425 | my $_base_value = $self->{api_client}->to_path_value($args{'service_id'}); | ||
| 426 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 427 | } | ||
| 428 | |||
| 429 | # path params | ||
| 430 | if ( exists $args{'dictionary_id'}) { | ||
| 431 | my $_base_variable = "{" . "dictionary_id" . "}"; | ||
| 432 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_id'}); | ||
| 433 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 434 | } | ||
| 435 | |||
| 436 | # path params | ||
| 437 | if ( exists $args{'dictionary_item_key'}) { | ||
| 438 | my $_base_variable = "{" . "dictionary_item_key" . "}"; | ||
| 439 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_item_key'}); | ||
| 440 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 441 | } | ||
| 442 | |||
| 443 | my $_body_data; | ||
| 444 | # authentication setting, if any | ||
| 445 | my $auth_settings = [qw(token )]; | ||
| 446 | |||
| 447 | # make the API Call | ||
| 448 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 449 | $query_params, $form_params, | ||
| 450 | $header_params, $_body_data, $auth_settings); | ||
| 451 | if (!$response) { | ||
| 452 | return; | ||
| 453 | } | ||
| 454 | my $_response_object = $self->{api_client}->deserialize('DictionaryItemResponse', $response); | ||
| 455 | return $_response_object; | ||
| 456 | } | ||
| 457 | |||
| 458 | # | ||
| 459 | # list_dictionary_items | ||
| 460 | # | ||
| 461 | # List items in a dictionary | ||
| 462 | # | ||
| 463 | # @param string $service_id Alphanumeric string identifying the service. (required) | ||
| 464 | # @param string $dictionary_id Alphanumeric string identifying a Dictionary. (required) | ||
| 465 | # @param int $page Current page. (optional) | ||
| 466 | # @param int $per_page Number of records per page. (optional, default to 100) | ||
| 467 | # @param string $sort Field on which to sort. (optional, default to 'created') | ||
| 468 | # @param string $direction Direction in which to sort results. (optional, default to 'ascend') | ||
| 469 | { | ||
| 470 | my $params = { | ||
| 471 | 'service_id' => { | ||
| 472 | data_type => 'string', | ||
| 473 | description => 'Alphanumeric string identifying the service.', | ||
| 474 | required => '1', | ||
| 475 | }, | ||
| 476 | 'dictionary_id' => { | ||
| 477 | data_type => 'string', | ||
| 478 | description => 'Alphanumeric string identifying a Dictionary.', | ||
| 479 | required => '1', | ||
| 480 | }, | ||
| 481 | 'page' => { | ||
| 482 | data_type => 'int', | ||
| 483 | description => 'Current page.', | ||
| 484 | required => '0', | ||
| 485 | }, | ||
| 486 | 'per_page' => { | ||
| 487 | data_type => 'int', | ||
| 488 | description => 'Number of records per page.', | ||
| 489 | required => '0', | ||
| 490 | }, | ||
| 491 | 'sort' => { | ||
| 492 | data_type => 'string', | ||
| 493 | description => 'Field on which to sort.', | ||
| 494 | required => '0', | ||
| 495 | }, | ||
| 496 | 'direction' => { | ||
| 497 | data_type => 'string', | ||
| 498 | description => 'Direction in which to sort results.', | ||
| 499 | required => '0', | ||
| 500 | }, | ||
| 501 | }; | ||
| 502 | __PACKAGE__->method_documentation->{ 'list_dictionary_items' } = { | ||
| 503 | summary => 'List items in a dictionary', | ||
| 504 | params => $params, | ||
| 505 | returns => 'ARRAY[DictionaryItemResponse]', | ||
| 506 | }; | ||
| 507 | } | ||
| 508 | # @return ARRAY[DictionaryItemResponse] | ||
| 509 | # | ||
| 510 | sub list_dictionary_items { | ||
| 511 | my ($self, %args) = @_; | ||
| 512 | |||
| 513 | # verify the required parameter 'service_id' is set | ||
| 514 | unless (exists $args{'service_id'}) { | ||
| 515 | croak("Missing the required parameter 'service_id' when calling list_dictionary_items"); | ||
| 516 | } | ||
| 517 | |||
| 518 | # verify the required parameter 'dictionary_id' is set | ||
| 519 | unless (exists $args{'dictionary_id'}) { | ||
| 520 | croak("Missing the required parameter 'dictionary_id' when calling list_dictionary_items"); | ||
| 521 | } | ||
| 522 | |||
| 523 | # parse inputs | ||
| 524 | my $_resource_path = '/service/{service_id}/dictionary/{dictionary_id}/items'; | ||
| 525 | |||
| 526 | my $_method = 'GET'; | ||
| 527 | my $query_params = {}; | ||
| 528 | my $header_params = {}; | ||
| 529 | my $form_params = {}; | ||
| 530 | |||
| 531 | # 'Accept' and 'Content-Type' header | ||
| 532 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 533 | if ($_header_accept) { | ||
| 534 | $header_params->{'Accept'} = $_header_accept; | ||
| 535 | } | ||
| 536 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 537 | |||
| 538 | # query params | ||
| 539 | if ( exists $args{'page'}) { | ||
| 540 | $query_params->{'page'} = $self->{api_client}->to_query_value($args{'page'}); | ||
| 541 | } | ||
| 542 | |||
| 543 | # query params | ||
| 544 | if ( exists $args{'per_page'}) { | ||
| 545 | $query_params->{'per_page'} = $self->{api_client}->to_query_value($args{'per_page'}); | ||
| 546 | } | ||
| 547 | |||
| 548 | # query params | ||
| 549 | if ( exists $args{'sort'}) { | ||
| 550 | $query_params->{'sort'} = $self->{api_client}->to_query_value($args{'sort'}); | ||
| 551 | } | ||
| 552 | |||
| 553 | # query params | ||
| 554 | if ( exists $args{'direction'}) { | ||
| 555 | $query_params->{'direction'} = $self->{api_client}->to_query_value($args{'direction'}); | ||
| 556 | } | ||
| 557 | |||
| 558 | # path params | ||
| 559 | if ( exists $args{'service_id'}) { | ||
| 560 | my $_base_variable = "{" . "service_id" . "}"; | ||
| 561 | my $_base_value = $self->{api_client}->to_path_value($args{'service_id'}); | ||
| 562 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 563 | } | ||
| 564 | |||
| 565 | # path params | ||
| 566 | if ( exists $args{'dictionary_id'}) { | ||
| 567 | my $_base_variable = "{" . "dictionary_id" . "}"; | ||
| 568 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_id'}); | ||
| 569 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 570 | } | ||
| 571 | |||
| 572 | my $_body_data; | ||
| 573 | # authentication setting, if any | ||
| 574 | my $auth_settings = [qw(token )]; | ||
| 575 | |||
| 576 | # make the API Call | ||
| 577 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 578 | $query_params, $form_params, | ||
| 579 | $header_params, $_body_data, $auth_settings); | ||
| 580 | if (!$response) { | ||
| 581 | return; | ||
| 582 | } | ||
| 583 | my $_response_object = $self->{api_client}->deserialize('ARRAY[DictionaryItemResponse]', $response); | ||
| 584 | return $_response_object; | ||
| 585 | } | ||
| 586 | |||
| 587 | # | ||
| 588 | # update_dictionary_item | ||
| 589 | # | ||
| 590 | # Update an entry in a dictionary | ||
| 591 | # | ||
| 592 | # @param string $service_id Alphanumeric string identifying the service. (required) | ||
| 593 | # @param string $dictionary_id Alphanumeric string identifying a Dictionary. (required) | ||
| 594 | # @param string $dictionary_item_key Item key, maximum 255 characters. (required) | ||
| 595 | # @param string $item_key Item key, maximum 255 characters. (optional) | ||
| 596 | # @param string $item_value Item value, maximum 8000 characters. (optional) | ||
| 597 | { | ||
| 598 | my $params = { | ||
| 599 | 'service_id' => { | ||
| 600 | data_type => 'string', | ||
| 601 | description => 'Alphanumeric string identifying the service.', | ||
| 602 | required => '1', | ||
| 603 | }, | ||
| 604 | 'dictionary_id' => { | ||
| 605 | data_type => 'string', | ||
| 606 | description => 'Alphanumeric string identifying a Dictionary.', | ||
| 607 | required => '1', | ||
| 608 | }, | ||
| 609 | 'dictionary_item_key' => { | ||
| 610 | data_type => 'string', | ||
| 611 | description => 'Item key, maximum 255 characters.', | ||
| 612 | required => '1', | ||
| 613 | }, | ||
| 614 | 'item_key' => { | ||
| 615 | data_type => 'string', | ||
| 616 | description => 'Item key, maximum 255 characters.', | ||
| 617 | required => '0', | ||
| 618 | }, | ||
| 619 | 'item_value' => { | ||
| 620 | data_type => 'string', | ||
| 621 | description => 'Item value, maximum 8000 characters.', | ||
| 622 | required => '0', | ||
| 623 | }, | ||
| 624 | }; | ||
| 625 | __PACKAGE__->method_documentation->{ 'update_dictionary_item' } = { | ||
| 626 | summary => 'Update an entry in a dictionary', | ||
| 627 | params => $params, | ||
| 628 | returns => 'DictionaryItemResponse', | ||
| 629 | }; | ||
| 630 | } | ||
| 631 | # @return DictionaryItemResponse | ||
| 632 | # | ||
| 633 | sub update_dictionary_item { | ||
| 634 | my ($self, %args) = @_; | ||
| 635 | |||
| 636 | # verify the required parameter 'service_id' is set | ||
| 637 | unless (exists $args{'service_id'}) { | ||
| 638 | croak("Missing the required parameter 'service_id' when calling update_dictionary_item"); | ||
| 639 | } | ||
| 640 | |||
| 641 | # verify the required parameter 'dictionary_id' is set | ||
| 642 | unless (exists $args{'dictionary_id'}) { | ||
| 643 | croak("Missing the required parameter 'dictionary_id' when calling update_dictionary_item"); | ||
| 644 | } | ||
| 645 | |||
| 646 | # verify the required parameter 'dictionary_item_key' is set | ||
| 647 | unless (exists $args{'dictionary_item_key'}) { | ||
| 648 | croak("Missing the required parameter 'dictionary_item_key' when calling update_dictionary_item"); | ||
| 649 | } | ||
| 650 | |||
| 651 | # parse inputs | ||
| 652 | my $_resource_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'; | ||
| 653 | |||
| 654 | my $_method = 'PATCH'; | ||
| 655 | my $query_params = {}; | ||
| 656 | my $header_params = {}; | ||
| 657 | my $form_params = {}; | ||
| 658 | |||
| 659 | # 'Accept' and 'Content-Type' header | ||
| 660 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 661 | if ($_header_accept) { | ||
| 662 | $header_params->{'Accept'} = $_header_accept; | ||
| 663 | } | ||
| 664 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded'); | ||
| 665 | |||
| 666 | # path params | ||
| 667 | if ( exists $args{'service_id'}) { | ||
| 668 | my $_base_variable = "{" . "service_id" . "}"; | ||
| 669 | my $_base_value = $self->{api_client}->to_path_value($args{'service_id'}); | ||
| 670 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 671 | } | ||
| 672 | |||
| 673 | # path params | ||
| 674 | if ( exists $args{'dictionary_id'}) { | ||
| 675 | my $_base_variable = "{" . "dictionary_id" . "}"; | ||
| 676 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_id'}); | ||
| 677 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 678 | } | ||
| 679 | |||
| 680 | # path params | ||
| 681 | if ( exists $args{'dictionary_item_key'}) { | ||
| 682 | my $_base_variable = "{" . "dictionary_item_key" . "}"; | ||
| 683 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_item_key'}); | ||
| 684 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 685 | } | ||
| 686 | |||
| 687 | # form params | ||
| 688 | if ( exists $args{'item_key'} ) { | ||
| 689 | $form_params->{'item_key'} = $self->{api_client}->to_form_value($args{'item_key'}); | ||
| 690 | } | ||
| 691 | |||
| 692 | # form params | ||
| 693 | if ( exists $args{'item_value'} ) { | ||
| 694 | $form_params->{'item_value'} = $self->{api_client}->to_form_value($args{'item_value'}); | ||
| 695 | } | ||
| 696 | |||
| 697 | my $_body_data; | ||
| 698 | # authentication setting, if any | ||
| 699 | my $auth_settings = [qw(token )]; | ||
| 700 | |||
| 701 | # make the API Call | ||
| 702 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 703 | $query_params, $form_params, | ||
| 704 | $header_params, $_body_data, $auth_settings); | ||
| 705 | if (!$response) { | ||
| 706 | return; | ||
| 707 | } | ||
| 708 | my $_response_object = $self->{api_client}->deserialize('DictionaryItemResponse', $response); | ||
| 709 | return $_response_object; | ||
| 710 | } | ||
| 711 | |||
| 712 | # | ||
| 713 | # upsert_dictionary_item | ||
| 714 | # | ||
| 715 | # Insert or update an entry in a dictionary | ||
| 716 | # | ||
| 717 | # @param string $service_id Alphanumeric string identifying the service. (required) | ||
| 718 | # @param string $dictionary_id Alphanumeric string identifying a Dictionary. (required) | ||
| 719 | # @param string $dictionary_item_key Item key, maximum 255 characters. (required) | ||
| 720 | # @param string $item_key Item key, maximum 255 characters. (optional) | ||
| 721 | # @param string $item_value Item value, maximum 8000 characters. (optional) | ||
| 722 | { | ||
| 723 | my $params = { | ||
| 724 | 'service_id' => { | ||
| 725 | data_type => 'string', | ||
| 726 | description => 'Alphanumeric string identifying the service.', | ||
| 727 | required => '1', | ||
| 728 | }, | ||
| 729 | 'dictionary_id' => { | ||
| 730 | data_type => 'string', | ||
| 731 | description => 'Alphanumeric string identifying a Dictionary.', | ||
| 732 | required => '1', | ||
| 733 | }, | ||
| 734 | 'dictionary_item_key' => { | ||
| 735 | data_type => 'string', | ||
| 736 | description => 'Item key, maximum 255 characters.', | ||
| 737 | required => '1', | ||
| 738 | }, | ||
| 739 | 'item_key' => { | ||
| 740 | data_type => 'string', | ||
| 741 | description => 'Item key, maximum 255 characters.', | ||
| 742 | required => '0', | ||
| 743 | }, | ||
| 744 | 'item_value' => { | ||
| 745 | data_type => 'string', | ||
| 746 | description => 'Item value, maximum 8000 characters.', | ||
| 747 | required => '0', | ||
| 748 | }, | ||
| 749 | }; | ||
| 750 | __PACKAGE__->method_documentation->{ 'upsert_dictionary_item' } = { | ||
| 751 | summary => 'Insert or update an entry in a dictionary', | ||
| 752 | params => $params, | ||
| 753 | returns => 'DictionaryItemResponse', | ||
| 754 | }; | ||
| 755 | } | ||
| 756 | # @return DictionaryItemResponse | ||
| 757 | # | ||
| 758 | sub upsert_dictionary_item { | ||
| 759 | my ($self, %args) = @_; | ||
| 760 | |||
| 761 | # verify the required parameter 'service_id' is set | ||
| 762 | unless (exists $args{'service_id'}) { | ||
| 763 | croak("Missing the required parameter 'service_id' when calling upsert_dictionary_item"); | ||
| 764 | } | ||
| 765 | |||
| 766 | # verify the required parameter 'dictionary_id' is set | ||
| 767 | unless (exists $args{'dictionary_id'}) { | ||
| 768 | croak("Missing the required parameter 'dictionary_id' when calling upsert_dictionary_item"); | ||
| 769 | } | ||
| 770 | |||
| 771 | # verify the required parameter 'dictionary_item_key' is set | ||
| 772 | unless (exists $args{'dictionary_item_key'}) { | ||
| 773 | croak("Missing the required parameter 'dictionary_item_key' when calling upsert_dictionary_item"); | ||
| 774 | } | ||
| 775 | |||
| 776 | # parse inputs | ||
| 777 | my $_resource_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'; | ||
| 778 | |||
| 779 | my $_method = 'PUT'; | ||
| 780 | my $query_params = {}; | ||
| 781 | my $header_params = {}; | ||
| 782 | my $form_params = {}; | ||
| 783 | |||
| 784 | # 'Accept' and 'Content-Type' header | ||
| 785 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 786 | if ($_header_accept) { | ||
| 787 | $header_params->{'Accept'} = $_header_accept; | ||
| 788 | } | ||
| 789 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded'); | ||
| 790 | |||
| 791 | # path params | ||
| 792 | if ( exists $args{'service_id'}) { | ||
| 793 | my $_base_variable = "{" . "service_id" . "}"; | ||
| 794 | my $_base_value = $self->{api_client}->to_path_value($args{'service_id'}); | ||
| 795 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 796 | } | ||
| 797 | |||
| 798 | # path params | ||
| 799 | if ( exists $args{'dictionary_id'}) { | ||
| 800 | my $_base_variable = "{" . "dictionary_id" . "}"; | ||
| 801 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_id'}); | ||
| 802 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 803 | } | ||
| 804 | |||
| 805 | # path params | ||
| 806 | if ( exists $args{'dictionary_item_key'}) { | ||
| 807 | my $_base_variable = "{" . "dictionary_item_key" . "}"; | ||
| 808 | my $_base_value = $self->{api_client}->to_path_value($args{'dictionary_item_key'}); | ||
| 809 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 810 | } | ||
| 811 | |||
| 812 | # form params | ||
| 813 | if ( exists $args{'item_key'} ) { | ||
| 814 | $form_params->{'item_key'} = $self->{api_client}->to_form_value($args{'item_key'}); | ||
| 815 | } | ||
| 816 | |||
| 817 | # form params | ||
| 818 | if ( exists $args{'item_value'} ) { | ||
| 819 | $form_params->{'item_value'} = $self->{api_client}->to_form_value($args{'item_value'}); | ||
| 820 | } | ||
| 821 | |||
| 822 | my $_body_data; | ||
| 823 | # authentication setting, if any | ||
| 824 | my $auth_settings = [qw(token )]; | ||
| 825 | |||
| 826 | # make the API Call | ||
| 827 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 828 | $query_params, $form_params, | ||
| 829 | $header_params, $_body_data, $auth_settings); | ||
| 830 | if (!$response) { | ||
| 831 | return; | ||
| 832 | } | ||
| 833 | my $_response_object = $self->{api_client}->deserialize('DictionaryItemResponse', $response); | ||
| 834 | return $_response_object; | ||
| 835 | } | ||
| 836 | |||
| 837 | 1; |