Skip to content

Commit 1ecf720

Browse files
feat(api): api update
1 parent 74c853e commit 1ecf720

10 files changed

Lines changed: 72 additions & 32 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 73
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock/knock-mapi-58321f620bf0bdfb4513c30fd185449659d0e25685a25198cf301837609a9141.yml
3-
openapi_spec_hash: e48c1ec498ba7f1eff10da98f619754e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock/knock-mapi-d9a8f56bda3b292ce411b2e224166f5e91571a51683a353fcff2c472553c7d3a.yml
3+
openapi_spec_hash: 1dee9829c5853a1d103298568c6edb05
44
config_hash: 1543050ac0815a90f8fc8158f853af03

src/knock_mapi/resources/data_sources.py

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def list_logs(
169169
date: str | Omit = omit,
170170
ending_at: Union[str, datetime] | Omit = omit,
171171
event: str | Omit = omit,
172-
includes: List[Literal["actions"]] | Omit = omit,
172+
include: List[Literal["actions"]] | Omit = omit,
173173
limit: int | Omit = omit,
174174
starting_at: Union[str, datetime] | Omit = omit,
175175
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -199,7 +199,7 @@ def list_logs(
199199
200200
event: The event name to filter by.
201201
202-
includes: Associated resources to include in the response. Accepts `actions` to include
202+
include: Associated resources to include in the response. Accepts `actions` to include
203203
the actions executed after receiving each source event.
204204
205205
limit: The number of entries to fetch per-page.
@@ -233,7 +233,7 @@ def list_logs(
233233
"date": date,
234234
"ending_at": ending_at,
235235
"event": event,
236-
"includes": includes,
236+
"include": include,
237237
"limit": limit,
238238
"starting_at": starting_at,
239239
},
@@ -265,7 +265,9 @@ def list_providers(
265265
def list_sources(
266266
self,
267267
*,
268+
annotate: bool | Omit = omit,
268269
environment: str | Omit = omit,
270+
include: List[Literal["environment_settings"]] | Omit = omit,
269271
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
270272
# The extra values given here take precedence over values defined on the client or passed to this method.
271273
extra_headers: Headers | None = None,
@@ -277,8 +279,12 @@ def list_sources(
277279
Returns connected sources for the project.
278280
279281
Args:
282+
annotate: Whether to annotate the resource. Only used in the Knock CLI.
283+
280284
environment: The environment slug.
281285
286+
include: Associated resources to include in each source. Accepts `environment_settings`.
287+
282288
extra_headers: Send extra headers
283289
284290
extra_query: Add additional query parameters to the request
@@ -295,7 +301,12 @@ def list_sources(
295301
extra_body=extra_body,
296302
timeout=timeout,
297303
query=maybe_transform(
298-
{"environment": environment}, data_source_list_sources_params.DataSourceListSourcesParams
304+
{
305+
"annotate": annotate,
306+
"environment": environment,
307+
"include": include,
308+
},
309+
data_source_list_sources_params.DataSourceListSourcesParams,
299310
),
300311
),
301312
cast_to=SourcesResponse,
@@ -354,7 +365,7 @@ def retrieve_provider(
354365
self,
355366
key: str,
356367
*,
357-
includes: List[
368+
include: List[
358369
Literal["branding", "default_action_mappings", "example_payloads", "preprocessing_script", "static_fields"]
359370
]
360371
| Omit = omit,
@@ -369,7 +380,7 @@ def retrieve_provider(
369380
Returns a source provider template available for creating sources.
370381
371382
Args:
372-
includes: Associated resources to include in the response. Accepts `branding`,
383+
include: Associated resources to include in the response. Accepts `branding`,
373384
`default_action_mappings`, `example_payloads`, `preprocessing_script`,
374385
`static_fields`.
375386
@@ -391,7 +402,7 @@ def retrieve_provider(
391402
extra_body=extra_body,
392403
timeout=timeout,
393404
query=maybe_transform(
394-
{"includes": includes}, data_source_retrieve_provider_params.DataSourceRetrieveProviderParams
405+
{"include": include}, data_source_retrieve_provider_params.DataSourceRetrieveProviderParams
395406
),
396407
),
397408
cast_to=SourceProviderResponse,
@@ -621,7 +632,7 @@ def list_logs(
621632
date: str | Omit = omit,
622633
ending_at: Union[str, datetime] | Omit = omit,
623634
event: str | Omit = omit,
624-
includes: List[Literal["actions"]] | Omit = omit,
635+
include: List[Literal["actions"]] | Omit = omit,
625636
limit: int | Omit = omit,
626637
starting_at: Union[str, datetime] | Omit = omit,
627638
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -651,7 +662,7 @@ def list_logs(
651662
652663
event: The event name to filter by.
653664
654-
includes: Associated resources to include in the response. Accepts `actions` to include
665+
include: Associated resources to include in the response. Accepts `actions` to include
655666
the actions executed after receiving each source event.
656667
657668
limit: The number of entries to fetch per-page.
@@ -685,7 +696,7 @@ def list_logs(
685696
"date": date,
686697
"ending_at": ending_at,
687698
"event": event,
688-
"includes": includes,
699+
"include": include,
689700
"limit": limit,
690701
"starting_at": starting_at,
691702
},
@@ -717,7 +728,9 @@ async def list_providers(
717728
async def list_sources(
718729
self,
719730
*,
731+
annotate: bool | Omit = omit,
720732
environment: str | Omit = omit,
733+
include: List[Literal["environment_settings"]] | Omit = omit,
721734
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
722735
# The extra values given here take precedence over values defined on the client or passed to this method.
723736
extra_headers: Headers | None = None,
@@ -729,8 +742,12 @@ async def list_sources(
729742
Returns connected sources for the project.
730743
731744
Args:
745+
annotate: Whether to annotate the resource. Only used in the Knock CLI.
746+
732747
environment: The environment slug.
733748
749+
include: Associated resources to include in each source. Accepts `environment_settings`.
750+
734751
extra_headers: Send extra headers
735752
736753
extra_query: Add additional query parameters to the request
@@ -747,7 +764,12 @@ async def list_sources(
747764
extra_body=extra_body,
748765
timeout=timeout,
749766
query=await async_maybe_transform(
750-
{"environment": environment}, data_source_list_sources_params.DataSourceListSourcesParams
767+
{
768+
"annotate": annotate,
769+
"environment": environment,
770+
"include": include,
771+
},
772+
data_source_list_sources_params.DataSourceListSourcesParams,
751773
),
752774
),
753775
cast_to=SourcesResponse,
@@ -808,7 +830,7 @@ async def retrieve_provider(
808830
self,
809831
key: str,
810832
*,
811-
includes: List[
833+
include: List[
812834
Literal["branding", "default_action_mappings", "example_payloads", "preprocessing_script", "static_fields"]
813835
]
814836
| Omit = omit,
@@ -823,7 +845,7 @@ async def retrieve_provider(
823845
Returns a source provider template available for creating sources.
824846
825847
Args:
826-
includes: Associated resources to include in the response. Accepts `branding`,
848+
include: Associated resources to include in the response. Accepts `branding`,
827849
`default_action_mappings`, `example_payloads`, `preprocessing_script`,
828850
`static_fields`.
829851
@@ -845,7 +867,7 @@ async def retrieve_provider(
845867
extra_body=extra_body,
846868
timeout=timeout,
847869
query=await async_maybe_transform(
848-
{"includes": includes}, data_source_retrieve_provider_params.DataSourceRetrieveProviderParams
870+
{"include": include}, data_source_retrieve_provider_params.DataSourceRetrieveProviderParams
849871
),
850872
),
851873
cast_to=SourceProviderResponse,

src/knock_mapi/types/data_source_list_logs_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DataSourceListLogsParams(TypedDict, total=False):
3333
event: str
3434
"""The event name to filter by."""
3535

36-
includes: List[Literal["actions"]]
36+
include: List[Literal["actions"]]
3737
"""Associated resources to include in the response.
3838
3939
Accepts `actions` to include the actions executed after receiving each source

src/knock_mapi/types/data_source_list_sources_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import TypedDict
5+
from typing import List
6+
from typing_extensions import Literal, TypedDict
67

78
__all__ = ["DataSourceListSourcesParams"]
89

910

1011
class DataSourceListSourcesParams(TypedDict, total=False):
12+
annotate: bool
13+
"""Whether to annotate the resource. Only used in the Knock CLI."""
14+
1115
environment: str
1216
"""The environment slug."""
17+
18+
include: List[Literal["environment_settings"]]
19+
"""Associated resources to include in each source. Accepts `environment_settings`."""

src/knock_mapi/types/data_source_retrieve_provider_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class DataSourceRetrieveProviderParams(TypedDict, total=False):
12-
includes: List[
12+
include: List[
1313
Literal["branding", "default_action_mappings", "example_payloads", "preprocessing_script", "static_fields"]
1414
]
1515
"""Associated resources to include in the response.

src/knock_mapi/types/source_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SourceLog(BaseModel):
2121
actions: Optional[List[SourceLogAction]] = None
2222
"""The actions executed after receiving the source event.
2323
24-
Only present when `includes` contains `actions`.
24+
Only present when `include` contains `actions`.
2525
"""
2626

2727
data: Optional[Dict[str, object]] = None

src/knock_mapi/types/source_logs_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class SourceLogsResponse(BaseModel):
1313
"""A paginated list of source logs.
1414
15-
Include `actions` in the `includes` query parameter to return action details for each log.
15+
Include `actions` in the `include` query parameter to return action details for each log.
1616
"""
1717

1818
entries: List[SourceLog]

src/knock_mapi/types/source_provider_response.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class DefaultSettingsPreprocessingScript(BaseModel):
2222
"""Verification script source code.
2323
24-
Only present when `includes` contains `preprocessing_script`.
24+
Only present when `include` contains `preprocessing_script`.
2525
"""
2626

2727
language: Literal["javascript"]
@@ -46,7 +46,7 @@ class DefaultSettings(BaseModel):
4646
preprocessing_script: Optional[DefaultSettingsPreprocessingScript] = None
4747
"""Verification script source code.
4848
49-
Only present when `includes` contains `preprocessing_script`.
49+
Only present when `include` contains `preprocessing_script`.
5050
"""
5151

5252
timestamp_path: Optional[str] = None
@@ -70,7 +70,7 @@ class ProviderBrandingColors(BaseModel):
7070

7171

7272
class ProviderBranding(BaseModel):
73-
"""Provider branding assets. Only present when `includes` contains `branding`."""
73+
"""Provider branding assets. Only present when `include` contains `branding`."""
7474

7575
icon_image: str
7676
"""Provider icon image URL or path."""
@@ -101,7 +101,7 @@ class Provider(BaseModel):
101101
"""Provider website URL."""
102102

103103
branding: Optional[ProviderBranding] = None
104-
"""Provider branding assets. Only present when `includes` contains `branding`."""
104+
"""Provider branding assets. Only present when `include` contains `branding`."""
105105

106106
knock_tutorial_url: Optional[str] = None
107107
"""Knock tutorial URL for setting up the provider."""
@@ -159,7 +159,7 @@ class SourceProviderResponse(BaseModel):
159159
default_action_mappings: Optional[List[DefaultActionMapping]] = None
160160
"""Default event action mappings for the provider.
161161
162-
Only present when `includes` contains `default_action_mappings`.
162+
Only present when `include` contains `default_action_mappings`.
163163
"""
164164

165165
example_payloads: Optional[Dict[str, List[ExamplePayload]]] = None
@@ -168,5 +168,5 @@ class SourceProviderResponse(BaseModel):
168168
static_fields: Optional[Dict[str, object]] = None
169169
"""JSON Schema fields needed to configure the source.
170170
171-
Only present when `includes` contains `static_fields`.
171+
Only present when `include` contains `static_fields`.
172172
"""

src/knock_mapi/types/sources_response.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Optional
3+
from typing import Dict, List, Optional
44

55
from .._models import BaseModel
6+
from .source_environment_settings import SourceEnvironmentSettings
67

78
__all__ = ["SourcesResponse", "Entry"]
89

@@ -22,6 +23,12 @@ class Entry(BaseModel):
2223
description: Optional[str] = None
2324
"""Source description."""
2425

26+
environment_settings: Optional[Dict[str, SourceEnvironmentSettings]] = None
27+
"""Per-environment settings keyed by environment slug.
28+
29+
Present only when requested via `include`.
30+
"""
31+
2532

2633
class SourcesResponse(BaseModel):
2734
"""Sources connected to the project."""

tests/api_resources/test_data_sources.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_method_list_logs_with_all_params(self, client: KnockMgmt) -> None:
157157
date="date",
158158
ending_at=parse_datetime("2019-12-27T18:11:19.117Z"),
159159
event="event",
160-
includes=["actions"],
160+
include=["actions"],
161161
limit=0,
162162
starting_at=parse_datetime("2019-12-27T18:11:19.117Z"),
163163
)
@@ -238,7 +238,9 @@ def test_method_list_sources(self, client: KnockMgmt) -> None:
238238
@parametrize
239239
def test_method_list_sources_with_all_params(self, client: KnockMgmt) -> None:
240240
data_source = client.data_sources.list_sources(
241+
annotate=True,
241242
environment="development",
243+
include=["environment_settings"],
242244
)
243245
assert_matches_type(SourcesResponse, data_source, path=["response"])
244246

@@ -339,7 +341,7 @@ def test_method_retrieve_provider(self, client: KnockMgmt) -> None:
339341
def test_method_retrieve_provider_with_all_params(self, client: KnockMgmt) -> None:
340342
data_source = client.data_sources.retrieve_provider(
341343
key="key",
342-
includes=["branding"],
344+
include=["branding"],
343345
)
344346
assert_matches_type(SourceProviderResponse, data_source, path=["response"])
345347

@@ -651,7 +653,7 @@ async def test_method_list_logs_with_all_params(self, async_client: AsyncKnockMg
651653
date="date",
652654
ending_at=parse_datetime("2019-12-27T18:11:19.117Z"),
653655
event="event",
654-
includes=["actions"],
656+
include=["actions"],
655657
limit=0,
656658
starting_at=parse_datetime("2019-12-27T18:11:19.117Z"),
657659
)
@@ -732,7 +734,9 @@ async def test_method_list_sources(self, async_client: AsyncKnockMgmt) -> None:
732734
@parametrize
733735
async def test_method_list_sources_with_all_params(self, async_client: AsyncKnockMgmt) -> None:
734736
data_source = await async_client.data_sources.list_sources(
737+
annotate=True,
735738
environment="development",
739+
include=["environment_settings"],
736740
)
737741
assert_matches_type(SourcesResponse, data_source, path=["response"])
738742

@@ -833,7 +837,7 @@ async def test_method_retrieve_provider(self, async_client: AsyncKnockMgmt) -> N
833837
async def test_method_retrieve_provider_with_all_params(self, async_client: AsyncKnockMgmt) -> None:
834838
data_source = await async_client.data_sources.retrieve_provider(
835839
key="key",
836-
includes=["branding"],
840+
include=["branding"],
837841
)
838842
assert_matches_type(SourceProviderResponse, data_source, path=["response"])
839843

0 commit comments

Comments
 (0)