mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
451 lines
13 KiB
TypeScript
451 lines
13 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 GetPinServerList = ["https://plex.tv/api/v2/"] as const;
|
|
|
|
export type GetPinGlobals = {
|
|
/**
|
|
* 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 GetPinRequest = {
|
|
/**
|
|
* Determines the kind of code returned by the API call
|
|
*
|
|
* @remarks
|
|
* Strong codes are used for Pin authentication flows
|
|
* Non-Strong codes are used for `Plex.tv/link`
|
|
*
|
|
*/
|
|
strong?: boolean | undefined;
|
|
/**
|
|
* 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;
|
|
xPlexProduct?: string | undefined;
|
|
};
|
|
|
|
/**
|
|
* Geo location data
|
|
*/
|
|
export type GeoData = {
|
|
/**
|
|
* 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;
|
|
};
|
|
|
|
/**
|
|
* Requests a new pin id used in the authentication flow
|
|
*/
|
|
export type GetPinAuthPinContainer = {
|
|
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: GeoData;
|
|
/**
|
|
* 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 GetPinResponse = {
|
|
/**
|
|
* 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;
|
|
/**
|
|
* Requests a new pin id used in the authentication flow
|
|
*/
|
|
authPinContainer?: GetPinAuthPinContainer | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const GetPinGlobals$inboundSchema: z.ZodType<GetPinGlobals, 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 GetPinGlobals$Outbound = {
|
|
"X-Plex-Client-Identifier"?: string | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const GetPinGlobals$outboundSchema: z.ZodType<
|
|
GetPinGlobals$Outbound,
|
|
z.ZodTypeDef,
|
|
GetPinGlobals
|
|
> = 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 GetPinGlobals$ {
|
|
/** @deprecated use `GetPinGlobals$inboundSchema` instead. */
|
|
export const inboundSchema = GetPinGlobals$inboundSchema;
|
|
/** @deprecated use `GetPinGlobals$outboundSchema` instead. */
|
|
export const outboundSchema = GetPinGlobals$outboundSchema;
|
|
/** @deprecated use `GetPinGlobals$Outbound` instead. */
|
|
export type Outbound = GetPinGlobals$Outbound;
|
|
}
|
|
|
|
/** @internal */
|
|
export const GetPinRequest$inboundSchema: z.ZodType<GetPinRequest, z.ZodTypeDef, unknown> = z
|
|
.object({
|
|
strong: z.boolean().default(false),
|
|
"X-Plex-Client-Identifier": z.string().optional(),
|
|
"X-Plex-Product": z.string().optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
"X-Plex-Client-Identifier": "xPlexClientIdentifier",
|
|
"X-Plex-Product": "xPlexProduct",
|
|
});
|
|
});
|
|
|
|
/** @internal */
|
|
export type GetPinRequest$Outbound = {
|
|
strong: boolean;
|
|
"X-Plex-Client-Identifier"?: string | undefined;
|
|
"X-Plex-Product"?: string | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const GetPinRequest$outboundSchema: z.ZodType<
|
|
GetPinRequest$Outbound,
|
|
z.ZodTypeDef,
|
|
GetPinRequest
|
|
> = z
|
|
.object({
|
|
strong: z.boolean().default(false),
|
|
xPlexClientIdentifier: z.string().optional(),
|
|
xPlexProduct: z.string().optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
xPlexClientIdentifier: "X-Plex-Client-Identifier",
|
|
xPlexProduct: "X-Plex-Product",
|
|
});
|
|
});
|
|
|
|
/**
|
|
* @internal
|
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
*/
|
|
export namespace GetPinRequest$ {
|
|
/** @deprecated use `GetPinRequest$inboundSchema` instead. */
|
|
export const inboundSchema = GetPinRequest$inboundSchema;
|
|
/** @deprecated use `GetPinRequest$outboundSchema` instead. */
|
|
export const outboundSchema = GetPinRequest$outboundSchema;
|
|
/** @deprecated use `GetPinRequest$Outbound` instead. */
|
|
export type Outbound = GetPinRequest$Outbound;
|
|
}
|
|
|
|
/** @internal */
|
|
export const GeoData$inboundSchema: z.ZodType<GeoData, 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 GeoData$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 GeoData$outboundSchema: z.ZodType<GeoData$Outbound, z.ZodTypeDef, GeoData> = 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 GeoData$ {
|
|
/** @deprecated use `GeoData$inboundSchema` instead. */
|
|
export const inboundSchema = GeoData$inboundSchema;
|
|
/** @deprecated use `GeoData$outboundSchema` instead. */
|
|
export const outboundSchema = GeoData$outboundSchema;
|
|
/** @deprecated use `GeoData$Outbound` instead. */
|
|
export type Outbound = GeoData$Outbound;
|
|
}
|
|
|
|
/** @internal */
|
|
export const GetPinAuthPinContainer$inboundSchema: z.ZodType<
|
|
GetPinAuthPinContainer,
|
|
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(() => GeoData$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 GetPinAuthPinContainer$Outbound = {
|
|
id: number;
|
|
code: string;
|
|
product: string;
|
|
trusted: boolean;
|
|
qr: string;
|
|
clientIdentifier: string;
|
|
location: GeoData$Outbound;
|
|
expiresIn: number;
|
|
createdAt: string;
|
|
expiresAt: string;
|
|
authToken?: any | null | undefined;
|
|
newRegistration?: any | null | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const GetPinAuthPinContainer$outboundSchema: z.ZodType<
|
|
GetPinAuthPinContainer$Outbound,
|
|
z.ZodTypeDef,
|
|
GetPinAuthPinContainer
|
|
> = 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(() => GeoData$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 GetPinAuthPinContainer$ {
|
|
/** @deprecated use `GetPinAuthPinContainer$inboundSchema` instead. */
|
|
export const inboundSchema = GetPinAuthPinContainer$inboundSchema;
|
|
/** @deprecated use `GetPinAuthPinContainer$outboundSchema` instead. */
|
|
export const outboundSchema = GetPinAuthPinContainer$outboundSchema;
|
|
/** @deprecated use `GetPinAuthPinContainer$Outbound` instead. */
|
|
export type Outbound = GetPinAuthPinContainer$Outbound;
|
|
}
|
|
|
|
/** @internal */
|
|
export const GetPinResponse$inboundSchema: z.ZodType<GetPinResponse, z.ZodTypeDef, unknown> = z
|
|
.object({
|
|
ContentType: z.string(),
|
|
StatusCode: z.number().int(),
|
|
RawResponse: z.instanceof(Response),
|
|
AuthPinContainer: z.lazy(() => GetPinAuthPinContainer$inboundSchema).optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
ContentType: "contentType",
|
|
StatusCode: "statusCode",
|
|
RawResponse: "rawResponse",
|
|
AuthPinContainer: "authPinContainer",
|
|
});
|
|
});
|
|
|
|
/** @internal */
|
|
export type GetPinResponse$Outbound = {
|
|
ContentType: string;
|
|
StatusCode: number;
|
|
RawResponse: never;
|
|
AuthPinContainer?: GetPinAuthPinContainer$Outbound | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const GetPinResponse$outboundSchema: z.ZodType<
|
|
GetPinResponse$Outbound,
|
|
z.ZodTypeDef,
|
|
GetPinResponse
|
|
> = z
|
|
.object({
|
|
contentType: z.string(),
|
|
statusCode: z.number().int(),
|
|
rawResponse: z.instanceof(Response).transform(() => {
|
|
throw new Error("Response cannot be serialized");
|
|
}),
|
|
authPinContainer: z.lazy(() => GetPinAuthPinContainer$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 GetPinResponse$ {
|
|
/** @deprecated use `GetPinResponse$inboundSchema` instead. */
|
|
export const inboundSchema = GetPinResponse$inboundSchema;
|
|
/** @deprecated use `GetPinResponse$outboundSchema` instead. */
|
|
export const outboundSchema = GetPinResponse$outboundSchema;
|
|
/** @deprecated use `GetPinResponse$Outbound` instead. */
|
|
export type Outbound = GetPinResponse$Outbound;
|
|
}
|