Skip to content

Commit b038fbe

Browse files
feat(api): add project increment_queries and other recent endpoints
1 parent 4f39e46 commit b038fbe

14 files changed

+1227
-7
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
configured_endpoints: 36
1+
configured_endpoints: 42
22
openapi_spec_hash: 71ff1de391293cdfb6dcb761ed89210d
3-
config_hash: adbedb6317fca6f566f54564cc341846
3+
config_hash: 93ac12138700569dc57329400410c0fd

api.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ Methods:
1616
Types:
1717

1818
```python
19-
from codex.types import OrganizationSchemaPublic
19+
from codex.types import (
20+
OrganizationSchemaPublic,
21+
OrganizationListMembersResponse,
22+
OrganizationRetrievePermissionsResponse,
23+
)
2024
```
2125

2226
Methods:
2327

2428
- <code title="get /api/organizations/{organization_id}">client.organizations.<a href="./src/codex/resources/organizations/organizations.py">retrieve</a>(organization_id) -> <a href="./src/codex/types/organization_schema_public.py">OrganizationSchemaPublic</a></code>
29+
- <code title="get /api/organizations/{organization_id}/members">client.organizations.<a href="./src/codex/resources/organizations/organizations.py">list_members</a>(organization_id) -> <a href="./src/codex/types/organization_list_members_response.py">OrganizationListMembersResponse</a></code>
30+
- <code title="get /api/organizations/{organization_id}/permissions">client.organizations.<a href="./src/codex/resources/organizations/organizations.py">retrieve_permissions</a>(organization_id) -> <a href="./src/codex/types/organization_retrieve_permissions_response.py">OrganizationRetrievePermissionsResponse</a></code>
2531

2632
## Billing
2733

