Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-f0038c91e290e6ffce873f627e8fb548c35aea1d7fa2e317997b151c159049e3.yml
openapi_spec_hash: 735905a92f106aae48c80635729f44c1
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-573ba7bb24acb12f9769960c0d801cd5e6d9522993d27f66c5c10c9e6588ea0e.yml
openapi_spec_hash: db9d90654bbdc3d6280c4a4c752a08ed
config_hash: 3745e90e1c879ca82ecfade8dfd108df
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ

Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.

## Nested params

Nested parameters are dictionaries, typed using `TypedDict`, for example:

```python
from openint import Openint

client = Openint()

response = client.create_magic_link(
customer_id="x",
client_options={
"minus_background": "--background",
"minus_card": "--card",
"minus_card_foreground": "--card-foreground",
"minus_foreground": "--foreground",
"minus_primary": "--primary",
"connector_name": "plaid",
"debug": True,
"tab": "my-connections",
},
)
print(response.client_options)
```

## Handling errors

When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openint.APIConnectionError` is raised.
Expand Down
208 changes: 34 additions & 174 deletions src/openint/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,71 +327,8 @@ def create_magic_link(
self,
customer_id: str,
*,
connection_id: str | NotGiven = NOT_GIVEN,
connector_names: List[
Literal[
"aircall",
"airtable",
"apollo",
"brex",
"coda",
"confluence",
"discord",
"facebook",
"finch",
"firebase",
"foreceipt",
"github",
"gong",
"googlecalendar",
"googledocs",
"googledrive",
"googlemail",
"googlesheet",
"greenhouse",
"heron",
"hubspot",
"instagram",
"intercom",
"jira",
"kustomer",
"lever",
"linear",
"linkedin",
"lunchmoney",
"merge",
"microsoft",
"moota",
"notion",
"onebrick",
"outreach",
"pipedrive",
"plaid",
"quickbooks",
"ramp",
"reddit",
"salesforce",
"salesloft",
"saltedge",
"sharepointonline",
"slack",
"splitwise",
"stripe",
"teller",
"toggl",
"twenty",
"twitter",
"wise",
"xero",
"yodlee",
"zohodesk",
]
]
| NotGiven = NOT_GIVEN,
redirect_url: str | NotGiven = NOT_GIVEN,
theme: Literal["light", "dark"] | NotGiven = NOT_GIVEN,
client_options: client_create_magic_link_params.ClientOptions | NotGiven = NOT_GIVEN,
validity_in_seconds: float | NotGiven = NOT_GIVEN,
view: Literal["manage", "manage-deeplink", "add", "add-deeplink"] | 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,
Expand All @@ -400,24 +337,15 @@ def create_magic_link(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CreateMagicLinkResponse:
"""
Create a magic link for connecting integrations
Create a magic link that is ready to be shared with customers who want to use
Connect

Args:
customer_id: The id of the customer in your application. Ensure it is unique for that
customer.

connection_id: The specific connection id to load

connector_names: Filter integrations by connector names

redirect_url: Where to send user to after connect / if they press back button

theme: Magic Link display theme
client_options: Search params to configure the connect page. Not signed as part of JWT and
therefore can be modified by client

validity_in_seconds: How long the magic link will be valid for (in seconds) before it expires

view: Magic Link tab view to load in the connect magic link

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -432,12 +360,8 @@ def create_magic_link(
f"/customer/{customer_id}/magic-link",
body=maybe_transform(
{
"connection_id": connection_id,
"connector_names": connector_names,
"redirect_url": redirect_url,
"theme": theme,
"client_options": client_options,
"validity_in_seconds": validity_in_seconds,
"view": view,
},
client_create_magic_link_params.ClientCreateMagicLinkParams,
),
Expand All @@ -459,8 +383,10 @@ def create_token(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CreateTokenResponse:
"""
Create an authentication token for a customer
"""Create a @Connect authentication token for a customer.

This token can be used to
embed @Connect in your application via the `@openint/connect` npm package.

Args:
customer_id: The id of the customer in your application. Ensure it is unique for that
Expand Down Expand Up @@ -674,7 +600,8 @@ def list_connection_configs(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncOffsetPagination[ListConnectionConfigsResponse]:
"""
List all connector configurations
List the connectors that are configured in your account and available for your
customers

Args:
connector_name: The name of the connector
Expand Down Expand Up @@ -792,8 +719,11 @@ def list_connections(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncOffsetPagination[ListConnectionsResponse]:
"""
List all connections with optional filtering
"""List all connections with optional filtering.

Does not retrieve secrets or
perform any connection healthcheck. For that use `getConnection` or
`checkConnectionHealth`.

Args:
connector_config_id: The id of the connector config, starts with `ccfg_`
Expand Down Expand Up @@ -1136,71 +1066,8 @@ async def create_magic_link(
self,
customer_id: str,
*,
connection_id: str | NotGiven = NOT_GIVEN,
connector_names: List[
Literal[
"aircall",
"airtable",
"apollo",
"brex",
"coda",
"confluence",
"discord",
"facebook",
"finch",
"firebase",
"foreceipt",
"github",
"gong",
"googlecalendar",
"googledocs",
"googledrive",
"googlemail",
"googlesheet",
"greenhouse",
"heron",
"hubspot",
"instagram",
"intercom",
"jira",
"kustomer",
"lever",
"linear",
"linkedin",
"lunchmoney",
"merge",
"microsoft",
"moota",
"notion",
"onebrick",
"outreach",
"pipedrive",
"plaid",
"quickbooks",
"ramp",
"reddit",
"salesforce",
"salesloft",
"saltedge",
"sharepointonline",
"slack",
"splitwise",
"stripe",
"teller",
"toggl",
"twenty",
"twitter",
"wise",
"xero",
"yodlee",
"zohodesk",
]
]
| NotGiven = NOT_GIVEN,
redirect_url: str | NotGiven = NOT_GIVEN,
theme: Literal["light", "dark"] | NotGiven = NOT_GIVEN,
client_options: client_create_magic_link_params.ClientOptions | NotGiven = NOT_GIVEN,
validity_in_seconds: float | NotGiven = NOT_GIVEN,
view: Literal["manage", "manage-deeplink", "add", "add-deeplink"] | 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,
Expand All @@ -1209,24 +1076,15 @@ async def create_magic_link(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CreateMagicLinkResponse:
"""
Create a magic link for connecting integrations
Create a magic link that is ready to be shared with customers who want to use
Connect

Args:
customer_id: The id of the customer in your application. Ensure it is unique for that
customer.

connection_id: The specific connection id to load

connector_names: Filter integrations by connector names

redirect_url: Where to send user to after connect / if they press back button

theme: Magic Link display theme
client_options: Search params to configure the connect page. Not signed as part of JWT and
therefore can be modified by client

validity_in_seconds: How long the magic link will be valid for (in seconds) before it expires

view: Magic Link tab view to load in the connect magic link

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -1241,12 +1099,8 @@ async def create_magic_link(
f"/customer/{customer_id}/magic-link",
body=await async_maybe_transform(
{
"connection_id": connection_id,
"connector_names": connector_names,
"redirect_url": redirect_url,
"theme": theme,
"client_options": client_options,
"validity_in_seconds": validity_in_seconds,
"view": view,
},
client_create_magic_link_params.ClientCreateMagicLinkParams,
),
Expand All @@ -1268,8 +1122,10 @@ async def create_token(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CreateTokenResponse:
"""
Create an authentication token for a customer
"""Create a @Connect authentication token for a customer.

This token can be used to
embed @Connect in your application via the `@openint/connect` npm package.

Args:
customer_id: The id of the customer in your application. Ensure it is unique for that
Expand Down Expand Up @@ -1483,7 +1339,8 @@ def list_connection_configs(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[ListConnectionConfigsResponse, AsyncOffsetPagination[ListConnectionConfigsResponse]]:
"""
List all connector configurations
List the connectors that are configured in your account and available for your
customers

Args:
connector_name: The name of the connector
Expand Down Expand Up @@ -1601,8 +1458,11 @@ def list_connections(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[ListConnectionsResponse, AsyncOffsetPagination[ListConnectionsResponse]]:
"""
List all connections with optional filtering
"""List all connections with optional filtering.

Does not retrieve secrets or
perform any connection healthcheck. For that use `getConnection` or
`checkConnectionHealth`.

Args:
connector_config_id: The id of the connector config, starts with `ccfg_`
Expand Down
Loading