From 316e546bdb14eabb87ff0878545a21c1d7cef4a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 22:18:09 +0000 Subject: [PATCH 1/6] feat(docs): updating documented docs for stainless --- .stats.yml | 4 ++-- src/openint/_client.py | 8 ++++---- src/openint/types/client_list_events_params.py | 5 ++--- tests/api_resources/test_client.py | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index eb02f9c..b540dde 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 16 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-a7212b4566ed125aa08bf8c11ec8e06cb155893a70fea4237e6c8524f9dfe2e9.yml -openapi_spec_hash: 962403d111f029b8911c5ec6acd6f215 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-14197431bab8814d6b1f5d0e69c7913dbd1213d1389bbbd4f87f7d4bdc386939.yml +openapi_spec_hash: d9c8e659e294c71dc6f74280a521174b config_hash: 4f1d196a8f57efed93da0f033aec310e diff --git a/src/openint/_client.py b/src/openint/_client.py index af9d3c2..b1c8cbd 100644 --- a/src/openint/_client.py +++ b/src/openint/_client.py @@ -1425,7 +1425,7 @@ def list_customers( def list_events( self, *, - expand: List[Literal["prompt"]] | NotGiven = NOT_GIVEN, + include_prompt: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, search_query: str | NotGiven = NOT_GIVEN, @@ -1463,7 +1463,7 @@ def list_events( timeout=timeout, query=maybe_transform( { - "expand": expand, + "include_prompt": include_prompt, "limit": limit, "offset": offset, "search_query": search_query, @@ -2940,7 +2940,7 @@ def list_customers( def list_events( self, *, - expand: List[Literal["prompt"]] | NotGiven = NOT_GIVEN, + include_prompt: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, search_query: str | NotGiven = NOT_GIVEN, @@ -2978,7 +2978,7 @@ def list_events( timeout=timeout, query=maybe_transform( { - "expand": expand, + "include_prompt": include_prompt, "limit": limit, "offset": offset, "search_query": search_query, diff --git a/src/openint/types/client_list_events_params.py b/src/openint/types/client_list_events_params.py index 2c953fa..0eecbae 100644 --- a/src/openint/types/client_list_events_params.py +++ b/src/openint/types/client_list_events_params.py @@ -2,14 +2,13 @@ from __future__ import annotations -from typing import List -from typing_extensions import Literal, TypedDict +from typing_extensions import TypedDict __all__ = ["ClientListEventsParams"] class ClientListEventsParams(TypedDict, total=False): - expand: List[Literal["prompt"]] + include_prompt: bool limit: int """Limit the number of items returned""" diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index bf11443..977b851 100644 --- a/tests/api_resources/test_client.py +++ b/tests/api_resources/test_client.py @@ -684,7 +684,7 @@ def test_method_list_events(self, client: Openint) -> None: @parametrize def test_method_list_events_with_all_params(self, client: Openint) -> None: client_ = client.list_events( - expand=["prompt"], + include_prompt=True, limit=0, offset=0, search_query="search_query", @@ -1458,7 +1458,7 @@ async def test_method_list_events(self, async_client: AsyncOpenint) -> None: @parametrize async def test_method_list_events_with_all_params(self, async_client: AsyncOpenint) -> None: client = await async_client.list_events( - expand=["prompt"], + include_prompt=True, limit=0, offset=0, search_query="search_query", From 444bab6f2527e7d21fc33b840cbdeec21fdddd8c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 23:35:20 +0000 Subject: [PATCH 2/6] feat(docs): updating documented docs for stainless --- .stats.yml | 4 ++-- src/openint/types/client_create_connection_params.py | 2 +- src/openint/types/client_create_token_params.py | 6 ++++++ src/openint/types/create_connection_response.py | 2 +- src/openint/types/get_connection_response.py | 2 +- src/openint/types/list_connections_response.py | 2 +- tests/api_resources/test_client.py | 2 ++ 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index b540dde..7b17780 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 16 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-14197431bab8814d6b1f5d0e69c7913dbd1213d1389bbbd4f87f7d4bdc386939.yml -openapi_spec_hash: d9c8e659e294c71dc6f74280a521174b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-00a3ddd4864882413f36470aae8bb3ee0e554c1e4396551df31a42e8c5aff628.yml +openapi_spec_hash: c766b8f3b3fac5ba7c1d824d512f0dd7 config_hash: 4f1d196a8f57efed93da0f033aec310e diff --git a/src/openint/types/client_create_connection_params.py b/src/openint/types/client_create_connection_params.py index ce85b58..07b59fe 100644 --- a/src/openint/types/client_create_connection_params.py +++ b/src/openint/types/client_create_connection_params.py @@ -7920,7 +7920,7 @@ class DataConnectorPlaidDiscriminatedConnectionSettings(TypedDict, total=False): class DataConnectorPostgresDiscriminatedConnectionSettingsSettings(TypedDict, total=False): - database_url: Annotated[str, PropertyInfo(alias="databaseURL")] + database_url: str class DataConnectorPostgresDiscriminatedConnectionSettings(TypedDict, total=False): diff --git a/src/openint/types/client_create_token_params.py b/src/openint/types/client_create_token_params.py index 9088316..73543ab 100644 --- a/src/openint/types/client_create_token_params.py +++ b/src/openint/types/client_create_token_params.py @@ -203,6 +203,12 @@ class ConnectOptions(TypedDict, total=False): debug: bool """Whether to enable debug mode""" + hide_navigation: bool + """Whether to hide the navigation bar. + + This is useful for hardcoding to a particular view. + """ + is_embedded: bool """Whether to enable embedded mode. diff --git a/src/openint/types/create_connection_response.py b/src/openint/types/create_connection_response.py index 7fcf91e..cc5ec23 100644 --- a/src/openint/types/create_connection_response.py +++ b/src/openint/types/create_connection_response.py @@ -12174,7 +12174,7 @@ class ConnectorPlaidDiscriminatedConnectionSettings(BaseModel): class ConnectorPostgresDiscriminatedConnectionSettingsSettings(BaseModel): - database_url: Optional[str] = FieldInfo(alias="databaseURL", default=None) + database_url: Optional[str] = None class ConnectorPostgresDiscriminatedConnectionSettings(BaseModel): diff --git a/src/openint/types/get_connection_response.py b/src/openint/types/get_connection_response.py index 4fb5a52..3ea9a4e 100644 --- a/src/openint/types/get_connection_response.py +++ b/src/openint/types/get_connection_response.py @@ -12812,7 +12812,7 @@ class ConnectorPlaidDiscriminatedConnectionSettings(BaseModel): class ConnectorPostgresDiscriminatedConnectionSettingsSettings(BaseModel): - database_url: Optional[str] = FieldInfo(alias="databaseURL", default=None) + database_url: Optional[str] = None class ConnectorPostgresDiscriminatedConnectionSettings(BaseModel): diff --git a/src/openint/types/list_connections_response.py b/src/openint/types/list_connections_response.py index ad297cb..66722c5 100644 --- a/src/openint/types/list_connections_response.py +++ b/src/openint/types/list_connections_response.py @@ -12812,7 +12812,7 @@ class ConnectorPlaidDiscriminatedConnectionSettings(BaseModel): class ConnectorPostgresDiscriminatedConnectionSettingsSettings(BaseModel): - database_url: Optional[str] = FieldInfo(alias="databaseURL", default=None) + database_url: Optional[str] = None class ConnectorPostgresDiscriminatedConnectionSettings(BaseModel): diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index 977b851..23b367a 100644 --- a/tests/api_resources/test_client.py +++ b/tests/api_resources/test_client.py @@ -214,6 +214,7 @@ def test_method_create_token_with_all_params(self, client: Openint) -> None: connect_options={ "connector_names": ["accelo"], "debug": True, + "hide_navigation": True, "is_embedded": True, "return_url": "return_url", "view": "add", @@ -988,6 +989,7 @@ async def test_method_create_token_with_all_params(self, async_client: AsyncOpen connect_options={ "connector_names": ["accelo"], "debug": True, + "hide_navigation": True, "is_embedded": True, "return_url": "return_url", "view": "add", From cd673e1e7fff34115e2c735e458d53804c2f0628 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 07:18:32 +0000 Subject: [PATCH 3/6] chore: update github action --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dedd61..8e2df5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: run: ./scripts/lint build: - if: github.repository == 'stainless-sdks/openint-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork timeout-minutes: 10 name: build permissions: @@ -61,12 +61,14 @@ jobs: run: rye build - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/openint-python' id: github-oidc uses: actions/github-script@v6 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball + if: github.repository == 'stainless-sdks/openint-python' env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From 48aff10bbe28bb6f428f07c97ea5d005c35cb759 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 00:22:35 +0000 Subject: [PATCH 4/6] feat(api-v2): api v2 spec --- .stats.yml | 8 +- README.md | 50 ++- api.md | 42 +- src/openint/_client.py | 422 ++++++++++++++---- src/openint/types/__init__.py | 6 +- .../types/assign_connection_response.py | 14 + .../client_get_message_template_params.py | 15 - .../types/client_list_connections_params.py | 2 + .../types/client_list_connectors_params.py | 2 + .../types/delete_assignment_response.py | 14 + .../types/delete_connector_config_response.py | 10 + .../types/get_message_template_response.py | 11 - .../types/list_assignments_response.py | 14 + tests/api_resources/test_client.py | 385 ++++++++++++++-- tests/test_client.py | 86 +++- 15 files changed, 876 insertions(+), 205 deletions(-) create mode 100644 src/openint/types/assign_connection_response.py delete mode 100644 src/openint/types/client_get_message_template_params.py create mode 100644 src/openint/types/delete_assignment_response.py create mode 100644 src/openint/types/delete_connector_config_response.py delete mode 100644 src/openint/types/get_message_template_response.py create mode 100644 src/openint/types/list_assignments_response.py diff --git a/.stats.yml b/.stats.yml index 7b17780..b8d7885 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 16 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-00a3ddd4864882413f36470aae8bb3ee0e554c1e4396551df31a42e8c5aff628.yml -openapi_spec_hash: c766b8f3b3fac5ba7c1d824d512f0dd7 -config_hash: 4f1d196a8f57efed93da0f033aec310e +configured_endpoints: 19 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-8939526af685821b7c8d595a10525162c1ce8a0d14da26247f379595aa51df04.yml +openapi_spec_hash: d6482999678782fbf0190b20ab353a7b +config_hash: cb86aadf1cfe987b2b3b878ff539bb20 diff --git a/README.md b/README.md index 5e98b26..3104dfb 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,11 @@ client = Openint( token=os.environ.get("OPENINT_API_KEY"), # This is the default and can be omitted ) -page = client.list_connections() -print(page.items) +response = client.assign_connection( + repl_id="replId", + id="conn_", +) +print(response.id) ``` While you can provide a `token` keyword argument, @@ -56,8 +59,11 @@ client = AsyncOpenint( async def main() -> None: - page = await client.list_connections() - print(page.items) + response = await client.assign_connection( + repl_id="replId", + id="conn_", + ) + print(response.id) asyncio.run(main()) @@ -89,8 +95,11 @@ async def main() -> None: token="My Token", http_client=DefaultAioHttpClient(), ) as client: - page = await client.list_connections() - print(page.items) + response = await client.assign_connection( + repl_id="replId", + id="conn_", + ) + print(response.id) asyncio.run(main()) @@ -137,7 +146,10 @@ from openint import Openint client = Openint() try: - client.list_connections() + client.assign_connection( + repl_id="replId", + id="conn_", + ) except openint.APIConnectionError as e: print("The server could not be reached") print(e.__cause__) # an underlying Exception, likely raised within httpx. @@ -180,7 +192,10 @@ client = Openint( ) # Or, configure per-request: -client.with_options(max_retries=5).list_connections() +client.with_options(max_retries=5).assign_connection( + repl_id="replId", + id="conn_", +) ``` ### Timeouts @@ -203,7 +218,10 @@ client = Openint( ) # Override per-request: -client.with_options(timeout=5.0).list_connections() +client.with_options(timeout=5.0).assign_connection( + repl_id="replId", + id="conn_", +) ``` On timeout, an `APITimeoutError` is thrown. @@ -244,11 +262,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to from openint import Openint client = Openint() -response = client.with_raw_response.list_connections() +response = client.with_raw_response.assign_connection( + repl_id="replId", + id="conn_", +) print(response.headers.get('X-My-Header')) -client = response.parse() # get the object that `list_connections()` would have returned -print(client) +client = response.parse() # get the object that `assign_connection()` would have returned +print(client.id) ``` These methods return an [`APIResponse`](https://github.com/openintegrations/python-sdk/tree/main/src/openint/_response.py) object. @@ -262,7 +283,10 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.with_streaming_response.list_connections() as response: +with client.with_streaming_response.assign_connection( + repl_id="replId", + id="conn_", +) as response: print(response.headers.get("X-My-Header")) for line in response.iter_lines(): diff --git a/api.md b/api.md index aea6fe0..dd50878 100644 --- a/api.md +++ b/api.md @@ -6,15 +6,18 @@ Types: from openint.types import ( Connector, Integration, + AssignConnectionResponse, CheckConnectionResponse, CreateConnectionResponse, CreateConnnectorConfigResponse, CreateTokenResponse, + DeleteAssignmentResponse, DeleteConnectionResponse, + DeleteConnectorConfigResponse, GetConectorConfigResponse, GetConnectionResponse, GetCurrentUserResponse, - GetMessageTemplateResponse, + ListAssignmentsResponse, ListConnectionConfigsResponse, ListConnectionsResponse, ListConnectorsResponse, @@ -28,20 +31,23 @@ from openint.types import ( Methods: -- client.check_connection(id) -> CheckConnectionResponse -- client.create_connection(\*\*params) -> CreateConnectionResponse -- client.create_connnector_config(\*\*params) -> CreateConnnectorConfigResponse -- client.create_token(customer_id, \*\*params) -> CreateTokenResponse -- client.delete_connection(id) -> DeleteConnectionResponse -- client.get_conector_config(id, \*\*params) -> GetConectorConfigResponse -- client.get_connection(id, \*\*params) -> GetConnectionResponse -- client.get_current_user() -> GetCurrentUserResponse -- client.get_message_template(\*\*params) -> GetMessageTemplateResponse -- client.list_connection_configs(\*\*params) -> SyncOffsetPagination[ListConnectionConfigsResponse] -- client.list_connections(\*\*params) -> SyncOffsetPagination[ListConnectionsResponse] -- client.list_connectors(\*\*params) -> SyncOffsetPagination[ListConnectorsResponse] -- client.list_connnector_configs(\*\*params) -> SyncOffsetPagination[ListConnnectorConfigsResponse] -- client.list_customers(\*\*params) -> SyncOffsetPagination[ListCustomersResponse] -- client.list_events(\*\*params) -> SyncOffsetPagination[ListEventsResponse] -- client.upsert_connnector_config(id, \*\*params) -> UpsertConnnectorConfigResponse -- client.upsert_customer(\*\*params) -> UpsertCustomerResponse +- client.assign_connection(repl_id, \*, id) -> AssignConnectionResponse +- client.check_connection(id) -> CheckConnectionResponse +- client.create_connection(\*\*params) -> CreateConnectionResponse +- client.create_connnector_config(\*\*params) -> CreateConnnectorConfigResponse +- client.create_token(customer_id, \*\*params) -> CreateTokenResponse +- client.delete_assignment(repl_id, \*, id) -> DeleteAssignmentResponse +- client.delete_connection(id) -> DeleteConnectionResponse +- client.delete_connector_config(id) -> DeleteConnectorConfigResponse +- client.get_conector_config(id, \*\*params) -> GetConectorConfigResponse +- client.get_connection(id, \*\*params) -> GetConnectionResponse +- client.get_current_user() -> GetCurrentUserResponse +- client.list_assignments(id) -> ListAssignmentsResponse +- client.list_connection_configs(\*\*params) -> SyncOffsetPagination[ListConnectionConfigsResponse] +- client.list_connections(\*\*params) -> SyncOffsetPagination[ListConnectionsResponse] +- client.list_connectors(\*\*params) -> SyncOffsetPagination[ListConnectorsResponse] +- client.list_connnector_configs(\*\*params) -> SyncOffsetPagination[ListConnnectorConfigsResponse] +- client.list_customers(\*\*params) -> SyncOffsetPagination[ListCustomersResponse] +- client.list_events(\*\*params) -> SyncOffsetPagination[ListEventsResponse] +- client.upsert_connnector_config(id, \*\*params) -> UpsertConnnectorConfigResponse +- client.upsert_customer(\*\*params) -> UpsertCustomerResponse diff --git a/src/openint/_client.py b/src/openint/_client.py index b1c8cbd..d2e33e7 100644 --- a/src/openint/_client.py +++ b/src/openint/_client.py @@ -20,7 +20,6 @@ client_list_connections_params, client_create_connection_params, client_get_conector_config_params, - client_get_message_template_params, client_list_connection_configs_params, client_list_connnector_configs_params, client_create_connnector_config_params, @@ -69,11 +68,14 @@ from .types.upsert_customer_response import UpsertCustomerResponse from .types.check_connection_response import CheckConnectionResponse from .types.get_current_user_response import GetCurrentUserResponse +from .types.list_assignments_response import ListAssignmentsResponse from .types.list_connections_response import ListConnectionsResponse +from .types.assign_connection_response import AssignConnectionResponse from .types.create_connection_response import CreateConnectionResponse +from .types.delete_assignment_response import DeleteAssignmentResponse from .types.delete_connection_response import DeleteConnectionResponse from .types.get_conector_config_response import GetConectorConfigResponse -from .types.get_message_template_response import GetMessageTemplateResponse +from .types.delete_connector_config_response import DeleteConnectorConfigResponse from .types.list_connection_configs_response import ListConnectionConfigsResponse from .types.list_connnector_configs_response import ListConnnectorConfigsResponse from .types.create_connnector_config_response import CreateConnnectorConfigResponse @@ -123,7 +125,7 @@ def __init__( if base_url is None: base_url = os.environ.get("OPENINT_BASE_URL") if base_url is None: - base_url = f"https://api.openint.dev/v1" + base_url = f"https://api.openint.dev" super().__init__( version=__version__, @@ -223,6 +225,46 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy + def assign_connection( + self, + repl_id: str, + *, + id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AssignConnectionResponse: + """ + Assign a connection to a customer + + Args: + id: The id of the connection, starts with `conn_` + + repl_id: The repl ID to assign to this connection + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not repl_id: + raise ValueError(f"Expected a non-empty value for `repl_id` but received {repl_id!r}") + return self.put( + f"/v2/connection/{id}/assignment/{repl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AssignConnectionResponse, + ) + def check_connection( self, id: str, @@ -251,7 +293,7 @@ def check_connection( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self.post( - f"/connection/{id}/check", + f"/v1/connection/{id}/check", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -297,7 +339,7 @@ def create_connection( return cast( CreateConnectionResponse, self.post( - "/connection", + "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/v2/connection", body=maybe_transform( { "connector_config_id": connector_config_id, @@ -345,7 +387,7 @@ def create_connnector_config( return cast( CreateConnnectorConfigResponse, self.post( - "/connector-config", + "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/v2/connector-config", body=maybe_transform( { "connector_name": connector_name, @@ -401,7 +443,7 @@ def create_token( if not customer_id: raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}") return self.post( - f"/customer/{customer_id}/token", + f"/v1/customer/{customer_id}/token", body=maybe_transform( { "connect_options": connect_options, @@ -415,6 +457,46 @@ def create_token( cast_to=CreateTokenResponse, ) + def delete_assignment( + self, + repl_id: str, + *, + id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DeleteAssignmentResponse: + """ + Remove a repl assignment from a connection + + Args: + id: The id of the connection, starts with `conn_` + + repl_id: The repl ID to remove from this connection + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not repl_id: + raise ValueError(f"Expected a non-empty value for `repl_id` but received {repl_id!r}") + return self.delete( + f"/v2/connection/{id}/assignment/{repl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeleteAssignmentResponse, + ) + def delete_connection( self, id: str, @@ -443,13 +525,46 @@ def delete_connection( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self.delete( - f"/connection/{id}", + f"/v2/connection/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=DeleteConnectionResponse, ) + def delete_connector_config( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DeleteConnectorConfigResponse: + """ + Args: + id: The id of the connector config, starts with `ccfg_` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self.delete( + f"/v2/connector-config/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeleteConnectorConfigResponse, + ) + def get_conector_config( self, id: str, @@ -479,7 +594,7 @@ def get_conector_config( return cast( GetConectorConfigResponse, self.get( - f"/connector-config/{id}", + f"/v2/connector-config/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -531,7 +646,7 @@ def get_connection( return cast( GetConnectionResponse, self.get( - f"/connection/{id}", + f"/v2/connection/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -564,30 +679,30 @@ def get_current_user( ) -> GetCurrentUserResponse: """Get information about the current authenticated user""" return self.get( - "/viewer", + "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/v1/viewer", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=GetCurrentUserResponse, ) - def get_message_template( + def list_assignments( self, + id: str, *, - customer_id: str, - language: Literal["javascript"] | NotGiven = NOT_GIVEN, - use_environment_variables: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GetMessageTemplateResponse: + ) -> ListAssignmentsResponse: """ - Get a message template for an AI agent + Get the list of assignments for a specific connection Args: + id: The id of the connection, starts with `conn_` + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -596,23 +711,14 @@ def get_message_template( timeout: Override the client-level default timeout for this request, in seconds """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self.get( - "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/ai/message_template", + f"/v2/connection/{id}/assignment", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "customer_id": customer_id, - "language": language, - "use_environment_variables": use_environment_variables, - }, - client_get_message_template_params.ClientGetMessageTemplateParams, - ), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GetMessageTemplateResponse, + cast_to=ListAssignmentsResponse, ) def list_connection_configs( @@ -822,7 +928,7 @@ def list_connection_configs( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connector-config", + "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/v2/connector-config", page=SyncOffsetPagination[ListConnectionConfigsResponse], options=make_request_options( extra_headers=extra_headers, @@ -848,6 +954,7 @@ def list_connection_configs( def list_connections( self, *, + connection_ids: List[str] | NotGiven = NOT_GIVEN, connector_config_id: str | NotGiven = NOT_GIVEN, connector_names: List[ Literal[ @@ -1069,7 +1176,7 @@ def list_connections( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connection", + "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/v2/connection", page=SyncOffsetPagination[ListConnectionsResponse], options=make_request_options( extra_headers=extra_headers, @@ -1078,6 +1185,7 @@ def list_connections( timeout=timeout, query=maybe_transform( { + "connection_ids": connection_ids, "connector_config_id": connector_config_id, "connector_names": connector_names, "customer_id": customer_id, @@ -1097,6 +1205,7 @@ def list_connections( def list_connectors( self, *, + connector_name: str | NotGiven = NOT_GIVEN, expand: List[Literal["schemas"]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, @@ -1124,7 +1233,7 @@ def list_connectors( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connector", + "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/v2/connector", page=SyncOffsetPagination[ListConnectorsResponse], options=make_request_options( extra_headers=extra_headers, @@ -1133,6 +1242,7 @@ def list_connectors( timeout=timeout, query=maybe_transform( { + "connector_name": connector_name, "expand": expand, "limit": limit, "offset": offset, @@ -1350,7 +1460,7 @@ def list_connnector_configs( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connector-config", + "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/v2/connector-config", page=SyncOffsetPagination[ListConnnectorConfigsResponse], options=make_request_options( extra_headers=extra_headers, @@ -1403,7 +1513,7 @@ def list_customers( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/customer", + "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/v1/customer", page=SyncOffsetPagination[ListCustomersResponse], options=make_request_options( extra_headers=extra_headers, @@ -1454,7 +1564,7 @@ def list_events( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/event", + "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/v1/event", page=SyncOffsetPagination[ListEventsResponse], options=make_request_options( extra_headers=extra_headers, @@ -1506,7 +1616,7 @@ def upsert_connnector_config( return cast( UpsertConnnectorConfigResponse, self.put( - f"/connector-config/{id}", + f"/v2/connector-config/{id}", body=maybe_transform( { "config": config, @@ -1549,7 +1659,7 @@ def upsert_customer( timeout: Override the client-level default timeout for this request, in seconds """ return self.put( - "/customer", + "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/v1/customer", body=maybe_transform( { "id": id, @@ -1638,7 +1748,7 @@ def __init__( if base_url is None: base_url = os.environ.get("OPENINT_BASE_URL") if base_url is None: - base_url = f"https://api.openint.dev/v1" + base_url = f"https://api.openint.dev" super().__init__( version=__version__, @@ -1738,6 +1848,46 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy + async def assign_connection( + self, + repl_id: str, + *, + id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AssignConnectionResponse: + """ + Assign a connection to a customer + + Args: + id: The id of the connection, starts with `conn_` + + repl_id: The repl ID to assign to this connection + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not repl_id: + raise ValueError(f"Expected a non-empty value for `repl_id` but received {repl_id!r}") + return await self.put( + f"/v2/connection/{id}/assignment/{repl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AssignConnectionResponse, + ) + async def check_connection( self, id: str, @@ -1766,7 +1916,7 @@ async def check_connection( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self.post( - f"/connection/{id}/check", + f"/v1/connection/{id}/check", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1812,7 +1962,7 @@ async def create_connection( return cast( CreateConnectionResponse, await self.post( - "/connection", + "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/v2/connection", body=await async_maybe_transform( { "connector_config_id": connector_config_id, @@ -1860,7 +2010,7 @@ async def create_connnector_config( return cast( CreateConnnectorConfigResponse, await self.post( - "/connector-config", + "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/v2/connector-config", body=await async_maybe_transform( { "connector_name": connector_name, @@ -1916,7 +2066,7 @@ async def create_token( if not customer_id: raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}") return await self.post( - f"/customer/{customer_id}/token", + f"/v1/customer/{customer_id}/token", body=await async_maybe_transform( { "connect_options": connect_options, @@ -1930,6 +2080,46 @@ async def create_token( cast_to=CreateTokenResponse, ) + async def delete_assignment( + self, + repl_id: str, + *, + id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DeleteAssignmentResponse: + """ + Remove a repl assignment from a connection + + Args: + id: The id of the connection, starts with `conn_` + + repl_id: The repl ID to remove from this connection + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not repl_id: + raise ValueError(f"Expected a non-empty value for `repl_id` but received {repl_id!r}") + return await self.delete( + f"/v2/connection/{id}/assignment/{repl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeleteAssignmentResponse, + ) + async def delete_connection( self, id: str, @@ -1958,13 +2148,46 @@ async def delete_connection( if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self.delete( - f"/connection/{id}", + f"/v2/connection/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=DeleteConnectionResponse, ) + async def delete_connector_config( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DeleteConnectorConfigResponse: + """ + Args: + id: The id of the connector config, starts with `ccfg_` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self.delete( + f"/v2/connector-config/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeleteConnectorConfigResponse, + ) + async def get_conector_config( self, id: str, @@ -1994,7 +2217,7 @@ async def get_conector_config( return cast( GetConectorConfigResponse, await self.get( - f"/connector-config/{id}", + f"/v2/connector-config/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2046,7 +2269,7 @@ async def get_connection( return cast( GetConnectionResponse, await self.get( - f"/connection/{id}", + f"/v2/connection/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2079,30 +2302,30 @@ async def get_current_user( ) -> GetCurrentUserResponse: """Get information about the current authenticated user""" return await self.get( - "/viewer", + "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/v1/viewer", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=GetCurrentUserResponse, ) - async def get_message_template( + async def list_assignments( self, + id: str, *, - customer_id: str, - language: Literal["javascript"] | NotGiven = NOT_GIVEN, - use_environment_variables: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GetMessageTemplateResponse: + ) -> ListAssignmentsResponse: """ - Get a message template for an AI agent + Get the list of assignments for a specific connection Args: + id: The id of the connection, starts with `conn_` + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2111,23 +2334,14 @@ async def get_message_template( timeout: Override the client-level default timeout for this request, in seconds """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self.get( - "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/ai/message_template", + f"/v2/connection/{id}/assignment", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "customer_id": customer_id, - "language": language, - "use_environment_variables": use_environment_variables, - }, - client_get_message_template_params.ClientGetMessageTemplateParams, - ), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GetMessageTemplateResponse, + cast_to=ListAssignmentsResponse, ) def list_connection_configs( @@ -2337,7 +2551,7 @@ def list_connection_configs( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connector-config", + "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/v2/connector-config", page=AsyncOffsetPagination[ListConnectionConfigsResponse], options=make_request_options( extra_headers=extra_headers, @@ -2363,6 +2577,7 @@ def list_connection_configs( def list_connections( self, *, + connection_ids: List[str] | NotGiven = NOT_GIVEN, connector_config_id: str | NotGiven = NOT_GIVEN, connector_names: List[ Literal[ @@ -2584,7 +2799,7 @@ def list_connections( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connection", + "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/v2/connection", page=AsyncOffsetPagination[ListConnectionsResponse], options=make_request_options( extra_headers=extra_headers, @@ -2593,6 +2808,7 @@ def list_connections( timeout=timeout, query=maybe_transform( { + "connection_ids": connection_ids, "connector_config_id": connector_config_id, "connector_names": connector_names, "customer_id": customer_id, @@ -2612,6 +2828,7 @@ def list_connections( def list_connectors( self, *, + connector_name: str | NotGiven = NOT_GIVEN, expand: List[Literal["schemas"]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, @@ -2639,7 +2856,7 @@ def list_connectors( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connector", + "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/v2/connector", page=AsyncOffsetPagination[ListConnectorsResponse], options=make_request_options( extra_headers=extra_headers, @@ -2648,6 +2865,7 @@ def list_connectors( timeout=timeout, query=maybe_transform( { + "connector_name": connector_name, "expand": expand, "limit": limit, "offset": offset, @@ -2865,7 +3083,7 @@ def list_connnector_configs( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/connector-config", + "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/v2/connector-config", page=AsyncOffsetPagination[ListConnnectorConfigsResponse], options=make_request_options( extra_headers=extra_headers, @@ -2918,7 +3136,7 @@ def list_customers( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/customer", + "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/v1/customer", page=AsyncOffsetPagination[ListCustomersResponse], options=make_request_options( extra_headers=extra_headers, @@ -2969,7 +3187,7 @@ def list_events( timeout: Override the client-level default timeout for this request, in seconds """ return self.get_api_list( - "/event", + "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/v1/event", page=AsyncOffsetPagination[ListEventsResponse], options=make_request_options( extra_headers=extra_headers, @@ -3021,7 +3239,7 @@ async def upsert_connnector_config( return cast( UpsertConnnectorConfigResponse, await self.put( - f"/connector-config/{id}", + f"/v2/connector-config/{id}", body=await async_maybe_transform( { "config": config, @@ -3064,7 +3282,7 @@ async def upsert_customer( timeout: Override the client-level default timeout for this request, in seconds """ return await self.put( - "/customer", + "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/v1/customer", body=await async_maybe_transform( { "id": id, @@ -3114,6 +3332,9 @@ def _make_status_error( class OpenintWithRawResponse: def __init__(self, client: Openint) -> None: + self.assign_connection = to_raw_response_wrapper( + client.assign_connection, + ) self.check_connection = to_raw_response_wrapper( client.check_connection, ) @@ -3126,9 +3347,15 @@ def __init__(self, client: Openint) -> None: self.create_token = to_raw_response_wrapper( client.create_token, ) + self.delete_assignment = to_raw_response_wrapper( + client.delete_assignment, + ) self.delete_connection = to_raw_response_wrapper( client.delete_connection, ) + self.delete_connector_config = to_raw_response_wrapper( + client.delete_connector_config, + ) self.get_conector_config = to_raw_response_wrapper( client.get_conector_config, ) @@ -3138,8 +3365,8 @@ def __init__(self, client: Openint) -> None: self.get_current_user = to_raw_response_wrapper( client.get_current_user, ) - self.get_message_template = to_raw_response_wrapper( - client.get_message_template, + self.list_assignments = to_raw_response_wrapper( + client.list_assignments, ) self.list_connection_configs = to_raw_response_wrapper( client.list_connection_configs, @@ -3169,6 +3396,9 @@ def __init__(self, client: Openint) -> None: class AsyncOpenintWithRawResponse: def __init__(self, client: AsyncOpenint) -> None: + self.assign_connection = async_to_raw_response_wrapper( + client.assign_connection, + ) self.check_connection = async_to_raw_response_wrapper( client.check_connection, ) @@ -3181,9 +3411,15 @@ def __init__(self, client: AsyncOpenint) -> None: self.create_token = async_to_raw_response_wrapper( client.create_token, ) + self.delete_assignment = async_to_raw_response_wrapper( + client.delete_assignment, + ) self.delete_connection = async_to_raw_response_wrapper( client.delete_connection, ) + self.delete_connector_config = async_to_raw_response_wrapper( + client.delete_connector_config, + ) self.get_conector_config = async_to_raw_response_wrapper( client.get_conector_config, ) @@ -3193,8 +3429,8 @@ def __init__(self, client: AsyncOpenint) -> None: self.get_current_user = async_to_raw_response_wrapper( client.get_current_user, ) - self.get_message_template = async_to_raw_response_wrapper( - client.get_message_template, + self.list_assignments = async_to_raw_response_wrapper( + client.list_assignments, ) self.list_connection_configs = async_to_raw_response_wrapper( client.list_connection_configs, @@ -3224,6 +3460,9 @@ def __init__(self, client: AsyncOpenint) -> None: class OpenintWithStreamedResponse: def __init__(self, client: Openint) -> None: + self.assign_connection = to_streamed_response_wrapper( + client.assign_connection, + ) self.check_connection = to_streamed_response_wrapper( client.check_connection, ) @@ -3236,9 +3475,15 @@ def __init__(self, client: Openint) -> None: self.create_token = to_streamed_response_wrapper( client.create_token, ) + self.delete_assignment = to_streamed_response_wrapper( + client.delete_assignment, + ) self.delete_connection = to_streamed_response_wrapper( client.delete_connection, ) + self.delete_connector_config = to_streamed_response_wrapper( + client.delete_connector_config, + ) self.get_conector_config = to_streamed_response_wrapper( client.get_conector_config, ) @@ -3248,8 +3493,8 @@ def __init__(self, client: Openint) -> None: self.get_current_user = to_streamed_response_wrapper( client.get_current_user, ) - self.get_message_template = to_streamed_response_wrapper( - client.get_message_template, + self.list_assignments = to_streamed_response_wrapper( + client.list_assignments, ) self.list_connection_configs = to_streamed_response_wrapper( client.list_connection_configs, @@ -3279,6 +3524,9 @@ def __init__(self, client: Openint) -> None: class AsyncOpenintWithStreamedResponse: def __init__(self, client: AsyncOpenint) -> None: + self.assign_connection = async_to_streamed_response_wrapper( + client.assign_connection, + ) self.check_connection = async_to_streamed_response_wrapper( client.check_connection, ) @@ -3291,9 +3539,15 @@ def __init__(self, client: AsyncOpenint) -> None: self.create_token = async_to_streamed_response_wrapper( client.create_token, ) + self.delete_assignment = async_to_streamed_response_wrapper( + client.delete_assignment, + ) self.delete_connection = async_to_streamed_response_wrapper( client.delete_connection, ) + self.delete_connector_config = async_to_streamed_response_wrapper( + client.delete_connector_config, + ) self.get_conector_config = async_to_streamed_response_wrapper( client.get_conector_config, ) @@ -3303,8 +3557,8 @@ def __init__(self, client: AsyncOpenint) -> None: self.get_current_user = async_to_streamed_response_wrapper( client.get_current_user, ) - self.get_message_template = async_to_streamed_response_wrapper( - client.get_message_template, + self.list_assignments = async_to_streamed_response_wrapper( + client.list_assignments, ) self.list_connection_configs = async_to_streamed_response_wrapper( client.list_connection_configs, diff --git a/src/openint/types/__init__.py b/src/openint/types/__init__.py index f9710ac..5fa92c9 100644 --- a/src/openint/types/__init__.py +++ b/src/openint/types/__init__.py @@ -13,24 +13,26 @@ from .check_connection_response import CheckConnectionResponse as CheckConnectionResponse from .client_list_events_params import ClientListEventsParams as ClientListEventsParams from .get_current_user_response import GetCurrentUserResponse as GetCurrentUserResponse +from .list_assignments_response import ListAssignmentsResponse as ListAssignmentsResponse from .list_connections_response import ListConnectionsResponse as ListConnectionsResponse +from .assign_connection_response import AssignConnectionResponse as AssignConnectionResponse from .client_create_token_params import ClientCreateTokenParams as ClientCreateTokenParams from .create_connection_response import CreateConnectionResponse as CreateConnectionResponse +from .delete_assignment_response import DeleteAssignmentResponse as DeleteAssignmentResponse from .delete_connection_response import DeleteConnectionResponse as DeleteConnectionResponse from .client_get_connection_params import ClientGetConnectionParams as ClientGetConnectionParams from .client_list_customers_params import ClientListCustomersParams as ClientListCustomersParams from .get_conector_config_response import GetConectorConfigResponse as GetConectorConfigResponse from .client_list_connectors_params import ClientListConnectorsParams as ClientListConnectorsParams from .client_upsert_customer_params import ClientUpsertCustomerParams as ClientUpsertCustomerParams -from .get_message_template_response import GetMessageTemplateResponse as GetMessageTemplateResponse from .client_list_connections_params import ClientListConnectionsParams as ClientListConnectionsParams from .client_create_connection_params import ClientCreateConnectionParams as ClientCreateConnectionParams +from .delete_connector_config_response import DeleteConnectorConfigResponse as DeleteConnectorConfigResponse from .list_connection_configs_response import ListConnectionConfigsResponse as ListConnectionConfigsResponse from .list_connnector_configs_response import ListConnnectorConfigsResponse as ListConnnectorConfigsResponse from .client_get_conector_config_params import ClientGetConectorConfigParams as ClientGetConectorConfigParams from .create_connnector_config_response import CreateConnnectorConfigResponse as CreateConnnectorConfigResponse from .upsert_connnector_config_response import UpsertConnnectorConfigResponse as UpsertConnnectorConfigResponse -from .client_get_message_template_params import ClientGetMessageTemplateParams as ClientGetMessageTemplateParams from .client_list_connection_configs_params import ( ClientListConnectionConfigsParams as ClientListConnectionConfigsParams, ) diff --git a/src/openint/types/assign_connection_response.py b/src/openint/types/assign_connection_response.py new file mode 100644 index 0000000..910312b --- /dev/null +++ b/src/openint/types/assign_connection_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .._models import BaseModel + +__all__ = ["AssignConnectionResponse"] + + +class AssignConnectionResponse(BaseModel): + id: str + """The id of the connection, starts with `conn_`""" + + assignments: Optional[List[str]] = None diff --git a/src/openint/types/client_get_message_template_params.py b/src/openint/types/client_get_message_template_params.py deleted file mode 100644 index a4fd46d..0000000 --- a/src/openint/types/client_get_message_template_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["ClientGetMessageTemplateParams"] - - -class ClientGetMessageTemplateParams(TypedDict, total=False): - customer_id: Required[str] - - language: Literal["javascript"] - - use_environment_variables: bool diff --git a/src/openint/types/client_list_connections_params.py b/src/openint/types/client_list_connections_params.py index 18133f6..e351ebe 100644 --- a/src/openint/types/client_list_connections_params.py +++ b/src/openint/types/client_list_connections_params.py @@ -9,6 +9,8 @@ class ClientListConnectionsParams(TypedDict, total=False): + connection_ids: List[str] + connector_config_id: str """The id of the connector config, starts with `ccfg_`""" diff --git a/src/openint/types/client_list_connectors_params.py b/src/openint/types/client_list_connectors_params.py index 0a4abd4..ea2827e 100644 --- a/src/openint/types/client_list_connectors_params.py +++ b/src/openint/types/client_list_connectors_params.py @@ -9,6 +9,8 @@ class ClientListConnectorsParams(TypedDict, total=False): + connector_name: str + expand: List[Literal["schemas"]] limit: int diff --git a/src/openint/types/delete_assignment_response.py b/src/openint/types/delete_assignment_response.py new file mode 100644 index 0000000..3f7c864 --- /dev/null +++ b/src/openint/types/delete_assignment_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel + +__all__ = ["DeleteAssignmentResponse"] + + +class DeleteAssignmentResponse(BaseModel): + id: str + """The id of the connection, starts with `conn_`""" + + assignments: List[str] diff --git a/src/openint/types/delete_connector_config_response.py b/src/openint/types/delete_connector_config_response.py new file mode 100644 index 0000000..3879d36 --- /dev/null +++ b/src/openint/types/delete_connector_config_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["DeleteConnectorConfigResponse"] + + +class DeleteConnectorConfigResponse(BaseModel): + id: str + """The id of the connector config, starts with `ccfg_`""" diff --git a/src/openint/types/get_message_template_response.py b/src/openint/types/get_message_template_response.py deleted file mode 100644 index 51eb5e2..0000000 --- a/src/openint/types/get_message_template_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .._models import BaseModel - -__all__ = ["GetMessageTemplateResponse"] - - -class GetMessageTemplateResponse(BaseModel): - language: str - - template: str diff --git a/src/openint/types/list_assignments_response.py b/src/openint/types/list_assignments_response.py new file mode 100644 index 0000000..9f6be5c --- /dev/null +++ b/src/openint/types/list_assignments_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel + +__all__ = ["ListAssignmentsResponse"] + + +class ListAssignmentsResponse(BaseModel): + id: str + """The id of the connection, starts with `conn_`""" + + assignments: List[str] diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index 23b367a..9c0a6ab 100644 --- a/tests/api_resources/test_client.py +++ b/tests/api_resources/test_client.py @@ -18,11 +18,14 @@ ListConnectorsResponse, UpsertCustomerResponse, CheckConnectionResponse, + ListAssignmentsResponse, ListConnectionsResponse, + AssignConnectionResponse, CreateConnectionResponse, + DeleteAssignmentResponse, DeleteConnectionResponse, GetConectorConfigResponse, - GetMessageTemplateResponse, + DeleteConnectorConfigResponse, ListConnectionConfigsResponse, ListConnnectorConfigsResponse, CreateConnnectorConfigResponse, @@ -36,6 +39,58 @@ class TestClient: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_assign_connection(self, client: Openint) -> None: + client_ = client.assign_connection( + repl_id="replId", + id="conn_", + ) + assert_matches_type(AssignConnectionResponse, client_, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_assign_connection(self, client: Openint) -> None: + response = client.with_raw_response.assign_connection( + repl_id="replId", + id="conn_", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_ = response.parse() + assert_matches_type(AssignConnectionResponse, client_, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_assign_connection(self, client: Openint) -> None: + with client.with_streaming_response.assign_connection( + repl_id="replId", + id="conn_", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_ = response.parse() + assert_matches_type(AssignConnectionResponse, client_, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_assign_connection(self, client: Openint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.with_raw_response.assign_connection( + repl_id="replId", + id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repl_id` but received ''"): + client.with_raw_response.assign_connection( + repl_id="", + id="conn_", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_check_connection(self, client: Openint) -> None: @@ -257,6 +312,58 @@ def test_path_params_create_token(self, client: Openint) -> None: customer_id="", ) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete_assignment(self, client: Openint) -> None: + client_ = client.delete_assignment( + repl_id="replId", + id="conn_", + ) + assert_matches_type(DeleteAssignmentResponse, client_, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete_assignment(self, client: Openint) -> None: + response = client.with_raw_response.delete_assignment( + repl_id="replId", + id="conn_", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_ = response.parse() + assert_matches_type(DeleteAssignmentResponse, client_, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete_assignment(self, client: Openint) -> None: + with client.with_streaming_response.delete_assignment( + repl_id="replId", + id="conn_", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_ = response.parse() + assert_matches_type(DeleteAssignmentResponse, client_, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete_assignment(self, client: Openint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.with_raw_response.delete_assignment( + repl_id="replId", + id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repl_id` but received ''"): + client.with_raw_response.delete_assignment( + repl_id="", + id="conn_", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_delete_connection(self, client: Openint) -> None: @@ -299,6 +406,48 @@ def test_path_params_delete_connection(self, client: Openint) -> None: "", ) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete_connector_config(self, client: Openint) -> None: + client_ = client.delete_connector_config( + "ccfg_", + ) + assert_matches_type(DeleteConnectorConfigResponse, client_, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete_connector_config(self, client: Openint) -> None: + response = client.with_raw_response.delete_connector_config( + "ccfg_", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_ = response.parse() + assert_matches_type(DeleteConnectorConfigResponse, client_, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete_connector_config(self, client: Openint) -> None: + with client.with_streaming_response.delete_connector_config( + "ccfg_", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_ = response.parse() + assert_matches_type(DeleteConnectorConfigResponse, client_, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete_connector_config(self, client: Openint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.with_raw_response.delete_connector_config( + "", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_get_conector_config(self, client: Openint) -> None: @@ -433,48 +582,46 @@ def test_streaming_response_get_current_user(self, client: Openint) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize - def test_method_get_message_template(self, client: Openint) -> None: - client_ = client.get_message_template( - customer_id="customer_id", - ) - assert_matches_type(GetMessageTemplateResponse, client_, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_get_message_template_with_all_params(self, client: Openint) -> None: - client_ = client.get_message_template( - customer_id="customer_id", - language="javascript", - use_environment_variables=True, + def test_method_list_assignments(self, client: Openint) -> None: + client_ = client.list_assignments( + "conn_", ) - assert_matches_type(GetMessageTemplateResponse, client_, path=["response"]) + assert_matches_type(ListAssignmentsResponse, client_, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize - def test_raw_response_get_message_template(self, client: Openint) -> None: - response = client.with_raw_response.get_message_template( - customer_id="customer_id", + def test_raw_response_list_assignments(self, client: Openint) -> None: + response = client.with_raw_response.list_assignments( + "conn_", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" client_ = response.parse() - assert_matches_type(GetMessageTemplateResponse, client_, path=["response"]) + assert_matches_type(ListAssignmentsResponse, client_, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize - def test_streaming_response_get_message_template(self, client: Openint) -> None: - with client.with_streaming_response.get_message_template( - customer_id="customer_id", + def test_streaming_response_list_assignments(self, client: Openint) -> None: + with client.with_streaming_response.list_assignments( + "conn_", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" client_ = response.parse() - assert_matches_type(GetMessageTemplateResponse, client_, path=["response"]) + assert_matches_type(ListAssignmentsResponse, client_, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_list_assignments(self, client: Openint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.with_raw_response.list_assignments( + "", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_connection_configs(self, client: Openint) -> None: @@ -525,6 +672,7 @@ def test_method_list_connections(self, client: Openint) -> None: @parametrize def test_method_list_connections_with_all_params(self, client: Openint) -> None: client_ = client.list_connections( + connection_ids=["conn_"], connector_config_id="ccfg_", connector_names=["accelo"], customer_id="customer_id", @@ -569,6 +717,7 @@ def test_method_list_connectors(self, client: Openint) -> None: @parametrize def test_method_list_connectors_with_all_params(self, client: Openint) -> None: client_ = client.list_connectors( + connector_name="connector_name", expand=["schemas"], limit=0, offset=0, @@ -811,6 +960,58 @@ class TestAsyncClient: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_assign_connection(self, async_client: AsyncOpenint) -> None: + client = await async_client.assign_connection( + repl_id="replId", + id="conn_", + ) + assert_matches_type(AssignConnectionResponse, client, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_assign_connection(self, async_client: AsyncOpenint) -> None: + response = await async_client.with_raw_response.assign_connection( + repl_id="replId", + id="conn_", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client = await response.parse() + assert_matches_type(AssignConnectionResponse, client, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_assign_connection(self, async_client: AsyncOpenint) -> None: + async with async_client.with_streaming_response.assign_connection( + repl_id="replId", + id="conn_", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client = await response.parse() + assert_matches_type(AssignConnectionResponse, client, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_assign_connection(self, async_client: AsyncOpenint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.with_raw_response.assign_connection( + repl_id="replId", + id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repl_id` but received ''"): + await async_client.with_raw_response.assign_connection( + repl_id="", + id="conn_", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_check_connection(self, async_client: AsyncOpenint) -> None: @@ -1032,6 +1233,58 @@ async def test_path_params_create_token(self, async_client: AsyncOpenint) -> Non customer_id="", ) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete_assignment(self, async_client: AsyncOpenint) -> None: + client = await async_client.delete_assignment( + repl_id="replId", + id="conn_", + ) + assert_matches_type(DeleteAssignmentResponse, client, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete_assignment(self, async_client: AsyncOpenint) -> None: + response = await async_client.with_raw_response.delete_assignment( + repl_id="replId", + id="conn_", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client = await response.parse() + assert_matches_type(DeleteAssignmentResponse, client, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete_assignment(self, async_client: AsyncOpenint) -> None: + async with async_client.with_streaming_response.delete_assignment( + repl_id="replId", + id="conn_", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client = await response.parse() + assert_matches_type(DeleteAssignmentResponse, client, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete_assignment(self, async_client: AsyncOpenint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.with_raw_response.delete_assignment( + repl_id="replId", + id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repl_id` but received ''"): + await async_client.with_raw_response.delete_assignment( + repl_id="", + id="conn_", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_delete_connection(self, async_client: AsyncOpenint) -> None: @@ -1074,6 +1327,48 @@ async def test_path_params_delete_connection(self, async_client: AsyncOpenint) - "", ) + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete_connector_config(self, async_client: AsyncOpenint) -> None: + client = await async_client.delete_connector_config( + "ccfg_", + ) + assert_matches_type(DeleteConnectorConfigResponse, client, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete_connector_config(self, async_client: AsyncOpenint) -> None: + response = await async_client.with_raw_response.delete_connector_config( + "ccfg_", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client = await response.parse() + assert_matches_type(DeleteConnectorConfigResponse, client, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete_connector_config(self, async_client: AsyncOpenint) -> None: + async with async_client.with_streaming_response.delete_connector_config( + "ccfg_", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client = await response.parse() + assert_matches_type(DeleteConnectorConfigResponse, client, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete_connector_config(self, async_client: AsyncOpenint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.with_raw_response.delete_connector_config( + "", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_get_conector_config(self, async_client: AsyncOpenint) -> None: @@ -1208,48 +1503,46 @@ async def test_streaming_response_get_current_user(self, async_client: AsyncOpen @pytest.mark.skip(reason="Prism tests are disabled") @parametrize - async def test_method_get_message_template(self, async_client: AsyncOpenint) -> None: - client = await async_client.get_message_template( - customer_id="customer_id", - ) - assert_matches_type(GetMessageTemplateResponse, client, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_get_message_template_with_all_params(self, async_client: AsyncOpenint) -> None: - client = await async_client.get_message_template( - customer_id="customer_id", - language="javascript", - use_environment_variables=True, + async def test_method_list_assignments(self, async_client: AsyncOpenint) -> None: + client = await async_client.list_assignments( + "conn_", ) - assert_matches_type(GetMessageTemplateResponse, client, path=["response"]) + assert_matches_type(ListAssignmentsResponse, client, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize - async def test_raw_response_get_message_template(self, async_client: AsyncOpenint) -> None: - response = await async_client.with_raw_response.get_message_template( - customer_id="customer_id", + async def test_raw_response_list_assignments(self, async_client: AsyncOpenint) -> None: + response = await async_client.with_raw_response.list_assignments( + "conn_", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" client = await response.parse() - assert_matches_type(GetMessageTemplateResponse, client, path=["response"]) + assert_matches_type(ListAssignmentsResponse, client, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize - async def test_streaming_response_get_message_template(self, async_client: AsyncOpenint) -> None: - async with async_client.with_streaming_response.get_message_template( - customer_id="customer_id", + async def test_streaming_response_list_assignments(self, async_client: AsyncOpenint) -> None: + async with async_client.with_streaming_response.list_assignments( + "conn_", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" client = await response.parse() - assert_matches_type(GetMessageTemplateResponse, client, path=["response"]) + assert_matches_type(ListAssignmentsResponse, client, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_list_assignments(self, async_client: AsyncOpenint) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.with_raw_response.list_assignments( + "", + ) + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_connection_configs(self, async_client: AsyncOpenint) -> None: @@ -1300,6 +1593,7 @@ async def test_method_list_connections(self, async_client: AsyncOpenint) -> None @parametrize async def test_method_list_connections_with_all_params(self, async_client: AsyncOpenint) -> None: client = await async_client.list_connections( + connection_ids=["conn_"], connector_config_id="ccfg_", connector_names=["accelo"], customer_id="customer_id", @@ -1344,6 +1638,7 @@ async def test_method_list_connectors(self, async_client: AsyncOpenint) -> None: @parametrize async def test_method_list_connectors_with_all_params(self, async_client: AsyncOpenint) -> None: client = await async_client.list_connectors( + connector_name="connector_name", expand=["schemas"], limit=0, offset=0, diff --git a/tests/test_client.py b/tests/test_client.py index c089140..efef65a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -24,7 +24,7 @@ from openint import Openint, AsyncOpenint, APIResponseValidationError from openint._types import Omit from openint._models import BaseModel, FinalRequestOptions -from openint._exceptions import APIStatusError, APIResponseValidationError +from openint._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError from openint._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, @@ -50,6 +50,14 @@ def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 +def _get_open_connections(client: Openint | AsyncOpenint) -> int: + transport = client._client._transport + assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) + + pool = transport._pool + return len(pool._requests) + + class TestOpenint: client = Openint(base_url=base_url, token=token, _strict_response_validation=True) @@ -699,6 +707,27 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + @mock.patch("openint._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: Openint) -> None: + respx_mock.put("/v2/connection/conn_/assignment/replId").mock( + side_effect=httpx.TimeoutException("Test timeout error") + ) + + with pytest.raises(APITimeoutError): + client.with_streaming_response.assign_connection(repl_id="replId", id="conn_").__enter__() + + assert _get_open_connections(self.client) == 0 + + @mock.patch("openint._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: Openint) -> None: + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(return_value=httpx.Response(500)) + + with pytest.raises(APIStatusError): + client.with_streaming_response.assign_connection(repl_id="replId", id="conn_").__enter__() + assert _get_open_connections(self.client) == 0 + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("openint._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -723,9 +752,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/connection").mock(side_effect=retry_handler) + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(side_effect=retry_handler) - response = client.with_raw_response.list_connections() + response = client.with_raw_response.assign_connection(repl_id="replId", id="conn_") assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -747,9 +776,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/connection").mock(side_effect=retry_handler) + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(side_effect=retry_handler) - response = client.with_raw_response.list_connections(extra_headers={"x-stainless-retry-count": Omit()}) + response = client.with_raw_response.assign_connection( + repl_id="replId", id="conn_", extra_headers={"x-stainless-retry-count": Omit()} + ) assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @@ -770,9 +801,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/connection").mock(side_effect=retry_handler) + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(side_effect=retry_handler) - response = client.with_raw_response.list_connections(extra_headers={"x-stainless-retry-count": "42"}) + response = client.with_raw_response.assign_connection( + repl_id="replId", id="conn_", extra_headers={"x-stainless-retry-count": "42"} + ) assert response.http_request.headers.get("x-stainless-retry-count") == "42" @@ -1491,6 +1524,29 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + @mock.patch("openint._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_retrying_timeout_errors_doesnt_leak( + self, respx_mock: MockRouter, async_client: AsyncOpenint + ) -> None: + respx_mock.put("/v2/connection/conn_/assignment/replId").mock( + side_effect=httpx.TimeoutException("Test timeout error") + ) + + with pytest.raises(APITimeoutError): + await async_client.with_streaming_response.assign_connection(repl_id="replId", id="conn_").__aenter__() + + assert _get_open_connections(self.client) == 0 + + @mock.patch("openint._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncOpenint) -> None: + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(return_value=httpx.Response(500)) + + with pytest.raises(APIStatusError): + await async_client.with_streaming_response.assign_connection(repl_id="replId", id="conn_").__aenter__() + assert _get_open_connections(self.client) == 0 + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("openint._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1516,9 +1572,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/connection").mock(side_effect=retry_handler) + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(side_effect=retry_handler) - response = await client.with_raw_response.list_connections() + response = await client.with_raw_response.assign_connection(repl_id="replId", id="conn_") assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -1541,9 +1597,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/connection").mock(side_effect=retry_handler) + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(side_effect=retry_handler) - response = await client.with_raw_response.list_connections(extra_headers={"x-stainless-retry-count": Omit()}) + response = await client.with_raw_response.assign_connection( + repl_id="replId", id="conn_", extra_headers={"x-stainless-retry-count": Omit()} + ) assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @@ -1565,9 +1623,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: return httpx.Response(500) return httpx.Response(200) - respx_mock.get("/connection").mock(side_effect=retry_handler) + respx_mock.put("/v2/connection/conn_/assignment/replId").mock(side_effect=retry_handler) - response = await client.with_raw_response.list_connections(extra_headers={"x-stainless-retry-count": "42"}) + response = await client.with_raw_response.assign_connection( + repl_id="replId", id="conn_", extra_headers={"x-stainless-retry-count": "42"} + ) assert response.http_request.headers.get("x-stainless-retry-count") == "42" From b2e358b53358bd194de2943ad551b5267fae94e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 00:27:57 +0000 Subject: [PATCH 5/6] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index b8d7885..a8a5843 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 19 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-8939526af685821b7c8d595a10525162c1ce8a0d14da26247f379595aa51df04.yml openapi_spec_hash: d6482999678782fbf0190b20ab353a7b -config_hash: cb86aadf1cfe987b2b3b878ff539bb20 +config_hash: e2381d4d19e19a62ea5c13018808e3aa From 998dc4e9c477d5b2ea91be3f070573d0b4bce87d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 00:28:16 +0000 Subject: [PATCH 6/6] release: 2.9.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ pyproject.toml | 2 +- src/openint/_version.py | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 64f9ff4..427b8ec 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.8.0" + ".": "2.9.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 63a18db..892f231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 2.9.0 (2025-08-26) + +Full Changelog: [v2.8.0...v2.9.0](https://github.com/openintegrations/python-sdk/compare/v2.8.0...v2.9.0) + +### Features + +* **api-v2:** api v2 spec ([48aff10](https://github.com/openintegrations/python-sdk/commit/48aff10bbe28bb6f428f07c97ea5d005c35cb759)) +* **docs:** updating documented docs for stainless ([444bab6](https://github.com/openintegrations/python-sdk/commit/444bab6f2527e7d21fc33b840cbdeec21fdddd8c)) +* **docs:** updating documented docs for stainless ([316e546](https://github.com/openintegrations/python-sdk/commit/316e546bdb14eabb87ff0878545a21c1d7cef4a8)) + + +### Chores + +* update github action ([cd673e1](https://github.com/openintegrations/python-sdk/commit/cd673e1e7fff34115e2c735e458d53804c2f0628)) + ## 2.8.0 (2025-08-13) Full Changelog: [v2.7.0...v2.8.0](https://github.com/openintegrations/python-sdk/compare/v2.7.0...v2.8.0) diff --git a/pyproject.toml b/pyproject.toml index def258e..cc95b84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openint" -version = "2.8.0" +version = "2.9.0" description = "The official Python library for the Openint API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/openint/_version.py b/src/openint/_version.py index c3b9407..4ed8fb6 100644 --- a/src/openint/_version.py +++ b/src/openint/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "openint" -__version__ = "2.8.0" # x-release-please-version +__version__ = "2.9.0" # x-release-please-version