UNPKG

attio-js

Version:

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

216 lines 8.98 kB
"use strict"; /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.GetV2SelfResponse$ = exports.GetV2SelfResponse$outboundSchema = exports.GetV2SelfResponse$inboundSchema = exports.ResponseBody$ = exports.ResponseBody$outboundSchema = exports.ResponseBody$inboundSchema = exports.Bearer$ = exports.Bearer$outboundSchema = exports.Bearer$inboundSchema = exports.Iss$ = exports.Iss$outboundSchema = exports.Iss$inboundSchema = exports.TokenType$ = exports.TokenType$outboundSchema = exports.TokenType$inboundSchema = exports.Iss = exports.TokenType = void 0; exports.bearerToJSON = bearerToJSON; exports.bearerFromJSON = bearerFromJSON; exports.responseBodyToJSON = responseBodyToJSON; exports.responseBodyFromJSON = responseBodyFromJSON; exports.getV2SelfResponseToJSON = getV2SelfResponseToJSON; exports.getV2SelfResponseFromJSON = getV2SelfResponseFromJSON; const z = __importStar(require("zod")); const primitives_js_1 = require("../../lib/primitives.js"); const schemas_js_1 = require("../../lib/schemas.js"); /** * The type of token, always Bearer for tokens acquired via the OAuth 2.0 flow. */ exports.TokenType = { Bearer: "Bearer", }; /** * The issuer of the token. Always attio.com */ exports.Iss = { AttioCom: "attio.com", }; /** @internal */ exports.TokenType$inboundSchema = z .nativeEnum(exports.TokenType); /** @internal */ exports.TokenType$outboundSchema = exports.TokenType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var TokenType$; (function (TokenType$) { /** @deprecated use `TokenType$inboundSchema` instead. */ TokenType$.inboundSchema = exports.TokenType$inboundSchema; /** @deprecated use `TokenType$outboundSchema` instead. */ TokenType$.outboundSchema = exports.TokenType$outboundSchema; })(TokenType$ || (exports.TokenType$ = TokenType$ = {})); /** @internal */ exports.Iss$inboundSchema = z.nativeEnum(exports.Iss); /** @internal */ exports.Iss$outboundSchema = exports.Iss$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var Iss$; (function (Iss$) { /** @deprecated use `Iss$inboundSchema` instead. */ Iss$.inboundSchema = exports.Iss$inboundSchema; /** @deprecated use `Iss$outboundSchema` instead. */ Iss$.outboundSchema = exports.Iss$outboundSchema; })(Iss$ || (exports.Iss$ = Iss$ = {})); /** @internal */ exports.Bearer$inboundSchema = z .object({ active: z.boolean(), scope: z.string(), client_id: z.string(), token_type: exports.TokenType$inboundSchema, exp: z.nullable(z.number()), iat: z.number(), sub: z.string(), aud: z.string(), iss: exports.Iss$inboundSchema, authorized_by_workspace_member_id: z.nullable(z.string()), workspace_id: z.string(), workspace_name: z.string(), workspace_slug: z.string(), workspace_logo_url: z.nullable(z.string()), }).transform((v) => { return (0, primitives_js_1.remap)(v, { "client_id": "clientId", "token_type": "tokenType", "authorized_by_workspace_member_id": "authorizedByWorkspaceMemberId", "workspace_id": "workspaceId", "workspace_name": "workspaceName", "workspace_slug": "workspaceSlug", "workspace_logo_url": "workspaceLogoUrl", }); }); /** @internal */ exports.Bearer$outboundSchema = z.object({ active: z.boolean(), scope: z.string(), clientId: z.string(), tokenType: exports.TokenType$outboundSchema, exp: z.nullable(z.number()), iat: z.number(), sub: z.string(), aud: z.string(), iss: exports.Iss$outboundSchema, authorizedByWorkspaceMemberId: z.nullable(z.string()), workspaceId: z.string(), workspaceName: z.string(), workspaceSlug: z.string(), workspaceLogoUrl: z.nullable(z.string()), }).transform((v) => { return (0, primitives_js_1.remap)(v, { clientId: "client_id", tokenType: "token_type", authorizedByWorkspaceMemberId: "authorized_by_workspace_member_id", workspaceId: "workspace_id", workspaceName: "workspace_name", workspaceSlug: "workspace_slug", workspaceLogoUrl: "workspace_logo_url", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var Bearer$; (function (Bearer$) { /** @deprecated use `Bearer$inboundSchema` instead. */ Bearer$.inboundSchema = exports.Bearer$inboundSchema; /** @deprecated use `Bearer$outboundSchema` instead. */ Bearer$.outboundSchema = exports.Bearer$outboundSchema; })(Bearer$ || (exports.Bearer$ = Bearer$ = {})); function bearerToJSON(bearer) { return JSON.stringify(exports.Bearer$outboundSchema.parse(bearer)); } function bearerFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Bearer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Bearer' from JSON`); } /** @internal */ exports.ResponseBody$inboundSchema = z.object({ active: z.boolean(), }); /** @internal */ exports.ResponseBody$outboundSchema = z.object({ active: z.boolean(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var ResponseBody$; (function (ResponseBody$) { /** @deprecated use `ResponseBody$inboundSchema` instead. */ ResponseBody$.inboundSchema = exports.ResponseBody$inboundSchema; /** @deprecated use `ResponseBody$outboundSchema` instead. */ ResponseBody$.outboundSchema = exports.ResponseBody$outboundSchema; })(ResponseBody$ || (exports.ResponseBody$ = ResponseBody$ = {})); function responseBodyToJSON(responseBody) { return JSON.stringify(exports.ResponseBody$outboundSchema.parse(responseBody)); } function responseBodyFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBody' from JSON`); } /** @internal */ exports.GetV2SelfResponse$inboundSchema = z.union([ z.lazy(() => exports.ResponseBody$inboundSchema), z.lazy(() => exports.Bearer$inboundSchema), ]); /** @internal */ exports.GetV2SelfResponse$outboundSchema = z.union([ z.lazy(() => exports.ResponseBody$outboundSchema), z.lazy(() => exports.Bearer$outboundSchema), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var GetV2SelfResponse$; (function (GetV2SelfResponse$) { /** @deprecated use `GetV2SelfResponse$inboundSchema` instead. */ GetV2SelfResponse$.inboundSchema = exports.GetV2SelfResponse$inboundSchema; /** @deprecated use `GetV2SelfResponse$outboundSchema` instead. */ GetV2SelfResponse$.outboundSchema = exports.GetV2SelfResponse$outboundSchema; })(GetV2SelfResponse$ || (exports.GetV2SelfResponse$ = GetV2SelfResponse$ = {})); function getV2SelfResponseToJSON(getV2SelfResponse) { return JSON.stringify(exports.GetV2SelfResponse$outboundSchema.parse(getV2SelfResponse)); } function getV2SelfResponseFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.GetV2SelfResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetV2SelfResponse' from JSON`); } //# sourceMappingURL=getv2self.js.map