Fastly/BotManagementApi.pm untested

filter: Statementstmt 0.0% 0 / 418 Branchbran 0.0% 0 / 152 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 21 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 612 CC 77 SCAR 42.3
CC
77
Cov
0%
bot_management_update_bot
132.0
bot_management_get_bot
90.0
bot_management_list_category_bots
90.0
CRAP 69.0
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::BotManagementApi;
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 # bot_management_get_bot
51 #
52 # Get a bot
53 #
54 # @param string $workspace_id The ID of the bot management workspace. (required)
55 # @param string $category_id The ID of the bot category. (required)
56 # @param string $bot_id The ID of the bot. (required)
57 {
58 my $params = {
59 'workspace_id' => {
60 data_type => 'string',
61 description => 'The ID of the bot management workspace.',
62 required => '1',
63 },
64 'category_id' => {
65 data_type => 'string',
66 description => 'The ID of the bot category.',
67 required => '1',
68 },
69 'bot_id' => {
70 data_type => 'string',
71 description => 'The ID of the bot.',
72 required => '1',
73 },
74 };
75 __PACKAGE__->method_documentation->{ 'bot_management_get_bot' } = {
76 summary => 'Get a bot',
77 params => $params,
78 returns => 'BotManagementBotResponse',
79 };
80 }
81 # @return BotManagementBotResponse
82 #
83 sub bot_management_get_bot {
84 my ($self, %args) = @_;
85  
86 # verify the required parameter 'workspace_id' is set
87 unless (exists $args{'workspace_id'}) {
88 croak("Missing the required parameter 'workspace_id' when calling bot_management_get_bot");
89 }
90  
91 # verify the required parameter 'category_id' is set
92 unless (exists $args{'category_id'}) {
93 croak("Missing the required parameter 'category_id' when calling bot_management_get_bot");
94 }
95  
96 # verify the required parameter 'bot_id' is set
97 unless (exists $args{'bot_id'}) {
98 croak("Missing the required parameter 'bot_id' when calling bot_management_get_bot");
99 }
100  
101 # parse inputs
102 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/categories/{category_id}/bots/{bot_id}';
103  
104 my $_method = 'GET';
105 my $query_params = {};
106 my $header_params = {};
107 my $form_params = {};
108  
109 # 'Accept' and 'Content-Type' header
110 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
111 if ($_header_accept) {
112 $header_params->{'Accept'} = $_header_accept;
113 }
114 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
115  
116 # path params
117 if ( exists $args{'workspace_id'}) {
118 my $_base_variable = "{" . "workspace_id" . "}";
119 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
120 $_resource_path =~ s/$_base_variable/$_base_value/g;
121 }
122  
123 # path params
124 if ( exists $args{'category_id'}) {
125 my $_base_variable = "{" . "category_id" . "}";
126 my $_base_value = $self->{api_client}->to_path_value($args{'category_id'});
127 $_resource_path =~ s/$_base_variable/$_base_value/g;
128 }
129  
130 # path params
131 if ( exists $args{'bot_id'}) {
132 my $_base_variable = "{" . "bot_id" . "}";
133 my $_base_value = $self->{api_client}->to_path_value($args{'bot_id'});
134 $_resource_path =~ s/$_base_variable/$_base_value/g;
135 }
136  
137 my $_body_data;
138 # authentication setting, if any
139 my $auth_settings = [qw(token )];
140  
141 # make the API Call
142 my $response = $self->{api_client}->call_api($_resource_path, $_method,
143 $query_params, $form_params,
144 $header_params, $_body_data, $auth_settings);
145 if (!$response) {
146 return;
147 }
148 my $_response_object = $self->{api_client}->deserialize('BotManagementBotResponse', $response);
149 return $_response_object;
150 }
151  
152 #
153 # bot_management_get_category
154 #
155 # Get a category
156 #
157 # @param string $workspace_id The ID of the bot management workspace. (required)
158 # @param string $category_id The ID of the bot category. (required)
159 {
160 my $params = {
161 'workspace_id' => {
162 data_type => 'string',
163 description => 'The ID of the bot management workspace.',
164 required => '1',
165 },
166 'category_id' => {
167 data_type => 'string',
168 description => 'The ID of the bot category.',
169 required => '1',
170 },
171 };
172 __PACKAGE__->method_documentation->{ 'bot_management_get_category' } = {
173 summary => 'Get a category',
174 params => $params,
175 returns => 'BotManagementCategoryResponse',
176 };
177 }
178 # @return BotManagementCategoryResponse
179 #
180 sub bot_management_get_category {
181 my ($self, %args) = @_;
182  
183 # verify the required parameter 'workspace_id' is set
184 unless (exists $args{'workspace_id'}) {
185 croak("Missing the required parameter 'workspace_id' when calling bot_management_get_category");
186 }
187  
188 # verify the required parameter 'category_id' is set
189 unless (exists $args{'category_id'}) {
190 croak("Missing the required parameter 'category_id' when calling bot_management_get_category");
191 }
192  
193 # parse inputs
194 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/categories/{category_id}';
195  
196 my $_method = 'GET';
197 my $query_params = {};
198 my $header_params = {};
199 my $form_params = {};
200  
201 # 'Accept' and 'Content-Type' header
202 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
203 if ($_header_accept) {
204 $header_params->{'Accept'} = $_header_accept;
205 }
206 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
207  
208 # path params
209 if ( exists $args{'workspace_id'}) {
210 my $_base_variable = "{" . "workspace_id" . "}";
211 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
212 $_resource_path =~ s/$_base_variable/$_base_value/g;
213 }
214  
215 # path params
216 if ( exists $args{'category_id'}) {
217 my $_base_variable = "{" . "category_id" . "}";
218 my $_base_value = $self->{api_client}->to_path_value($args{'category_id'});
219 $_resource_path =~ s/$_base_variable/$_base_value/g;
220 }
221  
222 my $_body_data;
223 # authentication setting, if any
224 my $auth_settings = [qw(token )];
225  
226 # make the API Call
227 my $response = $self->{api_client}->call_api($_resource_path, $_method,
228 $query_params, $form_params,
229 $header_params, $_body_data, $auth_settings);
230 if (!$response) {
231 return;
232 }
233 my $_response_object = $self->{api_client}->deserialize('BotManagementCategoryResponse', $response);
234 return $_response_object;
235 }
236  
237 #
238 # bot_management_get_workspace
239 #
240 # Get a workspace
241 #
242 # @param string $workspace_id The ID of the bot management workspace. (required)
243 {
244 my $params = {
245 'workspace_id' => {
246 data_type => 'string',
247 description => 'The ID of the bot management workspace.',
248 required => '1',
249 },
250 };
251 __PACKAGE__->method_documentation->{ 'bot_management_get_workspace' } = {
252 summary => 'Get a workspace',
253 params => $params,
254 returns => 'BotManagementWorkspaceResponse',
255 };
256 }
257 # @return BotManagementWorkspaceResponse
258 #
259 sub bot_management_get_workspace {
260 my ($self, %args) = @_;
261  
262 # verify the required parameter 'workspace_id' is set
263 unless (exists $args{'workspace_id'}) {
264 croak("Missing the required parameter 'workspace_id' when calling bot_management_get_workspace");
265 }
266  
267 # parse inputs
268 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}';
269  
270 my $_method = 'GET';
271 my $query_params = {};
272 my $header_params = {};
273 my $form_params = {};
274  
275 # 'Accept' and 'Content-Type' header
276 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
277 if ($_header_accept) {
278 $header_params->{'Accept'} = $_header_accept;
279 }
280 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
281  
282 # path params
283 if ( exists $args{'workspace_id'}) {
284 my $_base_variable = "{" . "workspace_id" . "}";
285 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
286 $_resource_path =~ s/$_base_variable/$_base_value/g;
287 }
288  
289 my $_body_data;
290 # authentication setting, if any
291 my $auth_settings = [qw(token )];
292  
293 # make the API Call
294 my $response = $self->{api_client}->call_api($_resource_path, $_method,
295 $query_params, $form_params,
296 $header_params, $_body_data, $auth_settings);
297 if (!$response) {
298 return;
299 }
300 my $_response_object = $self->{api_client}->deserialize('BotManagementWorkspaceResponse', $response);
301 return $_response_object;
302 }
303  
304 #
305 # bot_management_list_bots
306 #
307 # List all bots in a workspace
308 #
309 # @param string $workspace_id The ID of the bot management workspace. (required)
310 # @param int $limit Limit how many results are returned. (optional, default to 100)
311 # @param string $cursor Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results. (optional)
312 {
313 my $params = {
314 'workspace_id' => {
315 data_type => 'string',
316 description => 'The ID of the bot management workspace.',
317 required => '1',
318 },
319 'limit' => {
320 data_type => 'int',
321 description => 'Limit how many results are returned.',
322 required => '0',
323 },
324 'cursor' => {
325 data_type => 'string',
326 description => 'Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results.',
327 required => '0',
328 },
329 };
330 __PACKAGE__->method_documentation->{ 'bot_management_list_bots' } = {
331 summary => 'List all bots in a workspace',
332 params => $params,
333 returns => 'BotManagementWorkspaceBotsResponse',
334 };
335 }
336 # @return BotManagementWorkspaceBotsResponse
337 #
338 sub bot_management_list_bots {
339 my ($self, %args) = @_;
340  
341 # verify the required parameter 'workspace_id' is set
342 unless (exists $args{'workspace_id'}) {
343 croak("Missing the required parameter 'workspace_id' when calling bot_management_list_bots");
344 }
345  
346 # parse inputs
347 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/bots';
348  
349 my $_method = 'GET';
350 my $query_params = {};
351 my $header_params = {};
352 my $form_params = {};
353  
354 # 'Accept' and 'Content-Type' header
355 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
356 if ($_header_accept) {
357 $header_params->{'Accept'} = $_header_accept;
358 }
359 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
360  
361 # query params
362 if ( exists $args{'limit'}) {
363 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
364 }
365  
366 # query params
367 if ( exists $args{'cursor'}) {
368 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
369 }
370  
371 # path params
372 if ( exists $args{'workspace_id'}) {
373 my $_base_variable = "{" . "workspace_id" . "}";
374 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
375 $_resource_path =~ s/$_base_variable/$_base_value/g;
376 }
377  
378 my $_body_data;
379 # authentication setting, if any
380 my $auth_settings = [qw(token )];
381  
382 # make the API Call
383 my $response = $self->{api_client}->call_api($_resource_path, $_method,
384 $query_params, $form_params,
385 $header_params, $_body_data, $auth_settings);
386 if (!$response) {
387 return;
388 }
389 my $_response_object = $self->{api_client}->deserialize('BotManagementWorkspaceBotsResponse', $response);
390 return $_response_object;
391 }
392  
393 #
394 # bot_management_list_categories
395 #
396 # List categories
397 #
398 # @param string $workspace_id The ID of the bot management workspace. (required)
399 # @param int $limit Limit how many results are returned. (optional, default to 100)
400 # @param string $cursor Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results. (optional)
401 {
402 my $params = {
403 'workspace_id' => {
404 data_type => 'string',
405 description => 'The ID of the bot management workspace.',
406 required => '1',
407 },
408 'limit' => {
409 data_type => 'int',
410 description => 'Limit how many results are returned.',
411 required => '0',
412 },
413 'cursor' => {
414 data_type => 'string',
415 description => 'Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results.',
416 required => '0',
417 },
418 };
419 __PACKAGE__->method_documentation->{ 'bot_management_list_categories' } = {
420 summary => 'List categories',
421 params => $params,
422 returns => 'BotManagementCategoriesResponse',
423 };
424 }
425 # @return BotManagementCategoriesResponse
426 #
427 sub bot_management_list_categories {
428 my ($self, %args) = @_;
429  
430 # verify the required parameter 'workspace_id' is set
431 unless (exists $args{'workspace_id'}) {
432 croak("Missing the required parameter 'workspace_id' when calling bot_management_list_categories");
433 }
434  
435 # parse inputs
436 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/categories';
437  
438 my $_method = 'GET';
439 my $query_params = {};
440 my $header_params = {};
441 my $form_params = {};
442  
443 # 'Accept' and 'Content-Type' header
444 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
445 if ($_header_accept) {
446 $header_params->{'Accept'} = $_header_accept;
447 }
448 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
449  
450 # query params
451 if ( exists $args{'limit'}) {
452 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
453 }
454  
455 # query params
456 if ( exists $args{'cursor'}) {
457 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
458 }
459  
460 # path params
461 if ( exists $args{'workspace_id'}) {
462 my $_base_variable = "{" . "workspace_id" . "}";
463 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
464 $_resource_path =~ s/$_base_variable/$_base_value/g;
465 }
466  
467 my $_body_data;
468 # authentication setting, if any
469 my $auth_settings = [qw(token )];
470  
471 # make the API Call
472 my $response = $self->{api_client}->call_api($_resource_path, $_method,
473 $query_params, $form_params,
474 $header_params, $_body_data, $auth_settings);
475 if (!$response) {
476 return;
477 }
478 my $_response_object = $self->{api_client}->deserialize('BotManagementCategoriesResponse', $response);
479 return $_response_object;
480 }
481  
482 #
483 # bot_management_list_category_bots
484 #
485 # List bots in a category
486 #
487 # @param string $workspace_id The ID of the bot management workspace. (required)
488 # @param string $category_id The ID of the bot category. (required)
489 # @param int $limit Limit how many results are returned. (optional, default to 100)
490 # @param string $cursor Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results. (optional)
491 {
492 my $params = {
493 'workspace_id' => {
494 data_type => 'string',
495 description => 'The ID of the bot management workspace.',
496 required => '1',
497 },
498 'category_id' => {
499 data_type => 'string',
500 description => 'The ID of the bot category.',
501 required => '1',
502 },
503 'limit' => {
504 data_type => 'int',
505 description => 'Limit how many results are returned.',
506 required => '0',
507 },
508 'cursor' => {
509 data_type => 'string',
510 description => 'Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results.',
511 required => '0',
512 },
513 };
514 __PACKAGE__->method_documentation->{ 'bot_management_list_category_bots' } = {
515 summary => 'List bots in a category',
516 params => $params,
517 returns => 'BotManagementBotsResponse',
518 };
519 }
520 # @return BotManagementBotsResponse
521 #
522 sub bot_management_list_category_bots {
523 my ($self, %args) = @_;
524  
525 # verify the required parameter 'workspace_id' is set
526 unless (exists $args{'workspace_id'}) {
527 croak("Missing the required parameter 'workspace_id' when calling bot_management_list_category_bots");
528 }
529  
530 # verify the required parameter 'category_id' is set
531 unless (exists $args{'category_id'}) {
532 croak("Missing the required parameter 'category_id' when calling bot_management_list_category_bots");
533 }
534  
535 # parse inputs
536 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/categories/{category_id}/bots';
537  
538 my $_method = 'GET';
539 my $query_params = {};
540 my $header_params = {};
541 my $form_params = {};
542  
543 # 'Accept' and 'Content-Type' header
544 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
545 if ($_header_accept) {
546 $header_params->{'Accept'} = $_header_accept;
547 }
548 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
549  
550 # query params
551 if ( exists $args{'limit'}) {
552 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
553 }
554  
555 # query params
556 if ( exists $args{'cursor'}) {
557 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
558 }
559  
560 # path params
561 if ( exists $args{'workspace_id'}) {
562 my $_base_variable = "{" . "workspace_id" . "}";
563 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
564 $_resource_path =~ s/$_base_variable/$_base_value/g;
565 }
566  
567 # path params
568 if ( exists $args{'category_id'}) {
569 my $_base_variable = "{" . "category_id" . "}";
570 my $_base_value = $self->{api_client}->to_path_value($args{'category_id'});
571 $_resource_path =~ s/$_base_variable/$_base_value/g;
572 }
573  
574 my $_body_data;
575 # authentication setting, if any
576 my $auth_settings = [qw(token )];
577  
578 # make the API Call
579 my $response = $self->{api_client}->call_api($_resource_path, $_method,
580 $query_params, $form_params,
581 $header_params, $_body_data, $auth_settings);
582 if (!$response) {
583 return;
584 }
585 my $_response_object = $self->{api_client}->deserialize('BotManagementBotsResponse', $response);
586 return $_response_object;
587 }
588  
589 #
590 # bot_management_list_workspaces
591 #
592 # List workspaces
593 #
594 # @param string $service_id Filter results to the workspace attached to this service. Returns an empty list if the service is not attached to a workspace. (optional)
595 # @param int $limit Limit how many results are returned. (optional, default to 100)
596 # @param string $cursor Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results. (optional)
597 {
598 my $params = {
599 'service_id' => {
600 data_type => 'string',
601 description => 'Filter results to the workspace attached to this service. Returns an empty list if the service is not attached to a workspace.',
602 required => '0',
603 },
604 'limit' => {
605 data_type => 'int',
606 description => 'Limit how many results are returned.',
607 required => '0',
608 },
609 'cursor' => {
610 data_type => 'string',
611 description => 'Cursor for pagination. Use the `next_cursor` value from a previous response to request the next page of results.',
612 required => '0',
613 },
614 };
615 __PACKAGE__->method_documentation->{ 'bot_management_list_workspaces' } = {
616 summary => 'List workspaces',
617 params => $params,
618 returns => 'BotManagementWorkspacesResponse',
619 };
620 }
621 # @return BotManagementWorkspacesResponse
622 #
623 sub bot_management_list_workspaces {
624 my ($self, %args) = @_;
625  
626 # parse inputs
627 my $_resource_path = '/bot-management/v1/workspaces';
628  
629 my $_method = 'GET';
630 my $query_params = {};
631 my $header_params = {};
632 my $form_params = {};
633  
634 # 'Accept' and 'Content-Type' header
635 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
636 if ($_header_accept) {
637 $header_params->{'Accept'} = $_header_accept;
638 }
639 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
640  
641 # query params
642 if ( exists $args{'service_id'}) {
643 $query_params->{'service_id'} = $self->{api_client}->to_query_value($args{'service_id'});
644 }
645  
646 # query params
647 if ( exists $args{'limit'}) {
648 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
649 }
650  
651 # query params
652 if ( exists $args{'cursor'}) {
653 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
654 }
655  
656 my $_body_data;
657 # authentication setting, if any
658 my $auth_settings = [qw(token )];
659  
660 # make the API Call
661 my $response = $self->{api_client}->call_api($_resource_path, $_method,
662 $query_params, $form_params,
663 $header_params, $_body_data, $auth_settings);
664 if (!$response) {
665 return;
666 }
667 my $_response_object = $self->{api_client}->deserialize('BotManagementWorkspacesResponse', $response);
668 return $_response_object;
669 }
670  
671 #
672 # bot_management_update_bot
673 #
674 # Set a bot action
675 #
676 # @param string $workspace_id The ID of the bot management workspace. (required)
677 # @param string $category_id The ID of the bot category. (required)
678 # @param string $bot_id The ID of the bot. (required)
679 # @param BotManagementBot $bot_management_bot (required)
680 {
681 my $params = {
682 'workspace_id' => {
683 data_type => 'string',
684 description => 'The ID of the bot management workspace.',
685 required => '1',
686 },
687 'category_id' => {
688 data_type => 'string',
689 description => 'The ID of the bot category.',
690 required => '1',
691 },
692 'bot_id' => {
693 data_type => 'string',
694 description => 'The ID of the bot.',
695 required => '1',
696 },
697 'bot_management_bot' => {
698 data_type => 'BotManagementBot',
699 description => '',
700 required => '1',
701 },
702 };
703 __PACKAGE__->method_documentation->{ 'bot_management_update_bot' } = {
704 summary => 'Set a bot action',
705 params => $params,
706 returns => 'BotManagementBotResponse',
707 };
708 }
709 # @return BotManagementBotResponse
710 #
711 sub bot_management_update_bot {
712 my ($self, %args) = @_;
713  
714 # verify the required parameter 'workspace_id' is set
715 unless (exists $args{'workspace_id'}) {
716 croak("Missing the required parameter 'workspace_id' when calling bot_management_update_bot");
717 }
718  
719 # verify the required parameter 'category_id' is set
720 unless (exists $args{'category_id'}) {
721 croak("Missing the required parameter 'category_id' when calling bot_management_update_bot");
722 }
723  
724 # verify the required parameter 'bot_id' is set
725 unless (exists $args{'bot_id'}) {
726 croak("Missing the required parameter 'bot_id' when calling bot_management_update_bot");
727 }
728  
729 # verify the required parameter 'bot_management_bot' is set
730 unless (exists $args{'bot_management_bot'}) {
731 croak("Missing the required parameter 'bot_management_bot' when calling bot_management_update_bot");
732 }
733  
734 # parse inputs
735 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/categories/{category_id}/bots/{bot_id}';
736  
737 my $_method = 'PATCH';
738 my $query_params = {};
739 my $header_params = {};
740 my $form_params = {};
741  
742 # 'Accept' and 'Content-Type' header
743 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
744 if ($_header_accept) {
745 $header_params->{'Accept'} = $_header_accept;
746 }
747 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
748  
749 # path params
750 if ( exists $args{'workspace_id'}) {
751 my $_base_variable = "{" . "workspace_id" . "}";
752 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
753 $_resource_path =~ s/$_base_variable/$_base_value/g;
754 }
755  
756 # path params
757 if ( exists $args{'category_id'}) {
758 my $_base_variable = "{" . "category_id" . "}";
759 my $_base_value = $self->{api_client}->to_path_value($args{'category_id'});
760 $_resource_path =~ s/$_base_variable/$_base_value/g;
761 }
762  
763 # path params
764 if ( exists $args{'bot_id'}) {
765 my $_base_variable = "{" . "bot_id" . "}";
766 my $_base_value = $self->{api_client}->to_path_value($args{'bot_id'});
767 $_resource_path =~ s/$_base_variable/$_base_value/g;
768 }
769  
770 my $_body_data;
771 # body params
772 if ( exists $args{'bot_management_bot'}) {
773 $_body_data = $args{'bot_management_bot'};
774 }
775  
776 # authentication setting, if any
777 my $auth_settings = [qw(token )];
778  
779 # make the API Call
780 my $response = $self->{api_client}->call_api($_resource_path, $_method,
781 $query_params, $form_params,
782 $header_params, $_body_data, $auth_settings);
783 if (!$response) {
784 return;
785 }
786 my $_response_object = $self->{api_client}->deserialize('BotManagementBotResponse', $response);
787 return $_response_object;
788 }
789  
790 #
791 # bot_management_update_category
792 #
793 # Set a category action
794 #
795 # @param string $workspace_id The ID of the bot management workspace. (required)
796 # @param string $category_id The ID of the bot category. (required)
797 # @param BotManagementCategory $bot_management_category (required)
798 {
799 my $params = {
800 'workspace_id' => {
801 data_type => 'string',
802 description => 'The ID of the bot management workspace.',
803 required => '1',
804 },
805 'category_id' => {
806 data_type => 'string',
807 description => 'The ID of the bot category.',
808 required => '1',
809 },
810 'bot_management_category' => {
811 data_type => 'BotManagementCategory',
812 description => '',
813 required => '1',
814 },
815 };
816 __PACKAGE__->method_documentation->{ 'bot_management_update_category' } = {
817 summary => 'Set a category action',
818 params => $params,
819 returns => 'BotManagementCategoryResponse',
820 };
821 }
822 # @return BotManagementCategoryResponse
823 #
824 sub bot_management_update_category {
825 my ($self, %args) = @_;
826  
827 # verify the required parameter 'workspace_id' is set
828 unless (exists $args{'workspace_id'}) {
829 croak("Missing the required parameter 'workspace_id' when calling bot_management_update_category");
830 }
831  
832 # verify the required parameter 'category_id' is set
833 unless (exists $args{'category_id'}) {
834 croak("Missing the required parameter 'category_id' when calling bot_management_update_category");
835 }
836  
837 # verify the required parameter 'bot_management_category' is set
838 unless (exists $args{'bot_management_category'}) {
839 croak("Missing the required parameter 'bot_management_category' when calling bot_management_update_category");
840 }
841  
842 # parse inputs
843 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/categories/{category_id}';
844  
845 my $_method = 'PATCH';
846 my $query_params = {};
847 my $header_params = {};
848 my $form_params = {};
849  
850 # 'Accept' and 'Content-Type' header
851 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
852 if ($_header_accept) {
853 $header_params->{'Accept'} = $_header_accept;
854 }
855 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
856  
857 # path params
858 if ( exists $args{'workspace_id'}) {
859 my $_base_variable = "{" . "workspace_id" . "}";
860 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
861 $_resource_path =~ s/$_base_variable/$_base_value/g;
862 }
863  
864 # path params
865 if ( exists $args{'category_id'}) {
866 my $_base_variable = "{" . "category_id" . "}";
867 my $_base_value = $self->{api_client}->to_path_value($args{'category_id'});
868 $_resource_path =~ s/$_base_variable/$_base_value/g;
869 }
870  
871 my $_body_data;
872 # body params
873 if ( exists $args{'bot_management_category'}) {
874 $_body_data = $args{'bot_management_category'};
875 }
876  
877 # authentication setting, if any
878 my $auth_settings = [qw(token )];
879  
880 # make the API Call
881 my $response = $self->{api_client}->call_api($_resource_path, $_method,
882 $query_params, $form_params,
883 $header_params, $_body_data, $auth_settings);
884 if (!$response) {
885 return;
886 }
887 my $_response_object = $self->{api_client}->deserialize('BotManagementCategoryResponse', $response);
888 return $_response_object;
889 }
890  
891 #
892 # bot_management_update_category_bots
893 #
894 # Set the action for all bots in a category
895 #
896 # @param string $workspace_id The ID of the bot management workspace. (required)
897 # @param string $category_id The ID of the bot category. (required)
898 # @param BotManagementCategoryBots $bot_management_category_bots (required)
899 {
900 my $params = {
901 'workspace_id' => {
902 data_type => 'string',
903 description => 'The ID of the bot management workspace.',
904 required => '1',
905 },
906 'category_id' => {
907 data_type => 'string',
908 description => 'The ID of the bot category.',
909 required => '1',
910 },
911 'bot_management_category_bots' => {
912 data_type => 'BotManagementCategoryBots',
913 description => '',
914 required => '1',
915 },
916 };
917 __PACKAGE__->method_documentation->{ 'bot_management_update_category_bots' } = {
918 summary => 'Set the action for all bots in a category',
919 params => $params,
920 returns => 'BotManagementBotsResponse',
921 };
922 }
923 # @return BotManagementBotsResponse
924 #
925 sub bot_management_update_category_bots {
926 my ($self, %args) = @_;
927  
928 # verify the required parameter 'workspace_id' is set
929 unless (exists $args{'workspace_id'}) {
930 croak("Missing the required parameter 'workspace_id' when calling bot_management_update_category_bots");
931 }
932  
933 # verify the required parameter 'category_id' is set
934 unless (exists $args{'category_id'}) {
935 croak("Missing the required parameter 'category_id' when calling bot_management_update_category_bots");
936 }
937  
938 # verify the required parameter 'bot_management_category_bots' is set
939 unless (exists $args{'bot_management_category_bots'}) {
940 croak("Missing the required parameter 'bot_management_category_bots' when calling bot_management_update_category_bots");
941 }
942  
943 # parse inputs
944 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}/policy/categories/{category_id}/bots';
945  
946 my $_method = 'PATCH';
947 my $query_params = {};
948 my $header_params = {};
949 my $form_params = {};
950  
951 # 'Accept' and 'Content-Type' header
952 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
953 if ($_header_accept) {
954 $header_params->{'Accept'} = $_header_accept;
955 }
956 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
957  
958 # path params
959 if ( exists $args{'workspace_id'}) {
960 my $_base_variable = "{" . "workspace_id" . "}";
961 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
962 $_resource_path =~ s/$_base_variable/$_base_value/g;
963 }
964  
965 # path params
966 if ( exists $args{'category_id'}) {
967 my $_base_variable = "{" . "category_id" . "}";
968 my $_base_value = $self->{api_client}->to_path_value($args{'category_id'});
969 $_resource_path =~ s/$_base_variable/$_base_value/g;
970 }
971  
972 my $_body_data;
973 # body params
974 if ( exists $args{'bot_management_category_bots'}) {
975 $_body_data = $args{'bot_management_category_bots'};
976 }
977  
978 # authentication setting, if any
979 my $auth_settings = [qw(token )];
980  
981 # make the API Call
982 my $response = $self->{api_client}->call_api($_resource_path, $_method,
983 $query_params, $form_params,
984 $header_params, $_body_data, $auth_settings);
985 if (!$response) {
986 return;
987 }
988 my $_response_object = $self->{api_client}->deserialize('BotManagementBotsResponse', $response);
989 return $_response_object;
990 }
991  
992 #
993 # bot_management_update_workspace
994 #
995 # Update a workspace
996 #
997 # @param string $workspace_id The ID of the bot management workspace. (required)
998 # @param BotManagementWorkspace $bot_management_workspace (required)
999 {
1000 my $params = {
1001 'workspace_id' => {
1002 data_type => 'string',
1003 description => 'The ID of the bot management workspace.',
1004 required => '1',
1005 },
1006 'bot_management_workspace' => {
1007 data_type => 'BotManagementWorkspace',
1008 description => '',
1009 required => '1',
1010 },
1011 };
1012 __PACKAGE__->method_documentation->{ 'bot_management_update_workspace' } = {
1013 summary => 'Update a workspace',
1014 params => $params,
1015 returns => 'BotManagementWorkspaceResponse',
1016 };
1017 }
1018 # @return BotManagementWorkspaceResponse
1019 #
1020 sub bot_management_update_workspace {
1021 my ($self, %args) = @_;
1022  
1023 # verify the required parameter 'workspace_id' is set
1024 unless (exists $args{'workspace_id'}) {
1025 croak("Missing the required parameter 'workspace_id' when calling bot_management_update_workspace");
1026 }
1027  
1028 # verify the required parameter 'bot_management_workspace' is set
1029 unless (exists $args{'bot_management_workspace'}) {
1030 croak("Missing the required parameter 'bot_management_workspace' when calling bot_management_update_workspace");
1031 }
1032  
1033 # parse inputs
1034 my $_resource_path = '/bot-management/v1/workspaces/{workspace_id}';
1035  
1036 my $_method = 'PATCH';
1037 my $query_params = {};
1038 my $header_params = {};
1039 my $form_params = {};
1040  
1041 # 'Accept' and 'Content-Type' header
1042 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
1043 if ($_header_accept) {
1044 $header_params->{'Accept'} = $_header_accept;
1045 }
1046 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
1047  
1048 # path params
1049 if ( exists $args{'workspace_id'}) {
1050 my $_base_variable = "{" . "workspace_id" . "}";
1051 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
1052 $_resource_path =~ s/$_base_variable/$_base_value/g;
1053 }
1054  
1055 my $_body_data;
1056 # body params
1057 if ( exists $args{'bot_management_workspace'}) {
1058 $_body_data = $args{'bot_management_workspace'};
1059 }
1060  
1061 # authentication setting, if any
1062 my $auth_settings = [qw(token )];
1063  
1064 # make the API Call
1065 my $response = $self->{api_client}->call_api($_resource_path, $_method,
1066 $query_params, $form_params,
1067 $header_params, $_body_data, $auth_settings);
1068 if (!$response) {
1069 return;
1070 }
1071 my $_response_object = $self->{api_client}->deserialize('BotManagementWorkspaceResponse', $response);
1072 return $_response_object;
1073 }
1074  
1075 1;