@@ -140,6 +146,7 @@ from codex.types import (
140146
ProjectRetrieveResponse,
141147
ProjectListResponse,
142148
ProjectExportResponse,
149+
ProjectIncrementQueriesResponse,
143150
)
144151
```
145152

@@ -151,6 +158,7 @@ Methods:
151158
- <code title="get /api/projects/">client.projects.<a href="./src/codex/resources/projects/projects.py">list</a>(\*\*<a href="src/codex/types/project_list_params.py">params</a>) -> <a href="./src/codex/types/project_list_response.py">ProjectListResponse</a></code>
152159
- <code title="delete /api/projects/{project_id}">client.projects.<a href="./src/codex/resources/projects/projects.py">delete</a>(project_id) -> None</code>
153160
- <code title="get /api/projects/{project_id}/export">client.projects.<a href="./src/codex/resources/projects/projects.py">export</a>(project_id) -> <a href="./src/codex/types/project_export_response.py">object</a></code>
161+
- <code title="post /api/projects/{project_id}/increment_queries">client.projects.<a href="./src/codex/resources/projects/projects.py">increment_queries</a>(project_id) -> <a href="./src/codex/types/project_increment_queries_response.py">object</a></code>
154162

155163
## AccessKeys
156164

@@ -179,7 +187,7 @@ Methods:
179187
Types:
180188

181189
```python
182-
from codex.types.projects import Entry, EntryQueryResponse
190+
from codex.types.projects import Entry, EntryNotifySmeResponse, EntryQueryResponse
183191
```
184192

185193
Methods:
@@ -188,7 +196,10 @@ Methods:
188196
- <code title="get /api/projects/{project_id}/entries/{entry_id}">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">retrieve</a>(entry_id, \*, project_id) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
189197
- <code title="put /api/projects/{project_id}/entries/{entry_id}">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">update</a>(entry_id, \*, project_id, \*\*<a href="src/codex/types/projects/entry_update_params.py">params</a>) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
190198
- <code title="delete /api/projects/{project_id}/entries/{entry_id}">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">delete</a>(entry_id, \*, project_id) -> None</code>
199+
- <code title="post /api/projects/{project_id}/entries/{entry_id}/notifications">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">notify_sme</a>(entry_id, \*, project_id, \*\*<a href="src/codex/types/projects/entry_notify_sme_params.py">params</a>) -> <a href="./src/codex/types/projects/entry_notify_sme_response.py">EntryNotifySmeResponse</a></code>
200+
- <code title="put /api/projects/{project_id}/entries/{entry_id}/publish_draft_answer">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">publish_draft_answer</a>(entry_id, \*, project_id) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
191201
- <code title="post /api/projects/{project_id}/entries/query">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">query</a>(project_id, \*\*<a href="src/codex/types/projects/entry_query_params.py">params</a>) -> <a href="./src/codex/types/projects/entry_query_response.py">EntryQueryResponse</a></code>
202+
- <code title="put /api/projects/{project_id}/entries/{entry_id}/unpublish_answer">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">unpublish_answer</a>(entry_id, \*, project_id) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
192203

193204
## Clusters
194205

src/codex/resources/organizations/organizations.py

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
AsyncBillingResourceWithStreamingResponse,
2424
)
2525
from ...types.organization_schema_public import OrganizationSchemaPublic
26+
from ...types.organization_list_members_response import OrganizationListMembersResponse
27+
from ...types.organization_retrieve_permissions_response import OrganizationRetrievePermissionsResponse
2628

2729
__all__ = ["OrganizationsResource", "AsyncOrganizationsResource"]
2830

@@ -84,6 +86,72 @@ def retrieve(
8486
cast_to=OrganizationSchemaPublic,
8587
)
8688

89+
def list_members(
90+
self,
91+
organization_id: str,
92+
*,
93+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
94+
# The extra values given here take precedence over values defined on the client or passed to this method.
95+
extra_headers: Headers | None = None,
96+
extra_query: Query | None = None,
97+
extra_body: Body | None = None,
98+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
99+
) -> OrganizationListMembersResponse:
100+
"""
101+
Get a list of organization members with their names and emails.
102+
103+
Args:
104+
extra_headers: Send extra headers
105+
106+
extra_query: Add additional query parameters to the request
107+
108+
extra_body: Add additional JSON properties to the request
109+
110+
timeout: Override the client-level default timeout for this request, in seconds
111+
"""
112+
if not organization_id:
113+
raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}")
114+
return self._get(
115+
f"/api/organizations/{organization_id}/members",
116+
options=make_request_options(
117+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
118+
),
119+
cast_to=OrganizationListMembersResponse,
120+
)
121+
122+
def retrieve_permissions(
123+
self,
124+
organization_id: str,
125+
*,
126+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
127+
# The extra values given here take precedence over values defined on the client or passed to this method.
128+
extra_headers: Headers | None = None,
129+
extra_query: Query | None = None,
130+
extra_body: Body | None = None,
131+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
132+
) -> OrganizationRetrievePermissionsResponse:
133+
"""
134+
Get the user's permissions for this organization.
135+
136+
Args:
137+
extra_headers: Send extra headers
138+
139+
extra_query: Add additional query parameters to the request
140+
141+
extra_body: Add additional JSON properties to the request
142+
143+
timeout: Override the client-level default timeout for this request, in seconds
144+
"""
145+
if not organization_id:
146+
raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}")
147+
return self._get(
148+
f"/api/organizations/{organization_id}/permissions",
149+
options=make_request_options(
150+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
151+
),
152+
cast_to=OrganizationRetrievePermissionsResponse,
153+
)
154+
87155

88156
class AsyncOrganizationsResource(AsyncAPIResource):
89157
@cached_property
@@ -142,6 +210,72 @@ async def retrieve(
142210
cast_to=OrganizationSchemaPublic,
143211
)
144212

213+
async def list_members(
214+
self,
215+
organization_id: str,
216+
*,
217+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
218+
# The extra values given here take precedence over values defined on the client or passed to this method.
219+
extra_headers: Headers | None = None,
220+
extra_query: Query | None = None,
221+
extra_body: Body | None = None,
222+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
223+
) -> OrganizationListMembersResponse:
224+
"""
225+
Get a list of organization members with their names and emails.
226+
227+
Args:
228+
extra_headers: Send extra headers
229+
230+
extra_query: Add additional query parameters to the request
231+
232+
extra_body: Add additional JSON properties to the request
233+
234+
timeout: Override the client-level default timeout for this request, in seconds
235+
"""
236+
if not organization_id:
237+
raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}")
238+
return await self._get(
239+
f"/api/organizations/{organization_id}/members",
240+
options=make_request_options(
241+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
242+
),
243+
cast_to=OrganizationListMembersResponse,
244+
)
245+
246+
async def retrieve_permissions(
247+
self,
248+
organization_id: str,
249+
*,
250+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
251+
# The extra values given here take precedence over values defined on the client or passed to this method.
252+
extra_headers: Headers | None = None,
253+
extra_query: Query | None = None,
254+
extra_body: Body | None = None,
255+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
256+
) -> OrganizationRetrievePermissionsResponse:
257+
"""
258+
Get the user's permissions for this organization.
259+
260+
Args:
261+
extra_headers: Send extra headers
262+
263+
extra_query: Add additional query parameters to the request
264+
265+
extra_body: Add additional JSON properties to the request
266+
267+
timeout: Override the client-level default timeout for this request, in seconds
268+
"""
269+
if not organization_id:
270+
raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}")
271+
return await self._get(
272+
f"/api/organizations/{organization_id}/permissions",
273+
options=make_request_options(
274+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
275+
),
276+
cast_to=OrganizationRetrievePermissionsResponse,
277+
)
278+
145279

146280
class OrganizationsResourceWithRawResponse:
147281
def __init__(self, organizations: OrganizationsResource) -> None:
@@ -150,6 +284,12 @@ def __init__(self, organizations: OrganizationsResource) -> None:
150284
self.retrieve = to_raw_response_wrapper(
151285
organizations.retrieve,
152286
)
287+
self.list_members = to_raw_response_wrapper(
288+
organizations.list_members,
289+
)
290+
self.retrieve_permissions = to_raw_response_wrapper(
291+
organizations.retrieve_permissions,
292+
)
153293

154294
@cached_property
155295
def billing(self) -> BillingResourceWithRawResponse:
@@ -163,6 +303,12 @@ def __init__(self, organizations: AsyncOrganizationsResource) -> None:
163303
self.retrieve = async_to_raw_response_wrapper(
164304
organizations.retrieve,
165305
)
306+
self.list_members = async_to_raw_response_wrapper(
307+
organizations.list_members,
308+
)
309+
self.retrieve_permissions = async_to_raw_response_wrapper(
310+
organizations.retrieve_permissions,
311+
)
166312

167313
@cached_property
168314
def billing(self) -> AsyncBillingResourceWithRawResponse:
@@ -176,6 +322,12 @@ def __init__(self, organizations: OrganizationsResource) -> None:
176322
self.retrieve = to_streamed_response_wrapper(
177323
organizations.retrieve,
178324
)
325+
self.list_members = to_streamed_response_wrapper(
326+
organizations.list_members,
327+
)
328+
self.retrieve_permissions = to_streamed_response_wrapper(
329+
organizations.retrieve_permissions,
330+
)
179331

180332
@cached_property
181333
def billing(self) -> BillingResourceWithStreamingResponse:
@@ -189,6 +341,12 @@ def __init__(self, organizations: AsyncOrganizationsResource) -> None:
189341
self.retrieve = async_to_streamed_response_wrapper(
190342
organizations.retrieve,
191343
)
344+
self.list_members = async_to_streamed_response_wrapper(
345+
organizations.list_members,
346+
)
347+
self.retrieve_permissions = async_to_streamed_response_wrapper(
348+
organizations.retrieve_permissions,
349+
)
192350

193351
@cached_property
194352
def billing(self) -> AsyncBillingResourceWithStreamingResponse:

0 commit comments

Comments
 (0)