Skip to content

Commit 48aff10

Browse files
feat(api-v2): api v2 spec
1 parent cd673e1 commit 48aff10

15 files changed

+876
-205
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 16
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-00a3ddd4864882413f36470aae8bb3ee0e554c1e4396551df31a42e8c5aff628.yml
3-
openapi_spec_hash: c766b8f3b3fac5ba7c1d824d512f0dd7
4-
config_hash: 4f1d196a8f57efed93da0f033aec310e
1+
configured_endpoints: 19
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-8939526af685821b7c8d595a10525162c1ce8a0d14da26247f379595aa51df04.yml
3+
openapi_spec_hash: d6482999678782fbf0190b20ab353a7b
4+
config_hash: cb86aadf1cfe987b2b3b878ff539bb20

README.md

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ client = Openint(
3232
token=os.environ.get("OPENINT_API_KEY"), # This is the default and can be omitted
3333
)
3434

35-
page = client.list_connections()
36-
print(page.items)
35+
response = client.assign_connection(
36+
repl_id="replId",
37+
id="conn_",
38+
)
39+
print(response.id)
3740
```
3841

3942
While you can provide a `token` keyword argument,
@@ -56,8 +59,11 @@ client = AsyncOpenint(
5659

5760

5861
async def main() -> None:
59-
page = await client.list_connections()
60-
print(page.items)
62+
response = await client.assign_connection(
63+
repl_id="replId",
64+
id="conn_",
65+
)
66+
print(response.id)
6167

6268

6369
asyncio.run(main())
@@ -89,8 +95,11 @@ async def main() -> None:
8995
token="My Token",
9096
http_client=DefaultAioHttpClient(),
9197
) as client:
92-
page = await client.list_connections()
93-
print(page.items)
98+
response = await client.assign_connection(
99+
repl_id="replId",
100+
id="conn_",
101+
)
102+
print(response.id)
94103

95104

96105
asyncio.run(main())
@@ -137,7 +146,10 @@ from openint import Openint
137146
client = Openint()
138147

139148
try:
140-
client.list_connections()
149+
client.assign_connection(
150+
repl_id="replId",
151+
id="conn_",
152+
)
141153
except openint.APIConnectionError as e:
142154
print("The server could not be reached")
143155
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -180,7 +192,10 @@ client = Openint(
180192
)
181193

182194
# Or, configure per-request:
183-
client.with_options(max_retries=5).list_connections()
195+
client.with_options(max_retries=5).assign_connection(
196+
repl_id="replId",
197+
id="conn_",
198+
)
184199
```
185200

186201
### Timeouts
@@ -203,7 +218,10 @@ client = Openint(
203218
)
204219

205220
# Override per-request:
206-
client.with_options(timeout=5.0).list_connections()
221+
client.with_options(timeout=5.0).assign_connection(
222+
repl_id="replId",
223+
id="conn_",
224+
)
207225
```
208226

209227
On timeout, an `APITimeoutError` is thrown.
@@ -244,11 +262,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
244262
from openint import Openint
245263

246264
client = Openint()
247-
response = client.with_raw_response.list_connections()
265+
response = client.with_raw_response.assign_connection(
266+
repl_id="replId",
267+
id="conn_",
268+
)
248269
print(response.headers.get('X-My-Header'))
249270

250-
client = response.parse() # get the object that `list_connections()` would have returned
251-
print(client)
271+
client = response.parse() # get the object that `assign_connection()` would have returned
272+
print(client.id)
252273
```
253274

254275
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
262283
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.
263284

