Skip to content

Commit ec5d611

Browse files
feat(api): org apis
1 parent 30821ed commit ec5d611

6 files changed

Lines changed: 184 additions & 4 deletions

File tree

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 19
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-9c50c3264b57b3d0b1fd11b152ad21d43b3f0573de500069c54bc0ee84f186b7.yml
3-
openapi_spec_hash: d657abb1834496d4e301e8f0da617c9c
4-
config_hash: e41b790d1ab796040f38456962f09ee4
1+
configured_endpoints: 20
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-b0f1cc110198f358326983457f50440f062a5cc7531eb0c5ed854e8bcc2eb78a.yml
3+
openapi_spec_hash: 69a97c17db26ec2cc6da820a63baeb4f
4+
config_hash: bc2ed32362cf85854a332d7ee8bdd35a

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ from openint.types import (
2626
ListEventsResponse,
2727
UpsertConnnectorConfigResponse,
2828
UpsertCustomerResponse,
29+
UpsertOrganizationResponse,
2930
)
3031
```
3132

@@ -51,3 +52,4 @@ Methods:
5152
- <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>
5253
- <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>
5354
- <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>
55+
- <code title="put /v2/organization/{orgId}">client.<a href="./src/openint/_client.py">upsert_organization</a>(org_id) -> <a href="./src/openint/types/upsert_organization_response.py">UpsertOrganizationResponse</a></code>

src/openint/_client.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
from .types.delete_assignment_response import DeleteAssignmentResponse
7676
from .types.delete_connection_response import DeleteConnectionResponse
7777
from .types.get_conector_config_response import GetConectorConfigResponse
78+
from .types.upsert_organization_response import UpsertOrganizationResponse
7879
from .types.delete_connector_config_response import DeleteConnectorConfigResponse
7980
from .types.list_connection_configs_response import ListConnectionConfigsResponse
8081
from .types.list_connnector_configs_response import ListConnnectorConfigsResponse
@@ -1675,6 +1676,40 @@ def upsert_customer(
16751676
cast_to=UpsertCustomerResponse,
16761677
)
16771678

1679+
def upsert_organization(
1680+
self,
1681+
org_id: str,
1682+
*,
1683+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1684+
# The extra values given here take precedence over values defined on the client or passed to this method.
1685+
extra_headers: Headers | None = None,
1686+
extra_query: Query | None = None,
1687+
extra_body: Body | None = None,
1688+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1689+
) -> UpsertOrganizationResponse:
1690+
"""Upsert an organization by ID.
1691+
1692+
Creates if it does not exist.
1693+
1694+
Args:
1695+
extra_headers: Send extra headers
1696+
1697+
extra_query: Add additional query parameters to the request
1698+
1699+
extra_body: Add additional JSON properties to the request
1700+
1701+
timeout: Override the client-level default timeout for this request, in seconds
1702+
"""
1703+
if not org_id:
1704+
raise ValueError(f"Expected a non-empty value for `org_id` but received {org_id!r}")
1705+
return self.put(
1706+
f"/v2/organization/{org_id}",
1707+
options=make_request_options(
1708+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1709+
),
1710+
cast_to=UpsertOrganizationResponse,
1711+
)
1712+
16781713
@override
16791714
def _make_status_error(
16801715
self,
@@ -3300,6 +3335,40 @@ async def upsert_customer(
33003335
cast_to=UpsertCustomerResponse,
33013336
)
33023337

3338+
async def upsert_organization(
3339+
self,
3340+
org_id: str,
3341+
*,
3342+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
3343+
# The extra values given here take precedence over values defined on the client or passed to this method.
3344+
extra_headers: Headers | None = None,
3345+
extra_query: Query | None = None,
3346+
extra_body: Body | None = None,
3347+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3348+
) -> UpsertOrganizationResponse:
3349+
"""Upsert an organization by ID.
3350+
3351+
Creates if it does not exist.
3352+
3353+
Args:
3354+
extra_headers: Send extra headers
3355+
3356+
extra_query: Add additional query parameters to the request
3357+
3358+
extra_body: Add additional JSON properties to the request
3359+
3360+
timeout: Override the client-level default timeout for this request, in seconds
3361+
"""
3362+
if not org_id:
3363+
raise ValueError(f"Expected a non-empty value for `org_id` but received {org_id!r}")
3364+
return await self.put(
3365+
f"/v2/organization/{org_id}",
3366+
options=make_request_options(
3367+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
3368+
),
3369+
cast_to=UpsertOrganizationResponse,
3370+
)
3371+
33033372
@override
33043373
def _make_status_error(
33053374
self,
@@ -3396,6 +3465,9 @@ def __init__(self, client: Openint) -> None:
33963465
self.upsert_customer = to_raw_response_wrapper(
33973466
client.upsert_customer,
33983467
)
3468+
self.upsert_organization = to_raw_response_wrapper(
3469+
client.upsert_organization,
3470+
)
33993471

34003472

34013473
class AsyncOpenintWithRawResponse:
@@ -3460,6 +3532,9 @@ def __init__(self, client: AsyncOpenint) -> None:
34603532
self.upsert_customer = async_to_raw_response_wrapper(
34613533
client.upsert_customer,
34623534
)
3535+
self.upsert_organization = async_to_raw_response_wrapper(
3536+
client.upsert_organization,
3537+
)
34633538

34643539

34653540
class OpenintWithStreamedResponse:
@@ -3524,6 +3599,9 @@ def __init__(self, client: Openint) -> None:
35243599
self.upsert_customer = to_streamed_response_wrapper(
35253600
client.upsert_customer,
35263601
)
3602+
self.upsert_organization = to_streamed_response_wrapper(
3603+
client.upsert_organization,
3604+
)
35273605

35283606

35293607
class AsyncOpenintWithStreamedResponse:
@@ -3588,6 +3666,9 @@ def __init__(self, client: AsyncOpenint) -> None:
35883666
self.upsert_customer = async_to_streamed_response_wrapper(
35893667
client.upsert_customer,
35903668
)
3669+
self.upsert_organization = async_to_streamed_response_wrapper(
3670+
client.upsert_organization,
3671+
)
35913672

35923673

35933674
Client = Openint

src/openint/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from .client_get_connection_params import ClientGetConnectionParams as ClientGetConnectionParams
2424
from .client_list_customers_params import ClientListCustomersParams as ClientListCustomersParams
2525
from .get_conector_config_response import GetConectorConfigResponse as GetConectorConfigResponse
26+
from .upsert_organization_response import UpsertOrganizationResponse as UpsertOrganizationResponse
2627
from .client_list_connectors_params import ClientListConnectorsParams as ClientListConnectorsParams
2728
from .client_upsert_customer_params import ClientUpsertCustomerParams as ClientUpsertCustomerParams
2829
from .client_list_connections_params import ClientListConnectionsParams as ClientListConnectionsParams
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .._models import BaseModel
4+
5+
__all__ = ["UpsertOrganizationResponse"]
6+
7+
8+
class UpsertOrganizationResponse(BaseModel):
9+
id: str
10+
11+
created: bool

tests/api_resources/test_client.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
DeleteAssignmentResponse,
2626
DeleteConnectionResponse,
2727
GetConectorConfigResponse,
28+
UpsertOrganizationResponse,
2829
DeleteConnectorConfigResponse,
2930
ListConnectionConfigsResponse,
3031
ListConnnectorConfigsResponse,
@@ -955,6 +956,48 @@ def test_streaming_response_upsert_customer(self, client: Openint) -> None:
955956

956957
assert cast(Any, response.is_closed) is True
957958

959+
@pytest.mark.skip(reason="Prism tests are disabled")
960+
@parametrize
961+
def test_method_upsert_organization(self, client: Openint) -> None:
962+
client_ = client.upsert_organization(
963+
"x",
964+
)
965+
assert_matches_type(UpsertOrganizationResponse, client_, path=["response"])
966+
967+
@pytest.mark.skip(reason="Prism tests are disabled")
968+
@parametrize
969+
def test_raw_response_upsert_organization(self, client: Openint) -> None:
970+
response = client.with_raw_response.upsert_organization(
971+
"x",
972+
)
973+
974+
assert response.is_closed is True
975+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
976+
client_ = response.parse()
977+
assert_matches_type(UpsertOrganizationResponse, client_, path=["response"])
978+
979+
@pytest.mark.skip(reason="Prism tests are disabled")
980+
@parametrize
981+
def test_streaming_response_upsert_organization(self, client: Openint) -> None:
982+
with client.with_streaming_response.upsert_organization(
983+
"x",
984+
) as response:
985+
assert not response.is_closed
986+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
987+
988+
client_ = response.parse()
989+
assert_matches_type(UpsertOrganizationResponse, client_, path=["response"])
990+
991+
assert cast(Any, response.is_closed) is True
992+
993+
@pytest.mark.skip(reason="Prism tests are disabled")
994+
@parametrize
995+
def test_path_params_upsert_organization(self, client: Openint) -> None:
996+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `org_id` but received ''"):
997+
client.with_raw_response.upsert_organization(
998+
"",
999+
)
1000+
9581001

9591002
class TestAsyncClient:
9601003
parametrize = pytest.mark.parametrize(
@@ -1876,3 +1919,45 @@ async def test_streaming_response_upsert_customer(self, async_client: AsyncOpeni
18761919
assert_matches_type(UpsertCustomerResponse, client, path=["response"])
18771920

18781921
assert cast(Any, response.is_closed) is True
1922+
1923+
@pytest.mark.skip(reason="Prism tests are disabled")
1924+
@parametrize
1925+
async def test_method_upsert_organization(self, async_client: AsyncOpenint) -> None:
1926+
client = await async_client.upsert_organization(
1927+
"x",
1928+
)
1929+
assert_matches_type(UpsertOrganizationResponse, client, path=["response"])
1930+
1931+
@pytest.mark.skip(reason="Prism tests are disabled")
1932+
@parametrize
1933+
async def test_raw_response_upsert_organization(self, async_client: AsyncOpenint) -> None:
1934+
response = await async_client.with_raw_response.upsert_organization(
1935+
"x",
1936+
)
1937+
1938+
assert response.is_closed is True
1939+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1940+
client = await response.parse()
1941+
assert_matches_type(UpsertOrganizationResponse, client, path=["response"])
1942+
1943+
@pytest.mark.skip(reason="Prism tests are disabled")
1944+
@parametrize
1945+
async def test_streaming_response_upsert_organization(self, async_client: AsyncOpenint) -> None:
1946+
async with async_client.with_streaming_response.upsert_organization(
1947+
"x",
1948+
) as response:
1949+
assert not response.is_closed
1950+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1951+
1952+
client = await response.parse()
1953+
assert_matches_type(UpsertOrganizationResponse, client, path=["response"])
1954+
1955+
assert cast(Any, response.is_closed) is True
1956+
1957+
@pytest.mark.skip(reason="Prism tests are disabled")
1958+
@parametrize
1959+
async def test_path_params_upsert_organization(self, async_client: AsyncOpenint) -> None:
1960+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `org_id` but received ''"):
1961+
await async_client.with_raw_response.upsert_organization(
1962+
"",
1963+
)

0 commit comments

Comments
 (0)