Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Fern Regeneration -- June 9, 2024 #8

Merged
merged 1 commit into from
Jun 9, 2024
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
180 changes: 90 additions & 90 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
[tool.poetry]
name = "schematichq"
version = "1.0.0"
version = "1.0.1"
description = ""
readme = "README.md"
authors = []
keywords = []

classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed"
]
packages = [
{ include = "schematic", from = "src"}
]

[project.urls]
Repository = 'https://github.com/schematichq/schematic-python'

[tool.poetry.dependencies]
python = "^3.8"
httpx = ">=0.21.2"
Expand Down
43 changes: 42 additions & 1 deletion src/schematic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
RuleDetailResponseData,
RuleResponseData,
RulesDetailResponseData,
SegmentStatusResp,
UpdateReqCommon,
UpdateReqCommonMetricPeriod,
UpdateReqCommonValueType,
Expand All @@ -91,9 +92,11 @@
UpsertUserSubRequestBody,
UserDetailResponseData,
UserResponseData,
WebhookEventResponseData,
WebhookResponseData,
)
from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError, UnauthorizedError
from . import accounts, billing, companies, entitlements, events, features, plans
from . import accounts, billing, companies, entitlements, events, features, plans, webhooks
from .accounts import (
CountApiKeysParams,
CountApiKeysResponse,
Expand Down Expand Up @@ -123,6 +126,7 @@
UpsertBillingProductResponse,
UpsertBillingSubscriptionResponse,
)
from .client import AsyncSchematic, LocalCache, Schematic
from .companies import (
CountCompaniesParams,
CountCompaniesResponse,
Expand Down Expand Up @@ -221,6 +225,7 @@
GetEventSummariesParams,
GetEventSummariesResponse,
GetEventSummaryBySubtypeResponse,
GetSegmentIntegrationStatusResponse,
ListEventsParams,
ListEventsResponse,
ListMetricCountsParams,
Expand Down Expand Up @@ -276,13 +281,29 @@
UpdatePlanResponse,
)
from .version import __version__
from .webhooks import (
CountWebhookEventsParams,
CountWebhookEventsResponse,
CountWebhooksParams,
CountWebhooksResponse,
CreateWebhookResponse,
DeleteWebhookResponse,
GetWebhookEventResponse,
GetWebhookResponse,
ListWebhookEventsParams,
ListWebhookEventsResponse,
ListWebhooksParams,
ListWebhooksResponse,
UpdateWebhookResponse,
)

__all__ = [
"ApiError",
"ApiKeyCreateResponseData",
"ApiKeyRequestListResponseData",
"ApiKeyRequestResponseData",
"ApiKeyResponseData",
"AsyncSchematic",
"AudienceRequestBody",
"BadRequestError",
"BillingProductResponseData",
Expand Down Expand Up @@ -333,6 +354,10 @@
"CountResponse",
"CountUsersParams",
"CountUsersResponse",
"CountWebhookEventsParams",
"CountWebhookEventsResponse",
"CountWebhooksParams",
"CountWebhooksResponse",
"CreateApiKeyResponse",
"CreateCompanyOverrideRequestBodyMetricPeriod",
"CreateCompanyOverrideRequestBodyValueType",
Expand Down Expand Up @@ -367,6 +392,7 @@
"CreateReqCommonMetricPeriod",
"CreateReqCommonValueType",
"CreateUserResponse",
"CreateWebhookResponse",
"DeleteApiKeyResponse",
"DeleteAudienceResponse",
"DeleteCompanyByKeysResponse",
Expand All @@ -381,6 +407,7 @@
"DeleteResponse",
"DeleteUserByKeysResponse",
"DeleteUserResponse",
"DeleteWebhookResponse",
"EntityKeyDefinitionResponseData",
"EntityKeyDetailResponseData",
"EntityKeyResponseData",
Expand Down Expand Up @@ -434,7 +461,10 @@
"GetOrCreateEntityTraitDefinitionResponse",
"GetPlanEntitlementResponse",
"GetPlanResponse",
"GetSegmentIntegrationStatusResponse",
"GetUserResponse",
"GetWebhookEventResponse",
"GetWebhookResponse",
"InternalServerError",
"KeysRequestBody",
"ListApiKeysParams",
Expand Down Expand Up @@ -481,6 +511,11 @@
"ListProductsResponse",
"ListUsersParams",
"ListUsersResponse",
"ListWebhookEventsParams",
"ListWebhookEventsResponse",
"ListWebhooksParams",
"ListWebhooksResponse",
"LocalCache",
"LookupCompanyParams",
"LookupCompanyResponse",
"LookupUserParams",
Expand All @@ -504,7 +539,9 @@
"RuleDetailResponseData",
"RuleResponseData",
"RulesDetailResponseData",
"Schematic",
"SchematicEnvironment",
"SegmentStatusResp",
"UnauthorizedError",
"UpdateApiKeyResponse",
"UpdateAudienceResponse",
Expand All @@ -528,6 +565,7 @@
"UpdateReqCommonMetricPeriod",
"UpdateReqCommonValueType",
"UpdateRuleRequestBody",
"UpdateWebhookResponse",
"UpsertBillingProductResponse",
"UpsertBillingSubscriptionResponse",
"UpsertCompanyRequestBody",
Expand All @@ -540,6 +578,8 @@
"UpsertUserTraitResponse",
"UserDetailResponseData",
"UserResponseData",
"WebhookEventResponseData",
"WebhookResponseData",
"__version__",
"accounts",
"billing",
Expand All @@ -548,4 +588,5 @@
"events",
"features",
"plans",
"webhooks",
]
3 changes: 3 additions & 0 deletions src/schematic/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .events.client import AsyncEventsClient, EventsClient
from .features.client import AsyncFeaturesClient, FeaturesClient
from .plans.client import AsyncPlansClient, PlansClient
from .webhooks.client import AsyncWebhooksClient, WebhooksClient