264285
```python
265-
with client.with_streaming_response.list_connections() as response:
286+
with client.with_streaming_response.assign_connection(
287+
repl_id="replId",
288+
id="conn_",
289+
) as response:
266290
print(response.headers.get("X-My-Header"))
267291

268292
for line in response.iter_lines():

api.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ Types:
66
from openint.types import (
77
Connector,
88
Integration,
9+
AssignConnectionResponse,
910
CheckConnectionResponse,
1011
CreateConnectionResponse,
1112
CreateConnnectorConfigResponse,
1213
CreateTokenResponse,
14+
DeleteAssignmentResponse,
1315
DeleteConnectionResponse,
16+
DeleteConnectorConfigResponse,
1417
GetConectorConfigResponse,
1518
GetConnectionResponse,
1619
GetCurrentUserResponse,
17-
GetMessageTemplateResponse,
20+
ListAssignmentsResponse,
1821
ListConnectionConfigsResponse,
1922
ListConnectionsResponse,
2023
ListConnectorsResponse,
@@ -28,20 +31,23 @@ from openint.types import (
2831

2932
Methods:
3033

31-
- <code title="post /connection/{id}/check">client.<a href="./src/openint/_client.py">check_connection</a>(id) -> <a href="./src/openint/types/check_connection_response.py">CheckConnectionResponse</a></code>
32-
- <code title="post /connection">client.<a href="./src/openint/_client.py">create_connection</a>(\*\*<a href="src/openint/types/client_create_connection_params.py">params</a>) -> <a href="./src/openint/types/create_connection_response.py">CreateConnectionResponse</a></code>
33-
- <code title="post /connector-config">client.<a href="./src/openint/_client.py">create_connnector_config</a>(\*\*<a href="src/openint/types/client_create_connnector_config_params.py">params</a>) -> <a href="./src/openint/types/create_connnector_config_response.py">CreateConnnectorConfigResponse</a></code>
34-
- <code title="post /customer/{customer_id}/token">client.<a href="./src/openint/_client.py">create_token</a>(customer_id, \*\*<a href="src/openint/types/client_create_token_params.py">params</a>) -> <a href="./src/openint/types/create_token_response.py">CreateTokenResponse</a></code>
35-
- <code title="delete /connection/{id}">client.<a href="./src/openint/_client.py">delete_connection</a>(id) -> <a href="./src/openint/types/delete_connection_response.py">DeleteConnectionResponse</a></code>
36-
- <code title="get /connector-config/{id}">client.<a href="./src/openint/_client.py">get_conector_config</a>(id, \*\*<a href="src/openint/types/client_get_conector_config_params.py">params</a>) -> <a href="./src/openint/types/get_conector_config_response.py">GetConectorConfigResponse</a></code>
37-
- <code title="get /connection/{id}">client.<a href="./src/openint/_client.py">get_connection</a>(id, \*\*<a href="src/openint/types/client_get_connection_params.py">params</a>) -> <a href="./src/openint/types/get_connection_response.py">GetConnectionResponse</a></code>
38-
- <code title="get /viewer">client.<a href="./src/openint/_client.py">get_current_user</a>() -> <a href="./src/openint/types/get_current_user_response.py">GetCurrentUserResponse</a></code>
39-
- <code title="get /ai/message_template">client.<a href="./src/openint/_client.py">get_message_template</a>(\*\*<a href="src/openint/types/client_get_message_template_params.py">params</a>) -> <a href="./src/openint/types/get_message_template_response.py">GetMessageTemplateResponse</a></code>
40-
- <code title="get /connector-config">client.<a href="./src/openint/_client.py">list_connection_configs</a>(\*\*<a href="src/openint/types/client_list_connection_configs_params.py">params</a>) -> <a href="./src/openint/types/list_connection_configs_response.py">SyncOffsetPagination[ListConnectionConfigsResponse]</a></code>
41-
- <code title="get /connection">client.<a href="./src/openint/_client.py">list_connections</a>(\*\*<a href="src/openint/types/client_list_connections_params.py">params</a>) -> <a href="./src/openint/types/list_connections_response.py">SyncOffsetPagination[ListConnectionsResponse]</a></code>
42-
- <code title="get /connector">client.<a href="./src/openint/_client.py">list_connectors</a>(\*\*<a href="src/openint/types/client_list_connectors_params.py">params</a>) -> <a href="./src/openint/types/list_connectors_response.py">SyncOffsetPagination[ListConnectorsResponse]</a></code>
43-
- <code title="get /connector-config">client.<a href="./src/openint/_client.py">list_connnector_configs</a>(\*\*<a href="src/openint/types/client_list_connnector_configs_params.py">params</a>) -> <a href="./src/openint/types/list_connnector_configs_response.py">SyncOffsetPagination[ListConnnectorConfigsResponse]</a></code>
44-
- <code title="get /customer">client.<a href="./src/openint/_client.py">list_customers</a>(\*\*<a href="src/openint/types/client_list_customers_params.py">params</a>) -> <a href="./src/openint/types/list_customers_response.py">SyncOffsetPagination[ListCustomersResponse]</a></code>
45-
- <code title="get /event">client.<a href="./src/openint/_client.py">list_events</a>(\*\*<a href="src/openint/types/client_list_events_params.py">params</a>) -> <a href="./src/openint/types/list_events_response.py">SyncOffsetPagination[ListEventsResponse]</a></code>
46-
- <code title="put /connector-config/{id}">client.<a href="./src/openint/_client.py">upsert_connnector_config</a>(id, \*\*<a href="src/openint/types/client_upsert_connnector_config_params.py">params</a>) -> <a href="./src/openint/types/upsert_connnector_config_response.py">UpsertConnnectorConfigResponse</a></code>
47-
- <code title="put /customer">client.<a href="./src/openint/_client.py">upsert_customer</a>(\*\*<a href="src/openint/types/client_upsert_customer_params.py">params</a>) -> <a href="./src/openint/types/upsert_customer_response.py">UpsertCustomerResponse</a></code>
34+
- <code title="put /v2/connection/{id}/assignment/{replId}">client.<a href="./src/openint/_client.py">assign_connection</a>(repl_id, \*, id) -> <a href="./src/openint/types/assign_connection_response.py">AssignConnectionResponse</a></code>
35+
- <code title="post /v1/connection/{id}/check">client.<a href="./src/openint/_client.py">check_connection</a>(id) -> <a href="./src/openint/types/check_connection_response.py">CheckConnectionResponse</a></code>
36+
- <code title="post /v2/connection">client.<a href="./src/openint/_client.py">create_connection</a>(\*\*<a href="src/openint/types/client_create_connection_params.py">params</a>) -> <a href="./src/openint/types/create_connection_response.py">CreateConnectionResponse</a></code>
37+
- <code title="post /v2/connector-config">client.<a href="./src/openint/_client.py">create_connnector_config</a>(\*\*<a href="src/openint/types/client_create_connnector_config_params.py">params</a>) -> <a href="./src/openint/types/create_connnector_config_response.py">CreateConnnectorConfigResponse</a></code>
38+
- <code title="post /v1/customer/{customer_id}/token">client.<a href="./src/openint/_client.py">create_token</a>(customer_id, \*\*<a href="src/openint/types/client_create_token_params.py">params</a>) -> <a href="./src/openint/types/create_token_response.py">CreateTokenResponse</a></code>
39+
- <code title="delete /v2/connection/{id}/assignment/{replId}">client.<a href="./src/openint/_client.py">delete_assignment</a>(repl_id, \*, id) -> <a href="./src/openint/types/delete_assignment_response.py">DeleteAssignmentResponse</a></code>
40+
- <code title="delete /v2/connection/{id}">client.<a href="./src/openint/_client.py">delete_connection</a>(id) -> <a href="./src/openint/types/delete_connection_response.py">DeleteConnectionResponse</a></code>
41+
- <code title="delete /v2/connector-config/{id}">client.<a href="./src/openint/_client.py">delete_connector_config</a>(id) -> <a href="./src/openint/types/delete_connector_config_response.py">DeleteConnectorConfigResponse</a></code>
42+
- <code title="get /v2/connector-config/{id}">client.<a href="./src/openint/_client.py">get_conector_config</a>(id, \*\*<a href="src/openint/types/client_get_conector_config_params.py">params</a>) -> <a href="./src/openint/types/get_conector_config_response.py">GetConectorConfigResponse</a></code>
43+
- <code title="get /v2/connection/{id}">client.<a href="./src/openint/_client.py">get_connection</a>(id, \*\*<a href="src/openint/types/client_get_connection_params.py">params</a>) -> <a href="./src/openint/types/get_connection_response.py">GetConnectionResponse</a></code>
44+
- <code title="get /v1/viewer">client.<a href="./src/openint/_client.py">get_current_user</a>() -> <a href="./src/openint/types/get_current_user_response.py">GetCurrentUserResponse</a></code>
45+
- <code title="get /v2/connection/{id}/assignment">client.<a href="./src/openint/_client.py">list_assignments</a>(id) -> <a href="./src/openint/types/list_assignments_response.py">ListAssignmentsResponse</a></code>
46+
- <code title="get /v2/connector-config">client.<a href="./src/openint/_client.py">list_connection_configs</a>(\*\*<a href="src/openint/types/client_list_connection_configs_params.py">params</a>) -> <a href="./src/openint/types/list_connection_configs_response.py">SyncOffsetPagination[ListConnectionConfigsResponse]</a></code>
47+
- <code title="get /v2/connection">client.<a href="./src/openint/_client.py">list_connections</a>(\*\*<a href="src/openint/types/client_list_connections_params.py">params</a>) -> <a href="./src/openint/types/list_connections_response.py">SyncOffsetPagination[ListConnectionsResponse]</a></code>
48+
- <code title="get /v2/connector">client.<a href="./src/openint/_client.py">list_connectors</a>(\*\*<a href="src/openint/types/client_list_connectors_params.py">params</a>) -> <a href="./src/openint/types/list_connectors_response.py">SyncOffsetPagination[ListConnectorsResponse]</a></code>
49+
- <code title="get /v2/connector-config">client.<a href="./src/openint/_client.py">list_connnector_configs</a>(\*\*<a href="src/openint/types/client_list_connnector_configs_params.py">params</a>) -> <a href="./src/openint/types/list_connnector_configs_response.py">SyncOffsetPagination[ListConnnectorConfigsResponse]</a></code>
50+
- <code title="get /v1/customer">client.<a href="./src/openint/_client.py">list_customers</a>(\*\*<a href="src/openint/types/client_list_customers_params.py">params</a>) -> <a href="./src/openint/types/list_customers_response.py">SyncOffsetPagination[ListCustomersResponse]</a></code>
51+
- <code title="get /v1/event">client.<a href="./src/openint/_client.py">list_events</a>(\*\*<a href="src/openint/types/client_list_events_params.py">params</a>) -> <a href="./src/openint/types/list_events_response.py">SyncOffsetPagination[ListEventsResponse]</a></code>
52+
- <code title="put /v2/connector-config/{id}">client.<a href="./src/openint/_client.py">upsert_connnector_config</a>(id, \*\*<a href="src/openint/types/client_upsert_connnector_config_params.py">params</a>) -> <a href="./src/openint/types/upsert_connnector_config_response.py">UpsertConnnectorConfigResponse</a></code>
53+
- <code title="put /v1/customer">client.<a href="./src/openint/_client.py">upsert_customer</a>(\*\*<a href="src/openint/types/client_upsert_customer_params.py">params</a>) -> <a href="./src/openint/types/upsert_customer_response.py">UpsertCustomerResponse</a></code>

0 commit comments

Comments
 (0)