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

feat(api): manual updates #364

Merged
merged 1 commit into from
Oct 31, 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
13 changes: 2 additions & 11 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ Methods:
Types:

```python
from openlayer.types.projects import CommitListResponse
from openlayer.types.projects import CommitCreateResponse, CommitListResponse
```

Methods:

- <code title="post /projects/{projectId}/versions">client.projects.commits.<a href="./src/openlayer/resources/projects/commits.py">create</a>(project_id, \*\*<a href="src/openlayer/types/projects/commit_create_params.py">params</a>) -> <a href="./src/openlayer/types/projects/commit_create_response.py">CommitCreateResponse</a></code>
- <code title="get /projects/{projectId}/versions">client.projects.commits.<a href="./src/openlayer/resources/projects/commits.py">list</a>(project_id, \*\*<a href="src/openlayer/types/projects/commit_list_params.py">params</a>) -> <a href="./src/openlayer/types/projects/commit_list_response.py">CommitListResponse</a></code>

## InferencePipelines
Expand All @@ -38,16 +39,6 @@ Methods:

# Commits

Types:

```python
from openlayer.types import CommitCreateResponse
```

Methods:

- <code title="post /projects/{projectId}/versions">client.commits.<a href="./src/openlayer/resources/commits/commits.py">create</a>(project_id, \*\*<a href="src/openlayer/types/commit_create_params.py">params</a>) -> <a href="./src/openlayer/types/commit_create_response.py">CommitCreateResponse</a></code>

## TestResults

Types:
Expand Down
142 changes: 0 additions & 142 deletions src/openlayer/resources/commits/commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,8 @@

from __future__ import annotations

from typing import Optional

import httpx

from ...types import commit_create_params
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
maybe_transform,
async_maybe_transform,
)
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .test_results import (
TestResultsResource,
AsyncTestResultsResource,
Expand All @@ -28,8 +12,6 @@
TestResultsResourceWithStreamingResponse,
AsyncTestResultsResourceWithStreamingResponse,
)
from ..._base_client import make_request_options
from ...types.commit_create_response import CommitCreateResponse

__all__ = ["CommitsResource", "AsyncCommitsResource"]

Expand Down Expand Up @@ -58,60 +40,6 @@ def with_streaming_response(self) -> CommitsResourceWithStreamingResponse:
"""
return CommitsResourceWithStreamingResponse(self)

def create(
self,
project_id: str,
*,
commit: commit_create_params.Commit,
storage_uri: str,
archived: Optional[bool] | NotGiven = NOT_GIVEN,
deployment_status: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CommitCreateResponse:
"""
Create a new commit (project version) in a project.

Args:
commit: The details of a commit (project version).

storage_uri: The storage URI where the commit bundle is stored.

archived: Whether the commit is archived.

deployment_status: The deployment status associated with the commit's model.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return self._post(
f"/projects/{project_id}/versions",
body=maybe_transform(
{
"commit": commit,
"storage_uri": storage_uri,
"archived": archived,
"deployment_status": deployment_status,
},
commit_create_params.CommitCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CommitCreateResponse,
)


class AsyncCommitsResource(AsyncAPIResource):
@cached_property
Expand All @@ -137,69 +65,11 @@ def with_streaming_response(self) -> AsyncCommitsResourceWithStreamingResponse:
"""
return AsyncCommitsResourceWithStreamingResponse(self)

async def create(
self,
project_id: str,
*,
commit: commit_create_params.Commit,
storage_uri: str,
archived: Optional[bool] | NotGiven = NOT_GIVEN,
deployment_status: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CommitCreateResponse:
"""
Create a new commit (project version) in a project.

Args:
commit: The details of a commit (project version).

storage_uri: The storage URI where the commit bundle is stored.

archived: Whether the commit is archived.

deployment_status: The deployment status associated with the commit's model.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
return await self._post(
f"/projects/{project_id}/versions",
body=await async_maybe_transform(
{
"commit": commit,
"storage_uri": storage_uri,
"archived": archived,
"deployment_status": deployment_status,
},
commit_create_params.CommitCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CommitCreateResponse,
)


class CommitsResourceWithRawResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits

self.create = to_raw_response_wrapper(
commits.create,
)

@cached_property
def test_results(self) -> TestResultsResourceWithRawResponse:
return TestResultsResourceWithRawResponse(self._commits.test_results)
Expand All @@ -209,10 +79,6 @@ class AsyncCommitsResourceWithRawResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits

self.create = async_to_raw_response_wrapper(
commits.create,
)

@cached_property
def test_results(self) -> AsyncTestResultsResourceWithRawResponse:
return AsyncTestResultsResourceWithRawResponse(self._commits.test_results)
Expand All @@ -222,10 +88,6 @@ class CommitsResourceWithStreamingResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits

self.create = to_streamed_response_wrapper(
commits.create,
)

@cached_property
def test_results(self) -> TestResultsResourceWithStreamingResponse:
return TestResultsResourceWithStreamingResponse(self._commits.test_results)
Expand All @@ -235,10 +97,6 @@ class AsyncCommitsResourceWithStreamingResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits

self.create = async_to_streamed_response_wrapper(
commits.create,
)

@cached_property
def test_results(self) -> AsyncTestResultsResourceWithStreamingResponse:
return AsyncTestResultsResourceWithStreamingResponse(self._commits.test_results)
Loading