class BaseSchematic:
Expand Down Expand Up @@ -80,6 +81,7 @@ def __init__(
self.entitlements = EntitlementsClient(client_wrapper=self._client_wrapper)
self.events = EventsClient(client_wrapper=self._client_wrapper)
self.plans = PlansClient(client_wrapper=self._client_wrapper)
self.webhooks = WebhooksClient(client_wrapper=self._client_wrapper)


class AsyncBaseSchematic:
Expand Down Expand Up @@ -147,6 +149,7 @@ def __init__(
self.entitlements = AsyncEntitlementsClient(client_wrapper=self._client_wrapper)
self.events = AsyncEventsClient(client_wrapper=self._client_wrapper)
self.plans = AsyncPlansClient(client_wrapper=self._client_wrapper)
self.webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)


def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SchematicEnvironment) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/schematic/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "schematichq",
"X-Fern-SDK-Version": "1.0.0",
"X-Fern-SDK-Version": "1.0.1",
}
headers["X-Schematic-Api-Key"] = self.api_key
return headers
Expand Down
4 changes: 2 additions & 2 deletions src/schematic/core/query_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ def single_query_encoder(query_key: str, query_value: Any) -> Dict[str, Any]:
return {query_key: query_value}


def encode_query(query: Dict[str, Any]) -> Dict[str, Any]:
return dict(ChainMap(*[single_query_encoder(k, v) for k, v in query.items()]))
def encode_query(query: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
return dict(ChainMap(*[single_query_encoder(k, v) for k, v in query.items()])) if query is not None else None
2 changes: 2 additions & 0 deletions src/schematic/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
GetEventSummariesParams,
GetEventSummariesResponse,
GetEventSummaryBySubtypeResponse,
GetSegmentIntegrationStatusResponse,
ListEventsParams,
ListEventsResponse,
ListMetricCountsParams,
Expand All @@ -20,6 +21,7 @@
"GetEventSummariesParams",
"GetEventSummariesResponse",
"GetEventSummaryBySubtypeResponse",
"GetSegmentIntegrationStatusResponse",
"ListEventsParams",
"ListEventsResponse",
"ListMetricCountsParams",
Expand Down
131 changes: 131 additions & 0 deletions src/schematic/events/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .types.get_event_response import GetEventResponse
from .types.get_event_summaries_response import GetEventSummariesResponse
from .types.get_event_summary_by_subtype_response import GetEventSummaryBySubtypeResponse
from .types.get_segment_integration_status_response import GetSegmentIntegrationStatusResponse
from .types.list_events_response import ListEventsResponse
from .types.list_metric_counts_response import ListMetricCountsResponse

Expand Down Expand Up @@ -657,6 +658,71 @@ def list_metric_counts(
raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text)
raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json)

def get_segment_integration_status(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> GetSegmentIntegrationStatusResponse:
"""
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Returns
-------
GetSegmentIntegrationStatusResponse
OK

Examples
--------
from schematic.client import Schematic

client = Schematic(
api_key="YOUR_API_KEY",
)
client.events.get_segment_integration_status()
"""
_response = self._client_wrapper.httpx_client.request(
method="GET",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "segment-integration"),
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else self._client_wrapper.get_timeout(),
retries=0,
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(GetSegmentIntegrationStatusResponse, _response.json()) # type: ignore
if _response.status_code == 401:
raise UnauthorizedError(
pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore
)
if _response.status_code == 403:
raise ForbiddenError(pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json())) # type: ignore
if _response.status_code == 404:
raise NotFoundError(pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json())) # type: ignore
if _response.status_code == 500:
raise InternalServerError(
pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore
)
try:
_response_json = _response.json()
except JSONDecodeError:
raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text)
raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json)


class AsyncEventsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
Expand Down Expand Up @@ -1282,3 +1348,68 @@ async def list_metric_counts(
except JSONDecodeError:
raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text)
raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json)

async def get_segment_integration_status(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> GetSegmentIntegrationStatusResponse:
"""
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Returns
-------
GetSegmentIntegrationStatusResponse
OK

Examples
--------
from schematic.client import AsyncSchematic

client = AsyncSchematic(
api_key="YOUR_API_KEY",
)
await client.events.get_segment_integration_status()
"""
_response = await self._client_wrapper.httpx_client.request(
method="GET",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "segment-integration"),
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else self._client_wrapper.get_timeout(),
retries=0,
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(GetSegmentIntegrationStatusResponse, _response.json()) # type: ignore
if _response.status_code == 401:
raise UnauthorizedError(
pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore
)
if _response.status_code == 403:
raise ForbiddenError(pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json())) # type: ignore
if _response.status_code == 404:
raise NotFoundError(pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json())) # type: ignore
if _response.status_code == 500:
raise InternalServerError(
pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore
)
try:
_response_json = _response.json()
except JSONDecodeError:
raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text)
raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json)
Loading
Loading