Skip to content
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.37.0"
".": "2.38.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 233
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-50d816559ef0935e64d07789ff936a2b762e26ab0714a2fa6bc06d06d4484294.yml
openapi_spec_hash: c5d8f37edbf66c1fef627d787b4c54fd
config_hash: b64135fff1fe9cf4069b9ecf59ae8b07
configured_endpoints: 262
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-afacc4343d0efc074c8c5667eb83570642c8b9acaa7792ca8e075c6d18ef9f3a.yml
openapi_spec_hash: a62a557c61532681963fd21e748b0eb4
config_hash: bb69d8d0771dbac4a84fc6dca11e3ceb
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 2.38.0 (2026-05-21)

Full Changelog: [v2.37.0...v2.38.0](https://github.com/openai/openai-python/compare/v2.37.0...v2.38.0)

### Features

* **api:** api update ([33d1d01](https://github.com/openai/openai-python/commit/33d1d013250053886a73d178136e6bd1b09df059))
* **api:** manual updates ([a21700a](https://github.com/openai/openai-python/commit/a21700a2cd510cb9e6c88065ac8e942d4c041aa8))
* **api:** update OpenAPI spec or Stainless config ([00265c5](https://github.com/openai/openai-python/commit/00265c5daba4d2481452ad35220f1556dab6bcf6))


### Chores

* **api:** docs updates ([ee10152](https://github.com/openai/openai-python/commit/ee101520d49e22c09cf8096f8cbb3848ea58a1f9))
* check release PR custom code sync ([2638779](https://github.com/openai/openai-python/commit/2638779a5b8fffaa8fdb6eebc1d734f15d2491f8))
* remove release automation trigger ([bd6eea5](https://github.com/openai/openai-python/commit/bd6eea559f2996d914258a65e645981bdce3cad4))
* trigger release automation ([f62d082](https://github.com/openai/openai-python/commit/f62d08201eea8e08d4bb3385662f934d4adccb29))

## 2.37.0 (2026-05-13)

Full Changelog: [v2.36.0...v2.37.0](https://github.com/openai/openai-python/compare/v2.36.0...v2.37.0)
Expand Down
105 changes: 105 additions & 0 deletions api.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openai"
version = "2.37.0"
version = "2.38.0"
description = "The official Python library for the openai API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/openai/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "openai"
__version__ = "2.37.0" # x-release-please-version
__version__ = "2.38.0" # x-release-please-version
28 changes: 28 additions & 0 deletions src/openai/resources/admin/organization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@
OrganizationWithStreamingResponse,
AsyncOrganizationWithStreamingResponse,
)
from .spend_alerts import (
SpendAlerts,
AsyncSpendAlerts,
SpendAlertsWithRawResponse,
AsyncSpendAlertsWithRawResponse,
SpendAlertsWithStreamingResponse,
AsyncSpendAlertsWithStreamingResponse,
)
from .admin_api_keys import (
AdminAPIKeys,
AsyncAdminAPIKeys,
Expand All @@ -80,6 +88,14 @@
AdminAPIKeysWithStreamingResponse,
AsyncAdminAPIKeysWithStreamingResponse,
)
from .data_retention import (
DataRetention,
AsyncDataRetention,
DataRetentionWithRawResponse,
AsyncDataRetentionWithRawResponse,
DataRetentionWithStreamingResponse,
AsyncDataRetentionWithStreamingResponse,
)

__all__ = [
"AuditLogs",
Expand Down Expand Up @@ -124,6 +140,18 @@
"AsyncRolesWithRawResponse",
"RolesWithStreamingResponse",
"AsyncRolesWithStreamingResponse",
"DataRetention",
"AsyncDataRetention",
"DataRetentionWithRawResponse",
"AsyncDataRetentionWithRawResponse",
"DataRetentionWithStreamingResponse",
"AsyncDataRetentionWithStreamingResponse",
"SpendAlerts",
"AsyncSpendAlerts",
"SpendAlertsWithRawResponse",
"AsyncSpendAlertsWithRawResponse",
"SpendAlertsWithStreamingResponse",
"AsyncSpendAlertsWithStreamingResponse",
"Certificates",
"AsyncCertificates",
"CertificatesWithRawResponse",
Expand Down
245 changes: 245 additions & 0 deletions src/openai/resources/admin/organization/data_retention.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal

import httpx

from .... import _legacy_response
from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ...._base_client import make_request_options
from ....types.admin.organization import data_retention_update_params
from ....types.admin.organization.organization_data_retention import OrganizationDataRetention

__all__ = ["DataRetention", "AsyncDataRetention"]


class DataRetention(SyncAPIResource):
@cached_property
def with_raw_response(self) -> DataRetentionWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
"""
return DataRetentionWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> DataRetentionWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
"""
return DataRetentionWithStreamingResponse(self)

def retrieve(
self,
*,
# 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,
) -> OrganizationDataRetention:
"""Retrieves organization data retention controls."""
return self._get(
"/organization/data_retention",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
security={"admin_api_key_auth": True},
),
cast_to=OrganizationDataRetention,
)

def update(
self,
*,
retention_type: Literal[
"zero_data_retention",
"modified_abuse_monitoring",
"enhanced_zero_data_retention",
"enhanced_modified_abuse_monitoring",
],
# 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,
) -> OrganizationDataRetention:
"""
Updates organization data retention controls.

Args:
retention_type: The desired organization data retention type.

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
"""
return self._post(
"/organization/data_retention",
body=maybe_transform(
{"retention_type": retention_type}, data_retention_update_params.DataRetentionUpdateParams
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
security={"admin_api_key_auth": True},
),
cast_to=OrganizationDataRetention,
)


class AsyncDataRetention(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncDataRetentionWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
"""
return AsyncDataRetentionWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncDataRetentionWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
"""
return AsyncDataRetentionWithStreamingResponse(self)

async def retrieve(
self,
*,
# 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,
) -> OrganizationDataRetention:
"""Retrieves organization data retention controls."""
return await self._get(
"/organization/data_retention",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
security={"admin_api_key_auth": True},
),
cast_to=OrganizationDataRetention,
)

async def update(
self,
*,
retention_type: Literal[
"zero_data_retention",
"modified_abuse_monitoring",
"enhanced_zero_data_retention",
"enhanced_modified_abuse_monitoring",
],
# 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,
) -> OrganizationDataRetention:
"""
Updates organization data retention controls.

Args:
retention_type: The desired organization data retention type.

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
"""
return await self._post(
"/organization/data_retention",
body=await async_maybe_transform(
{"retention_type": retention_type}, data_retention_update_params.DataRetentionUpdateParams
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
security={"admin_api_key_auth": True},
),
cast_to=OrganizationDataRetention,
)


class DataRetentionWithRawResponse:
def __init__(self, data_retention: DataRetention) -> None:
self._data_retention = data_retention

self.retrieve = _legacy_response.to_raw_response_wrapper(
data_retention.retrieve,
)
self.update = _legacy_response.to_raw_response_wrapper(
data_retention.update,
)


class AsyncDataRetentionWithRawResponse:
def __init__(self, data_retention: AsyncDataRetention) -> None:
self._data_retention = data_retention

self.retrieve = _legacy_response.async_to_raw_response_wrapper(
data_retention.retrieve,
)
self.update = _legacy_response.async_to_raw_response_wrapper(
data_retention.update,
)


class DataRetentionWithStreamingResponse:
def __init__(self, data_retention: DataRetention) -> None:
self._data_retention = data_retention

self.retrieve = to_streamed_response_wrapper(
data_retention.retrieve,
)
self.update = to_streamed_response_wrapper(
data_retention.update,
)


class AsyncDataRetentionWithStreamingResponse:
def __init__(self, data_retention: AsyncDataRetention) -> None:
self._data_retention = data_retention

self.retrieve = async_to_streamed_response_wrapper(
data_retention.retrieve,
)
self.update = async_to_streamed_response_wrapper(
data_retention.update,
)
Loading
Loading