UNPKG

attio-js

Version:

Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.

203 lines 7.53 kB
import * as z from "zod"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The type of token, always Bearer for tokens acquired via the OAuth 2.0 flow. */ export declare const TokenType: { readonly Bearer: "Bearer"; }; /** * The type of token, always Bearer for tokens acquired via the OAuth 2.0 flow. */ export type TokenType = ClosedEnum<typeof TokenType>; /** * The issuer of the token. Always attio.com */ export declare const Iss: { readonly AttioCom: "attio.com"; }; /** * The issuer of the token. Always attio.com */ export type Iss = ClosedEnum<typeof Iss>; export type Bearer = { /** * Whether the token is currently active and usable. */ active: boolean; /** * A space-separated list of scopes associated with this token */ scope: string; /** * The app ID of the OAuth application that requested this token */ clientId: string; /** * The type of token, always Bearer for tokens acquired via the OAuth 2.0 flow. */ tokenType: TokenType; /** * The time at which this token will expire, if set, as a number of seconds since January 1 1970 UTC. */ exp: number | null; /** * The time at which this token was issued, as a number of seconds since January 1 1970 UTC. */ iat: number; /** * Since Bearer tokens grant Workspace-level permissions, this property contains the workspace_id. */ sub: string; /** * The intended audience for this token, for Bearer tokens this is the same as the client_id. */ aud: string; /** * The issuer of the token. Always attio.com */ iss: Iss; /** * The ID of the workspace member who authorised this token initially, if known */ authorizedByWorkspaceMemberId: string | null; /** * The ID of the workspace the token is scoped to. */ workspaceId: string; /** * The name of the workspace the token is scoped to. */ workspaceName: string; /** * The slug of the workspace the token is scoped to. */ workspaceSlug: string; /** * The logo URL of the workspace the token is scoped to. */ workspaceLogoUrl: string | null; }; export type ResponseBody = { active: boolean; }; /** * Success */ export type GetV2SelfResponse = ResponseBody | Bearer; /** @internal */ export declare const TokenType$inboundSchema: z.ZodNativeEnum<typeof TokenType>; /** @internal */ export declare const TokenType$outboundSchema: z.ZodNativeEnum<typeof TokenType>; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export declare namespace TokenType$ { /** @deprecated use `TokenType$inboundSchema` instead. */ const inboundSchema: z.ZodNativeEnum<{ readonly Bearer: "Bearer"; }>; /** @deprecated use `TokenType$outboundSchema` instead. */ const outboundSchema: z.ZodNativeEnum<{ readonly Bearer: "Bearer"; }>; } /** @internal */ export declare const Iss$inboundSchema: z.ZodNativeEnum<typeof Iss>; /** @internal */ export declare const Iss$outboundSchema: z.ZodNativeEnum<typeof Iss>; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export declare namespace Iss$ { /** @deprecated use `Iss$inboundSchema` instead. */ const inboundSchema: z.ZodNativeEnum<{ readonly AttioCom: "attio.com"; }>; /** @deprecated use `Iss$outboundSchema` instead. */ const outboundSchema: z.ZodNativeEnum<{ readonly AttioCom: "attio.com"; }>; } /** @internal */ export declare const Bearer$inboundSchema: z.ZodType<Bearer, z.ZodTypeDef, unknown>; /** @internal */ export type Bearer$Outbound = { active: boolean; scope: string; client_id: string; token_type: string; exp: number | null; iat: number; sub: string; aud: string; iss: string; authorized_by_workspace_member_id: string | null; workspace_id: string; workspace_name: string; workspace_slug: string; workspace_logo_url: string | null; }; /** @internal */ export declare const Bearer$outboundSchema: z.ZodType<Bearer$Outbound, z.ZodTypeDef, Bearer>; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export declare namespace Bearer$ { /** @deprecated use `Bearer$inboundSchema` instead. */ const inboundSchema: z.ZodType<Bearer, z.ZodTypeDef, unknown>; /** @deprecated use `Bearer$outboundSchema` instead. */ const outboundSchema: z.ZodType<Bearer$Outbound, z.ZodTypeDef, Bearer>; /** @deprecated use `Bearer$Outbound` instead. */ type Outbound = Bearer$Outbound; } export declare function bearerToJSON(bearer: Bearer): string; export declare function bearerFromJSON(jsonString: string): SafeParseResult<Bearer, SDKValidationError>; /** @internal */ export declare const ResponseBody$inboundSchema: z.ZodType<ResponseBody, z.ZodTypeDef, unknown>; /** @internal */ export type ResponseBody$Outbound = { active: boolean; }; /** @internal */ export declare const ResponseBody$outboundSchema: z.ZodType<ResponseBody$Outbound, z.ZodTypeDef, ResponseBody>; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export declare namespace ResponseBody$ { /** @deprecated use `ResponseBody$inboundSchema` instead. */ const inboundSchema: z.ZodType<ResponseBody, z.ZodTypeDef, unknown>; /** @deprecated use `ResponseBody$outboundSchema` instead. */ const outboundSchema: z.ZodType<ResponseBody$Outbound, z.ZodTypeDef, ResponseBody>; /** @deprecated use `ResponseBody$Outbound` instead. */ type Outbound = ResponseBody$Outbound; } export declare function responseBodyToJSON(responseBody: ResponseBody): string; export declare function responseBodyFromJSON(jsonString: string): SafeParseResult<ResponseBody, SDKValidationError>; /** @internal */ export declare const GetV2SelfResponse$inboundSchema: z.ZodType<GetV2SelfResponse, z.ZodTypeDef, unknown>; /** @internal */ export type GetV2SelfResponse$Outbound = ResponseBody$Outbound | Bearer$Outbound; /** @internal */ export declare const GetV2SelfResponse$outboundSchema: z.ZodType<GetV2SelfResponse$Outbound, z.ZodTypeDef, GetV2SelfResponse>; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export declare namespace GetV2SelfResponse$ { /** @deprecated use `GetV2SelfResponse$inboundSchema` instead. */ const inboundSchema: z.ZodType<GetV2SelfResponse, z.ZodTypeDef, unknown>; /** @deprecated use `GetV2SelfResponse$outboundSchema` instead. */ const outboundSchema: z.ZodType<GetV2SelfResponse$Outbound, z.ZodTypeDef, GetV2SelfResponse>; /** @deprecated use `GetV2SelfResponse$Outbound` instead. */ type Outbound = GetV2SelfResponse$Outbound; } export declare function getV2SelfResponseToJSON(getV2SelfResponse: GetV2SelfResponse): string; export declare function getV2SelfResponseFromJSON(jsonString: string): SafeParseResult<GetV2SelfResponse, SDKValidationError>; //# sourceMappingURL=getv2self.d.ts.map