|
16 | 16 | IntegrationMappingPartnerItemSlack, |
17 | 17 | ) |
18 | 18 |
|
| 19 | +from box_sdk_gen.schemas.integration_mapping_partner_item_teams_create_request import ( |
| 20 | + IntegrationMappingPartnerItemTeamsCreateRequest, |
| 21 | +) |
| 22 | + |
19 | 23 | from box_sdk_gen.schemas.integration_mappings import IntegrationMappings |
20 | 24 |
|
21 | 25 | from box_sdk_gen.schemas.client_error import ClientError |
|
34 | 38 | IntegrationMappingSlackOptions, |
35 | 39 | ) |
36 | 40 |
|
| 41 | +from box_sdk_gen.schemas.integration_mappings_teams import IntegrationMappingsTeams |
| 42 | + |
| 43 | +from box_sdk_gen.schemas.integration_mapping_teams import IntegrationMappingTeams |
| 44 | + |
| 45 | +from box_sdk_gen.schemas.integration_mapping_teams_create_request import ( |
| 46 | + IntegrationMappingTeamsCreateRequest, |
| 47 | +) |
| 48 | + |
| 49 | +from box_sdk_gen.schemas.folder_reference import FolderReference |
| 50 | + |
37 | 51 | from box_sdk_gen.box.errors import BoxSDKError |
38 | 52 |
|
39 | 53 | from box_sdk_gen.networking.auth import Authentication |
@@ -63,6 +77,15 @@ class GetSlackIntegrationMappingBoxItemType(str, Enum): |
63 | 77 | FOLDER = 'folder' |
64 | 78 |
|
65 | 79 |
|
| 80 | +class GetIntegrationMappingTeamsPartnerItemType(str, Enum): |
| 81 | + CHANNEL = 'channel' |
| 82 | + TEAM = 'team' |
| 83 | + |
| 84 | + |
| 85 | +class GetIntegrationMappingTeamsBoxItemType(str, Enum): |
| 86 | + FOLDER = 'folder' |
| 87 | + |
| 88 | + |
66 | 89 | class IntegrationMappingsManager: |
67 | 90 | def __init__( |
68 | 91 | self, |
@@ -285,3 +308,193 @@ def delete_slack_integration_mapping_by_id( |
285 | 308 | ) |
286 | 309 | ) |
287 | 310 | return None |
| 311 | + |
| 312 | + def get_integration_mapping_teams( |
| 313 | + self, |
| 314 | + *, |
| 315 | + partner_item_type: Optional[GetIntegrationMappingTeamsPartnerItemType] = None, |
| 316 | + partner_item_id: Optional[str] = None, |
| 317 | + box_item_id: Optional[str] = None, |
| 318 | + box_item_type: Optional[GetIntegrationMappingTeamsBoxItemType] = None, |
| 319 | + extra_headers: Optional[Dict[str, Optional[str]]] = None |
| 320 | + ) -> IntegrationMappingsTeams: |
| 321 | + """ |
| 322 | + Lists [Teams integration mappings](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams) in a users' enterprise. |
| 323 | +
|
| 324 | + You need Admin or Co-Admin role to |
| 325 | +
|
| 326 | +
|
| 327 | + use this endpoint. |
| 328 | +
|
| 329 | + :param partner_item_type: Mapped item type, for which the mapping should be returned, defaults to None |
| 330 | + :type partner_item_type: Optional[GetIntegrationMappingTeamsPartnerItemType], optional |
| 331 | + :param partner_item_id: ID of the mapped item, for which the mapping should be returned, defaults to None |
| 332 | + :type partner_item_id: Optional[str], optional |
| 333 | + :param box_item_id: Box item ID, for which the mappings should be returned, defaults to None |
| 334 | + :type box_item_id: Optional[str], optional |
| 335 | + :param box_item_type: Box item type, for which the mappings should be returned, defaults to None |
| 336 | + :type box_item_type: Optional[GetIntegrationMappingTeamsBoxItemType], optional |
| 337 | + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None |
| 338 | + :type extra_headers: Optional[Dict[str, Optional[str]]], optional |
| 339 | + """ |
| 340 | + if extra_headers is None: |
| 341 | + extra_headers = {} |
| 342 | + query_params_map: Dict[str, str] = prepare_params( |
| 343 | + { |
| 344 | + 'partner_item_type': to_string(partner_item_type), |
| 345 | + 'partner_item_id': to_string(partner_item_id), |
| 346 | + 'box_item_id': to_string(box_item_id), |
| 347 | + 'box_item_type': to_string(box_item_type), |
| 348 | + } |
| 349 | + ) |
| 350 | + headers_map: Dict[str, str] = prepare_params({**extra_headers}) |
| 351 | + response: FetchResponse = self.network_session.network_client.fetch( |
| 352 | + FetchOptions( |
| 353 | + url=''.join( |
| 354 | + [ |
| 355 | + self.network_session.base_urls.base_url, |
| 356 | + '/2.0/integration_mappings/teams', |
| 357 | + ] |
| 358 | + ), |
| 359 | + method='GET', |
| 360 | + params=query_params_map, |
| 361 | + headers=headers_map, |
| 362 | + response_format=ResponseFormat.JSON, |
| 363 | + auth=self.auth, |
| 364 | + network_session=self.network_session, |
| 365 | + ) |
| 366 | + ) |
| 367 | + return deserialize(response.data, IntegrationMappingsTeams) |
| 368 | + |
| 369 | + def create_integration_mapping_teams( |
| 370 | + self, |
| 371 | + partner_item: IntegrationMappingPartnerItemTeamsCreateRequest, |
| 372 | + box_item: FolderReference, |
| 373 | + *, |
| 374 | + extra_headers: Optional[Dict[str, Optional[str]]] = None |
| 375 | + ) -> IntegrationMappingTeams: |
| 376 | + """ |
| 377 | + Creates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams) |
| 378 | +
|
| 379 | + by mapping a Teams channel to a Box item. |
| 380 | +
|
| 381 | +
|
| 382 | + You need Admin or Co-Admin role to |
| 383 | +
|
| 384 | +
|
| 385 | + use this endpoint. |
| 386 | +
|
| 387 | + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None |
| 388 | + :type extra_headers: Optional[Dict[str, Optional[str]]], optional |
| 389 | + """ |
| 390 | + if extra_headers is None: |
| 391 | + extra_headers = {} |
| 392 | + request_body: Dict = {'partner_item': partner_item, 'box_item': box_item} |
| 393 | + headers_map: Dict[str, str] = prepare_params({**extra_headers}) |
| 394 | + response: FetchResponse = self.network_session.network_client.fetch( |
| 395 | + FetchOptions( |
| 396 | + url=''.join( |
| 397 | + [ |
| 398 | + self.network_session.base_urls.base_url, |
| 399 | + '/2.0/integration_mappings/teams', |
| 400 | + ] |
| 401 | + ), |
| 402 | + method='POST', |
| 403 | + headers=headers_map, |
| 404 | + data=serialize(request_body), |
| 405 | + content_type='application/json', |
| 406 | + response_format=ResponseFormat.JSON, |
| 407 | + auth=self.auth, |
| 408 | + network_session=self.network_session, |
| 409 | + ) |
| 410 | + ) |
| 411 | + return deserialize(response.data, IntegrationMappingTeams) |
| 412 | + |
| 413 | + def update_integration_mapping_teams_by_id( |
| 414 | + self, |
| 415 | + integration_mapping_id: str, |
| 416 | + *, |
| 417 | + box_item: Optional[FolderReference] = None, |
| 418 | + extra_headers: Optional[Dict[str, Optional[str]]] = None |
| 419 | + ) -> IntegrationMappingTeams: |
| 420 | + """ |
| 421 | + Updates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams). |
| 422 | +
|
| 423 | + Supports updating the Box folder ID and options. |
| 424 | +
|
| 425 | +
|
| 426 | + You need Admin or Co-Admin role to |
| 427 | +
|
| 428 | +
|
| 429 | + use this endpoint. |
| 430 | +
|
| 431 | + :param integration_mapping_id: An ID of an integration mapping |
| 432 | + Example: "11235432" |
| 433 | + :type integration_mapping_id: str |
| 434 | + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None |
| 435 | + :type extra_headers: Optional[Dict[str, Optional[str]]], optional |
| 436 | + """ |
| 437 | + if extra_headers is None: |
| 438 | + extra_headers = {} |
| 439 | + request_body: Dict = {'box_item': box_item} |
| 440 | + headers_map: Dict[str, str] = prepare_params({**extra_headers}) |
| 441 | + response: FetchResponse = self.network_session.network_client.fetch( |
| 442 | + FetchOptions( |
| 443 | + url=''.join( |
| 444 | + [ |
| 445 | + self.network_session.base_urls.base_url, |
| 446 | + '/2.0/integration_mappings/teams/', |
| 447 | + to_string(integration_mapping_id), |
| 448 | + ] |
| 449 | + ), |
| 450 | + method='PUT', |
| 451 | + headers=headers_map, |
| 452 | + data=serialize(request_body), |
| 453 | + content_type='application/json', |
| 454 | + response_format=ResponseFormat.JSON, |
| 455 | + auth=self.auth, |
| 456 | + network_session=self.network_session, |
| 457 | + ) |
| 458 | + ) |
| 459 | + return deserialize(response.data, IntegrationMappingTeams) |
| 460 | + |
| 461 | + def delete_integration_mapping_teams_by_id( |
| 462 | + self, |
| 463 | + integration_mapping_id: str, |
| 464 | + *, |
| 465 | + extra_headers: Optional[Dict[str, Optional[str]]] = None |
| 466 | + ) -> None: |
| 467 | + """ |
| 468 | + Deletes a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams). |
| 469 | +
|
| 470 | + You need Admin or Co-Admin role to |
| 471 | +
|
| 472 | +
|
| 473 | + use this endpoint. |
| 474 | +
|
| 475 | + :param integration_mapping_id: An ID of an integration mapping |
| 476 | + Example: "11235432" |
| 477 | + :type integration_mapping_id: str |
| 478 | + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None |
| 479 | + :type extra_headers: Optional[Dict[str, Optional[str]]], optional |
| 480 | + """ |
| 481 | + if extra_headers is None: |
| 482 | + extra_headers = {} |
| 483 | + headers_map: Dict[str, str] = prepare_params({**extra_headers}) |
| 484 | + response: FetchResponse = self.network_session.network_client.fetch( |
| 485 | + FetchOptions( |
| 486 | + url=''.join( |
| 487 | + [ |
| 488 | + self.network_session.base_urls.base_url, |
| 489 | + '/2.0/integration_mappings/teams/', |
| 490 | + to_string(integration_mapping_id), |
| 491 | + ] |
| 492 | + ), |
| 493 | + method='DELETE', |
| 494 | + headers=headers_map, |
| 495 | + response_format=ResponseFormat.NO_CONTENT, |
| 496 | + auth=self.auth, |
| 497 | + network_session=self.network_session, |
| 498 | + ) |
| 499 | + ) |
| 500 | + return None |
0 commit comments