Skip to content

Commit 44287dc

Browse files
feat(api): add missing endpoints
1 parent 67ae717 commit 44287dc

23 files changed

+1857
-3
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: 19
1+
configured_endpoints: 24
22
openapi_spec_hash: 68055a774f3305fb11efa5b5b5881446
3-
config_hash: 00442fdab71911b02ab1e10f9ec05b79
3+
config_hash: f0743196c68fb84cbd06a95f134702b3

api.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,44 @@ Methods:
5151
- <code title="put /projects/{projectId}/tests">client.projects.tests.<a href="./src/openlayer/resources/projects/tests.py">update</a>(project_id, \*\*<a href="src/openlayer/types/projects/test_update_params.py">params</a>) -> <a href="./src/openlayer/types/projects/test_update_response.py">TestUpdateResponse</a></code>
5252
- <code title="get /projects/{projectId}/tests">client.projects.tests.<a href="./src/openlayer/resources/projects/tests.py">list</a>(project_id, \*\*<a href="src/openlayer/types/projects/test_list_params.py">params</a>) -> <a href="./src/openlayer/types/projects/test_list_response.py">TestListResponse</a></code>
5353

54+
# Workspaces
55+
56+
Types:
57+
58+
```python
59+
from openlayer.types import WorkspaceRetrieveResponse, WorkspaceUpdateResponse
60+
```
61+
62+
Methods:
63+
64+
- <code title="get /workspaces/{workspaceId}">client.workspaces.<a href="./src/openlayer/resources/workspaces/workspaces.py">retrieve</a>(workspace_id) -> <a href="./src/openlayer/types/workspace_retrieve_response.py">WorkspaceRetrieveResponse</a></code>
65+
- <code title="put /workspaces/{workspaceId}">client.workspaces.<a href="./src/openlayer/resources/workspaces/workspaces.py">update</a>(workspace_id, \*\*<a href="src/openlayer/types/workspace_update_params.py">params</a>) -> <a href="./src/openlayer/types/workspace_update_response.py">WorkspaceUpdateResponse</a></code>
66+
67+
## Invites
68+
69+
Types:
70+
71+
```python
72+
from openlayer.types.workspaces import InviteCreateResponse, InviteListResponse
73+
```
74+
75+
Methods:
76+
77+
- <code title="post /workspaces/{workspaceId}/invites">client.workspaces.invites.<a href="./src/openlayer/resources/workspaces/invites.py">create</a>(workspace_id, \*\*<a href="src/openlayer/types/workspaces/invite_create_params.py">params</a>) -> <a href="./src/openlayer/types/workspaces/invite_create_response.py">InviteCreateResponse</a></code>
78+
- <code title="get /workspaces/{workspaceId}/invites">client.workspaces.invites.<a href="./src/openlayer/resources/workspaces/invites.py">list</a>(workspace_id, \*\*<a href="src/openlayer/types/workspaces/invite_list_params.py">params</a>) -> <a href="./src/openlayer/types/workspaces/invite_list_response.py">InviteListResponse</a></code>
79+
80+
## APIKeys
81+
82+
Types:
83+
84+
```python
85+
from openlayer.types.workspaces import APIKeyCreateResponse
86+
```
87+
88+
Methods:
89+
90+
- <code title="post /workspaces/{workspaceId}/api-keys">client.workspaces.api_keys.<a href="./src/openlayer/resources/workspaces/api_keys.py">create</a>(workspace_id, \*\*<a href="src/openlayer/types/workspaces/api_key_create_params.py">params</a>) -> <a href="./src/openlayer/types/workspaces/api_key_create_response.py">APIKeyCreateResponse</a></code>
91+
5492
# Commits
5593

5694
Types:

src/openlayer/_client.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@
3232
)
3333

