From 34b25338de94f693b44becff3c643689ea230f42 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Tue, 24 Nov 2026 08:01:34 +0000 Subject: [PATCH 1/7] feat(api)!: update SDK surface (7 changes) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - method-name POST video/assets/{p}/thumbnail — method names differ (breaking: renamed; the old spelling no longer resolves) - path-params POST video/assets/{p}/thumbnail — path parameter missing on one side (breaking: changed in a way existing callers can observe) - request-shape POST video/assets/{p}/thumbnail.file — field only in after (breaking: new required request member; existing calls lack it) - types-files types/video_asset_thumbnail_upload_response.py — type file only in before (1 member: 0 matched by name and kind elsewhere in after, 1 not found) (breaking: removed; video_asset_upload_thumbnail_file_response.py appeared in its place, likely a rename) - types-classes types/__init__.py:VideoAssetThumbnailUploadResponse — reexport only in before (breaking: removed; VideoAssetUploadThumbnailFileResponse appeared in its place, likely a rename) - types-files types/video_asset_upload_thumbnail_file_response.py — type file only in after (additive: only the new snapshot has it; likely the new name of video_asset_thumbnail_upload_response.py) - types-classes types/__init__.py:VideoAssetUploadThumbnailFileResponse — reexport only in after (additive: only the new snapshot has it; likely the new name of VideoAssetThumbnailUploadResponse) The generator version changed between the two builds, so these changes may come from the generator upgrade rather than from the API description. BREAKING CHANGE: 5 breaking changes to the SDK surface. - method-name POST video/assets/{p}/thumbnail — method names differ (breaking: renamed; the old spelling no longer resolves) - path-params POST video/assets/{p}/thumbnail — path parameter missing on one side (breaking: changed in a way existing callers can observe) - request-shape POST video/assets/{p}/thumbnail.file — field only in after (breaking: new required request member; existing calls lack it) - types-files types/video_asset_thumbnail_upload_response.py — type file only in before (1 member: 0 matched by name and kind elsewhere in after, 1 not found) (breaking: removed; video_asset_upload_thumbnail_file_response.py appeared in its place, likely a rename) - types-classes types/__init__.py:VideoAssetThumbnailUploadResponse — reexport only in before (breaking: removed; VideoAssetUploadThumbnailFileResponse appeared in its place, likely a rename) Build: gILgma7wiqkdqDBGhULTC --- README.md | 15 + api.md | 40 +- scalar-sdk.manifest.json | 214 +++--- src/gumlet/__init__.py | 4 + src/gumlet/_base_client.py | 22 +- src/gumlet/_exceptions.py | 14 + src/gumlet/_signed_upload.py | 675 ++++++++++++++++++ src/gumlet/_version.py | 2 +- src/gumlet/_webhook_verify.py | 110 ++- src/gumlet/resources/video_assets.py | 252 +++---- src/gumlet/resources/webhooks.py | 9 +- src/gumlet/types/__init__.py | 6 +- ...o_asset_upload_thumbnail_file_response.py} | 4 +- tests/api_resources/test_video_assets.py | 9 - tests/smoke_support.py | 2 +- 15 files changed, 1070 insertions(+), 308 deletions(-) create mode 100644 src/gumlet/_signed_upload.py rename src/gumlet/types/{video_asset_thumbnail_upload_response.py => video_asset_upload_thumbnail_file_response.py} (80%) diff --git a/README.md b/README.md index 4a3fc88..5f6db9e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The REST API documentation can be found on [docs.gumlet.com](https://docs.gumlet - [Usage](#usage) - [API Reference](./api.md) - [Async](#async) +- [File uploads](#file-uploads) - [Authentication](#authentication) - [Errors](#errors) - [Client Options](#client-options) @@ -85,6 +86,20 @@ asyncio.run(main())
+## File uploads + +Some methods upload a file to a pre-signed URL the API returns, usually on another host, then confirm the upload where the API asks for that. The upload goes out on a short-lived HTTP client of its own, carrying only the file, its content type and the headers the API named for it: none of the client's credentials, default headers, default query or cookies, and none of the `auth`, headers, cookies, params or event hooks of a custom `http_client`. The client's retries and timeout apply. The upload URL must be `https:` (plain `http:` only to this machine), and a redirect from the upload host is refused rather than followed. + +Without an `http_client`, the upload goes out on httpx's defaults: it takes its proxy and CA settings from the environment (`HTTPS_PROXY`, `SSL_CERT_FILE` and the like) when it is sent. With one you pass, the upload uses that client's proxy and TLS settings — `proxy=`, `mounts=`, `verify=` (`verify=False` included) and `cert=`, so a corporate proxy or a private CA works for uploads too, and a client certificate is presented to the upload host — when the transport the client would send the upload URL through is httpx's own `httpx.HTTPTransport` (`httpx.AsyncHTTPTransport` on the async client). Any other transport class, such as a subclass of your own or `DefaultAioHttpClient`'s, sends the request itself and could add headers, credentials or cookies, so with one the upload falls back to httpx's defaults as if no `http_client` were passed. So does an httpx transport bound to a Unix socket (`uds=`). + +When your proxy or TLS setup lives only in a transport class of your own, opt that transport in by inheriting `SignedUploadTransport` (`from gumlet import SignedUploadTransport`), as in `class CorporateTransport(SignedUploadTransport, httpx.HTTPTransport)`. Inheriting it declares that the transport sends a request as handed over: it adds no credentials, cookies or headers of its own, keeps no session or cookie jar that would, is bound to no Unix socket, follows no redirects and honours the timeout httpx hands it with each request, which is the only way the upload's timeout reaches it. The upload then goes through it, still carrying only the file, its type and the headers the API named. The SDK checks the marker, not what it promises, and reads it off the transport the client routes the upload URL to, so a wrapper around another transport has to inherit it itself. + +The same goes the other way: an `http_client` that trusts only a private CA, or whose proxy reaches only the API, applies that to the upload host too. Mount the transport the upload host needs, such as `mounts={"https://uploads.example.com": httpx.HTTPTransport()}` (`httpx.AsyncHTTPTransport()` on the async client) for httpx's default CA bundle and no proxy, and the upload uses that mount. + +A transport the upload borrows this way is used as the client built it. Its proxy routing and its trusted CAs are the ones the client settled on when it was created, environment variables included, as for its API calls, so a change to `HTTPS_PROXY`, `NO_PROXY`, `SSL_CERT_FILE` or `SSL_CERT_DIR` after that does not reach the upload. The upload also takes a connection from the client's pool, so it counts against the client's `limits` and, when the pool is full, waits for a free connection within its timeout like any other request. The timeout counts time without progress while the file goes out, but once the operating system has accepted the last of it, the wait for the upload host's answer is a single read. On a slow link that read can include the seconds the system still needs to send what it buffered, so keep an upload's timeout well above a few seconds. + +
+ ## Authentication Pass credentials to the generated client constructor. Environment variables are read automatically when supported by the target runtime. diff --git a/api.md b/api.md index 28bf1b1..c0acafb 100644 --- a/api.md +++ b/api.md @@ -11,13 +11,13 @@ Complete reference of every operation, grouped by resource. See [the README](./R - [Delete Asset](#delete-asset) - [Update Asset](#update-asset) - [Update thumbnail from video](#update-thumbnail-from-video) - - [Update thumbnail via upload](#update-thumbnail-via-upload) - [Create/Update Video Asset Chapters](#createupdate-video-asset-chapters) - [List Assets (Deprecated)](#list-assets-deprecated) - [List Assets](#list-assets) - [Bulk Delete](#bulk-delete) - [Bulk Tag](#bulk-tag) - [Asset Analytics](#asset-analytics) + - [Upload a thumbnail file](#upload-a-thumbnail-file) - [`SubtitleUpload`](#subtitleupload) - [Upload Subtitles](#upload-subtitles) - [Complete Subtitle Upload](#complete-subtitle-upload) @@ -250,28 +250,6 @@ video_asset = client.video_assets.thumbnail_select( ) ``` -### Update thumbnail via upload - -Use any image file to use as thumbnail. Once you use the API, you will get `upload_url` in the response, and that can be used to upload the image file. - -Here is the sample curl request. - -```bash -curl --location --request PUT '' \ ---data '' -``` - -| Direction | Type | -| --- | --- | -| Response | [`VideoAssetThumbnailUploadResponse`](./src/gumlet/types/video_asset_thumbnail_upload_response.py) | - -```python -video_asset = client.video_assets.thumbnail_upload( - asset_id="assetId", - idempotency_key="", -) -``` - ### Create/Update Video Asset Chapters This endpoint will create/update video asset chapters. @@ -393,6 +371,22 @@ video_asset = client.video_assets.analytics( ) ``` +### Upload a thumbnail file + +Requests a thumbnail upload URL for the asset and PUTs the file to it. + +| Direction | Type | +| --- | --- | +| Response | [`VideoAssetUploadThumbnailFileResponse`](./src/gumlet/types/video_asset_upload_thumbnail_file_response.py) | + +```python +video_asset = client.video_assets.upload_thumbnail_file( + asset_id="assetId", + file=open("path/to/file", "rb"), + idempotency_key="", +) +``` + ## `SubtitleUpload` Add subtitles to an existing asset. diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index 6b23a87..5accf04 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -1,7 +1,7 @@ { "name": "Gumlet", "slug": "gumlet", - "generatorVersion": "0.45.0", + "generatorVersion": "0.46.2", "servers": [ "https://api.gumlet.com/v1" ], @@ -2252,112 +2252,6 @@ "responseLinks": [], "transport": "http" }, - { - "resource": "videoAssets", - "publicResource": "videoAssets", - "operation": "thumbnailUpload", - "publicOperation": "thumbnailUpload", - "deprecated": false, - "method": "POST", - "path": "/video/assets/{asset_ID}/thumbnail", - "pathParams": [ - "asset_ID" - ], - "publicPathParams": [ - "asset_ID" - ], - "queryParams": [], - "publicQueryParams": [], - "headerParams": [], - "publicHeaderParams": [], - "bodyParams": [], - "publicBodyParams": [], - "bodyParamDetails": [], - "pathParamDetails": [ - { - "name": "asset_ID", - "required": true, - "style": "simple", - "explode": false - } - ], - "queryParamDetails": [], - "headerParamDetails": [], - "cookieParams": [], - "publicCookieParams": [], - "cookieParamDetails": [], - "paramsModel": { - "publicName": "VideoAssetThumbnailUploadParams" - }, - "response": { - "status": "200", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - "result": { - "successStatus": "200", - "errorStatuses": [ - "400", - "401", - "403", - "500" - ] - }, - "errorResponses": [ - { - "status": "400", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - { - "status": "401", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - { - "status": "403", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - }, - { - "status": "500", - "contentType": "application/json", - "encoding": "json", - "contents": [ - { - "contentType": "application/json", - "encoding": "json" - } - ] - } - ], - "responseLinks": [], - "transport": "http" - }, { "resource": "videoAssets", "publicResource": "videoAssets", @@ -3371,6 +3265,112 @@ "responseLinks": [], "transport": "http" }, + { + "resource": "videoAssets", + "publicResource": "videoAssets", + "operation": "uploadThumbnailFile", + "publicOperation": "uploadThumbnailFile", + "deprecated": false, + "method": "POST", + "path": "/video/assets/{asset_ID}/thumbnail", + "pathParams": [ + "asset_ID" + ], + "publicPathParams": [ + "asset_ID" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "asset_ID", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VideoAssetUploadThumbnailFileParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + } + ], + "responseLinks": [], + "transport": "http" + }, { "resource": "subtitleUpload", "publicResource": "subtitleUpload", diff --git a/src/gumlet/__init__.py b/src/gumlet/__init__.py index f2b5cbf..00f2c8d 100644 --- a/src/gumlet/__init__.py +++ b/src/gumlet/__init__.py @@ -28,9 +28,11 @@ APIWebhookValidationError, WebhookVerificationError, WebhookMissingHeadersError, + EmptyWebhookSecretError, ) from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging +from ._signed_upload import SignedUploadTransport __all__ = [ "types", @@ -53,6 +55,7 @@ "APIWebhookValidationError", "WebhookVerificationError", "WebhookMissingHeadersError", + "EmptyWebhookSecretError", "BadRequestError", "AuthenticationError", "PermissionDeniedError", @@ -77,6 +80,7 @@ "DefaultHttpxClient", "DefaultAsyncHttpxClient", "DefaultAioHttpClient", + "SignedUploadTransport", ] if not _t.TYPE_CHECKING: diff --git a/src/gumlet/_base_client.py b/src/gumlet/_base_client.py index ec39f6a..f4e0f88 100644 --- a/src/gumlet/_base_client.py +++ b/src/gumlet/_base_client.py @@ -1139,18 +1139,32 @@ def _build_headers( if idempotency_header and options.idempotency_key and idempotency_header not in headers: headers[idempotency_header] = options.idempotency_key - # Don't set these headers if they were already set or removed by the caller. We check - # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. + timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout + headers.update(self._attempt_headers(custom_headers, timeout=timeout, retries_taken=retries_taken)) + + return headers + + def _attempt_headers( + self, + custom_headers: Mapping[str, object], + *, + timeout: float | Timeout | None, + retries_taken: int, + ) -> Dict[str, str]: + """The headers each attempt of a request to this API adds: its retry count and its read timeout. + + Neither is added when the request's own headers (`custom_headers`, the call's) name it, set or + removed: `custom_headers` can hold `Omit()`, so it is checked rather than the merged headers. + """ + headers: Dict[str, str] = {} lower_custom_headers = [header.lower() for header in custom_headers] if "x-scalar-retry-count" not in lower_custom_headers: headers["x-scalar-retry-count"] = str(retries_taken) if "x-scalar-read-timeout" not in lower_custom_headers: - timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout if isinstance(timeout, Timeout): timeout = timeout.read if timeout is not None: headers["x-scalar-read-timeout"] = str(timeout) - return headers def _prepare_url(self, url: str) -> URL: diff --git a/src/gumlet/_exceptions.py b/src/gumlet/_exceptions.py index ae1779f..5c458d2 100644 --- a/src/gumlet/_exceptions.py +++ b/src/gumlet/_exceptions.py @@ -18,6 +18,7 @@ "APIWebhookValidationError", "WebhookVerificationError", "WebhookMissingHeadersError", + "EmptyWebhookSecretError", "WebSocketConnectionClosedError", "WebSocketQueueFullError", ] @@ -80,6 +81,19 @@ class WebhookMissingHeadersError(WebhookVerificationError, ValueError): """Raised when a webhook delivery lacks a signed header; it is also a `ValueError`, so `except ValueError` handlers catch it.""" +try: + from standardwebhooks.webhooks import EmptyWebhookSecretError as _StandardWebhooksEmptySecretError # type: ignore +except ImportError: + + class EmptyWebhookSecretError(GumletError, ValueError): + """Raised when a webhook signing key decodes to nothing; it is also a `ValueError`, so `except ValueError` handlers catch it.""" + +else: + + class EmptyWebhookSecretError(GumletError, ValueError, _StandardWebhooksEmptySecretError): # type: ignore + """Raised when a webhook signing key decodes to nothing; it is also a `ValueError`, so `except ValueError` handlers catch it.""" + + class APIStatusError(APIError): """Raised when an API response has a status code of 4xx or 5xx.""" diff --git a/src/gumlet/_signed_upload.py b/src/gumlet/_signed_upload.py new file mode 100644 index 0000000..973d698 --- /dev/null +++ b/src/gumlet/_signed_upload.py @@ -0,0 +1,675 @@ +"""Uploads to pre-signed URLs for the SDK's signed-upload methods. + +A signed-upload method calls an operation that answers with a pre-signed URL, sends a file to that +URL, then optionally confirms. The upload is deliberately *not* sent through the SDK client: the +client's requests carry its credentials (auth headers, query auth, cookies) and default headers, and +its `httpx` client may be one the caller configured with `auth=`, headers, cookies, params or event +hooks of its own. None of that may reach the upload host, which is usually a different host with the +authorization already signed into the URL. So each upload uses a fresh, short-lived `httpx` client +and sends exactly the file, `Content-Type`, and the headers the initiating response itself names. +Only the SDK client's timeout and retry budget are reused, and the transport of an `http_client` +the caller passed. + +That transport is borrowed so the caller's proxy and TLS settings (`proxy=`, `mounts=`, `verify=`, +`cert=`, or the same given to an `httpx.HTTPTransport`) reach the upload: a corporate proxy or a +private CA would otherwise make every upload fail. Only the one transport the caller's client would +route the upload URL to is borrowed, and by default only when it is exactly httpx's own +`HTTPTransport` (or `AsyncHTTPTransport`), which sends a request as given. Any other transport +class sends the request itself and can add headers, credentials or cookies the SDK cannot see, so +with one the upload falls back to a fresh client of httpx's defaults, where proxy and CA settings +come from the environment (`HTTPS_PROXY`, `SSL_CERT_FILE`, ...) only. + +A caller whose proxy or TLS setup lives only in a transport class of its own opts that transport in +by inheriting `SignedUploadTransport`. That is the caller's declaration, never a guess: the SDK +reads it off the routed transport itself, so a wrapper is lent only if it inherits the marker too. + +The upload is never handed to the caller's client itself (`http_client.send`): that would run its +event hooks, whose request hooks can add headers (an `Authorization` meant for the API among them) and +whose response hooks can raise for a status the upload retries, and it would file the upload host's +cookies in the client's jar. On the fresh client none of that exists, so only the routing, proxy, TLS +and connection pool of the borrowed transport reach the upload host, and the request carries +nothing but what `_request_kwargs` names. + +A client the SDK built itself, because the caller passed none, carries no such settings, so its +uploads keep a fresh client of httpx's defaults, which reads the environment at upload time and leaves +the client's connection pool alone. A borrowed transport is never closed here: the caller's client +owns it. +""" + +from __future__ import annotations + +import os +import json +import time +import email.utils +import random +import pathlib +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Type, + Tuple, + Union, + Mapping, + TypeVar, + Iterator, + Optional, + Sequence, + NamedTuple, + AsyncIterator, +) +from typing_extensions import Literal, TypedDict + +import anyio +import httpx + +from ._types import NotGiven, FileTypes +from ._models import BaseModel +from ._constants import MAX_RETRY_DELAY, INITIAL_RETRY_DELAY +from ._exceptions import APITimeoutError, APIConnectionError, GumletError +from ._base_client import SyncHttpxClientWrapper, AsyncHttpxClientWrapper + +if TYPE_CHECKING: + from ._base_client import SyncAPIClient, AsyncAPIClient + +__all__ = [ + "SignedUploadTransport", + "SignedUploadFile", + "SignedUploadSpec", + "read_signed_upload_file", + "async_read_signed_upload_file", + "read_signed_upload_field", + "signed_upload_path_param", + "upload_to_signed_url", + "async_upload_to_signed_url", +] + +_DEFAULT_CONTENT_TYPE = "application/octet-stream" + +# How much of the body goes out per write. httpx's write timeout covers one write, so this is the +# progress that restarts it: small enough that a slow link still gets a chunk out within the timeout. +_UPLOAD_CHUNK_BYTES = 16 * 1024 + + +class SignedUploadSpec(TypedDict, total=False): + """How a generated signed-upload method sends its file; fixed when the SDK is generated.""" + + url_field: Sequence[str] + """Wire-name path to the upload URL in the initiating response.""" + + method: Literal["PUT", "POST"] + + body: Literal["binary", "multipart"] + """`binary` sends the raw bytes; `multipart` sends `multipart/form-data` with the file as one part.""" + + multipart_field: str + """Form field the file is sent under, for a `multipart` upload.""" + + content_type: str + """Configured `Content-Type` of a `binary` upload.""" + + headers_field: Sequence[str] + """Wire-name path to a string map of headers the upload must carry, in the initiating response.""" + + +class SignedUploadTransport: + """A marker a transport of your own inherits so the SDK's signed uploads go through it. + + By default a signed upload borrows only httpx's own `HTTPTransport` (or `AsyncHTTPTransport`) + from a custom `http_client`, and any other transport class falls back to a fresh client of + httpx's defaults, since a class of its own may add headers, credentials or cookies as it sends. + Inheriting this marker declares that the transport sends a request as handed over: it adds no + credentials, cookies or headers of its own, keeps no session or cookie jar that would, is bound + to no Unix socket, follows no redirects, and honours the timeout httpx hands it with each request + (`request.extensions["timeout"]`). The upload then goes through it, for a caller whose + proxy or TLS setup lives only in that transport: + + class CorporateTransport(SignedUploadTransport, httpx.HTTPTransport): ... + + The SDK reads the marker off the transport the client routes the upload URL to, not off the client + or anything it wraps, so a wrapper is lent only if it inherits the marker itself. The upload still + carries only the file, its content type and the headers the API named, on a client with no auth, + cookies or event hooks, and the `https:` rule, the retries and the redirect refusal still apply. + The upload's timeout reaches the transport only as that request extension: by design the SDK runs + no watchdog of its own around a marked transport, so honouring it is part of the declaration. The + marker is checked, never what it promises: a marked transport that + adds a credential sends it to the upload host, and one that ignores the timeout can hang the call. + """ + + +def read_signed_upload_field(value: object, path: Sequence[str]) -> object: + """Reads a value out of a decoded response body by wire-name path, or `None` when a step is missing. + + A response the SDK already decoded into a model is read through its wire-name dump, because the + path is spelled in wire names and a model's attributes may be spelled differently. One decoded as + text, because the API labelled its JSON with another media type or with none, is parsed first. + """ + current = _decoded_body(value) + for segment in path: + if not isinstance(current, Mapping): + return None + mapping: Mapping[Any, object] = current + if segment not in mapping: + return None + current = mapping[segment] + return current + + +def _decoded_body(value: object) -> object: + """The initiating response as a plain value: a model's wire-name dump, or a raw body parsed as JSON. + + With a confirm step the initiating request hands back the raw `httpx.Response`, because the SDK + decodes a body to text (or, under strict response validation, refuses it) when its `Content-Type` + does not end in `json` — `text/plain`, `application/x-amz-json-1.1`, or none at all — which an API + that issues upload URLs does not always get right. A body that is not JSON is returned as is and + reads as a missing field. + """ + if isinstance(value, BaseModel): + return value.to_dict(use_api_names=True, exclude_unset=False) + if isinstance(value, httpx.Response): + value = value.content + if isinstance(value, (str, bytes, bytearray)): + try: + decoded: object = json.loads(value) + except ValueError: + return value + return decoded + return value + + +class SignedUploadFile(NamedTuple): + """The file a signed upload sends, read into memory once, before the initiating request.""" + + filename: Optional[str] + content: bytes + content_type: Optional[str] + headers: Mapping[str, str] + """The headers a `(name, content, type, headers)` file tuple carries; empty for any other form.""" + + +def read_signed_upload_file(file: FileTypes) -> SignedUploadFile: + """Reads the file a signed upload sends, before the initiating request is made. + + A file that cannot be read (a missing path, a text-mode handle, an unsupported type) then fails + the call before the API has created an upload that would never receive its file. + """ + filename, content, content_type = _read_file(file) + return SignedUploadFile(filename, content, content_type, _file_headers(file)) + + +async def async_read_signed_upload_file(file: FileTypes) -> SignedUploadFile: + """The async twin of `read_signed_upload_file`, reading paths without blocking the event loop.""" + filename, content, content_type = await _async_read_file(file) + return SignedUploadFile(filename, content, content_type, _file_headers(file)) + + +def signed_upload_path_param(value: object, path: Sequence[str]) -> str: + """Reads a confirm-step path parameter off the initiating response. + + Raises rather than filling the path with `None`: a confirm request sent to `/files/None` would at + best 404 and at worst act on a resource nobody named. A `.` or `..` segment is refused too: it would + send the confirm to another endpoint. `path_template` refuses one only once the confirm is built, + after the file is sent, so the call reads this before the upload. + """ + found = read_signed_upload_field(value, path) + if isinstance(found, str) and found: + segment = next((part for part in found.split("/") if part in (".", "..")), None) + if segment is not None: + raise GumletError( + f'The upload response\'s `{".".join(path)}` contains a "{segment}" segment, so the upload cannot be confirmed.' + ) + return found + if isinstance(found, int) and not isinstance(found, bool): + return str(found) + raise GumletError( + f"Expected the upload response to carry a non-empty `{'.'.join(path)}` to confirm the upload with." + ) + + +def upload_to_signed_url( + client: SyncAPIClient, + initiated: object, + spec: SignedUploadSpec, + file: SignedUploadFile, + *, + timeout: Union[float, httpx.Timeout, None, NotGiven], +) -> httpx.Response: + """Sends `file` to the pre-signed URL in `initiated` and returns the upload host's success response. + + Retries connection errors (whatever a lent transport raises for one, as the base client does), + timeouts, 408, 409, 429 and 5xx (or whatever `x-should-retry` says), + waiting as `Retry-After`/`retry-after-ms` asks up to a minute and otherwise backing off + exponentially, within the client's `max_retries`; safe because the file was read once (see + `read_signed_upload_file`) and every attempt sends the same bytes. A redirect is not followed: it + would re-send the file and the named headers to a host the API's response did not name. + + `timeout` (the client's when not given) bounds each phase rather than the whole upload: connecting, + each chunk of the file going out, and each read of the answer. A slow upload that keeps moving is + not cut off; a host that stops reading, or never answers, is. `None` means no timeout. + """ + url = _upload_url(initiated, spec) + headers, body = _encode_request(spec, url, _request_kwargs(initiated, spec, file)) + effective_timeout = client.timeout if isinstance(timeout, NotGiven) else timeout + max_retries = client.max_retries + with _upload_client(client._client, url, effective_timeout) as http: + attempt = 0 + while True: + remaining = max_retries - attempt + request = http.build_request(spec.get("method", "PUT"), url, headers=headers, content=_ChunkedBody(body)) + try: + response = http.send(request, auth=_upload_auth(request)) + except httpx.TimeoutException as err: + if remaining > 0: + time.sleep(_retry_delay(attempt)) + attempt += 1 + continue + raise APITimeoutError(request=request) from err + # Any other failure of the send, as the base client treats one: a lent transport of the + # caller's need not raise httpx's own errors for a dropped connection. + except Exception as err: + if remaining > 0: + time.sleep(_retry_delay(attempt)) + attempt += 1 + continue + raise APIConnectionError(request=request) from err + if response.is_success: + return response + if response.is_redirect: + response.close() + raise _redirect_error(response) + if remaining > 0 and _should_retry(response): + response.close() + time.sleep(_retry_after(response.headers) or _retry_delay(attempt)) + attempt += 1 + continue + response.read() + raise client._make_status_error_from_response(response) + + +async def async_upload_to_signed_url( + client: AsyncAPIClient, + initiated: object, + spec: SignedUploadSpec, + file: SignedUploadFile, + *, + timeout: Union[float, httpx.Timeout, None, NotGiven], +) -> httpx.Response: + """The async twin of `upload_to_signed_url`.""" + url = _upload_url(initiated, spec) + headers, body = _encode_request(spec, url, _request_kwargs(initiated, spec, file)) + effective_timeout = client.timeout if isinstance(timeout, NotGiven) else timeout + max_retries = client.max_retries + async with _async_upload_client(client._client, url, effective_timeout) as http: + attempt = 0 + while True: + remaining = max_retries - attempt + request = http.build_request( + spec.get("method", "PUT"), url, headers=headers, content=_AsyncChunkedBody(body) + ) + try: + response = await http.send(request, auth=_upload_auth(request)) + except httpx.TimeoutException as err: + if remaining > 0: + await anyio.sleep(_retry_delay(attempt)) + attempt += 1 + continue + raise APITimeoutError(request=request) from err + # Any other failure of the send, as the base client treats one: a lent transport of the + # caller's need not raise httpx's own errors for a dropped connection. + except Exception as err: + if remaining > 0: + await anyio.sleep(_retry_delay(attempt)) + attempt += 1 + continue + raise APIConnectionError(request=request) from err + if response.is_success: + return response + if response.is_redirect: + await response.aclose() + raise _redirect_error(response) + if remaining > 0 and _should_retry(response): + await response.aclose() + await anyio.sleep(_retry_after(response.headers) or _retry_delay(attempt)) + attempt += 1 + continue + await response.aread() + raise client._make_status_error_from_response(response) + + +def _upload_client(source: httpx.Client, url: str, timeout: Union[float, httpx.Timeout, None]) -> httpx.Client: + """A fresh client for one upload, on the caller's transport for `url` when that may be lent. + + The fresh client brings no auth, headers, cookies, params or event hooks, so none of the caller's + client's own reaches the upload; `follow_redirects=False` keeps a redirect from re-sending the file + to a host the API's response did not name. Given a transport, httpx skips its environment proxies: + the borrowed transport already is the caller's routing for this URL, environment proxies included + when the caller's client trusted them. + """ + transport = _caller_transport(source, url, httpx.HTTPTransport, httpx.BaseTransport) + if transport is None: + return httpx.Client(timeout=timeout, follow_redirects=False) + return httpx.Client(timeout=timeout, follow_redirects=False, transport=_BorrowedTransport(transport)) + + +def _async_upload_client( + source: httpx.AsyncClient, url: str, timeout: Union[float, httpx.Timeout, None] +) -> httpx.AsyncClient: + """The async twin of `_upload_client`.""" + transport = _caller_transport(source, url, httpx.AsyncHTTPTransport, httpx.AsyncBaseTransport) + if transport is None: + return httpx.AsyncClient(timeout=timeout, follow_redirects=False) + return httpx.AsyncClient(timeout=timeout, follow_redirects=False, transport=_AsyncBorrowedTransport(transport)) + + +_T = TypeVar("_T") +_B = TypeVar("_B") + + +def _caller_transport(source: object, url: str, httpx_type: Type[_T], base_type: Type[_B]) -> Optional[Union[_T, _B]]: + """The transport the caller's client would send `url` through, when it may be lent to the upload. + + That is the client's mount for the URL (a `proxy=`, a `mounts=` entry, or an environment proxy + the client picked up), else its default transport. It is lent when it is exactly `httpx_type` + (an exact type check, not `isinstance`: a subclass can override `handle_request` to add headers, + as any other transport class can, and those would reach the upload host) and bound to no Unix + socket, or when it inherits `SignedUploadTransport` and is a `base_type`, the flavour the fresh + upload client takes. A marked transport is lent as the caller declared, with nothing else checked: + detecting what a transport does from its class would miss whatever a wrapper delegates to. httpx + keeps the routing private (`_transport_for_url`, in every release the SDK supports), so a client + without it gets `None` and the upload a fresh transport. + + So does the client the SDK built because the caller passed no `http_client` (the + `HttpxClientWrapper` classes, which only the SDK creates). It holds no proxy or TLS setting of the + caller's to honour, and borrowing it would only fix the environment's proxy and CA settings at + client creation, take a slot in its pool, and send uploads on connections whose kernel buffers + an earlier upload grew. + """ + if type(source) is SyncHttpxClientWrapper or type(source) is AsyncHttpxClientWrapper: + return None + pick = getattr(source, "_transport_for_url", None) + if not callable(pick): + return None + # `_upload_url` already parsed and checked `url`, so this cannot raise for it. + transport: object = pick(httpx.URL(url)) + if isinstance(transport, SignedUploadTransport): + return transport if isinstance(transport, base_type) else None + # `isinstance` narrows the type; the exact check is the one that refuses a subclass. + if not isinstance(transport, httpx_type) or type(transport) is not httpx_type: + return None + # Fails closed: a transport is borrowed only when its pool is there and says it is bound to no + # Unix socket. An httpcore release that renamed `_pool` or `_uds` would otherwise read as "not + # bound" and send the file to whatever socket the caller's transport was built for. + pool = getattr(transport, "_pool", None) + if pool is None or not hasattr(pool, "_uds") or getattr(pool, "_uds") is not None: + return None + return transport + + +class _BorrowedTransport(httpx.BaseTransport): + """The caller's `httpx.HTTPTransport` or marked transport, lent to one upload client and left open when it closes.""" + + def __init__(self, transport: httpx.BaseTransport) -> None: + """Wraps `transport`, which stays the caller's to close.""" + self._transport = transport + + def handle_request(self, request: httpx.Request) -> httpx.Response: + """Sends `request` through the caller's transport: its proxy, TLS settings and connection pool.""" + return self._transport.handle_request(request) + + def close(self) -> None: + """Leaves the transport open: the caller's client owns its connection pool and closes it.""" + + +class _AsyncBorrowedTransport(httpx.AsyncBaseTransport): + """The async twin of `_BorrowedTransport`, lending an `httpx.AsyncHTTPTransport` or a marked async transport.""" + + def __init__(self, transport: httpx.AsyncBaseTransport) -> None: + """Wraps `transport`, which stays the caller's to close.""" + self._transport = transport + + async def handle_async_request(self, request: httpx.Request) -> httpx.Response: + """Sends `request` through the caller's transport: its proxy, TLS settings and connection pool.""" + return await self._transport.handle_async_request(request) + + async def aclose(self) -> None: + """Leaves the transport open: the caller's client owns its connection pool and closes it.""" + + +def _upload_url(initiated: object, spec: SignedUploadSpec) -> str: + """Reads and validates the upload URL, refusing a missing value or one that is not https. + + The URL came from a response rather than from the caller, so a `file:` or `data:` URL is refused + before any request is made, and so is plain `http:` to anything but a loopback host: it would send + the file, the signature in the query and the named headers in cleartext, for anyone on the path + to replay until the URL expires. + """ + path = spec.get("url_field", ()) + value = read_signed_upload_field(initiated, path) + if not isinstance(value, str) or not value: + raise GumletError(f"Expected the upload response to carry an upload URL in `{'.'.join(path)}`.") + try: + parsed = httpx.URL(value) + except Exception as err: + raise GumletError(f"The upload URL in `{'.'.join(path)}` is not a valid URL.") from err + if parsed.scheme not in ("http", "https") or not parsed.host: + raise GumletError(f"Refusing to upload to `{'.'.join(path)}`: expected an absolute https: URL.") + if parsed.scheme == "http" and not _is_loopback(parsed.host): + raise GumletError(f"Refusing to upload to `{'.'.join(path)}` over plain http:; expected an https: URL.") + return value + + +def _is_loopback(host: str) -> bool: + """Whether `host` is this machine: exactly `localhost`, `127.0.0.1` or `::1`. + + The loopback hosts the CLI's OAuth runtime accepts plain `http:` for. A `*.localhost` name is not + one: not every resolver sends it to loopback. + """ + return host.lower().strip("[]") in ("localhost", "127.0.0.1", "::1") + + +def _upload_auth(request: httpx.Request) -> httpx.Auth: + """The only auth an upload carries: Basic credentials the pre-signed URL itself names, else none. + + Passed on every send so httpx never chooses one: httpx < 0.24 (the dependency floor admits + 0.23) signs a request to any host listed in `~/.netrc` with that entry's password by default, so + a fresh client would hand the caller's machine credentials to whatever host the API's response + named. `trust_env` stays on so environment proxies still apply on a fallback client (see + `_upload_client`); a borrowed transport already carries the caller's own proxy routing. + """ + username, password = request.url.username, request.url.password + if username or password: + return httpx.BasicAuth(username=username, password=password) + return httpx.Auth() + + +def _redirect_error(response: httpx.Response) -> GumletError: + """The error a redirect from the upload host raises: it is not followed, since following it would + re-send the file and the named headers to a host the API's response did not name.""" + return GumletError(f"The upload host answered with a redirect ({response.status_code}), which is not followed.") + + +def _request_kwargs(initiated: object, spec: SignedUploadSpec, file: SignedUploadFile) -> Dict[str, Any]: + """The headers and body of the upload request: nothing from the SDK client, by construction. + + The headers are the ones the initiating response names, plus — for a `(name, content, type, + headers)` file tuple — the caller's own: on the part itself in a multipart upload, on the request + in a binary one, where a header the response names wins because the URL may be signed for it. + """ + filename, content, file_content_type, file_headers = file + headers: Dict[str, str] = {} + headers_field = spec.get("headers_field") + if headers_field is not None: + named = read_signed_upload_field(initiated, headers_field) + if isinstance(named, Mapping): + named_headers: Mapping[Any, object] = named + for name, value in named_headers.items(): + if isinstance(name, str) and isinstance(value, str): + headers[name] = value + + if spec.get("body", "binary") == "multipart": + # httpx writes the multipart `Content-Type` with its boundary; a named one would break it. + headers = {name: value for name, value in headers.items() if name.lower() != "content-type"} + _check_headers(headers) + _check_headers(file_headers) + field = spec.get("multipart_field", "file") + part: Tuple[Any, ...] = (filename or "file", content, file_content_type or _DEFAULT_CONTENT_TYPE) + if file_headers: + part = (*part, dict(file_headers)) + return {"headers": headers, "files": {field: part}} + + named_names = {name.lower() for name in headers} + for name, value in file_headers.items(): + if name.lower() not in named_names: + headers[name] = value + # A header the initiating response names wins: a pre-signed URL can sign the type it was issued for. + if not any(name.lower() == "content-type" for name in headers): + headers["Content-Type"] = spec.get("content_type") or file_content_type or _DEFAULT_CONTENT_TYPE + _check_headers(headers) + return {"headers": headers, "content": content} + + +def _encode_request(spec: SignedUploadSpec, url: str, request_kwargs: Dict[str, Any]) -> Tuple[httpx.Headers, bytes]: + """Encodes the upload once, into the headers and the exact bytes every attempt sends. + + The body is then sent in chunks (see `_ChunkedBody`), and httpx would send an iterated body with + chunked transfer encoding, which object stores refuse. So `Content-Length` is set here, along + with the multipart `Content-Type` and its boundary, which httpx only writes when it encodes. + """ + encoded = httpx.Request(spec.get("method", "PUT"), url, **request_kwargs) + body = encoded.read() + headers = httpx.Headers(request_kwargs["headers"]) + content_type = encoded.headers.get("Content-Type") + if content_type is not None: + headers.setdefault("Content-Type", content_type) + headers.setdefault("Content-Length", str(len(body))) + return headers, body + + +class _ChunkedBody: + """The body, sent a chunk at a time, so the write timeout counts time without progress. + + httpx applies its write timeout to each write, and a body given whole is one write on some + backends: a large file on a slow link would then time out while still going out. An iterable + rather than a generator: httpx refuses to read a generator body twice (`StreamConsumed`), and a + transport the caller lends, such as one that retries a request itself, may send the same request + again, which would then fail on every attempt and never upload. + """ + + def __init__(self, body: bytes) -> None: + """Holds the encoded body every pass sends.""" + self._body = body + + def __iter__(self) -> Iterator[bytes]: + """Yields the whole body again on every pass, `_UPLOAD_CHUNK_BYTES` at a time.""" + for start in range(0, len(self._body), _UPLOAD_CHUNK_BYTES): + yield self._body[start : start + _UPLOAD_CHUNK_BYTES] + + +class _AsyncChunkedBody: + """The async twin of `_ChunkedBody`; only async-iterable, so httpx sends it on an `AsyncClient`.""" + + def __init__(self, body: bytes) -> None: + """Holds the encoded body every pass sends.""" + self._chunks = _ChunkedBody(body) + + async def __aiter__(self) -> AsyncIterator[bytes]: + """Yields the whole body again on every pass, as `_ChunkedBody` does.""" + for chunk in self._chunks: + yield chunk + + +def _check_headers(headers: Mapping[str, str]) -> None: + """Refuses a header no HTTP request can carry, once, rather than on every retried attempt. + + A CR, LF or NUL in a name or value would otherwise fail inside the transport, which reads as a + connection error and is retried with backoff although every attempt fails the same way. + """ + for name, value in headers.items(): + if not name or any(char in name for char in "\r\n\0:") or any(char in value for char in "\r\n\0"): + raise GumletError(f"The upload header {name!r} is not a valid HTTP header.") + + +def _file_headers(file: FileTypes) -> Mapping[str, str]: + """The headers a `(name, content, type, headers)` file tuple carries, or none for any other form.""" + if isinstance(file, tuple): + parts: Tuple[Any, ...] = file + if len(parts) > 3 and isinstance(parts[3], Mapping): + given: Mapping[Any, Any] = parts[3] + return {str(name): str(value) for name, value in given.items()} + return {} + + +def _split_file(file: FileTypes) -> Tuple[Optional[str], object, Optional[str]]: + """Splits the SDK's file input forms into filename, content and content type.""" + if isinstance(file, tuple): + parts: Tuple[Any, ...] = file + filename = parts[0] if len(parts) > 0 else None + content = parts[1] if len(parts) > 1 else b"" + content_type = parts[2] if len(parts) > 2 else None + return filename, content, content_type + return None, file, None + + +def _read_file(file: FileTypes) -> Tuple[Optional[str], bytes, Optional[str]]: + """Reads the whole file once, so every retry sends the same bytes.""" + filename, content, content_type = _split_file(file) + if isinstance(content, os.PathLike): + path = pathlib.Path(content) + return filename or path.name, path.read_bytes(), content_type + if isinstance(content, (bytes, bytearray)): + return filename, bytes(content), content_type + read = getattr(content, "read", None) + if callable(read): + data = read() + if not isinstance(data, (bytes, bytearray)): + raise TypeError("Expected the file to be opened in binary mode") + name = getattr(content, "name", None) + return filename or (os.path.basename(name) if isinstance(name, str) else None), bytes(data), content_type + raise TypeError(f"Expected a file path, bytes or a binary file object, got {type(content)}") + + +async def _async_read_file(file: FileTypes) -> Tuple[Optional[str], bytes, Optional[str]]: + """The async twin of `_read_file`, reading paths without blocking the event loop.""" + filename, content, content_type = _split_file(file) + if isinstance(content, os.PathLike): + path = anyio.Path(content) + return filename or path.name, await path.read_bytes(), content_type + return _read_file((filename, content, content_type)) # type: ignore[arg-type] + + +def _should_retry(response: httpx.Response) -> bool: + """Whether the SDK client itself would retry this response: `x-should-retry` first, then its statuses.""" + should_retry = response.headers.get("x-should-retry") + if should_retry == "true": + return True + if should_retry == "false": + return False + return response.status_code in (408, 409, 429) or response.status_code >= 500 + + +def _retry_after(headers: httpx.Headers) -> Optional[float]: + """The wait in seconds a `retry-after-ms` or `Retry-After` header asks for, when it is a sane one (under a minute).""" + try: + millis = float(headers.get("retry-after-ms", "")) + if 0 < millis < 60_000: + return millis / 1000 + except ValueError: + pass + retry_after = headers.get("retry-after") + if not retry_after: + return None + try: + seconds = float(retry_after) + except ValueError: + parsed = email.utils.parsedate_tz(retry_after) + if parsed is None: + return None + seconds = float(email.utils.mktime_tz(parsed) - time.time()) + return seconds if 0 < seconds < 60 else None + + +def _retry_delay(attempt: int) -> float: + """Exponential backoff with jitter, capped at the client's ceiling.""" + delay: float = min(INITIAL_RETRY_DELAY * pow(2.0, min(attempt, 1000)), MAX_RETRY_DELAY) + return delay * (1 - 0.25 * random.random()) diff --git a/src/gumlet/_version.py b/src/gumlet/_version.py index 9692ab0..0a161ab 100644 --- a/src/gumlet/_version.py +++ b/src/gumlet/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Scalar. See README.md for details. __title__ = "gumlet" -__version__ = "1.5.2" # x-release-please-version +__version__ = "1.6.0" # x-release-please-version diff --git a/src/gumlet/_webhook_verify.py b/src/gumlet/_webhook_verify.py index a61aaab..99e6e2f 100644 --- a/src/gumlet/_webhook_verify.py +++ b/src/gumlet/_webhook_verify.py @@ -5,13 +5,24 @@ one or more space-separated `v1,` entries. Each helper passes in its own algorithm, header names (`webhook-id`, `webhook-timestamp` and `webhook-signature` by default) and replay window. Ed25519 and RSA signatures cannot be checked here, so such a delivery is always refused. With -the default settings this module checks a delivery the way the `standardwebhooks` 1.x package does, -with the same secret decoding, header lookup, signed content, tolerance window and error messages, -and like the library's `verify` it returns the JSON-decoded body once a signature matches. A refused -delivery raises this package's `WebhookVerificationError`, which also subclasses the library's class -of that name whenever the library is installed, so handlers written against it still catch it. -An empty secret raises `ValueError` where the library raised `EmptyWebhookSecretError`; the generated -webhook methods refuse such a key before calling in here. A delivery without its signed headers raises +the default settings this module checks a delivery the way the `standardwebhooks` package does from +1.3.0 on, with the same secret decoding, header lookup, signed content, tolerance window and error +messages: a `bytes` body is signed byte for byte, as received, and an entry that is not a +`v1,` pair, or whose signature does not decode, is one that does not match, so a garbled +header is refused as an unsigned delivery rather than raising a parsing error. It differs from the +library in three places. An absent signed header is named (`Could not find header`) where the +library says `Missing required headers`, which this module keeps for a present but empty one. The +library compares each entry's text exactly, while this module decodes the signature leniently and +compares the bytes, so stray characters around a valid signature (extra padding, a trailing `!`) do +not stop it from matching; the entry still has to carry the correct HMAC. And a body has to be `str`, +`bytes` or `bytearray`: the library also takes a `memoryview`, which `json.loads`, and so every +generated method that decodes the verified body, cannot read. Like the library's `verify` it returns +the JSON-decoded body once a signature matches. A refused delivery raises this package's +`WebhookVerificationError`, which also subclasses the library's class of that name whenever the +library is installed, so handlers written against it still catch it. +An empty secret raises this package's `EmptyWebhookSecretError`, a `ValueError` that also subclasses the +library's class of that name whenever the library is installed; the generated webhook methods refuse +such a key, with the same error, before calling in here. A delivery without its signed headers raises `WebhookMissingHeadersError`, a `WebhookVerificationError` that is also a `ValueError`, so either `except` clause catches it. """ @@ -26,7 +37,7 @@ from typing import Mapping from datetime import datetime, timezone, timedelta -from ._exceptions import WebhookVerificationError, WebhookMissingHeadersError +from ._exceptions import EmptyWebhookSecretError, WebhookVerificationError, WebhookMissingHeadersError __all__ = ["verify_webhook_signature", "refuse_unverifiable_algorithm"] @@ -59,16 +70,19 @@ def _decode_secret(key: str | bytes) -> bytes: that was already padded decodes to the same bytes. Decoding is not strict, as in the library: ASCII characters outside the base64 alphabet are dropped, so a secret that is not base64 usually decodes to some other key and simply fails to verify. A non-ASCII secret, or one left with a length - no padding can fix, raises `ValueError` (the latter as its `binascii.Error` subclass). + no padding can fix, raises `ValueError` (the latter as its `binascii.Error` subclass), and one that + decodes to nothing raises `EmptyWebhookSecretError`. """ if isinstance(key, str): if key.startswith(_SECRET_PREFIX): key = key[len(_SECRET_PREFIX) :] key = base64.b64decode(key + "==") - # An empty HMAC key is one anyone can sign with, so it can never verify a delivery. + # An empty HMAC key is one anyone can sign with, so it can never verify a delivery. The library's + # message, under a class that `except EmptyWebhookSecretError` matches whether the name was imported + # from this package or, when it is installed, from `standardwebhooks`. if not key: - raise ValueError("webhook secret may not be empty") + raise EmptyWebhookSecretError("webhook secret may not be empty") return key @@ -88,6 +102,41 @@ def refuse_unverifiable_algorithm(algorithm: str, decode_method: str | None = No ) +def _payload_bytes(payload: str | bytes) -> bytes: + """The body as it was signed: `bytes` exactly as received, and a `str` as its UTF-8 encoding. + + A `bytes` body is never decoded first, so one that is not UTF-8 text is still checked against the + bytes the sender signed. Only `bytes` and `bytearray` are accepted, the binary types `json.loads` + reads, so every generated method can decode a body it verified: `bytes()` would also turn an `int` + or a list of ints into bytes, signing something other than the body. + """ + if isinstance(payload, str): + return payload.encode() + if isinstance(payload, (bytes, bytearray)): + return bytes(payload) + raise TypeError("Expected payload to be of type str or bytes") + + +def _v1_signature(entry: str) -> bytes | None: + """The signature bytes of a `v1,` entry, or `None` for any other entry. + + An entry for another signature version is skipped, and so is a malformed one: no comma, a second + comma, or a signature that does not decode (`b64decode` raises `ValueError` for a non-ASCII + character and its `binascii.Error` subclass when the characters left are not whole, padded base64 + groups). The header is attacker-controlled, so a garbled entry has to read as a signature that does + not match, never as an error a handler catching only `WebhookVerificationError` lets through. + Decoding is lenient, as in `_decode_secret`: ASCII characters outside the alphabet + and surplus padding are dropped, so they only change which bytes are compared. + """ + version, separator, signature = entry.partition(",") + if not separator or version != "v1" or "," in signature: + return None + try: + return base64.b64decode(signature) + except ValueError: + return None + + def _parse_timestamp(header: str, tolerance_seconds: int) -> datetime: """Reads the timestamp header (seconds since the epoch) and refuses one outside the tolerance window.""" now = _utcnow() @@ -128,19 +177,22 @@ def verify_webhook_signature( A missing header, a timestamp outside the tolerance or no matching signature raises `WebhookVerificationError`; for a missing header it is the `WebhookMissingHeadersError` subclass, which is also a `ValueError`, saying `Could not find header` for an absent one and - `Missing required headers` for an empty one. Input the library also rejected with something else raises the same - `ValueError` it did: a signature entry that is not a `,` pair, an undecodable - signature, a `bytes` payload that is not UTF-8, or a signed body that is not JSON. An empty secret - raises `ValueError` too, where the library raised `EmptyWebhookSecretError`. - - `headers` is matched case-insensitively. A `bytes` payload is decoded as UTF-8 and signed as text, - exactly as a `str` payload is, so either form of the same body verifies alike. + `Missing required headers` for an empty one. A signature entry that is not a `v1,` + pair, or whose signature does not decode, counts as one that does not match, so a header holding + nothing else is refused with `No matching signature found`. A signed body that is not JSON raises + the `ValueError` decoding it raises, as the library's `verify` does. An empty secret raises + `EmptyWebhookSecretError`, which is a `ValueError` too and, when the library is installed, its + `EmptyWebhookSecretError` as well. + + `headers` is matched case-insensitively. A `bytes` payload is verified byte for byte, as received, + so a body that is not UTF-8 text verifies; a `str` payload is verified as its UTF-8 encoding, so + either form of a UTF-8 body verifies alike. """ refuse_unverifiable_algorithm(algorithm, decode_method) digest = _HMAC_DIGESTS[algorithm] secret = _decode_secret(key) - body = payload if isinstance(payload, str) else payload.decode() + body = _payload_bytes(payload) lowered = {name.lower(): value for name, value in headers.items()} # An absent header is named, as `get_required_header` names it; one that is present but empty is @@ -157,21 +209,19 @@ def verify_webhook_signature( timestamp = _parse_timestamp(msg_timestamp, tolerance_seconds) # The signed content uses the whole seconds of the parsed timestamp, not the header text, so a # header such as `1614265330.0` is checked against the signature made over `1614265330`. - signed_content = f"{msg_id}.{floor(timestamp.timestamp())}.{body}".encode() + signed_content = f"{msg_id}.{floor(timestamp.timestamp())}.".encode() + body expected = hmac.new(secret, signed_content, digest).digest() - # A sender rotating its secret signs with both keys, so any one `v1` entry matching is enough; - # entries for other signature versions are skipped. An entry that is not a `,` - # pair raises the `ValueError` unpacking raises, as one whose signature leaves an unfixable base64 - # length does; other stray characters are dropped by the lenient decoder and the entry just fails. - # Entries are checked in order, so a malformed one ahead of a valid one raises before it is reached. + # A sender rotating its secret signs with both keys, so any one `v1` entry matching is enough. + # Entries for other signature versions and malformed entries are skipped (`_v1_signature`), so a + # garbled entry ahead of a valid one does not stop the valid one from matching. for entry in msg_signature.split(" "): - version, signature = entry.split(",") - if version != "v1": - continue + signature = _v1_signature(entry) # `compare_digest` takes the same time wherever the first differing byte is, so the response # time cannot be used to recover a valid signature one byte at a time. - if hmac.compare_digest(expected, base64.b64decode(signature)): - return json.loads(body) + if signature is not None and hmac.compare_digest(expected, signature): + # `json.loads` reads the body's bytes as the library's `verify` does, detecting a UTF-8, + # UTF-16 or UTF-32 body; a `str` is decoded as it was given. + return json.loads(payload) raise WebhookVerificationError("No matching signature found") diff --git a/src/gumlet/resources/video_assets.py b/src/gumlet/resources/video_assets.py index 897d453..685aa84 100644 --- a/src/gumlet/resources/video_assets.py +++ b/src/gumlet/resources/video_assets.py @@ -7,9 +7,15 @@ from typing import Dict, Iterable, List, Union from datetime import date from typing_extensions import Literal -from .._types import SequenceNotStr +from .._types import FileTypes, SequenceNotStr from .._types import Body, Omit, Query, Headers, NotGiven, NoneType, omit, not_given +from .._signed_upload import ( + upload_to_signed_url, + async_upload_to_signed_url, + read_signed_upload_file, + async_read_signed_upload_file, +) from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -37,7 +43,6 @@ from ..types.video_asset_retrieve_details_response import VideoAssetRetrieveDetailsResponse from ..types.video_asset_update_response import VideoAssetUpdateResponse from ..types.video_asset_thumbnail_select_response import VideoAssetThumbnailSelectResponse -from ..types.video_asset_thumbnail_upload_response import VideoAssetThumbnailUploadResponse from ..types.video_asset_create_update_chapter_response import VideoAssetCreateUpdateChapterResponse from ..types.video_asset_list_workspace_folders_and_deprecated_response import ( VideoAssetListWorkspaceFoldersAndDeprecatedResponse, @@ -46,6 +51,7 @@ from ..types.video_asset_delete_many_response import VideoAssetDeleteManyResponse from ..types.video_asset_tag_many_response import VideoAssetTagManyResponse from ..types.video_asset_analytics_response import VideoAssetAnalyticsResponse +from ..types.video_asset_upload_thumbnail_file_response import VideoAssetUploadThumbnailFileResponse __all__ = ["VideoAssetsResource", "AsyncVideoAssetsResource"] @@ -566,61 +572,6 @@ def thumbnail_select( cast_to=VideoAssetThumbnailSelectResponse, ) - def thumbnail_upload( - self, - asset_id: str, - *, - # 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, - idempotency_key: str | None = None, - ) -> VideoAssetThumbnailUploadResponse: - """ - Use any image file to use as thumbnail. Once you use the API, you will get `upload_url` in the response, and that can be used to upload the image file. - - Here is the sample curl request. - - ```bash - curl --location --request PUT '' \\ - --data '' - ``` - - Args: - asset_id: An asset id for the previously created asset. - extra_headers: Send extra headers with the request. - extra_query: Send extra query parameters with the request. - extra_body: Send extra JSON properties with the request. - timeout: Override the client-level default timeout for this request, in seconds. - idempotency_key: Override or provide the idempotency key for this request. - - Returns: - VideoAssetThumbnailUploadResponse - - Example: - ```python - video_asset = client.video_assets.thumbnail_upload( - asset_id="assetId", - idempotency_key="", - ) - ``` - """ - if asset_id is None or (isinstance(asset_id, str) and not asset_id): - raise ValueError(f"Expected a non-empty value for `asset_id` but received {asset_id!r}") - return self._post( - path_template("/video/assets/{asset_ID}/thumbnail", **{"asset_ID": asset_id}), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=VideoAssetThumbnailUploadResponse, - ) - def create_update_chapter( self, asset_id: str, @@ -1098,6 +1049,66 @@ def analytics( cast_to=VideoAssetAnalyticsResponse, ) + def upload_thumbnail_file( + self, + asset_id: str, + file: FileTypes, + *, + # 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, + idempotency_key: str | None = None, + ) -> VideoAssetUploadThumbnailFileResponse: + """ + Requests a thumbnail upload URL for the asset and PUTs the file to it. + + Args: + asset_id: An asset id for the previously created asset. + file: The file to upload. It is sent to the pre-signed URL the request returns, without the client's credentials. A custom `http_client`'s transport carries it only when that is httpx's own `HTTPTransport` (`AsyncHTTPTransport` on the async client) or inherits `SignedUploadTransport`. + extra_headers: Send extra headers with the request. + extra_query: Send extra query parameters with the request. + extra_body: Send extra JSON properties with the request. + timeout: Override the client-level default timeout for this request, in seconds. + idempotency_key: Override or provide the idempotency key for this request. + + Returns: + VideoAssetUploadThumbnailFileResponse + + Example: + ```python + video_asset = client.video_assets.upload_thumbnail_file( + asset_id="assetId", + file=open("path/to/file", "rb"), + idempotency_key="", + ) + ``` + """ + _signed_upload_file = read_signed_upload_file(file) + if asset_id is None or (isinstance(asset_id, str) and not asset_id): + raise ValueError(f"Expected a non-empty value for `asset_id` but received {asset_id!r}") + initiated = self._post( + path_template("/video/assets/{asset_ID}/thumbnail", **{"asset_ID": asset_id}), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=VideoAssetUploadThumbnailFileResponse, + ) + upload_to_signed_url( + self._client, + initiated, + {"url_field": ["upload_url"], "method": "PUT", "body": "binary"}, + _signed_upload_file, + timeout=timeout, + ) + return initiated + class AsyncVideoAssetsResource(AsyncAPIResource): @cached_property @@ -1615,61 +1626,6 @@ async def thumbnail_select( cast_to=VideoAssetThumbnailSelectResponse, ) - async def thumbnail_upload( - self, - asset_id: str, - *, - # 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, - idempotency_key: str | None = None, - ) -> VideoAssetThumbnailUploadResponse: - """ - Use any image file to use as thumbnail. Once you use the API, you will get `upload_url` in the response, and that can be used to upload the image file. - - Here is the sample curl request. - - ```bash - curl --location --request PUT '' \\ - --data '' - ``` - - Args: - asset_id: An asset id for the previously created asset. - extra_headers: Send extra headers with the request. - extra_query: Send extra query parameters with the request. - extra_body: Send extra JSON properties with the request. - timeout: Override the client-level default timeout for this request, in seconds. - idempotency_key: Override or provide the idempotency key for this request. - - Returns: - VideoAssetThumbnailUploadResponse - - Example: - ```python - video_asset = await client.video_assets.thumbnail_upload( - asset_id="assetId", - idempotency_key="", - ) - ``` - """ - if asset_id is None or (isinstance(asset_id, str) and not asset_id): - raise ValueError(f"Expected a non-empty value for `asset_id` but received {asset_id!r}") - return await self._post( - path_template("/video/assets/{asset_ID}/thumbnail", **{"asset_ID": asset_id}), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=VideoAssetThumbnailUploadResponse, - ) - async def create_update_chapter( self, asset_id: str, @@ -2147,6 +2103,66 @@ async def analytics( cast_to=VideoAssetAnalyticsResponse, ) + async def upload_thumbnail_file( + self, + asset_id: str, + file: FileTypes, + *, + # 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, + idempotency_key: str | None = None, + ) -> VideoAssetUploadThumbnailFileResponse: + """ + Requests a thumbnail upload URL for the asset and PUTs the file to it. + + Args: + asset_id: An asset id for the previously created asset. + file: The file to upload. It is sent to the pre-signed URL the request returns, without the client's credentials. A custom `http_client`'s transport carries it only when that is httpx's own `HTTPTransport` (`AsyncHTTPTransport` on the async client) or inherits `SignedUploadTransport`. + extra_headers: Send extra headers with the request. + extra_query: Send extra query parameters with the request. + extra_body: Send extra JSON properties with the request. + timeout: Override the client-level default timeout for this request, in seconds. + idempotency_key: Override or provide the idempotency key for this request. + + Returns: + VideoAssetUploadThumbnailFileResponse + + Example: + ```python + video_asset = await client.video_assets.upload_thumbnail_file( + asset_id="assetId", + file=open("path/to/file", "rb"), + idempotency_key="", + ) + ``` + """ + _signed_upload_file = await async_read_signed_upload_file(file) + if asset_id is None or (isinstance(asset_id, str) and not asset_id): + raise ValueError(f"Expected a non-empty value for `asset_id` but received {asset_id!r}") + initiated = await self._post( + path_template("/video/assets/{asset_ID}/thumbnail", **{"asset_ID": asset_id}), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=VideoAssetUploadThumbnailFileResponse, + ) + await async_upload_to_signed_url( + self._client, + initiated, + {"url_field": ["upload_url"], "method": "PUT", "body": "binary"}, + _signed_upload_file, + timeout=timeout, + ) + return initiated + class VideoAssetsResourceWithRawResponse: def __init__(self, video_assets: VideoAssetsResource) -> None: @@ -2170,9 +2186,6 @@ def __init__(self, video_assets: VideoAssetsResource) -> None: self.thumbnail_select = to_raw_response_wrapper( video_assets.thumbnail_select, ) - self.thumbnail_upload = to_raw_response_wrapper( - video_assets.thumbnail_upload, - ) self.create_update_chapter = to_raw_response_wrapper( video_assets.create_update_chapter, ) @@ -2215,9 +2228,6 @@ def __init__(self, video_assets: AsyncVideoAssetsResource) -> None: self.thumbnail_select = async_to_raw_response_wrapper( video_assets.thumbnail_select, ) - self.thumbnail_upload = async_to_raw_response_wrapper( - video_assets.thumbnail_upload, - ) self.create_update_chapter = async_to_raw_response_wrapper( video_assets.create_update_chapter, ) @@ -2260,9 +2270,6 @@ def __init__(self, video_assets: VideoAssetsResource) -> None: self.thumbnail_select = to_streamed_response_wrapper( video_assets.thumbnail_select, ) - self.thumbnail_upload = to_streamed_response_wrapper( - video_assets.thumbnail_upload, - ) self.create_update_chapter = to_streamed_response_wrapper( video_assets.create_update_chapter, ) @@ -2305,9 +2312,6 @@ def __init__(self, video_assets: AsyncVideoAssetsResource) -> None: self.thumbnail_select = async_to_streamed_response_wrapper( video_assets.thumbnail_select, ) - self.thumbnail_upload = async_to_streamed_response_wrapper( - video_assets.thumbnail_upload, - ) self.create_update_chapter = async_to_streamed_response_wrapper( video_assets.create_update_chapter, ) diff --git a/src/gumlet/resources/webhooks.py b/src/gumlet/resources/webhooks.py index 862d8d4..e2adc5e 100644 --- a/src/gumlet/resources/webhooks.py +++ b/src/gumlet/resources/webhooks.py @@ -9,6 +9,7 @@ from .._utils import get_required_header from .._models import construct_type from .._resource import SyncAPIResource, AsyncAPIResource +from .._exceptions import EmptyWebhookSecretError from .._webhook_verify import verify_webhook_signature from ..types.parsed_webhook_event import ParsedWebhookEvent @@ -32,7 +33,7 @@ def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | except ValueError: empty_key = False if empty_key: - raise ValueError("Cannot verify a webhook with a key that decodes to an empty key") + raise EmptyWebhookSecretError("Cannot verify a webhook with a key that decodes to an empty key") if not isinstance(headers, dict): headers = dict(headers) @@ -67,7 +68,7 @@ def verify_signature(self, payload: str | bytes, headers: HeadersLike, *, key: s except ValueError: empty_key = False if empty_key: - raise ValueError("Cannot verify a webhook with a key that decodes to an empty key") + raise EmptyWebhookSecretError("Cannot verify a webhook with a key that decodes to an empty key") signed_headers = { "webhook-id": get_required_header(headers, "webhook-id"), @@ -107,7 +108,7 @@ def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | except ValueError: empty_key = False if empty_key: - raise ValueError("Cannot verify a webhook with a key that decodes to an empty key") + raise EmptyWebhookSecretError("Cannot verify a webhook with a key that decodes to an empty key") if not isinstance(headers, dict): headers = dict(headers) @@ -142,7 +143,7 @@ def verify_signature(self, payload: str | bytes, headers: HeadersLike, *, key: s except ValueError: empty_key = False if empty_key: - raise ValueError("Cannot verify a webhook with a key that decodes to an empty key") + raise EmptyWebhookSecretError("Cannot verify a webhook with a key that decodes to an empty key") signed_headers = { "webhook-id": get_required_header(headers, "webhook-id"), diff --git a/src/gumlet/types/__init__.py b/src/gumlet/types/__init__.py index b40d90d..6737db0 100644 --- a/src/gumlet/types/__init__.py +++ b/src/gumlet/types/__init__.py @@ -19,9 +19,6 @@ VideoAssetThumbnailSelectResponse as VideoAssetThumbnailSelectResponse, ) from .video_asset_thumbnail_select_params import VideoAssetThumbnailSelectParams as VideoAssetThumbnailSelectParams -from .video_asset_thumbnail_upload_response import ( - VideoAssetThumbnailUploadResponse as VideoAssetThumbnailUploadResponse, -) from .video_asset_create_update_chapter_response import ( VideoAssetCreateUpdateChapterResponse as VideoAssetCreateUpdateChapterResponse, ) @@ -42,6 +39,9 @@ from .video_asset_tag_many_params import VideoAssetTagManyParams as VideoAssetTagManyParams from .video_asset_analytics_response import VideoAssetAnalyticsResponse as VideoAssetAnalyticsResponse from .video_asset_analytics_params import VideoAssetAnalyticsParams as VideoAssetAnalyticsParams +from .video_asset_upload_thumbnail_file_response import ( + VideoAssetUploadThumbnailFileResponse as VideoAssetUploadThumbnailFileResponse, +) from .subtitle_upload_upload_response import SubtitleUploadUploadResponse as SubtitleUploadUploadResponse from .subtitle_upload_upload_params import SubtitleUploadUploadParams as SubtitleUploadUploadParams from .subtitle_upload_complete_response import SubtitleUploadCompleteResponse as SubtitleUploadCompleteResponse diff --git a/src/gumlet/types/video_asset_thumbnail_upload_response.py b/src/gumlet/types/video_asset_upload_thumbnail_file_response.py similarity index 80% rename from src/gumlet/types/video_asset_thumbnail_upload_response.py rename to src/gumlet/types/video_asset_upload_thumbnail_file_response.py index fa2305b..7308e07 100644 --- a/src/gumlet/types/video_asset_thumbnail_upload_response.py +++ b/src/gumlet/types/video_asset_upload_thumbnail_file_response.py @@ -4,10 +4,10 @@ from .._models import BaseModel -__all__ = ["VideoAssetThumbnailUploadResponse"] +__all__ = ["VideoAssetUploadThumbnailFileResponse"] -class VideoAssetThumbnailUploadResponse(BaseModel): +class VideoAssetUploadThumbnailFileResponse(BaseModel): upload_url: Optional[str] = None """Upload URL on which new thumbnail must be uploaded using a PUT request""" diff --git a/tests/api_resources/test_video_assets.py b/tests/api_resources/test_video_assets.py index 7c8550b..0b9e58e 100644 --- a/tests/api_resources/test_video_assets.py +++ b/tests/api_resources/test_video_assets.py @@ -215,15 +215,6 @@ def test_method_thumbnail_select(self) -> None: idempotency_key="", ) - @smoke_case( - "videoAssets.thumbnailUpload:single", operation="thumbnailUpload", path="/video/assets/{asset_ID}/thumbnail" - ) - def test_method_thumbnail_upload(self) -> None: - video_asset = client.video_assets.thumbnail_upload( - asset_id="assetId", - idempotency_key="", - ) - @smoke_case( "videoAssets.createUpdateChapter:single", operation="createUpdateChapter", diff --git a/tests/smoke_support.py b/tests/smoke_support.py index 1909054..c481793 100644 --- a/tests/smoke_support.py +++ b/tests/smoke_support.py @@ -33,7 +33,7 @@ # Fingerprint of the case list the generator's smoke runner checks this suite against (written only # for generator tooling). The runner refuses a list whose digest differs, so a list left by an # earlier generation is never trusted. -SMOKE_CASE_LIST_DIGEST = "68aef1b66ab28e6b" +SMOKE_CASE_LIST_DIGEST = "6e1eeb80c7a3ed96" _BASE_URL = os.environ.get("TEST_API_BASE_URL") or None From 8a894b820c9c57d565378060f9c3f9cf2f94aaaf Mon Sep 17 00:00:00 2001 From: scalarbot Date: Tue, 24 Nov 2026 08:07:34 +0000 Subject: [PATCH 2/7] feat(api)!: update SDK surface (5 changes) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - method-name POST video/assets/{p}/thumbnail — method names differ (breaking: renamed; the old spelling no longer resolves) - types-files types/video_asset_upload_thumbnail_file_response.py — type file only in before (1 member: 0 matched by name and kind elsewhere in after, 1 not found) (breaking: removed; video_asset_upload_thumbnail_response.py appeared in its place, likely a rename) - types-classes types/__init__.py:VideoAssetUploadThumbnailFileResponse — reexport only in before (breaking: removed; VideoAssetUploadThumbnailResponse appeared in its place, likely a rename) - types-files types/video_asset_upload_thumbnail_response.py — type file only in after (additive: only the new snapshot has it; likely the new name of video_asset_upload_thumbnail_file_response.py) - types-classes types/__init__.py:VideoAssetUploadThumbnailResponse — reexport only in after (additive: only the new snapshot has it; likely the new name of VideoAssetUploadThumbnailFileResponse) BREAKING CHANGE: 3 breaking changes to the SDK surface. - method-name POST video/assets/{p}/thumbnail — method names differ (breaking: renamed; the old spelling no longer resolves) - types-files types/video_asset_upload_thumbnail_file_response.py — type file only in before (1 member: 0 matched by name and kind elsewhere in after, 1 not found) (breaking: removed; video_asset_upload_thumbnail_response.py appeared in its place, likely a rename) - types-classes types/__init__.py:VideoAssetUploadThumbnailFileResponse — reexport only in before (breaking: removed; VideoAssetUploadThumbnailResponse appeared in its place, likely a rename) Build: H5sbZ544iOEBDxiRhpgWx --- api.md | 4 ++-- scalar-sdk.manifest.json | 6 ++--- src/gumlet/resources/video_assets.py | 22 +++++++++---------- src/gumlet/types/__init__.py | 4 ++-- ... video_asset_upload_thumbnail_response.py} | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) rename src/gumlet/types/{video_asset_upload_thumbnail_file_response.py => video_asset_upload_thumbnail_response.py} (80%) diff --git a/api.md b/api.md index c0acafb..14f216c 100644 --- a/api.md +++ b/api.md @@ -377,10 +377,10 @@ Requests a thumbnail upload URL for the asset and PUTs the file to it. | Direction | Type | | --- | --- | -| Response | [`VideoAssetUploadThumbnailFileResponse`](./src/gumlet/types/video_asset_upload_thumbnail_file_response.py) | +| Response | [`VideoAssetUploadThumbnailResponse`](./src/gumlet/types/video_asset_upload_thumbnail_response.py) | ```python -video_asset = client.video_assets.upload_thumbnail_file( +video_asset = client.video_assets.upload_thumbnail( asset_id="assetId", file=open("path/to/file", "rb"), idempotency_key="", diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index 5accf04..d2ed7f3 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -3268,8 +3268,8 @@ { "resource": "videoAssets", "publicResource": "videoAssets", - "operation": "uploadThumbnailFile", - "publicOperation": "uploadThumbnailFile", + "operation": "uploadThumbnail", + "publicOperation": "uploadThumbnail", "deprecated": false, "method": "POST", "path": "/video/assets/{asset_ID}/thumbnail", @@ -3300,7 +3300,7 @@ "publicCookieParams": [], "cookieParamDetails": [], "paramsModel": { - "publicName": "VideoAssetUploadThumbnailFileParams" + "publicName": "VideoAssetUploadThumbnailParams" }, "response": { "status": "200", diff --git a/src/gumlet/resources/video_assets.py b/src/gumlet/resources/video_assets.py index 685aa84..915431c 100644 --- a/src/gumlet/resources/video_assets.py +++ b/src/gumlet/resources/video_assets.py @@ -51,7 +51,7 @@ from ..types.video_asset_delete_many_response import VideoAssetDeleteManyResponse from ..types.video_asset_tag_many_response import VideoAssetTagManyResponse from ..types.video_asset_analytics_response import VideoAssetAnalyticsResponse -from ..types.video_asset_upload_thumbnail_file_response import VideoAssetUploadThumbnailFileResponse +from ..types.video_asset_upload_thumbnail_response import VideoAssetUploadThumbnailResponse __all__ = ["VideoAssetsResource", "AsyncVideoAssetsResource"] @@ -1049,7 +1049,7 @@ def analytics( cast_to=VideoAssetAnalyticsResponse, ) - def upload_thumbnail_file( + def upload_thumbnail( self, asset_id: str, file: FileTypes, @@ -1061,7 +1061,7 @@ def upload_thumbnail_file( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> VideoAssetUploadThumbnailFileResponse: + ) -> VideoAssetUploadThumbnailResponse: """ Requests a thumbnail upload URL for the asset and PUTs the file to it. @@ -1075,11 +1075,11 @@ def upload_thumbnail_file( idempotency_key: Override or provide the idempotency key for this request. Returns: - VideoAssetUploadThumbnailFileResponse + VideoAssetUploadThumbnailResponse Example: ```python - video_asset = client.video_assets.upload_thumbnail_file( + video_asset = client.video_assets.upload_thumbnail( asset_id="assetId", file=open("path/to/file", "rb"), idempotency_key="", @@ -1098,7 +1098,7 @@ def upload_thumbnail_file( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=VideoAssetUploadThumbnailFileResponse, + cast_to=VideoAssetUploadThumbnailResponse, ) upload_to_signed_url( self._client, @@ -2103,7 +2103,7 @@ async def analytics( cast_to=VideoAssetAnalyticsResponse, ) - async def upload_thumbnail_file( + async def upload_thumbnail( self, asset_id: str, file: FileTypes, @@ -2115,7 +2115,7 @@ async def upload_thumbnail_file( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> VideoAssetUploadThumbnailFileResponse: + ) -> VideoAssetUploadThumbnailResponse: """ Requests a thumbnail upload URL for the asset and PUTs the file to it. @@ -2129,11 +2129,11 @@ async def upload_thumbnail_file( idempotency_key: Override or provide the idempotency key for this request. Returns: - VideoAssetUploadThumbnailFileResponse + VideoAssetUploadThumbnailResponse Example: ```python - video_asset = await client.video_assets.upload_thumbnail_file( + video_asset = await client.video_assets.upload_thumbnail( asset_id="assetId", file=open("path/to/file", "rb"), idempotency_key="", @@ -2152,7 +2152,7 @@ async def upload_thumbnail_file( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=VideoAssetUploadThumbnailFileResponse, + cast_to=VideoAssetUploadThumbnailResponse, ) await async_upload_to_signed_url( self._client, diff --git a/src/gumlet/types/__init__.py b/src/gumlet/types/__init__.py index 6737db0..5fb1596 100644 --- a/src/gumlet/types/__init__.py +++ b/src/gumlet/types/__init__.py @@ -39,8 +39,8 @@ from .video_asset_tag_many_params import VideoAssetTagManyParams as VideoAssetTagManyParams from .video_asset_analytics_response import VideoAssetAnalyticsResponse as VideoAssetAnalyticsResponse from .video_asset_analytics_params import VideoAssetAnalyticsParams as VideoAssetAnalyticsParams -from .video_asset_upload_thumbnail_file_response import ( - VideoAssetUploadThumbnailFileResponse as VideoAssetUploadThumbnailFileResponse, +from .video_asset_upload_thumbnail_response import ( + VideoAssetUploadThumbnailResponse as VideoAssetUploadThumbnailResponse, ) from .subtitle_upload_upload_response import SubtitleUploadUploadResponse as SubtitleUploadUploadResponse from .subtitle_upload_upload_params import SubtitleUploadUploadParams as SubtitleUploadUploadParams diff --git a/src/gumlet/types/video_asset_upload_thumbnail_file_response.py b/src/gumlet/types/video_asset_upload_thumbnail_response.py similarity index 80% rename from src/gumlet/types/video_asset_upload_thumbnail_file_response.py rename to src/gumlet/types/video_asset_upload_thumbnail_response.py index 7308e07..7362a14 100644 --- a/src/gumlet/types/video_asset_upload_thumbnail_file_response.py +++ b/src/gumlet/types/video_asset_upload_thumbnail_response.py @@ -4,10 +4,10 @@ from .._models import BaseModel -__all__ = ["VideoAssetUploadThumbnailFileResponse"] +__all__ = ["VideoAssetUploadThumbnailResponse"] -class VideoAssetUploadThumbnailFileResponse(BaseModel): +class VideoAssetUploadThumbnailResponse(BaseModel): upload_url: Optional[str] = None """Upload URL on which new thumbnail must be uploaded using a PUT request""" From a3ac8bbb6a8d7efe7e7a210988e48671e22173f9 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Tue, 24 Nov 2026 08:47:41 +0000 Subject: [PATCH 3/7] chore: release 1.6.1 Release-As: 1.6.1 From de6129ef4f205fffeed9d90f71ff46e06b460331 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Tue, 24 Nov 2026 08:51:15 +0000 Subject: [PATCH 4/7] feat(api): update SDK surface (2 changes) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - types-files types/video_asset_thumbnail_upload_response.py — type file only in after (additive: only the new snapshot has it) - types-classes types/__init__.py:VideoAssetThumbnailUploadResponse — reexport only in after (additive: only the new snapshot has it) Build: 2QdivLRFzhULVPDWkgjGC --- api.md | 23 ++++ scalar-sdk.manifest.json | 106 +++++++++++++++ src/gumlet/resources/video_assets.py | 123 ++++++++++++++++++ src/gumlet/types/__init__.py | 3 + .../video_asset_thumbnail_upload_response.py | 18 +++ tests/api_resources/test_video_assets.py | 9 ++ tests/smoke_support.py | 2 +- 7 files changed, 283 insertions(+), 1 deletion(-) create mode 100644 src/gumlet/types/video_asset_thumbnail_upload_response.py diff --git a/api.md b/api.md index 14f216c..966fad6 100644 --- a/api.md +++ b/api.md @@ -11,6 +11,7 @@ Complete reference of every operation, grouped by resource. See [the README](./R - [Delete Asset](#delete-asset) - [Update Asset](#update-asset) - [Update thumbnail from video](#update-thumbnail-from-video) + - [Update thumbnail via upload](#update-thumbnail-via-upload) - [Create/Update Video Asset Chapters](#createupdate-video-asset-chapters) - [List Assets (Deprecated)](#list-assets-deprecated) - [List Assets](#list-assets) @@ -250,6 +251,28 @@ video_asset = client.video_assets.thumbnail_select( ) ``` +### Update thumbnail via upload + +Use any image file to use as thumbnail. Once you use the API, you will get `upload_url` in the response, and that can be used to upload the image file. + +Here is the sample curl request. + +```bash +curl --location --request PUT '' \ +--data '' +``` + +| Direction | Type | +| --- | --- | +| Response | [`VideoAssetThumbnailUploadResponse`](./src/gumlet/types/video_asset_thumbnail_upload_response.py) | + +```python +video_asset = client.video_assets.thumbnail_upload( + asset_id="assetId", + idempotency_key="", +) +``` + ### Create/Update Video Asset Chapters This endpoint will create/update video asset chapters. diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index d2ed7f3..82b01d9 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -2252,6 +2252,112 @@ "responseLinks": [], "transport": "http" }, + { + "resource": "videoAssets", + "publicResource": "videoAssets", + "operation": "thumbnailUpload", + "publicOperation": "thumbnailUpload", + "deprecated": false, + "method": "POST", + "path": "/video/assets/{asset_ID}/thumbnail", + "pathParams": [ + "asset_ID" + ], + "publicPathParams": [ + "asset_ID" + ], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [], + "publicBodyParams": [], + "bodyParamDetails": [], + "pathParamDetails": [ + { + "name": "asset_ID", + "required": true, + "style": "simple", + "explode": false + } + ], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VideoAssetThumbnailUploadParams" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "403", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + } + ], + "responseLinks": [], + "transport": "http" + }, { "resource": "videoAssets", "publicResource": "videoAssets", diff --git a/src/gumlet/resources/video_assets.py b/src/gumlet/resources/video_assets.py index 915431c..9e86596 100644 --- a/src/gumlet/resources/video_assets.py +++ b/src/gumlet/resources/video_assets.py @@ -43,6 +43,7 @@ from ..types.video_asset_retrieve_details_response import VideoAssetRetrieveDetailsResponse from ..types.video_asset_update_response import VideoAssetUpdateResponse from ..types.video_asset_thumbnail_select_response import VideoAssetThumbnailSelectResponse +from ..types.video_asset_thumbnail_upload_response import VideoAssetThumbnailUploadResponse from ..types.video_asset_create_update_chapter_response import VideoAssetCreateUpdateChapterResponse from ..types.video_asset_list_workspace_folders_and_deprecated_response import ( VideoAssetListWorkspaceFoldersAndDeprecatedResponse, @@ -572,6 +573,61 @@ def thumbnail_select( cast_to=VideoAssetThumbnailSelectResponse, ) + def thumbnail_upload( + self, + asset_id: str, + *, + # 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, + idempotency_key: str | None = None, + ) -> VideoAssetThumbnailUploadResponse: + """ + Use any image file to use as thumbnail. Once you use the API, you will get `upload_url` in the response, and that can be used to upload the image file. + + Here is the sample curl request. + + ```bash + curl --location --request PUT '' \\ + --data '' + ``` + + Args: + asset_id: An asset id for the previously created asset. + extra_headers: Send extra headers with the request. + extra_query: Send extra query parameters with the request. + extra_body: Send extra JSON properties with the request. + timeout: Override the client-level default timeout for this request, in seconds. + idempotency_key: Override or provide the idempotency key for this request. + + Returns: + VideoAssetThumbnailUploadResponse + + Example: + ```python + video_asset = client.video_assets.thumbnail_upload( + asset_id="assetId", + idempotency_key="", + ) + ``` + """ + if asset_id is None or (isinstance(asset_id, str) and not asset_id): + raise ValueError(f"Expected a non-empty value for `asset_id` but received {asset_id!r}") + return self._post( + path_template("/video/assets/{asset_ID}/thumbnail", **{"asset_ID": asset_id}), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=VideoAssetThumbnailUploadResponse, + ) + def create_update_chapter( self, asset_id: str, @@ -1626,6 +1682,61 @@ async def thumbnail_select( cast_to=VideoAssetThumbnailSelectResponse, ) + async def thumbnail_upload( + self, + asset_id: str, + *, + # 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, + idempotency_key: str | None = None, + ) -> VideoAssetThumbnailUploadResponse: + """ + Use any image file to use as thumbnail. Once you use the API, you will get `upload_url` in the response, and that can be used to upload the image file. + + Here is the sample curl request. + + ```bash + curl --location --request PUT '' \\ + --data '' + ``` + + Args: + asset_id: An asset id for the previously created asset. + extra_headers: Send extra headers with the request. + extra_query: Send extra query parameters with the request. + extra_body: Send extra JSON properties with the request. + timeout: Override the client-level default timeout for this request, in seconds. + idempotency_key: Override or provide the idempotency key for this request. + + Returns: + VideoAssetThumbnailUploadResponse + + Example: + ```python + video_asset = await client.video_assets.thumbnail_upload( + asset_id="assetId", + idempotency_key="", + ) + ``` + """ + if asset_id is None or (isinstance(asset_id, str) and not asset_id): + raise ValueError(f"Expected a non-empty value for `asset_id` but received {asset_id!r}") + return await self._post( + path_template("/video/assets/{asset_ID}/thumbnail", **{"asset_ID": asset_id}), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=VideoAssetThumbnailUploadResponse, + ) + async def create_update_chapter( self, asset_id: str, @@ -2186,6 +2297,9 @@ def __init__(self, video_assets: VideoAssetsResource) -> None: self.thumbnail_select = to_raw_response_wrapper( video_assets.thumbnail_select, ) + self.thumbnail_upload = to_raw_response_wrapper( + video_assets.thumbnail_upload, + ) self.create_update_chapter = to_raw_response_wrapper( video_assets.create_update_chapter, ) @@ -2228,6 +2342,9 @@ def __init__(self, video_assets: AsyncVideoAssetsResource) -> None: self.thumbnail_select = async_to_raw_response_wrapper( video_assets.thumbnail_select, ) + self.thumbnail_upload = async_to_raw_response_wrapper( + video_assets.thumbnail_upload, + ) self.create_update_chapter = async_to_raw_response_wrapper( video_assets.create_update_chapter, ) @@ -2270,6 +2387,9 @@ def __init__(self, video_assets: VideoAssetsResource) -> None: self.thumbnail_select = to_streamed_response_wrapper( video_assets.thumbnail_select, ) + self.thumbnail_upload = to_streamed_response_wrapper( + video_assets.thumbnail_upload, + ) self.create_update_chapter = to_streamed_response_wrapper( video_assets.create_update_chapter, ) @@ -2312,6 +2432,9 @@ def __init__(self, video_assets: AsyncVideoAssetsResource) -> None: self.thumbnail_select = async_to_streamed_response_wrapper( video_assets.thumbnail_select, ) + self.thumbnail_upload = async_to_streamed_response_wrapper( + video_assets.thumbnail_upload, + ) self.create_update_chapter = async_to_streamed_response_wrapper( video_assets.create_update_chapter, ) diff --git a/src/gumlet/types/__init__.py b/src/gumlet/types/__init__.py index 5fb1596..e245b56 100644 --- a/src/gumlet/types/__init__.py +++ b/src/gumlet/types/__init__.py @@ -19,6 +19,9 @@ VideoAssetThumbnailSelectResponse as VideoAssetThumbnailSelectResponse, ) from .video_asset_thumbnail_select_params import VideoAssetThumbnailSelectParams as VideoAssetThumbnailSelectParams +from .video_asset_thumbnail_upload_response import ( + VideoAssetThumbnailUploadResponse as VideoAssetThumbnailUploadResponse, +) from .video_asset_create_update_chapter_response import ( VideoAssetCreateUpdateChapterResponse as VideoAssetCreateUpdateChapterResponse, ) diff --git a/src/gumlet/types/video_asset_thumbnail_upload_response.py b/src/gumlet/types/video_asset_thumbnail_upload_response.py new file mode 100644 index 0000000..fa2305b --- /dev/null +++ b/src/gumlet/types/video_asset_thumbnail_upload_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Scalar. See README.md for details. + +from typing import Optional + +from .._models import BaseModel + +__all__ = ["VideoAssetThumbnailUploadResponse"] + + +class VideoAssetThumbnailUploadResponse(BaseModel): + upload_url: Optional[str] = None + """Upload URL on which new thumbnail must be uploaded using a PUT request""" + + asset_id: Optional[str] = None + """Asset ID""" + + thumbnail_updated_at: Optional[int] = None + """Thumbnail updated at timestamp in milliseconds since epoch""" diff --git a/tests/api_resources/test_video_assets.py b/tests/api_resources/test_video_assets.py index 0b9e58e..7c8550b 100644 --- a/tests/api_resources/test_video_assets.py +++ b/tests/api_resources/test_video_assets.py @@ -215,6 +215,15 @@ def test_method_thumbnail_select(self) -> None: idempotency_key="", ) + @smoke_case( + "videoAssets.thumbnailUpload:single", operation="thumbnailUpload", path="/video/assets/{asset_ID}/thumbnail" + ) + def test_method_thumbnail_upload(self) -> None: + video_asset = client.video_assets.thumbnail_upload( + asset_id="assetId", + idempotency_key="", + ) + @smoke_case( "videoAssets.createUpdateChapter:single", operation="createUpdateChapter", diff --git a/tests/smoke_support.py b/tests/smoke_support.py index c481793..1909054 100644 --- a/tests/smoke_support.py +++ b/tests/smoke_support.py @@ -33,7 +33,7 @@ # Fingerprint of the case list the generator's smoke runner checks this suite against (written only # for generator tooling). The runner refuses a list whose digest differs, so a list left by an # earlier generation is never trusted. -SMOKE_CASE_LIST_DIGEST = "6e1eeb80c7a3ed96" +SMOKE_CASE_LIST_DIGEST = "68aef1b66ab28e6b" _BASE_URL = os.environ.get("TEST_API_BASE_URL") or None From b667221b3a612844112fe3e862e1221b245910d6 Mon Sep 17 00:00:00 2001 From: scalarbot Date: Tue, 24 Nov 2026 08:59:20 +0000 Subject: [PATCH 5/7] feat(api)!: update SDK surface (7 changes) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - method-name POST video/assets/upload — method names differ (breaking: renamed; the old spelling no longer resolves) - path-params POST video/assets/upload — path parameter missing on one side (breaking: changed in a way existing callers can observe) - request-shape POST video/assets/upload.file — field only in after (breaking: new required request member; existing calls lack it) - types-files types/video_asset_upload_file_params.py — type file only in after (additive: only the new snapshot has it) - types-files types/video_asset_upload_file_response.py — type file only in after (additive: only the new snapshot has it) - types-classes types/__init__.py:VideoAssetUploadFileParams — reexport only in after (additive: only the new snapshot has it) - types-classes types/__init__.py:VideoAssetUploadFileResponse — reexport only in after (additive: only the new snapshot has it) BREAKING CHANGE: 3 breaking changes to the SDK surface. - method-name POST video/assets/upload — method names differ (breaking: renamed; the old spelling no longer resolves) - path-params POST video/assets/upload — path parameter missing on one side (breaking: changed in a way existing callers can observe) - request-shape POST video/assets/upload.file — field only in after (breaking: new required request member; existing calls lack it) Build: 1iGmP6Cx6G0OKtOMMEB1V --- api.md | 39 +++ scalar-sdk.manifest.json | 297 ++++++++++++++++ src/gumlet/resources/video_assets.py | 328 ++++++++++++++++++ src/gumlet/types/__init__.py | 2 + .../types/video_asset_upload_file_params.py | 270 ++++++++++++++ .../types/video_asset_upload_file_response.py | 111 ++++++ 6 files changed, 1047 insertions(+) create mode 100644 src/gumlet/types/video_asset_upload_file_params.py create mode 100644 src/gumlet/types/video_asset_upload_file_response.py diff --git a/api.md b/api.md index 966fad6..d3c9250 100644 --- a/api.md +++ b/api.md @@ -18,6 +18,7 @@ Complete reference of every operation, grouped by resource. See [the README](./R - [Bulk Delete](#bulk-delete) - [Bulk Tag](#bulk-tag) - [Asset Analytics](#asset-analytics) + - [Create Asset Direct Upload](#create-asset-direct-upload-1) - [Upload a thumbnail file](#upload-a-thumbnail-file) - [`SubtitleUpload`](#subtitleupload) - [Upload Subtitles](#upload-subtitles) @@ -394,6 +395,44 @@ video_asset = client.video_assets.analytics( ) ``` +### Create Asset Direct Upload + +This endpoint creates a video asset allowing upload of a video from the local file system and ingest media content into the Gumlet system for processing and delivery. Body parameters are the same as the Create Asset body parameters except for the `input` parameter, which this endpoint does not take. A successful response will be returned with `upload_url` field. You can make `PUT` request to that URL to upload video. To upload video using `upload_url` refer to [this](https://docs.gumlet.com/docs/direct-upload#2-use-the-url-to-upload-a-file). + +| Direction | Type | +| --- | --- | +| Request | [`VideoAssetUploadFileParams`](./src/gumlet/types/video_asset_upload_file_params.py) | +| Response | [`VideoAssetUploadFileResponse`](./src/gumlet/types/video_asset_upload_file_response.py) | + +```python +video_asset = client.video_assets.upload_file( + file=open("path/to/file", "rb"), + collection_id="646df1c9173a4a2fcac180b4", + profile_id="646df1c9173a4a2fcac180b7", + format="ABR", + tag=["ball"], + description="some description", + metadata={"headermeta": "metavalue"}, + call_to_actions=[ + { + "start_time": 1, + "end_time": 90, + "text": "some test", + "url": "https://some-url.com", + "position_from_top": 11, + "position_from_right": 23, + "border_radius": "11", + "font_color": "#000001", + "background_color": "#ffffff", + } + ], + playlist_id="6597acd5ed6f26a9c5ca9633", + folder="697375fbfa2d1037283140e4", + workspace_id="646df1c9173a4a2fcac180b4", + idempotency_key="", +) +``` + ### Upload a thumbnail file Requests a thumbnail upload URL for the asset and PUTs the file to it. diff --git a/scalar-sdk.manifest.json b/scalar-sdk.manifest.json index 82b01d9..61e9282 100644 --- a/scalar-sdk.manifest.json +++ b/scalar-sdk.manifest.json @@ -3371,6 +3371,303 @@ "responseLinks": [], "transport": "http" }, + { + "resource": "videoAssets", + "publicResource": "videoAssets", + "operation": "uploadFile", + "publicOperation": "uploadFile", + "deprecated": false, + "method": "POST", + "path": "/video/assets/upload", + "pathParams": [], + "publicPathParams": [], + "queryParams": [], + "publicQueryParams": [], + "headerParams": [], + "publicHeaderParams": [], + "bodyParams": [ + "collection_id", + "profile_id", + "format", + "tag", + "title", + "description", + "metadata", + "width", + "height", + "resolution", + "crop", + "pad", + "trim", + "image_overlay", + "text_overlay", + "animated_gif", + "additional_tracks", + "generate_subtitles", + "mp4_access", + "per_title_encoding", + "process_low_resolution_input", + "audio_only", + "enable_drm", + "call_to_actions", + "playlist_id", + "folder", + "workspace_id" + ], + "publicBodyParams": [ + "collection_id", + "profile_id", + "format", + "tag", + "title", + "description", + "metadata", + "width", + "height", + "resolution", + "crop", + "pad", + "trim", + "image_overlay", + "text_overlay", + "animated_gif", + "additional_tracks", + "generate_subtitles", + "mp4_access", + "per_title_encoding", + "process_low_resolution_input", + "audio_only", + "enable_drm", + "call_to_actions", + "playlist_id", + "folder", + "workspace_id" + ], + "bodyParamDetails": [ + { + "name": "collection_id", + "required": false + }, + { + "name": "profile_id", + "required": false + }, + { + "name": "format", + "required": false + }, + { + "name": "tag", + "required": false + }, + { + "name": "title", + "required": false + }, + { + "name": "description", + "required": false + }, + { + "name": "metadata", + "required": false + }, + { + "name": "width", + "required": false + }, + { + "name": "height", + "required": false + }, + { + "name": "resolution", + "required": false + }, + { + "name": "crop", + "required": false + }, + { + "name": "pad", + "required": false + }, + { + "name": "trim", + "required": false + }, + { + "name": "image_overlay", + "required": false + }, + { + "name": "text_overlay", + "required": false + }, + { + "name": "animated_gif", + "required": false + }, + { + "name": "additional_tracks", + "required": false + }, + { + "name": "generate_subtitles", + "required": false + }, + { + "name": "mp4_access", + "required": false + }, + { + "name": "per_title_encoding", + "required": false + }, + { + "name": "process_low_resolution_input", + "required": false + }, + { + "name": "audio_only", + "required": false + }, + { + "name": "enable_drm", + "required": false + }, + { + "name": "call_to_actions", + "required": false + }, + { + "name": "playlist_id", + "required": false + }, + { + "name": "folder", + "required": false + }, + { + "name": "workspace_id", + "required": true + } + ], + "pathParamDetails": [], + "queryParamDetails": [], + "headerParamDetails": [], + "cookieParams": [], + "publicCookieParams": [], + "cookieParamDetails": [], + "paramsModel": { + "publicName": "VideoAssetUploadFileParams" + }, + "requestBody": { + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ], + "required": false, + "publicName": "body", + "publicIdentifier": "body" + }, + "response": { + "status": "200", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + "result": { + "successStatus": "200", + "errorStatuses": [ + "400", + "401", + "402", + "403", + "422", + "500" + ] + }, + "errorResponses": [ + { + "status": "400", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "401", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "402", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "403", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "422", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + }, + { + "status": "500", + "contentType": "application/json", + "encoding": "json", + "contents": [ + { + "contentType": "application/json", + "encoding": "json" + } + ] + } + ], + "responseLinks": [], + "transport": "http" + }, { "resource": "videoAssets", "publicResource": "videoAssets", diff --git a/src/gumlet/resources/video_assets.py b/src/gumlet/resources/video_assets.py index 9e86596..31b54a7 100644 --- a/src/gumlet/resources/video_assets.py +++ b/src/gumlet/resources/video_assets.py @@ -38,6 +38,7 @@ video_asset_delete_many_params, video_asset_tag_many_params, video_asset_analytics_params, + video_asset_upload_file_params, ) from ..types.video_asset_upload_response import VideoAssetUploadResponse from ..types.video_asset_retrieve_details_response import VideoAssetRetrieveDetailsResponse @@ -52,6 +53,7 @@ from ..types.video_asset_delete_many_response import VideoAssetDeleteManyResponse from ..types.video_asset_tag_many_response import VideoAssetTagManyResponse from ..types.video_asset_analytics_response import VideoAssetAnalyticsResponse +from ..types.video_asset_upload_file_response import VideoAssetUploadFileResponse from ..types.video_asset_upload_thumbnail_response import VideoAssetUploadThumbnailResponse __all__ = ["VideoAssetsResource", "AsyncVideoAssetsResource"] @@ -1105,6 +1107,169 @@ def analytics( cast_to=VideoAssetAnalyticsResponse, ) + def upload_file( + self, + file: FileTypes, + *, + collection_id: str | Omit = omit, + profile_id: str | Omit = omit, + format: Literal["ABR", "MP4"] | Omit = omit, + tag: SequenceNotStr[str] | Omit = omit, + title: str | Omit = omit, + description: str | Omit = omit, + metadata: Dict[str, object] | Omit = omit, + width: str | Omit = omit, + height: str | Omit = omit, + resolution: str | Omit = omit, + crop: video_asset_upload_file_params.Crop | Omit = omit, + pad: video_asset_upload_file_params.Pad | Omit = omit, + trim: video_asset_upload_file_params.Trim | Omit = omit, + image_overlay: video_asset_upload_file_params.ImageOverlay | Omit = omit, + text_overlay: video_asset_upload_file_params.TextOverlay | Omit = omit, + animated_gif: video_asset_upload_file_params.AnimatedGif | Omit = omit, + additional_tracks: Iterable[video_asset_upload_file_params.AdditionalTrack] | Omit = omit, + generate_subtitles: video_asset_upload_file_params.GenerateSubtitles | Omit = omit, + mp4_access: bool | Omit = omit, + per_title_encoding: bool | Omit = omit, + process_low_resolution_input: bool | Omit = omit, + audio_only: bool | Omit = omit, + enable_drm: bool | Omit = omit, + call_to_actions: Iterable[video_asset_upload_file_params.CallToAction] | Omit = omit, + playlist_id: str | Omit = omit, + folder: str | Omit = omit, + workspace_id: str, + # 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, + idempotency_key: str | None = None, + ) -> VideoAssetUploadFileResponse: + """ + This endpoint creates a video asset allowing upload of a video from the local file system and ingest media content into the Gumlet system for processing and delivery. Body parameters are the same as the Create Asset body parameters except for the `input` parameter, which this endpoint does not take. A successful response will be returned with `upload_url` field. You can make `PUT` request to that URL to upload video. To upload video using `upload_url` refer to [this](https://docs.gumlet.com/docs/direct-upload#2-use-the-url-to-upload-a-file). + + Args: + file: The file to upload. It is sent to the pre-signed URL the request returns, without the client's credentials. A custom `http_client`'s transport carries it only when that is httpx's own `HTTPTransport` (`AsyncHTTPTransport` on the async client) or inherits `SignedUploadTransport`. + collection_id: Deprecated. Use `workspace_id` instead. Still accepted for backwards compatibility. + profile_id: Provide `profile_id` of the previously created video profile. This parameter will override all the parameters (except `input` and `workspace_id`) from the video profile. + format: Transcode and deliver the asset in the requested format. The options can be one of `ABR` (HLS + DASH) and `MP4`. + tag: Specify a text string or identifier which can identify an asset or bunch of assets later. + title: Specify a text string or identifier which can be used for filtering or searching the asset. + description: Attach some textual data with the asset. This field is neither searchable nor filterable. + metadata: Add your metadata you want to associate with this asset.
Example:
{ "internal_video_id" : "123Abc" } + width: Resize video with the given width. Can be an absolute value in pixels or a percentage value with the `%` suffix. Specified values greater than the original asset width will be ignored. Applicable only when specified format is `MP4`. + height: Resize video with the given height. Can be an absolute value in pixels or a percentage value with the `%` suffix. Specified values greater than the original asset height will be ignored. Applicable only when specified format is `MP4`. + resolution: Required resolutions of the transformed asset in case of HLS or MPEG-DASH delivery format. Can be a comma-separated string out of the following values: `240p`, `360p`, `480p`, `540p`, `720p`, and `1080p`. Resized rendition will retain the input aspect ratio. + crop: This transformation can be used to crop the video by defining a rectangular area within the dimensions of the output video. + pad: This transformation can be used to add padding to the video. + trim: Trim transformation can be used to trim videos based on time duration. + image_overlay: Image overlay can be used to brand a video or add a visual label in the form of an image. + text_overlay: Text overlay can be used to brand a video or add a label in the form of text. + animated_gif: Create an animated GIF from the video. + additional_tracks: Add additional Audio / Subtitle tracks to Gumlet for transcoding and delivery along with video asset track. + generate_subtitles: Gumlet allows you to generate subtitles from the audio stream (use ISO 639-1 Language Codes) + mp4_access: Creates `MP4` version for download purpose in case of `MPEG-DASH` or `HLS` delivery format. **Default: `false`** + per_title_encoding: Gumlet analyzes each input video on a wide range of visual aspects. Based on the analysis, it chooses a unique set of transcoding options for processing the video. This ensures that the output video is of optimal size and best quality. **Default: `true`** + process_low_resolution_input: Currently, the minimum supported frame size is `57600` (`240x240`) pixels for `HLS/DASH` and `21025` (`145x145`) pixels for `MP4` format. However, enabling this flag will allow Gumlet to simply put your video asset into the specified delivery format without transcoding and optimization. Enabling this flag will cause any kind of specified video transformation to be ignored if you input video asset frame size is lower than the minimum supported frame size for the specified format. **Default: `false`** + audio_only: This flag allows Gumlet to transcode and deliver audio-only in the specified format. In this case, video transformation and thumbnails/animated GIFs would not be created. **Default: `false`** + enable_drm: Enable DRM encryption for transcoded videos. Gumlet supports Widevine and FairPlay DRMs. + call_to_actions: A CTA is an explicit prompt within the video content encouraging viewers to take a particular action. + playlist_id: Add this asset to a playlist. + folder: Add this asset to an existing folder by `folder_id`. + workspace_id: Gumlet video workspace ID. Preferred over deprecated `collection_id` / `source_id` (same ID). + extra_headers: Send extra headers with the request. + extra_query: Send extra query parameters with the request. + extra_body: Send extra JSON properties with the request. + timeout: Override the client-level default timeout for this request, in seconds. + idempotency_key: Override or provide the idempotency key for this request. + + Returns: + VideoAssetUploadFileResponse: 200 + + Example: + ```python + video_asset = client.video_assets.upload_file( + file=open("path/to/file", "rb"), + collection_id="646df1c9173a4a2fcac180b4", + profile_id="646df1c9173a4a2fcac180b7", + format="ABR", + tag=["ball"], + description="some description", + metadata={"headermeta": "metavalue"}, + call_to_actions=[ + { + "start_time": 1, + "end_time": 90, + "text": "some test", + "url": "https://some-url.com", + "position_from_top": 11, + "position_from_right": 23, + "border_radius": "11", + "font_color": "#000001", + "background_color": "#ffffff", + } + ], + playlist_id="6597acd5ed6f26a9c5ca9633", + folder="697375fbfa2d1037283140e4", + workspace_id="646df1c9173a4a2fcac180b4", + idempotency_key="", + ) + ``` + """ + _signed_upload_file = read_signed_upload_file(file) + initiated = self._post( + "/video/assets/upload", + body=maybe_transform( + { + "collection_id": collection_id, + "profile_id": profile_id, + "format": format, + "tag": tag, + "title": title, + "description": description, + "metadata": metadata, + "width": width, + "height": height, + "resolution": resolution, + "crop": crop, + "pad": pad, + "trim": trim, + "image_overlay": image_overlay, + "text_overlay": text_overlay, + "animated_gif": animated_gif, + "additional_tracks": additional_tracks, + "generate_subtitles": generate_subtitles, + "mp4_access": mp4_access, + "per_title_encoding": per_title_encoding, + "process_low_resolution_input": process_low_resolution_input, + "audio_only": audio_only, + "enable_drm": enable_drm, + "call_to_actions": call_to_actions, + "playlist_id": playlist_id, + "folder": folder, + "workspace_id": workspace_id, + }, + video_asset_upload_file_params.VideoAssetUploadFileParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=VideoAssetUploadFileResponse, + ) + upload_to_signed_url( + self._client, + initiated, + {"url_field": ["upload_url"], "method": "PUT", "body": "binary"}, + _signed_upload_file, + timeout=timeout, + ) + return initiated + def upload_thumbnail( self, asset_id: str, @@ -2214,6 +2379,169 @@ async def analytics( cast_to=VideoAssetAnalyticsResponse, ) + async def upload_file( + self, + file: FileTypes, + *, + collection_id: str | Omit = omit, + profile_id: str | Omit = omit, + format: Literal["ABR", "MP4"] | Omit = omit, + tag: SequenceNotStr[str] | Omit = omit, + title: str | Omit = omit, + description: str | Omit = omit, + metadata: Dict[str, object] | Omit = omit, + width: str | Omit = omit, + height: str | Omit = omit, + resolution: str | Omit = omit, + crop: video_asset_upload_file_params.Crop | Omit = omit, + pad: video_asset_upload_file_params.Pad | Omit = omit, + trim: video_asset_upload_file_params.Trim | Omit = omit, + image_overlay: video_asset_upload_file_params.ImageOverlay | Omit = omit, + text_overlay: video_asset_upload_file_params.TextOverlay | Omit = omit, + animated_gif: video_asset_upload_file_params.AnimatedGif | Omit = omit, + additional_tracks: Iterable[video_asset_upload_file_params.AdditionalTrack] | Omit = omit, + generate_subtitles: video_asset_upload_file_params.GenerateSubtitles | Omit = omit, + mp4_access: bool | Omit = omit, + per_title_encoding: bool | Omit = omit, + process_low_resolution_input: bool | Omit = omit, + audio_only: bool | Omit = omit, + enable_drm: bool | Omit = omit, + call_to_actions: Iterable[video_asset_upload_file_params.CallToAction] | Omit = omit, + playlist_id: str | Omit = omit, + folder: str | Omit = omit, + workspace_id: str, + # 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, + idempotency_key: str | None = None, + ) -> VideoAssetUploadFileResponse: + """ + This endpoint creates a video asset allowing upload of a video from the local file system and ingest media content into the Gumlet system for processing and delivery. Body parameters are the same as the Create Asset body parameters except for the `input` parameter, which this endpoint does not take. A successful response will be returned with `upload_url` field. You can make `PUT` request to that URL to upload video. To upload video using `upload_url` refer to [this](https://docs.gumlet.com/docs/direct-upload#2-use-the-url-to-upload-a-file). + + Args: + file: The file to upload. It is sent to the pre-signed URL the request returns, without the client's credentials. A custom `http_client`'s transport carries it only when that is httpx's own `HTTPTransport` (`AsyncHTTPTransport` on the async client) or inherits `SignedUploadTransport`. + collection_id: Deprecated. Use `workspace_id` instead. Still accepted for backwards compatibility. + profile_id: Provide `profile_id` of the previously created video profile. This parameter will override all the parameters (except `input` and `workspace_id`) from the video profile. + format: Transcode and deliver the asset in the requested format. The options can be one of `ABR` (HLS + DASH) and `MP4`. + tag: Specify a text string or identifier which can identify an asset or bunch of assets later. + title: Specify a text string or identifier which can be used for filtering or searching the asset. + description: Attach some textual data with the asset. This field is neither searchable nor filterable. + metadata: Add your metadata you want to associate with this asset.
Example:
{ "internal_video_id" : "123Abc" } + width: Resize video with the given width. Can be an absolute value in pixels or a percentage value with the `%` suffix. Specified values greater than the original asset width will be ignored. Applicable only when specified format is `MP4`. + height: Resize video with the given height. Can be an absolute value in pixels or a percentage value with the `%` suffix. Specified values greater than the original asset height will be ignored. Applicable only when specified format is `MP4`. + resolution: Required resolutions of the transformed asset in case of HLS or MPEG-DASH delivery format. Can be a comma-separated string out of the following values: `240p`, `360p`, `480p`, `540p`, `720p`, and `1080p`. Resized rendition will retain the input aspect ratio. + crop: This transformation can be used to crop the video by defining a rectangular area within the dimensions of the output video. + pad: This transformation can be used to add padding to the video. + trim: Trim transformation can be used to trim videos based on time duration. + image_overlay: Image overlay can be used to brand a video or add a visual label in the form of an image. + text_overlay: Text overlay can be used to brand a video or add a label in the form of text. + animated_gif: Create an animated GIF from the video. + additional_tracks: Add additional Audio / Subtitle tracks to Gumlet for transcoding and delivery along with video asset track. + generate_subtitles: Gumlet allows you to generate subtitles from the audio stream (use ISO 639-1 Language Codes) + mp4_access: Creates `MP4` version for download purpose in case of `MPEG-DASH` or `HLS` delivery format. **Default: `false`** + per_title_encoding: Gumlet analyzes each input video on a wide range of visual aspects. Based on the analysis, it chooses a unique set of transcoding options for processing the video. This ensures that the output video is of optimal size and best quality. **Default: `true`** + process_low_resolution_input: Currently, the minimum supported frame size is `57600` (`240x240`) pixels for `HLS/DASH` and `21025` (`145x145`) pixels for `MP4` format. However, enabling this flag will allow Gumlet to simply put your video asset into the specified delivery format without transcoding and optimization. Enabling this flag will cause any kind of specified video transformation to be ignored if you input video asset frame size is lower than the minimum supported frame size for the specified format. **Default: `false`** + audio_only: This flag allows Gumlet to transcode and deliver audio-only in the specified format. In this case, video transformation and thumbnails/animated GIFs would not be created. **Default: `false`** + enable_drm: Enable DRM encryption for transcoded videos. Gumlet supports Widevine and FairPlay DRMs. + call_to_actions: A CTA is an explicit prompt within the video content encouraging viewers to take a particular action. + playlist_id: Add this asset to a playlist. + folder: Add this asset to an existing folder by `folder_id`. + workspace_id: Gumlet video workspace ID. Preferred over deprecated `collection_id` / `source_id` (same ID). + extra_headers: Send extra headers with the request. + extra_query: Send extra query parameters with the request. + extra_body: Send extra JSON properties with the request. + timeout: Override the client-level default timeout for this request, in seconds. + idempotency_key: Override or provide the idempotency key for this request. + + Returns: + VideoAssetUploadFileResponse: 200 + + Example: + ```python + video_asset = await client.video_assets.upload_file( + file=open("path/to/file", "rb"), + collection_id="646df1c9173a4a2fcac180b4", + profile_id="646df1c9173a4a2fcac180b7", + format="ABR", + tag=["ball"], + description="some description", + metadata={"headermeta": "metavalue"}, + call_to_actions=[ + { + "start_time": 1, + "end_time": 90, + "text": "some test", + "url": "https://some-url.com", + "position_from_top": 11, + "position_from_right": 23, + "border_radius": "11", + "font_color": "#000001", + "background_color": "#ffffff", + } + ], + playlist_id="6597acd5ed6f26a9c5ca9633", + folder="697375fbfa2d1037283140e4", + workspace_id="646df1c9173a4a2fcac180b4", + idempotency_key="", + ) + ``` + """ + _signed_upload_file = await async_read_signed_upload_file(file) + initiated = await self._post( + "/video/assets/upload", + body=await async_maybe_transform( + { + "collection_id": collection_id, + "profile_id": profile_id, + "format": format, + "tag": tag, + "title": title, + "description": description, + "metadata": metadata, + "width": width, + "height": height, + "resolution": resolution, + "crop": crop, + "pad": pad, + "trim": trim, + "image_overlay": image_overlay, + "text_overlay": text_overlay, + "animated_gif": animated_gif, + "additional_tracks": additional_tracks, + "generate_subtitles": generate_subtitles, + "mp4_access": mp4_access, + "per_title_encoding": per_title_encoding, + "process_low_resolution_input": process_low_resolution_input, + "audio_only": audio_only, + "enable_drm": enable_drm, + "call_to_actions": call_to_actions, + "playlist_id": playlist_id, + "folder": folder, + "workspace_id": workspace_id, + }, + video_asset_upload_file_params.VideoAssetUploadFileParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=VideoAssetUploadFileResponse, + ) + await async_upload_to_signed_url( + self._client, + initiated, + {"url_field": ["upload_url"], "method": "PUT", "body": "binary"}, + _signed_upload_file, + timeout=timeout, + ) + return initiated + async def upload_thumbnail( self, asset_id: str, diff --git a/src/gumlet/types/__init__.py b/src/gumlet/types/__init__.py index e245b56..e6ffa97 100644 --- a/src/gumlet/types/__init__.py +++ b/src/gumlet/types/__init__.py @@ -42,6 +42,8 @@ from .video_asset_tag_many_params import VideoAssetTagManyParams as VideoAssetTagManyParams from .video_asset_analytics_response import VideoAssetAnalyticsResponse as VideoAssetAnalyticsResponse from .video_asset_analytics_params import VideoAssetAnalyticsParams as VideoAssetAnalyticsParams +from .video_asset_upload_file_response import VideoAssetUploadFileResponse as VideoAssetUploadFileResponse +from .video_asset_upload_file_params import VideoAssetUploadFileParams as VideoAssetUploadFileParams from .video_asset_upload_thumbnail_response import ( VideoAssetUploadThumbnailResponse as VideoAssetUploadThumbnailResponse, ) diff --git a/src/gumlet/types/video_asset_upload_file_params.py b/src/gumlet/types/video_asset_upload_file_params.py new file mode 100644 index 0000000..6449e1e --- /dev/null +++ b/src/gumlet/types/video_asset_upload_file_params.py @@ -0,0 +1,270 @@ +# File generated from our OpenAPI spec by Scalar. See README.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable +from typing_extensions import Literal, Required, TypedDict +from .._types import SequenceNotStr + +__all__ = [ + "VideoAssetUploadFileParams", + "Crop", + "Pad", + "Trim", + "ImageOverlay", + "TextOverlay", + "AnimatedGif", + "AdditionalTrack", + "GenerateSubtitles", + "CallToAction", +] + + +class VideoAssetUploadFileParams(TypedDict, total=False): + collection_id: str + """Deprecated. Use `workspace_id` instead. Still accepted for backwards compatibility.""" + + profile_id: str + """Provide `profile_id` of the previously created video profile. This parameter will override all the parameters (except `input` and `workspace_id`) from the video profile.""" + + format: Literal["ABR", "MP4"] + """Transcode and deliver the asset in the requested format. The options can be one of `ABR` (HLS + DASH) and `MP4`.""" + + tag: SequenceNotStr[str] + """Specify a text string or identifier which can identify an asset or bunch of assets later.""" + + title: str + """Specify a text string or identifier which can be used for filtering or searching the asset.""" + + description: str + """Attach some textual data with the asset. This field is neither searchable nor filterable.""" + + metadata: Dict[str, object] + """Add your metadata you want to associate with this asset.
Example:
{ "internal_video_id" : "123Abc" } """ + + width: str + """Resize video with the given width. Can be an absolute value in pixels or a percentage value with the `%` suffix. Specified values greater than the original asset width will be ignored. Applicable only when specified format is `MP4`.""" + + height: str + """Resize video with the given height. Can be an absolute value in pixels or a percentage value with the `%` suffix. Specified values greater than the original asset height will be ignored. Applicable only when specified format is `MP4`.""" + + resolution: str + """Required resolutions of the transformed asset in case of HLS or MPEG-DASH delivery format. Can be a comma-separated string out of the following values: `240p`, `360p`, `480p`, `540p`, `720p`, and `1080p`. Resized rendition will retain the input aspect ratio.""" + + crop: Crop + """This transformation can be used to crop the video by defining a rectangular area within the dimensions of the output video.""" + + pad: Pad + """This transformation can be used to add padding to the video.""" + + trim: Trim + """Trim transformation can be used to trim videos based on time duration.""" + + image_overlay: ImageOverlay + """Image overlay can be used to brand a video or add a visual label in the form of an image.""" + + text_overlay: TextOverlay + """Text overlay can be used to brand a video or add a label in the form of text.""" + + animated_gif: AnimatedGif + """Create an animated GIF from the video.""" + + additional_tracks: Iterable[AdditionalTrack] + """Add additional Audio / Subtitle tracks to Gumlet for transcoding and delivery along with video asset track.""" + + generate_subtitles: GenerateSubtitles + """Gumlet allows you to generate subtitles from the audio stream (use ISO 639-1 Language Codes)""" + + mp4_access: bool + """Creates `MP4` version for download purpose in case of `MPEG-DASH` or `HLS` delivery format. **Default: `false`**""" + + per_title_encoding: bool + """Gumlet analyzes each input video on a wide range of visual aspects. Based on the analysis, it chooses a unique set of transcoding options for processing the video. This ensures that the output video is of optimal size and best quality. **Default: `true`**""" + + process_low_resolution_input: bool + """Currently, the minimum supported frame size is `57600` (`240x240`) pixels for `HLS/DASH` and `21025` (`145x145`) pixels for `MP4` format. However, enabling this flag will allow Gumlet to simply put your video asset into the specified delivery format without transcoding and optimization. Enabling this flag will cause any kind of specified video transformation to be ignored if you input video asset frame size is lower than the minimum supported frame size for the specified format. **Default: `false`**""" + + audio_only: bool + """This flag allows Gumlet to transcode and deliver audio-only in the specified format. In this case, video transformation and thumbnails/animated GIFs would not be created. **Default: `false`**""" + + enable_drm: bool + """Enable DRM encryption for transcoded videos. Gumlet supports Widevine and FairPlay DRMs.""" + + call_to_actions: Iterable[CallToAction] + """A CTA is an explicit prompt within the video content encouraging viewers to take a particular action.""" + + playlist_id: str + """Add this asset to a playlist.""" + + folder: str + """Add this asset to an existing folder by `folder_id`.""" + + workspace_id: Required[str] + """Gumlet video workspace ID. Preferred over deprecated `collection_id` / `source_id` (same ID).""" + + +class CallToAction(TypedDict, total=False): + text: str + + url: str + + start_time: int + + end_time: int + + font_color: str + """hex value of color""" + + background_color: str + """hex code of color""" + + position_from_top: int + """number of pixels from top""" + + position_from_right: int + """number of pixels from right""" + + +class GenerateSubtitles(TypedDict, total=False): + audio_language: str + """Language code for native language of the audio.""" + + subtitle_languages: str + """Comma separated string of language codes for which subtitle needs to be generated. Maximum four language codes are allowed.""" + + +class AdditionalTrack(TypedDict, total=False): + url: Required[str] + """URL or web address of a file that Gumlet should download to add a stream.""" + + type: Required[str] + """Type of additional track. Value can be either audio or subtitle.""" + + language_code: Required[str] + """The language code value represents BCP 47 specification compliant value. For example, en for English.""" + + name: str + """The name of the track containing a human-readable description.""" + + +class AnimatedGif(TypedDict, total=False): + start_offset: str + """The time (in seconds or `HH:MM:SS` format) of the video timeline where the animated gif should begin. **Default: `0`**""" + + end_offset: str + """The time (in seconds or `HH:MM:SS` format) of the video timeline where the GIF ends. Defaults to `10` seconds after the start_offset. Maximum duration of GIF is limited to `10` seconds.""" + + width: str + """The width in pixels (or in percentage value of asset width) of the animated GIF. Max width is `640px`.""" + + height: str + """The height in pixels (or in percentage value of asset height) of the animated GIF. Max height is `640px`.""" + + fps: str + """The frame rate of the generated GIF. Defaults to `15` fps. Max `30` fps.""" + + +class TextOverlay(TypedDict, total=False): + text: Required[str] + """Text to be overlaid on video.""" + + horizontal_align: str + """This parameter specifies the horizontal alignment of the overlaid text and can be either `left` or `right`. **Default: `right`**""" + + vertical_align: str + """This parameter specifies the vertical alignment of the overlaid text and can be either `top` or `bottom`. **Default: `bottom`**""" + + horizontal_margin: str + """This parameter defines the horizontal coordinate value of the corner (determined by `horizontal_align`) of the overlay area. Values can be an absolute number of pixels relative to the video width. **Default: `0`**""" + + vertical_margin: str + """This parameter defines the vertical coordinate value of the corner (determined by vertical_align) of the overlay area. Values can be an absolute number of pixels relative to the video height. **Default: `0`**""" + + color: str + """Font color for text. **Default: `black`**""" + + font: str + """Font family type for text. **Default: `sans`**""" + + font_size: str + """Font size in pixels. **Default: `16`**""" + + opacity: str + """Overlay text opacity can be specified with opacity parameter where value can be between `0` and `100` where `0` is considered completely transparent and `100` is considered completely opaque. **Default: `100`**""" + + box: bool + """This parameter allows drawing a rectangular box over the overlaid text. **Default: `false`**""" + + box_color: str + """Box color can be specified with this parameter. **Default: `white`**""" + + box_opacity: str + """Box opacity can be specified with this parameter. **Default: `100`**""" + + box_border: str + """Padding between the box border and the text can be specified with this parameter in pixels. **Default: `0`**""" + + +class ImageOverlay(TypedDict, total=False): + url: Required[str] + """This is the required parameter for image overlay; it can be a URL to an image that needs to be overlaid.""" + + horizontal_margin: str + """This parameter defines the horizontal coordinate value of the corner (determined by `horizontal_align`) of the overlay area. Values can be an absolute number of pixels or a percentage value relative to the video width. **Default: `0`**""" + + vertical_margin: str + """This parameter defines the vertical coordinate value of the corner (determined by `vertical_align`) of the overlay area. Values can be an absolute number of pixels or a percentage value relative to the video height. **Default: `0`**""" + + horizontal_align: str + """This parameter specifies the horizontal alignment of the overlaid image and can be either `left` or `right`. **Default: `right`**""" + + vertical_align: str + """This parameter specifies the vertical alignment of the overlaid image and can be either `top` or `bottom`. **Default: `bottom`**""" + + width: str + """Width of the overlaid image. **Default: `image width`**""" + + height: str + """Height of the overlaid image. **Default: `image height`**""" + + +class Trim(TypedDict, total=False): + start_offset: Required[float] + """Start offset in number of seconds or in `HH:MM:SS` format.""" + + end_offset: Required[float] + """End offset in number of seconds or in `HH:MM:SS` format.""" + + duration: float + """Duration can be used in conjunction with `start_offset` parameter, can be specified in number of seconds.""" + + +class Pad(TypedDict, total=False): + top: str + """Width of padding on the top side. Values can be an absolute number of pixels or a percentage value relative to the video height. **Default: `%5`**""" + + left: str + """Width of padding on the left side. Values can be an absolute number of pixels or a percentage value relative to the video width. **Default: `0`**""" + + bottom: str + """Width of padding on the bottom side. Values can be an absolute number of pixels or a percentage value relative to the video height. **Default: `%5`**""" + + right: str + """Width of padding on the right side. Values can be an absolute number of pixels or a percentage value relative to the video width. **Default: `0`**""" + + color: str + """Color of padding area. **Default: `black`**""" + + +class Crop(TypedDict, total=False): + horizontal_margin: str + """This parameter defines the horizontal coordinate value of the upper-left corner of the cropping area. Values can be an absolute number of pixels or a percentage value relative to the video width. **Default: `0`**""" + + vertical_margin: str + """This parameter defines the vertical coordinate value of the upper-left corner of the cropping area. Values can be an absolute number of pixels or a percentage value relative to the video height. **Default: `0`**""" + + width: Required[str] + """Width of the cropping area in pixels.""" + + height: Required[str] + """Height of the cropping area in pixels.""" diff --git a/src/gumlet/types/video_asset_upload_file_response.py b/src/gumlet/types/video_asset_upload_file_response.py new file mode 100644 index 0000000..5a94469 --- /dev/null +++ b/src/gumlet/types/video_asset_upload_file_response.py @@ -0,0 +1,111 @@ +# File generated from our OpenAPI spec by Scalar. See README.md for details. + +from __future__ import annotations + +from typing import List, Optional + +from .._models import BaseModel + +__all__ = [ + "VideoAssetUploadFileResponse", + "Input", + "InputTransformations", + "InputMetadata", + "InputCallToAction", + "Output", +] + + +class Output(BaseModel): + format: Optional[str] = None + + status_url: Optional[str] = None + + playback_url: Optional[str] = None + + thumbnail_url: Optional[List[str]] = None + + +class InputCallToAction(BaseModel): + start_time: Optional[int] = None + + end_time: Optional[int] = None + + text: Optional[str] = None + + url: Optional[str] = None + + html_target: Optional[str] = None + + +class InputMetadata(BaseModel): + headermeta: Optional[str] = None + + +class InputTransformations(BaseModel): + format: Optional[str] = None + + resolution: Optional[List[str]] = None + + audio_codec: Optional[List[str]] = None + + video_codec: Optional[List[str]] = None + + thumbnail: Optional[List[str]] = None + + thumbnail_format: Optional[str] = None + + mp4_access: Optional[bool] = None + + per_title_encoding: Optional[bool] = None + + original_deleted: Optional[bool] = None + + +class Input(BaseModel): + transformations: Optional[InputTransformations] = None + + profile_id: Optional[str] = None + + title: Optional[str] = None + + description: Optional[str] = None + + metadata: Optional[InputMetadata] = None + + source_url: Optional[str] = None + + call_to_actions: Optional[List[InputCallToAction]] = None + + +class VideoAssetUploadFileResponse(BaseModel): + asset_id: Optional[str] = None + """Asset ID of the created asset""" + + progress: Optional[int] = None + """Processing progress percentage number between 0 and 100""" + + created_at: Optional[int] = None + """Created at timestamp in milliseconds since epoch""" + + updated_at: Optional[int] = None + """Updated at timestamp in milliseconds since epoch""" + + status: Optional[str] = None + """Status of asset""" + + tag: Optional[List[str]] = None + + input: Optional[Input] = None + + output: Optional[Output] = None + """Output data information""" + + upload_url: Optional[str] = None + """Upload URL on which you need to send actual file using PUT request""" + + playlists: Optional[List[str]] = None + """Information about playlists""" + + workspace_id: Optional[str] = None + """Workdspace ID""" From b8d812d61ddc9adeff26c8718602e0bdca9baf3a Mon Sep 17 00:00:00 2001 From: scalarbot Date: Tue, 24 Nov 2026 09:03:45 +0000 Subject: [PATCH 6/7] chore(api): update generated SDK content 3 generated files changed with no detected API surface change (documentation, examples, or file content). Build: M6jgQzhAARKU7SUDl2OVE --- api.md | 42 ------------ src/gumlet/resources/video_assets.py | 84 ------------------------ tests/api_resources/test_video_assets.py | 49 +++----------- 3 files changed, 8 insertions(+), 167 deletions(-) diff --git a/api.md b/api.md index d3c9250..1634611 100644 --- a/api.md +++ b/api.md @@ -167,27 +167,6 @@ This endpoint creates a video asset allowing upload of a video from the local fi ```python video_asset = client.video_assets.upload( - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", - format="ABR", - tag=["ball"], - description="some description", - metadata={"headermeta": "metavalue"}, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) @@ -407,27 +386,6 @@ This endpoint creates a video asset allowing upload of a video from the local fi ```python video_asset = client.video_assets.upload_file( file=open("path/to/file", "rb"), - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", - format="ABR", - tag=["ball"], - description="some description", - metadata={"headermeta": "metavalue"}, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) diff --git a/src/gumlet/resources/video_assets.py b/src/gumlet/resources/video_assets.py index 31b54a7..b4a159b 100644 --- a/src/gumlet/resources/video_assets.py +++ b/src/gumlet/resources/video_assets.py @@ -282,27 +282,6 @@ def upload( Example: ```python video_asset = client.video_assets.upload( - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", - format="ABR", - tag=["ball"], - description="some description", - metadata={"headermeta": "metavalue"}, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) @@ -1191,27 +1170,6 @@ def upload_file( ```python video_asset = client.video_assets.upload_file( file=open("path/to/file", "rb"), - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", - format="ABR", - tag=["ball"], - description="some description", - metadata={"headermeta": "metavalue"}, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) @@ -1554,27 +1512,6 @@ async def upload( Example: ```python video_asset = await client.video_assets.upload( - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", - format="ABR", - tag=["ball"], - description="some description", - metadata={"headermeta": "metavalue"}, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) @@ -2463,27 +2400,6 @@ async def upload_file( ```python video_asset = await client.video_assets.upload_file( file=open("path/to/file", "rb"), - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", - format="ABR", - tag=["ball"], - description="some description", - metadata={"headermeta": "metavalue"}, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) diff --git a/tests/api_resources/test_video_assets.py b/tests/api_resources/test_video_assets.py index 7c8550b..133990d 100644 --- a/tests/api_resources/test_video_assets.py +++ b/tests/api_resources/test_video_assets.py @@ -75,27 +75,6 @@ def test_method_create_with_all_params(self) -> None: @smoke_case("videoAssets.upload:required", operation="upload", path="/video/assets/upload") def test_method_upload(self) -> None: video_asset = client.video_assets.upload( - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", - format="ABR", - tag=["ball"], - description="some description", - metadata={"headermeta": "metavalue"}, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) @@ -103,13 +82,13 @@ def test_method_upload(self) -> None: @smoke_case("videoAssets.upload:all", operation="upload", path="/video/assets/upload") def test_method_upload_with_all_params(self) -> None: video_asset = client.video_assets.upload( - collection_id="646df1c9173a4a2fcac180b4", - profile_id="646df1c9173a4a2fcac180b7", + collection_id="", + profile_id="", format="ABR", - tag=["ball"], + tag=[""], title="", - description="some description", - metadata={"headermeta": "metavalue"}, + description="", + metadata={}, width="", height="", resolution="", @@ -148,21 +127,9 @@ def test_method_upload_with_all_params(self) -> None: process_low_resolution_input=False, audio_only=False, enable_drm=False, - call_to_actions=[ - { - "start_time": 1, - "end_time": 90, - "text": "some test", - "url": "https://some-url.com", - "position_from_top": 11, - "position_from_right": 23, - "border_radius": "11", - "font_color": "#000001", - "background_color": "#ffffff", - } - ], - playlist_id="6597acd5ed6f26a9c5ca9633", - folder="697375fbfa2d1037283140e4", + call_to_actions=[{}], + playlist_id="", + folder="", workspace_id="646df1c9173a4a2fcac180b4", idempotency_key="", ) From 516ec2938a485ed642caa860f70c9ddc6c9f26f5 Mon Sep 17 00:00:00 2001 From: "scalar-docs[bot]" <148485328+scalar-docs[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 09:04:07 +0000 Subject: [PATCH 7/7] release: 1.6.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/gumlet/_version.py | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0d1bebe..093be7e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.6.0" + ".": "1.6.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 16a15d3..4f088b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## [1.6.1](https://github.com/gumlet/python-sdk/compare/v1.6.0...v1.6.1) (2026-11-24) + + +### ⚠ BREAKING CHANGES + +* **api:** 3 breaking changes to the SDK surface. + - method-name POST video/assets/upload — method names differ (breaking: renamed; the old spelling no longer resolves) + - path-params POST video/assets/upload — path parameter missing on one side (breaking: changed in a way existing callers can observe) + - request-shape POST video/assets/upload.file — field only in after (breaking: new required request member; existing calls lack it) +* **api:** 3 breaking changes to the SDK surface. + - method-name POST video/assets/{p}/thumbnail — method names differ (breaking: renamed; the old spelling no longer resolves) + - types-files types/video_asset_upload_thumbnail_file_response.py — type file only in before (1 member: 0 matched by name and kind elsewhere in after, 1 not found) (breaking: removed; video_asset_upload_thumbnail_response.py appeared in its place, likely a rename) + - types-classes types/__init__.py:VideoAssetUploadThumbnailFileResponse — reexport only in before (breaking: removed; VideoAssetUploadThumbnailResponse appeared in its place, likely a rename) +* **api:** 5 breaking changes to the SDK surface. + - method-name POST video/assets/{p}/thumbnail — method names differ (breaking: renamed; the old spelling no longer resolves) + - path-params POST video/assets/{p}/thumbnail — path parameter missing on one side (breaking: changed in a way existing callers can observe) + - request-shape POST video/assets/{p}/thumbnail.file — field only in after (breaking: new required request member; existing calls lack it) + - types-files types/video_asset_thumbnail_upload_response.py — type file only in before (1 member: 0 matched by name and kind elsewhere in after, 1 not found) (breaking: removed; video_asset_upload_thumbnail_file_response.py appeared in its place, likely a rename) + - types-classes types/__init__.py:VideoAssetThumbnailUploadResponse — reexport only in before (breaking: removed; VideoAssetUploadThumbnailFileResponse appeared in its place, likely a rename) + +### Features + +* **api:** update SDK surface (2 changes) ([de6129e](https://github.com/gumlet/python-sdk/commit/de6129ef4f205fffeed9d90f71ff46e06b460331)) +* **api:** update SDK surface (5 changes) ([8a894b8](https://github.com/gumlet/python-sdk/commit/8a894b820c9c57d565378060f9c3f9cf2f94aaaf)) +* **api:** update SDK surface (7 changes) ([b667221](https://github.com/gumlet/python-sdk/commit/b667221b3a612844112fe3e862e1221b245910d6)) +* **api:** update SDK surface (7 changes) ([34b2533](https://github.com/gumlet/python-sdk/commit/34b25338de94f693b44becff3c643689ea230f42)) + + +### Chores + +* **api:** update generated SDK content ([b8d812d](https://github.com/gumlet/python-sdk/commit/b8d812d61ddc9adeff26c8718602e0bdca9baf3a)) +* release 1.6.1 ([a3ac8bb](https://github.com/gumlet/python-sdk/commit/a3ac8bbb6a8d7efe7e7a210988e48671e22173f9)) + ## [1.6.0](https://github.com/gumlet/python-sdk/compare/v1.5.2...v1.6.0) (2026-11-23) diff --git a/pyproject.toml b/pyproject.toml index c9af7e7..65618d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gumlet" -version = "1.6.0" # x-release-please-version +version = "1.6.1" # x-release-please-version description = "Gumlet helps developers deliver online video and images. This API encompasses Gumlet Video, Image and Video Analytics functionality to help you build your products better and faster than ever before." readme = "README.md" license = "Apache-2.0" diff --git a/src/gumlet/_version.py b/src/gumlet/_version.py index 0a161ab..38319db 100644 --- a/src/gumlet/_version.py +++ b/src/gumlet/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Scalar. See README.md for details. __title__ = "gumlet" -__version__ = "1.6.0" # x-release-please-version +__version__ = "1.6.1" # x-release-please-version