# This file was auto-generated by Fern from our API Definition. import typing from json.decoder import JSONDecodeError from ...core.api_error import ApiError from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ...core.http_response import AsyncHttpResponse, HttpResponse from ...core.jsonable_encoder import encode_path_param from ...core.pagination import AsyncPager, SyncPager from ...core.parse_error import ParsingError from ...core.pydantic_utilities import parse_obj_as from ...core.request_options import RequestOptions from ...errors.bad_request_error import BadRequestError from ...errors.conflict_error import ConflictError from ...errors.forbidden_error import ForbiddenError from ...errors.not_found_error import NotFoundError from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError from ...types.create_organization_all_connection_response_content import CreateOrganizationAllConnectionResponseContent from ...types.get_organization_all_connection_response_content import GetOrganizationAllConnectionResponseContent from ...types.list_organization_all_connections_offset_paginated_response_content import ( ListOrganizationAllConnectionsOffsetPaginatedResponseContent, ) from ...types.organization_access_level_enum import OrganizationAccessLevelEnum from ...types.organization_access_level_enum_with_null import OrganizationAccessLevelEnumWithNull from ...types.organization_all_connection_post import OrganizationAllConnectionPost from ...types.update_organization_all_connection_response_content import UpdateOrganizationAllConnectionResponseContent from pydantic import ValidationError # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) class RawConnectionsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper def list( self, id: str, *, page: typing.Optional[int] = 0, per_page: typing.Optional[int] = 50, include_totals: typing.Optional[bool] = True, is_enabled: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent]: """ Parameters ---------- id : str Organization identifier. page : typing.Optional[int] Page index of the results to return. First page is 0. per_page : typing.Optional[int] Number of results per page. Defaults to 50. include_totals : typing.Optional[bool] Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). is_enabled : typing.Optional[bool] Filter connections by enabled status. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent] Connections successfully retrieved. """ page = page if page is not None else 0 _response = self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections", method="GET", params={ "page": page, "per_page": per_page, "include_totals": include_totals, "is_enabled": is_enabled, }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _parsed_response = typing.cast( ListOrganizationAllConnectionsOffsetPaginatedResponseContent, parse_obj_as( type_=ListOrganizationAllConnectionsOffsetPaginatedResponseContent, # type: ignore object_=_response.json(), ), ) _items = _parsed_response.connections _has_next = len(_items or []) > 0 _get_next = lambda: self.list( id, page=page + 1, per_page=per_page, include_totals=include_totals, is_enabled=is_enabled, request_options=request_options, ) return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) def create( self, id: str, *, connection_id: str, organization_connection_name: typing.Optional[str] = OMIT, assign_membership_on_login: typing.Optional[bool] = OMIT, show_as_button: typing.Optional[bool] = OMIT, is_signup_enabled: typing.Optional[bool] = OMIT, organization_access_level: typing.Optional[OrganizationAccessLevelEnum] = OMIT, is_enabled: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[CreateOrganizationAllConnectionResponseContent]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. organization_connection_name : typing.Optional[str] Name of the connection in the scope of this organization. assign_membership_on_login : typing.Optional[bool] When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. show_as_button : typing.Optional[bool] Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. is_signup_enabled : typing.Optional[bool] Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. organization_access_level : typing.Optional[OrganizationAccessLevelEnum] is_enabled : typing.Optional[bool] Whether the connection is enabled for the organization. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[CreateOrganizationAllConnectionResponseContent] Connection successfully created. """ _response = self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections", method="POST", json={ "organization_connection_name": organization_connection_name, "assign_membership_on_login": assign_membership_on_login, "show_as_button": show_as_button, "is_signup_enabled": is_signup_enabled, "organization_access_level": organization_access_level, "is_enabled": is_enabled, "connection_id": connection_id, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( CreateOrganizationAllConnectionResponseContent, parse_obj_as( type_=CreateOrganizationAllConnectionResponseContent, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 409: raise ConflictError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) def get( self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[GetOrganizationAllConnectionResponseContent]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[GetOrganizationAllConnectionResponseContent] Connection successfully retrieved. """ _response = self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections/{encode_path_param(connection_id)}", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( GetOrganizationAllConnectionResponseContent, parse_obj_as( type_=GetOrganizationAllConnectionResponseContent, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) def delete( self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[None]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[None] """ _response = self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections/{encode_path_param(connection_id)}", method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: return HttpResponse(response=_response, data=None) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) def update( self, id: str, connection_id: str, *, organization_connection_name: typing.Optional[str] = OMIT, assign_membership_on_login: typing.Optional[bool] = OMIT, show_as_button: typing.Optional[bool] = OMIT, is_signup_enabled: typing.Optional[bool] = OMIT, organization_access_level: typing.Optional[OrganizationAccessLevelEnumWithNull] = OMIT, is_enabled: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[UpdateOrganizationAllConnectionResponseContent]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. organization_connection_name : typing.Optional[str] Name of the connection in the scope of this organization. assign_membership_on_login : typing.Optional[bool] When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. show_as_button : typing.Optional[bool] Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. is_signup_enabled : typing.Optional[bool] Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. organization_access_level : typing.Optional[OrganizationAccessLevelEnumWithNull] is_enabled : typing.Optional[bool] Whether the connection is enabled for the organization. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[UpdateOrganizationAllConnectionResponseContent] Connection successfully updated. """ _response = self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections/{encode_path_param(connection_id)}", method="PATCH", json={ "organization_connection_name": organization_connection_name, "assign_membership_on_login": assign_membership_on_login, "show_as_button": show_as_button, "is_signup_enabled": is_signup_enabled, "organization_access_level": organization_access_level, "is_enabled": is_enabled, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( UpdateOrganizationAllConnectionResponseContent, parse_obj_as( type_=UpdateOrganizationAllConnectionResponseContent, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) class AsyncRawConnectionsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper async def list( self, id: str, *, page: typing.Optional[int] = 0, per_page: typing.Optional[int] = 50, include_totals: typing.Optional[bool] = True, is_enabled: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent]: """ Parameters ---------- id : str Organization identifier. page : typing.Optional[int] Page index of the results to return. First page is 0. per_page : typing.Optional[int] Number of results per page. Defaults to 50. include_totals : typing.Optional[bool] Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). is_enabled : typing.Optional[bool] Filter connections by enabled status. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent] Connections successfully retrieved. """ page = page if page is not None else 0 _response = await self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections", method="GET", params={ "page": page, "per_page": per_page, "include_totals": include_totals, "is_enabled": is_enabled, }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _parsed_response = typing.cast( ListOrganizationAllConnectionsOffsetPaginatedResponseContent, parse_obj_as( type_=ListOrganizationAllConnectionsOffsetPaginatedResponseContent, # type: ignore object_=_response.json(), ), ) _items = _parsed_response.connections _has_next = len(_items or []) > 0 async def _get_next(): return await self.list( id, page=page + 1, per_page=per_page, include_totals=include_totals, is_enabled=is_enabled, request_options=request_options, ) return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) async def create( self, id: str, *, connection_id: str, organization_connection_name: typing.Optional[str] = OMIT, assign_membership_on_login: typing.Optional[bool] = OMIT, show_as_button: typing.Optional[bool] = OMIT, is_signup_enabled: typing.Optional[bool] = OMIT, organization_access_level: typing.Optional[OrganizationAccessLevelEnum] = OMIT, is_enabled: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[CreateOrganizationAllConnectionResponseContent]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. organization_connection_name : typing.Optional[str] Name of the connection in the scope of this organization. assign_membership_on_login : typing.Optional[bool] When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. show_as_button : typing.Optional[bool] Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. is_signup_enabled : typing.Optional[bool] Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. organization_access_level : typing.Optional[OrganizationAccessLevelEnum] is_enabled : typing.Optional[bool] Whether the connection is enabled for the organization. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[CreateOrganizationAllConnectionResponseContent] Connection successfully created. """ _response = await self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections", method="POST", json={ "organization_connection_name": organization_connection_name, "assign_membership_on_login": assign_membership_on_login, "show_as_button": show_as_button, "is_signup_enabled": is_signup_enabled, "organization_access_level": organization_access_level, "is_enabled": is_enabled, "connection_id": connection_id, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( CreateOrganizationAllConnectionResponseContent, parse_obj_as( type_=CreateOrganizationAllConnectionResponseContent, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 409: raise ConflictError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) async def get( self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[GetOrganizationAllConnectionResponseContent]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[GetOrganizationAllConnectionResponseContent] Connection successfully retrieved. """ _response = await self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections/{encode_path_param(connection_id)}", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( GetOrganizationAllConnectionResponseContent, parse_obj_as( type_=GetOrganizationAllConnectionResponseContent, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) async def delete( self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[None]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[None] """ _response = await self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections/{encode_path_param(connection_id)}", method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: return AsyncHttpResponse(response=_response, data=None) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) async def update( self, id: str, connection_id: str, *, organization_connection_name: typing.Optional[str] = OMIT, assign_membership_on_login: typing.Optional[bool] = OMIT, show_as_button: typing.Optional[bool] = OMIT, is_signup_enabled: typing.Optional[bool] = OMIT, organization_access_level: typing.Optional[OrganizationAccessLevelEnumWithNull] = OMIT, is_enabled: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[UpdateOrganizationAllConnectionResponseContent]: """ Parameters ---------- id : str Organization identifier. connection_id : str Connection identifier. organization_connection_name : typing.Optional[str] Name of the connection in the scope of this organization. assign_membership_on_login : typing.Optional[bool] When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. show_as_button : typing.Optional[bool] Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. is_signup_enabled : typing.Optional[bool] Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. organization_access_level : typing.Optional[OrganizationAccessLevelEnumWithNull] is_enabled : typing.Optional[bool] Whether the connection is enabled for the organization. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[UpdateOrganizationAllConnectionResponseContent] Connection successfully updated. """ _response = await self._client_wrapper.httpx_client.request( f"organizations/{encode_path_param(id)}/connections/{encode_path_param(connection_id)}", method="PATCH", json={ "organization_connection_name": organization_connection_name, "assign_membership_on_login": assign_membership_on_login, "show_as_button": show_as_button, "is_signup_enabled": is_signup_enabled, "organization_access_level": organization_access_level, "is_enabled": is_enabled, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( UpdateOrganizationAllConnectionResponseContent, parse_obj_as( type_=UpdateOrganizationAllConnectionResponseContent, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 429: raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( typing.Any, parse_obj_as( type_=typing.Any, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) except ValidationError as e: raise ParsingError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)