3434
if TYPE_CHECKING:
35-
from .resources import tests, commits, storage, projects, inference_pipelines
35+
from .resources import tests, commits, storage, projects, workspaces, inference_pipelines
3636
from .resources.tests import TestsResource, AsyncTestsResource
3737
from .resources.commits.commits import CommitsResource, AsyncCommitsResource
3838
from .resources.storage.storage import StorageResource, AsyncStorageResource
3939
from .resources.projects.projects import ProjectsResource, AsyncProjectsResource
40+
from .resources.workspaces.workspaces import WorkspacesResource, AsyncWorkspacesResource
4041
from .resources.inference_pipelines.inference_pipelines import (
4142
InferencePipelinesResource,
4243
AsyncInferencePipelinesResource,
@@ -111,6 +112,12 @@ def projects(self) -> ProjectsResource:
111112

112113
return ProjectsResource(self)
113114

115+
@cached_property
116+
def workspaces(self) -> WorkspacesResource:
117+
from .resources.workspaces import WorkspacesResource
118+
119+
return WorkspacesResource(self)
120+
114121
@cached_property
115122
def commits(self) -> CommitsResource:
116123
from .resources.commits import CommitsResource
@@ -316,6 +323,12 @@ def projects(self) -> AsyncProjectsResource:
316323

317324
return AsyncProjectsResource(self)
318325

326+
@cached_property
327+
def workspaces(self) -> AsyncWorkspacesResource:
328+
from .resources.workspaces import AsyncWorkspacesResource
329+
330+
return AsyncWorkspacesResource(self)
331+
319332
@cached_property
320333
def commits(self) -> AsyncCommitsResource:
321334
from .resources.commits import AsyncCommitsResource
@@ -476,6 +489,12 @@ def projects(self) -> projects.ProjectsResourceWithRawResponse:
476489

477490
return ProjectsResourceWithRawResponse(self._client.projects)
478491

492+
@cached_property
493+
def workspaces(self) -> workspaces.WorkspacesResourceWithRawResponse:
494+
from .resources.workspaces import WorkspacesResourceWithRawResponse
495+
496+
return WorkspacesResourceWithRawResponse(self._client.workspaces)
497+
479498
@cached_property
480499
def commits(self) -> commits.CommitsResourceWithRawResponse:
481500
from .resources.commits import CommitsResourceWithRawResponse
@@ -513,6 +532,12 @@ def projects(self) -> projects.AsyncProjectsResourceWithRawResponse:
513532

514533
return AsyncProjectsResourceWithRawResponse(self._client.projects)
515534

535+
@cached_property
536+
def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithRawResponse:
537+
from .resources.workspaces import AsyncWorkspacesResourceWithRawResponse
538+
539+
return AsyncWorkspacesResourceWithRawResponse(self._client.workspaces)
540+
516541
@cached_property
517542
def commits(self) -> commits.AsyncCommitsResourceWithRawResponse:
518543
from .resources.commits import AsyncCommitsResourceWithRawResponse
@@ -550,6 +575,12 @@ def projects(self) -> projects.ProjectsResourceWithStreamingResponse:
550575

551576
return ProjectsResourceWithStreamingResponse(self._client.projects)
552577

578+
@cached_property
579+
def workspaces(self) -> workspaces.WorkspacesResourceWithStreamingResponse:
580+
from .resources.workspaces import WorkspacesResourceWithStreamingResponse
581+
582+
return WorkspacesResourceWithStreamingResponse(self._client.workspaces)
583+
553584
@cached_property
554585
def commits(self) -> commits.CommitsResourceWithStreamingResponse:
555586
from .resources.commits import CommitsResourceWithStreamingResponse
@@ -587,6 +618,12 @@ def projects(self) -> projects.AsyncProjectsResourceWithStreamingResponse:
587618

588619
return AsyncProjectsResourceWithStreamingResponse(self._client.projects)
589620

621+
@cached_property
622+
def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithStreamingResponse:
623+
from .resources.workspaces import AsyncWorkspacesResourceWithStreamingResponse
624+
625+
return AsyncWorkspacesResourceWithStreamingResponse(self._client.workspaces)
626+
590627
@cached_property
591628
def commits(self) -> commits.AsyncCommitsResourceWithStreamingResponse:
592629
from .resources.commits import AsyncCommitsResourceWithStreamingResponse

src/openlayer/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
ProjectsResourceWithStreamingResponse,
3333
AsyncProjectsResourceWithStreamingResponse,
3434
)
35+
from .workspaces import (
36+
WorkspacesResource,
37+
AsyncWorkspacesResource,
38+
WorkspacesResourceWithRawResponse,
39+
AsyncWorkspacesResourceWithRawResponse,
40+
WorkspacesResourceWithStreamingResponse,
41+
AsyncWorkspacesResourceWithStreamingResponse,
42+
)
3543
from .inference_pipelines import (
3644
InferencePipelinesResource,
3745
AsyncInferencePipelinesResource,
@@ -48,6 +56,12 @@
4856
"AsyncProjectsResourceWithRawResponse",
4957
"ProjectsResourceWithStreamingResponse",
5058
"AsyncProjectsResourceWithStreamingResponse",
59+
"WorkspacesResource",
60+
"AsyncWorkspacesResource",
61+
"WorkspacesResourceWithRawResponse",
62+
"AsyncWorkspacesResourceWithRawResponse",
63+
"WorkspacesResourceWithStreamingResponse",
64+
"AsyncWorkspacesResourceWithStreamingResponse",
5165
"CommitsResource",
5266
"AsyncCommitsResource",
5367
"CommitsResourceWithRawResponse",
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .invites import (
4+
InvitesResource,
5+
AsyncInvitesResource,
6+
InvitesResourceWithRawResponse,
7+
AsyncInvitesResourceWithRawResponse,
8+
InvitesResourceWithStreamingResponse,
9+
AsyncInvitesResourceWithStreamingResponse,
10+
)
11+
from .api_keys import (
12+
APIKeysResource,
13+
AsyncAPIKeysResource,
14+
APIKeysResourceWithRawResponse,
15+
AsyncAPIKeysResourceWithRawResponse,
16+
APIKeysResourceWithStreamingResponse,
17+
AsyncAPIKeysResourceWithStreamingResponse,
18+
)
19+
from .workspaces import (
20+
WorkspacesResource,
21+
AsyncWorkspacesResource,
22+
WorkspacesResourceWithRawResponse,
23+
AsyncWorkspacesResourceWithRawResponse,
24+
WorkspacesResourceWithStreamingResponse,
25+
AsyncWorkspacesResourceWithStreamingResponse,
26+
)
27+
28+
__all__ = [
29+
"InvitesResource",
30+
"AsyncInvitesResource",
31+
"InvitesResourceWithRawResponse",
32+
"AsyncInvitesResourceWithRawResponse",
33+
"InvitesResourceWithStreamingResponse",
34+
"AsyncInvitesResourceWithStreamingResponse",
35+
"APIKeysResource",
36+
"AsyncAPIKeysResource",
37+
"APIKeysResourceWithRawResponse",
38+
"AsyncAPIKeysResourceWithRawResponse",
39+
"APIKeysResourceWithStreamingResponse",
40+
"AsyncAPIKeysResourceWithStreamingResponse",
41+
"WorkspacesResource",
42+
"AsyncWorkspacesResource",
43+
"WorkspacesResourceWithRawResponse",
44+
"AsyncWorkspacesResourceWithRawResponse",
45+
"WorkspacesResourceWithStreamingResponse",
46+
"AsyncWorkspacesResourceWithStreamingResponse",
47+
]
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
7+
import httpx
8+
9+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10+
from ..._utils import maybe_transform, async_maybe_transform
11+
from ..._compat import cached_property
12+
from ..._resource import SyncAPIResource, AsyncAPIResource
13+
from ..._response import (
14+
to_raw_response_wrapper,
15+
to_streamed_response_wrapper,
16+
async_to_raw_response_wrapper,
17+
async_to_streamed_response_wrapper,
18+
)
19+
from ..._base_client import make_request_options
20+
from ...types.workspaces import api_key_create_params
21+
from ...types.workspaces.api_key_create_response import APIKeyCreateResponse
22+
23+
__all__ = ["APIKeysResource", "AsyncAPIKeysResource"]
24+
25+
26+
class APIKeysResource(SyncAPIResource):
27+
@cached_property
28+
def with_raw_response(self) -> APIKeysResourceWithRawResponse:
29+
"""
30+
This property can be used as a prefix for any HTTP method call to return
31+
the raw response object instead of the parsed content.
32+
33+
For more information, see https://www.github.com/openlayer-ai/openlayer-python#accessing-raw-response-data-eg-headers
34+
"""
35+
return APIKeysResourceWithRawResponse(self)
36+
37+
@cached_property
38+
def with_streaming_response(self) -> APIKeysResourceWithStreamingResponse:
39+
"""
40+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41+
42+
For more information, see https://www.github.com/openlayer-ai/openlayer-python#with_streaming_response
43+
"""
44+
return APIKeysResourceWithStreamingResponse(self)
45+
46+
def create(
47+
self,
48+
workspace_id: str,
49+
*,
50+
name: Optional[str] | Omit = omit,
51+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
52+
# The extra values given here take precedence over values defined on the client or passed to this method.
53+
extra_headers: Headers | None = None,
54+
extra_query: Query | None = None,
55+
extra_body: Body | None = None,
56+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
57+
) -> APIKeyCreateResponse:
58+
"""
59+
Create a new API key in a workspace.
60+
61+
Args:
62+
name: The API key name.
63+
64+
extra_headers: Send extra headers
65+
66+
extra_query: Add additional query parameters to the request
67+
68+
extra_body: Add additional JSON properties to the request
69+
70+
timeout: Override the client-level default timeout for this request, in seconds
71+
"""
72+
if not workspace_id:
73+
raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
74+
return self._post(
75+
f"/workspaces/{workspace_id}/api-keys",
76+
body=maybe_transform({"name": name}, api_key_create_params.APIKeyCreateParams),
77+
options=make_request_options(
78+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
79+
),
80+
cast_to=APIKeyCreateResponse,
81+
)
82+
83+
84+
class AsyncAPIKeysResource(AsyncAPIResource):
85+
@cached_property
86+
def with_raw_response(self) -> AsyncAPIKeysResourceWithRawResponse:
87+
"""
88+
This property can be used as a prefix for any HTTP method call to return
89+
the raw response object instead of the parsed content.
90+
91+
For more information, see https://www.github.com/openlayer-ai/openlayer-python#accessing-raw-response-data-eg-headers
92+
"""
93+
return AsyncAPIKeysResourceWithRawResponse(self)
94+
95+
@cached_property
96+
def with_streaming_response(self) -> AsyncAPIKeysResourceWithStreamingResponse:
97+
"""
98+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
99+
100+
For more information, see https://www.github.com/openlayer-ai/openlayer-python#with_streaming_response
101+
"""
102+
return AsyncAPIKeysResourceWithStreamingResponse(self)
103+
104+
async def create(
105+
self,
106+
workspace_id: str,
107+
*,
108+
name: Optional[str] | Omit = omit,
109+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
110+
# The extra values given here take precedence over values defined on the client or passed to this method.
111+
extra_headers: Headers | None = None,
112+
extra_query: Query | None = None,
113+
extra_body: Body | None = None,
114+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
115+
) -> APIKeyCreateResponse:
116+
"""
117+
Create a new API key in a workspace.
118+
119+
Args:
120+
name: The API key name.
121+
122+
extra_headers: Send extra headers
123+
124+
extra_query: Add additional query parameters to the request
125+
126+
extra_body: Add additional JSON properties to the request
127+
128+
timeout: Override the client-level default timeout for this request, in seconds
129+
"""
130+
if not workspace_id:
131+
raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
132+
return await self._post(
133+
f"/workspaces/{workspace_id}/api-keys",
134+
body=await async_maybe_transform({"name": name}, api_key_create_params.APIKeyCreateParams),
135+
options=make_request_options(
136+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
137+
),
138+
cast_to=APIKeyCreateResponse,
139+
)
140+
141+
142+
class APIKeysResourceWithRawResponse:
143+
def __init__(self, api_keys: APIKeysResource) -> None:
144+
self._api_keys = api_keys
145+
146+
self.create = to_raw_response_wrapper(
147+
api_keys.create,
148+
)
149+
150+
151+
class AsyncAPIKeysResourceWithRawResponse:
152+
def __init__(self, api_keys: AsyncAPIKeysResource) -> None:
153+
self._api_keys = api_keys
154+
155+
self.create = async_to_raw_response_wrapper(
156+
api_keys.create,
157+
)
158+
159+
160+
class APIKeysResourceWithStreamingResponse:
161+
def __init__(self, api_keys: APIKeysResource) -> None:
162+
self._api_keys = api_keys
163+
164+
self.create = to_streamed_response_wrapper(
165+
api_keys.create,
166+
)
167+
168+
169+
class AsyncAPIKeysResourceWithStreamingResponse:
170+
def __init__(self, api_keys: AsyncAPIKeysResource) -> None:
171+
self._api_keys = api_keys
172+
173+
self.create = async_to_streamed_response_wrapper(
174+
api_keys.create,
175+
)

0 commit comments

Comments
 (0)