/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * If `cursor[enabled]` is set to 1, the first result set will be fetched with cursor pagination enabled. This * * @remarks * values is ignored if `cursor[before]` or `cursor[after]` are set. */ export const GetMediaExtendedAudioDescriptionsEnabled = { Zero: 0, One: 1, } as const; /** * If `cursor[enabled]` is set to 1, the first result set will be fetched with cursor pagination enabled. This * * @remarks * values is ignored if `cursor[before]` or `cursor[after]` are set. */ export type GetMediaExtendedAudioDescriptionsEnabled = ClosedEnum< typeof GetMediaExtendedAudioDescriptionsEnabled >; /** * If `cursor[enabled]` is set to 1 than cursor pagination is enabled and the * * @remarks * first set of records are fetched up to the `per_page`. Cursor * pagination will also be turned on if `cursor[before]` or `cursor[after]` * are set. Records returned will have a `cursor` property set which can be used to fetch more records in the same `sort_by` ordering. * The cursor value of the last record can be used to fetch records after the current result set and * the cursor of the first record can be used to fetch records before the result set. * * NOTE: a cursor value is only valid if the `sort_by` value hasn't changed from the * last fetch. For example, you cannot fetch using `sort_by` id and than pass that * cursor value to a `sort_by` name. */ export type GetMediaExtendedAudioDescriptionsCursor = { /** * If `cursor[enabled]` is set to 1, the first result set will be fetched with cursor pagination enabled. This * * @remarks * values is ignored if `cursor[before]` or `cursor[after]` are set. */ enabled?: GetMediaExtendedAudioDescriptionsEnabled | undefined; /** * If `cursor[before]` is set than cursor pagination is enabled and all records * * @remarks * before the cursor up to the `per_page` are returned. This feature is useful for * fetching "new records", for example, in a "pull to refersh" feature when showing records in a descending * order. */ before?: string | undefined; /** * If `cursor[after]` is set than cursor pagination is enabled and all records * * @remarks * after the cursor up to the `per_page` are returned. */ after?: string | undefined; }; /** * Field to order by. The default is id. */ export const GetMediaExtendedAudioDescriptionsSortBy = { Id: "id", } as const; /** * Field to order by. The default is id. */ export type GetMediaExtendedAudioDescriptionsSortBy = ClosedEnum< typeof GetMediaExtendedAudioDescriptionsSortBy >; /** * Direction to order by. (0 = desc, 1 = asc; default is 1) */ export const GetMediaExtendedAudioDescriptionsSortDirection = { Zero: 0, One: 1, } as const; /** * Direction to order by. (0 = desc, 1 = asc; default is 1) */ export type GetMediaExtendedAudioDescriptionsSortDirection = ClosedEnum< typeof GetMediaExtendedAudioDescriptionsSortDirection >; export type GetMediaExtendedAudioDescriptionsRequest = { /** * The page number to retrieve. This cannot be combined with `cursor`, * * @remarks * pagination. */ page?: number | undefined; /** * The number of medias per page. Use this for both offset pagination and cursor pagination. */ perPage?: number | undefined; /** * If `cursor[enabled]` is set to 1 than cursor pagination is enabled and the * * @remarks * first set of records are fetched up to the `per_page`. Cursor * pagination will also be turned on if `cursor[before]` or `cursor[after]` * are set. Records returned will have a `cursor` property set which can be used to fetch more records in the same `sort_by` ordering. * The cursor value of the last record can be used to fetch records after the current result set and * the cursor of the first record can be used to fetch records before the result set. * * NOTE: a cursor value is only valid if the `sort_by` value hasn't changed from the * last fetch. For example, you cannot fetch using `sort_by` id and than pass that * cursor value to a `sort_by` name. */ cursor?: GetMediaExtendedAudioDescriptionsCursor | undefined; /** * Filter extended audio descriptions to only those matching these hashed ids. */ hashedIds?: Array | undefined; /** * Field to order by. The default is id. */ sortBy?: GetMediaExtendedAudioDescriptionsSortBy | undefined; /** * Direction to order by. (0 = desc, 1 = asc; default is 1) */ sortDirection?: GetMediaExtendedAudioDescriptionsSortDirection | undefined; }; export type GetMediaExtendedAudioDescriptionsMedia = { /** * A unique alphanumeric identifier for the record. */ id: string; /** * A URL for fetching all the records of the given record type. You can pass hashed_ids as a param with multiple values * * @remarks * to do a batch fetch for this records type. */ indexUrl: string; /** * A URL that can be used to fetch this record. */ url: string; }; export type GetMediaExtendedAudioDescriptionsProvidedMediaFile = { /** * A unique alphanumeric identifier for the record. */ id: string; /** * A URL for fetching all the records of the given record type. You can pass hashed_ids as a param with multiple values * * @remarks * to do a batch fetch for this records type. */ indexUrl: string; /** * A URL that can be used to fetch this record. */ url: string; }; export type GetMediaExtendedAudioDescriptionsContact = { /** * A unique alphanumeric identifier for the record. */ id: string; /** * A URL for fetching all the records of the given record type. You can pass hashed_ids as a param with multiple values * * @remarks * to do a batch fetch for this records type. */ indexUrl: string; /** * A URL that can be used to fetch this record. */ url: string; }; export type GetMediaExtendedAudioDescriptionsResponse = { id?: string | undefined; ietfLanguageTag?: string | undefined; createdAt?: Date | undefined; updatedAt?: Date | undefined; media?: GetMediaExtendedAudioDescriptionsMedia | undefined; providedMediaFile?: | GetMediaExtendedAudioDescriptionsProvidedMediaFile | undefined; contact?: GetMediaExtendedAudioDescriptionsContact | undefined; }; /** @internal */ export const GetMediaExtendedAudioDescriptionsEnabled$outboundSchema: z.ZodNativeEnum = z .nativeEnum(GetMediaExtendedAudioDescriptionsEnabled); /** @internal */ export type GetMediaExtendedAudioDescriptionsCursor$Outbound = { enabled?: number | undefined; before?: string | undefined; after?: string | undefined; }; /** @internal */ export const GetMediaExtendedAudioDescriptionsCursor$outboundSchema: z.ZodType< GetMediaExtendedAudioDescriptionsCursor$Outbound, z.ZodTypeDef, GetMediaExtendedAudioDescriptionsCursor > = z.object({ enabled: GetMediaExtendedAudioDescriptionsEnabled$outboundSchema.optional(), before: z.string().optional(), after: z.string().optional(), }); export function getMediaExtendedAudioDescriptionsCursorToJSON( getMediaExtendedAudioDescriptionsCursor: GetMediaExtendedAudioDescriptionsCursor, ): string { return JSON.stringify( GetMediaExtendedAudioDescriptionsCursor$outboundSchema.parse( getMediaExtendedAudioDescriptionsCursor, ), ); } /** @internal */ export const GetMediaExtendedAudioDescriptionsSortBy$outboundSchema: z.ZodNativeEnum = z .nativeEnum(GetMediaExtendedAudioDescriptionsSortBy); /** @internal */ export const GetMediaExtendedAudioDescriptionsSortDirection$outboundSchema: z.ZodNativeEnum = z .nativeEnum(GetMediaExtendedAudioDescriptionsSortDirection); /** @internal */ export type GetMediaExtendedAudioDescriptionsRequest$Outbound = { page?: number | undefined; per_page?: number | undefined; cursor?: GetMediaExtendedAudioDescriptionsCursor$Outbound | undefined; "hashed_ids[]"?: Array | undefined; sort_by?: string | undefined; sort_direction?: number | undefined; }; /** @internal */ export const GetMediaExtendedAudioDescriptionsRequest$outboundSchema: z.ZodType< GetMediaExtendedAudioDescriptionsRequest$Outbound, z.ZodTypeDef, GetMediaExtendedAudioDescriptionsRequest > = z.object({ page: z.number().int().optional(), perPage: z.number().int().optional(), cursor: z.lazy(() => GetMediaExtendedAudioDescriptionsCursor$outboundSchema) .optional(), hashedIds: z.array(z.string()).optional(), sortBy: GetMediaExtendedAudioDescriptionsSortBy$outboundSchema.optional(), sortDirection: GetMediaExtendedAudioDescriptionsSortDirection$outboundSchema .optional(), }).transform((v) => { return remap$(v, { perPage: "per_page", hashedIds: "hashed_ids[]", sortBy: "sort_by", sortDirection: "sort_direction", }); }); export function getMediaExtendedAudioDescriptionsRequestToJSON( getMediaExtendedAudioDescriptionsRequest: GetMediaExtendedAudioDescriptionsRequest, ): string { return JSON.stringify( GetMediaExtendedAudioDescriptionsRequest$outboundSchema.parse( getMediaExtendedAudioDescriptionsRequest, ), ); } /** @internal */ export const GetMediaExtendedAudioDescriptionsMedia$inboundSchema: z.ZodType< GetMediaExtendedAudioDescriptionsMedia, z.ZodTypeDef, unknown > = z.object({ id: z.string(), index_url: z.string(), url: z.string(), }).transform((v) => { return remap$(v, { "index_url": "indexUrl", }); }); export function getMediaExtendedAudioDescriptionsMediaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetMediaExtendedAudioDescriptionsMedia$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetMediaExtendedAudioDescriptionsMedia' from JSON`, ); } /** @internal */ export const GetMediaExtendedAudioDescriptionsProvidedMediaFile$inboundSchema: z.ZodType< GetMediaExtendedAudioDescriptionsProvidedMediaFile, z.ZodTypeDef, unknown > = z.object({ id: z.string(), index_url: z.string(), url: z.string(), }).transform((v) => { return remap$(v, { "index_url": "indexUrl", }); }); export function getMediaExtendedAudioDescriptionsProvidedMediaFileFromJSON( jsonString: string, ): SafeParseResult< GetMediaExtendedAudioDescriptionsProvidedMediaFile, SDKValidationError > { return safeParse( jsonString, (x) => GetMediaExtendedAudioDescriptionsProvidedMediaFile$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetMediaExtendedAudioDescriptionsProvidedMediaFile' from JSON`, ); } /** @internal */ export const GetMediaExtendedAudioDescriptionsContact$inboundSchema: z.ZodType< GetMediaExtendedAudioDescriptionsContact, z.ZodTypeDef, unknown > = z.object({ id: z.string(), index_url: z.string(), url: z.string(), }).transform((v) => { return remap$(v, { "index_url": "indexUrl", }); }); export function getMediaExtendedAudioDescriptionsContactFromJSON( jsonString: string, ): SafeParseResult< GetMediaExtendedAudioDescriptionsContact, SDKValidationError > { return safeParse( jsonString, (x) => GetMediaExtendedAudioDescriptionsContact$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetMediaExtendedAudioDescriptionsContact' from JSON`, ); } /** @internal */ export const GetMediaExtendedAudioDescriptionsResponse$inboundSchema: z.ZodType< GetMediaExtendedAudioDescriptionsResponse, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), ietf_language_tag: z.string().optional(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), media: z.lazy(() => GetMediaExtendedAudioDescriptionsMedia$inboundSchema) .optional(), provided_media_file: z.lazy(() => GetMediaExtendedAudioDescriptionsProvidedMediaFile$inboundSchema ).optional(), contact: z.lazy(() => GetMediaExtendedAudioDescriptionsContact$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "ietf_language_tag": "ietfLanguageTag", "created_at": "createdAt", "updated_at": "updatedAt", "provided_media_file": "providedMediaFile", }); }); export function getMediaExtendedAudioDescriptionsResponseFromJSON( jsonString: string, ): SafeParseResult< GetMediaExtendedAudioDescriptionsResponse, SDKValidationError > { return safeParse( jsonString, (x) => GetMediaExtendedAudioDescriptionsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetMediaExtendedAudioDescriptionsResponse' from JSON`, ); }