Files
plexjs/src/sdk/models/operations/gettokenbypinid.ts

460 lines
14 KiB
TypeScript

/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { remap as remap$ } from "../../../lib/primitives.js";
import * as z from "zod";
export const GetTokenByPinIdServerList = ["https://plex.tv/api/v2/"] as const;
export type GetTokenByPinIdGlobals = {
/**
* The unique identifier for the client application
*
* @remarks
* This is used to track the client application and its usage
* (UUID, serial number, or other number unique per device)
*
*/
xPlexClientIdentifier?: string | undefined;
};
export type GetTokenByPinIdRequest = {
/**
* The unique identifier for the client application
*
* @remarks
* This is used to track the client application and its usage
* (UUID, serial number, or other number unique per device)
*
*/
xPlexClientIdentifier?: string | undefined;
/**
* The PinID to retrieve an access token for
*/
pinID: number;
};
/**
* Geo location data
*/
export type GetTokenByPinIdGeoData = {
/**
* The ISO 3166-1 alpha-2 code of the country.
*/
code: string;
/**
* The continent code where the country is located.
*/
continentCode: string;
/**
* The official name of the country.
*/
country: string;
/**
* The name of the city.
*/
city: string;
/**
* Indicates if the country is a member of the European Union.
*/
europeanUnionMember?: boolean | undefined;
/**
* The time zone of the country.
*/
timeZone: string;
/**
* The postal code of the location.
*/
postalCode: number;
/**
* Indicates if the country has privacy restrictions.
*/
inPrivacyRestrictedCountry?: boolean | undefined;
/**
* Indicates if the region has privacy restrictions.
*/
inPrivacyRestrictedRegion?: boolean | undefined;
/**
* The name of the primary administrative subdivision.
*/
subdivisions: string;
/**
* The geographical coordinates (latitude, longitude) of the location.
*/
coordinates: string;
};
/**
* The Pin with a non-null authToken when it has been verified by the user
*/
export type GetTokenByPinIdAuthPinContainer = {
id: number;
code: string;
product: string;
trusted?: boolean | undefined;
qr: string;
/**
* The X-Client-Identifier used in the request
*/
clientIdentifier: string;
/**
* Geo location data
*/
location: GetTokenByPinIdGeoData;
/**
* The number of seconds this pin expires, by default 900 seconds
*/
expiresIn?: number | undefined;
createdAt: Date;
expiresAt: Date;
authToken?: any | null | undefined;
newRegistration?: any | null | undefined;
};
export type GetTokenByPinIdResponse = {
/**
* HTTP response content type for this operation
*/
contentType: string;
/**
* HTTP response status code for this operation
*/
statusCode: number;
/**
* Raw HTTP response; suitable for custom response parsing
*/
rawResponse: Response;
/**
* The Pin with a non-null authToken when it has been verified by the user
*/
authPinContainer?: GetTokenByPinIdAuthPinContainer | undefined;
};
/** @internal */
export const GetTokenByPinIdGlobals$inboundSchema: z.ZodType<
GetTokenByPinIdGlobals,
z.ZodTypeDef,
unknown
> = z
.object({
"X-Plex-Client-Identifier": z.string().optional(),
})
.transform((v) => {
return remap$(v, {
"X-Plex-Client-Identifier": "xPlexClientIdentifier",
});
});
/** @internal */
export type GetTokenByPinIdGlobals$Outbound = {
"X-Plex-Client-Identifier"?: string | undefined;
};
/** @internal */
export const GetTokenByPinIdGlobals$outboundSchema: z.ZodType<
GetTokenByPinIdGlobals$Outbound,
z.ZodTypeDef,
GetTokenByPinIdGlobals
> = z
.object({
xPlexClientIdentifier: z.string().optional(),
})
.transform((v) => {
return remap$(v, {
xPlexClientIdentifier: "X-Plex-Client-Identifier",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetTokenByPinIdGlobals$ {
/** @deprecated use `GetTokenByPinIdGlobals$inboundSchema` instead. */
export const inboundSchema = GetTokenByPinIdGlobals$inboundSchema;
/** @deprecated use `GetTokenByPinIdGlobals$outboundSchema` instead. */
export const outboundSchema = GetTokenByPinIdGlobals$outboundSchema;
/** @deprecated use `GetTokenByPinIdGlobals$Outbound` instead. */
export type Outbound = GetTokenByPinIdGlobals$Outbound;
}
/** @internal */
export const GetTokenByPinIdRequest$inboundSchema: z.ZodType<
GetTokenByPinIdRequest,
z.ZodTypeDef,
unknown
> = z
.object({
"X-Plex-Client-Identifier": z.string().optional(),
pinID: z.number().int(),
})
.transform((v) => {
return remap$(v, {
"X-Plex-Client-Identifier": "xPlexClientIdentifier",
});
});
/** @internal */
export type GetTokenByPinIdRequest$Outbound = {
"X-Plex-Client-Identifier"?: string | undefined;
pinID: number;
};
/** @internal */
export const GetTokenByPinIdRequest$outboundSchema: z.ZodType<
GetTokenByPinIdRequest$Outbound,
z.ZodTypeDef,
GetTokenByPinIdRequest
> = z
.object({
xPlexClientIdentifier: z.string().optional(),
pinID: z.number().int(),
})
.transform((v) => {
return remap$(v, {
xPlexClientIdentifier: "X-Plex-Client-Identifier",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetTokenByPinIdRequest$ {
/** @deprecated use `GetTokenByPinIdRequest$inboundSchema` instead. */
export const inboundSchema = GetTokenByPinIdRequest$inboundSchema;
/** @deprecated use `GetTokenByPinIdRequest$outboundSchema` instead. */
export const outboundSchema = GetTokenByPinIdRequest$outboundSchema;
/** @deprecated use `GetTokenByPinIdRequest$Outbound` instead. */
export type Outbound = GetTokenByPinIdRequest$Outbound;
}
/** @internal */
export const GetTokenByPinIdGeoData$inboundSchema: z.ZodType<
GetTokenByPinIdGeoData,
z.ZodTypeDef,
unknown
> = z
.object({
code: z.string(),
continent_code: z.string(),
country: z.string(),
city: z.string(),
european_union_member: z.boolean().default(false),
time_zone: z.string(),
postal_code: z.number().int(),
in_privacy_restricted_country: z.boolean().default(false),
in_privacy_restricted_region: z.boolean().default(false),
subdivisions: z.string(),
coordinates: z.string(),
})
.transform((v) => {
return remap$(v, {
continent_code: "continentCode",
european_union_member: "europeanUnionMember",
time_zone: "timeZone",
postal_code: "postalCode",
in_privacy_restricted_country: "inPrivacyRestrictedCountry",
in_privacy_restricted_region: "inPrivacyRestrictedRegion",
});
});
/** @internal */
export type GetTokenByPinIdGeoData$Outbound = {
code: string;
continent_code: string;
country: string;
city: string;
european_union_member: boolean;
time_zone: string;
postal_code: number;
in_privacy_restricted_country: boolean;
in_privacy_restricted_region: boolean;
subdivisions: string;
coordinates: string;
};
/** @internal */
export const GetTokenByPinIdGeoData$outboundSchema: z.ZodType<
GetTokenByPinIdGeoData$Outbound,
z.ZodTypeDef,
GetTokenByPinIdGeoData
> = z
.object({
code: z.string(),
continentCode: z.string(),
country: z.string(),
city: z.string(),
europeanUnionMember: z.boolean().default(false),
timeZone: z.string(),
postalCode: z.number().int(),
inPrivacyRestrictedCountry: z.boolean().default(false),
inPrivacyRestrictedRegion: z.boolean().default(false),
subdivisions: z.string(),
coordinates: z.string(),
})
.transform((v) => {
return remap$(v, {
continentCode: "continent_code",
europeanUnionMember: "european_union_member",
timeZone: "time_zone",
postalCode: "postal_code",
inPrivacyRestrictedCountry: "in_privacy_restricted_country",
inPrivacyRestrictedRegion: "in_privacy_restricted_region",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetTokenByPinIdGeoData$ {
/** @deprecated use `GetTokenByPinIdGeoData$inboundSchema` instead. */
export const inboundSchema = GetTokenByPinIdGeoData$inboundSchema;
/** @deprecated use `GetTokenByPinIdGeoData$outboundSchema` instead. */
export const outboundSchema = GetTokenByPinIdGeoData$outboundSchema;
/** @deprecated use `GetTokenByPinIdGeoData$Outbound` instead. */
export type Outbound = GetTokenByPinIdGeoData$Outbound;
}
/** @internal */
export const GetTokenByPinIdAuthPinContainer$inboundSchema: z.ZodType<
GetTokenByPinIdAuthPinContainer,
z.ZodTypeDef,
unknown
> = z.object({
id: z.number().int(),
code: z.string(),
product: z.string(),
trusted: z.boolean().default(false),
qr: z.string(),
clientIdentifier: z.string(),
location: z.lazy(() => GetTokenByPinIdGeoData$inboundSchema),
expiresIn: z.number().int().default(900),
createdAt: z
.string()
.datetime({ offset: true })
.transform((v) => new Date(v)),
expiresAt: z
.string()
.datetime({ offset: true })
.transform((v) => new Date(v)),
authToken: z.nullable(z.any()).optional(),
newRegistration: z.nullable(z.any()).optional(),
});
/** @internal */
export type GetTokenByPinIdAuthPinContainer$Outbound = {
id: number;
code: string;
product: string;
trusted: boolean;
qr: string;
clientIdentifier: string;
location: GetTokenByPinIdGeoData$Outbound;
expiresIn: number;
createdAt: string;
expiresAt: string;
authToken?: any | null | undefined;
newRegistration?: any | null | undefined;
};
/** @internal */
export const GetTokenByPinIdAuthPinContainer$outboundSchema: z.ZodType<
GetTokenByPinIdAuthPinContainer$Outbound,
z.ZodTypeDef,
GetTokenByPinIdAuthPinContainer
> = z.object({
id: z.number().int(),
code: z.string(),
product: z.string(),
trusted: z.boolean().default(false),
qr: z.string(),
clientIdentifier: z.string(),
location: z.lazy(() => GetTokenByPinIdGeoData$outboundSchema),
expiresIn: z.number().int().default(900),
createdAt: z.date().transform((v) => v.toISOString()),
expiresAt: z.date().transform((v) => v.toISOString()),
authToken: z.nullable(z.any()).optional(),
newRegistration: z.nullable(z.any()).optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetTokenByPinIdAuthPinContainer$ {
/** @deprecated use `GetTokenByPinIdAuthPinContainer$inboundSchema` instead. */
export const inboundSchema = GetTokenByPinIdAuthPinContainer$inboundSchema;
/** @deprecated use `GetTokenByPinIdAuthPinContainer$outboundSchema` instead. */
export const outboundSchema = GetTokenByPinIdAuthPinContainer$outboundSchema;
/** @deprecated use `GetTokenByPinIdAuthPinContainer$Outbound` instead. */
export type Outbound = GetTokenByPinIdAuthPinContainer$Outbound;
}
/** @internal */
export const GetTokenByPinIdResponse$inboundSchema: z.ZodType<
GetTokenByPinIdResponse,
z.ZodTypeDef,
unknown
> = z
.object({
ContentType: z.string(),
StatusCode: z.number().int(),
RawResponse: z.instanceof(Response),
AuthPinContainer: z.lazy(() => GetTokenByPinIdAuthPinContainer$inboundSchema).optional(),
})
.transform((v) => {
return remap$(v, {
ContentType: "contentType",
StatusCode: "statusCode",
RawResponse: "rawResponse",
AuthPinContainer: "authPinContainer",
});
});
/** @internal */
export type GetTokenByPinIdResponse$Outbound = {
ContentType: string;
StatusCode: number;
RawResponse: never;
AuthPinContainer?: GetTokenByPinIdAuthPinContainer$Outbound | undefined;
};
/** @internal */
export const GetTokenByPinIdResponse$outboundSchema: z.ZodType<
GetTokenByPinIdResponse$Outbound,
z.ZodTypeDef,
GetTokenByPinIdResponse
> = z
.object({
contentType: z.string(),
statusCode: z.number().int(),
rawResponse: z.instanceof(Response).transform(() => {
throw new Error("Response cannot be serialized");
}),
authPinContainer: z.lazy(() => GetTokenByPinIdAuthPinContainer$outboundSchema).optional(),
})
.transform((v) => {
return remap$(v, {
contentType: "ContentType",
statusCode: "StatusCode",
rawResponse: "RawResponse",
authPinContainer: "AuthPinContainer",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetTokenByPinIdResponse$ {
/** @deprecated use `GetTokenByPinIdResponse$inboundSchema` instead. */
export const inboundSchema = GetTokenByPinIdResponse$inboundSchema;
/** @deprecated use `GetTokenByPinIdResponse$outboundSchema` instead. */
export const outboundSchema = GetTokenByPinIdResponse$outboundSchema;
/** @deprecated use `GetTokenByPinIdResponse$Outbound` instead. */
export type Outbound = GetTokenByPinIdResponse$Outbound;
}