attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
299 lines • 12.9 kB
JavaScript
"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.Task$ = exports.Task$outboundSchema = exports.Task$inboundSchema = exports.TaskCreatedByActor$ = exports.TaskCreatedByActor$outboundSchema = exports.TaskCreatedByActor$inboundSchema = exports.TaskType$ = exports.TaskType$outboundSchema = exports.TaskType$inboundSchema = exports.Assignee$ = exports.Assignee$outboundSchema = exports.Assignee$inboundSchema = exports.TaskReferencedActorType$ = exports.TaskReferencedActorType$outboundSchema = exports.TaskReferencedActorType$inboundSchema = exports.LinkedRecord$ = exports.LinkedRecord$outboundSchema = exports.LinkedRecord$inboundSchema = exports.TaskId$ = exports.TaskId$outboundSchema = exports.TaskId$inboundSchema = exports.TaskType = exports.TaskReferencedActorType = void 0;
exports.taskIdToJSON = taskIdToJSON;
exports.taskIdFromJSON = taskIdFromJSON;
exports.linkedRecordToJSON = linkedRecordToJSON;
exports.linkedRecordFromJSON = linkedRecordFromJSON;
exports.assigneeToJSON = assigneeToJSON;
exports.assigneeFromJSON = assigneeFromJSON;
exports.taskCreatedByActorToJSON = taskCreatedByActorToJSON;
exports.taskCreatedByActorFromJSON = taskCreatedByActorFromJSON;
exports.taskToJSON = taskToJSON;
exports.taskFromJSON = taskFromJSON;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
/**
* The type of actor. [Read more information on actor types here](/docs/actors).
*/
exports.TaskReferencedActorType = {
ApiToken: "api-token",
WorkspaceMember: "workspace-member",
System: "system",
App: "app",
};
/**
* The type of actor. [Read more information on actor types here](/docs/actors).
*/
exports.TaskType = {
ApiToken: "api-token",
WorkspaceMember: "workspace-member",
System: "system",
App: "app",
};
/** @internal */
exports.TaskId$inboundSchema = z
.object({
workspace_id: z.string(),
task_id: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
"workspace_id": "workspaceId",
"task_id": "taskId",
});
});
/** @internal */
exports.TaskId$outboundSchema = z.object({
workspaceId: z.string(),
taskId: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
workspaceId: "workspace_id",
taskId: "task_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
var TaskId$;
(function (TaskId$) {
/** @deprecated use `TaskId$inboundSchema` instead. */
TaskId$.inboundSchema = exports.TaskId$inboundSchema;
/** @deprecated use `TaskId$outboundSchema` instead. */
TaskId$.outboundSchema = exports.TaskId$outboundSchema;
})(TaskId$ || (exports.TaskId$ = TaskId$ = {}));
function taskIdToJSON(taskId) {
return JSON.stringify(exports.TaskId$outboundSchema.parse(taskId));
}
function taskIdFromJSON(jsonString) {
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.TaskId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TaskId' from JSON`);
}
/** @internal */
exports.LinkedRecord$inboundSchema = z.object({
target_object_id: z.string(),
target_record_id: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
"target_object_id": "targetObjectId",
"target_record_id": "targetRecordId",
});
});
/** @internal */
exports.LinkedRecord$outboundSchema = z.object({
targetObjectId: z.string(),
targetRecordId: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
targetObjectId: "target_object_id",
targetRecordId: "target_record_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
var LinkedRecord$;
(function (LinkedRecord$) {
/** @deprecated use `LinkedRecord$inboundSchema` instead. */
LinkedRecord$.inboundSchema = exports.LinkedRecord$inboundSchema;
/** @deprecated use `LinkedRecord$outboundSchema` instead. */
LinkedRecord$.outboundSchema = exports.LinkedRecord$outboundSchema;
})(LinkedRecord$ || (exports.LinkedRecord$ = LinkedRecord$ = {}));
function linkedRecordToJSON(linkedRecord) {
return JSON.stringify(exports.LinkedRecord$outboundSchema.parse(linkedRecord));
}
function linkedRecordFromJSON(jsonString) {
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.LinkedRecord$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedRecord' from JSON`);
}
/** @internal */
exports.TaskReferencedActorType$inboundSchema = z.nativeEnum(exports.TaskReferencedActorType);
/** @internal */
exports.TaskReferencedActorType$outboundSchema = exports.TaskReferencedActorType$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
var TaskReferencedActorType$;
(function (TaskReferencedActorType$) {
/** @deprecated use `TaskReferencedActorType$inboundSchema` instead. */
TaskReferencedActorType$.inboundSchema = exports.TaskReferencedActorType$inboundSchema;
/** @deprecated use `TaskReferencedActorType$outboundSchema` instead. */
TaskReferencedActorType$.outboundSchema = exports.TaskReferencedActorType$outboundSchema;
})(TaskReferencedActorType$ || (exports.TaskReferencedActorType$ = TaskReferencedActorType$ = {}));
/** @internal */
exports.Assignee$inboundSchema = z.object({
referenced_actor_type: exports.TaskReferencedActorType$inboundSchema,
referenced_actor_id: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
"referenced_actor_type": "referencedActorType",
"referenced_actor_id": "referencedActorId",
});
});
/** @internal */
exports.Assignee$outboundSchema = z.object({
referencedActorType: exports.TaskReferencedActorType$outboundSchema,
referencedActorId: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
referencedActorType: "referenced_actor_type",
referencedActorId: "referenced_actor_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
var Assignee$;
(function (Assignee$) {
/** @deprecated use `Assignee$inboundSchema` instead. */
Assignee$.inboundSchema = exports.Assignee$inboundSchema;
/** @deprecated use `Assignee$outboundSchema` instead. */
Assignee$.outboundSchema = exports.Assignee$outboundSchema;
})(Assignee$ || (exports.Assignee$ = Assignee$ = {}));
function assigneeToJSON(assignee) {
return JSON.stringify(exports.Assignee$outboundSchema.parse(assignee));
}
function assigneeFromJSON(jsonString) {
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Assignee$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Assignee' from JSON`);
}
/** @internal */
exports.TaskType$inboundSchema = z
.nativeEnum(exports.TaskType);
/** @internal */
exports.TaskType$outboundSchema = exports.TaskType$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
var TaskType$;
(function (TaskType$) {
/** @deprecated use `TaskType$inboundSchema` instead. */
TaskType$.inboundSchema = exports.TaskType$inboundSchema;
/** @deprecated use `TaskType$outboundSchema` instead. */
TaskType$.outboundSchema = exports.TaskType$outboundSchema;
})(TaskType$ || (exports.TaskType$ = TaskType$ = {}));
/** @internal */
exports.TaskCreatedByActor$inboundSchema = z.object({
id: z.nullable(z.string()).optional(),
type: z.nullable(exports.TaskType$inboundSchema).optional(),
});
/** @internal */
exports.TaskCreatedByActor$outboundSchema = z.object({
id: z.nullable(z.string()).optional(),
type: z.nullable(exports.TaskType$outboundSchema).optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
var TaskCreatedByActor$;
(function (TaskCreatedByActor$) {
/** @deprecated use `TaskCreatedByActor$inboundSchema` instead. */
TaskCreatedByActor$.inboundSchema = exports.TaskCreatedByActor$inboundSchema;
/** @deprecated use `TaskCreatedByActor$outboundSchema` instead. */
TaskCreatedByActor$.outboundSchema = exports.TaskCreatedByActor$outboundSchema;
})(TaskCreatedByActor$ || (exports.TaskCreatedByActor$ = TaskCreatedByActor$ = {}));
function taskCreatedByActorToJSON(taskCreatedByActor) {
return JSON.stringify(exports.TaskCreatedByActor$outboundSchema.parse(taskCreatedByActor));
}
function taskCreatedByActorFromJSON(jsonString) {
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.TaskCreatedByActor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TaskCreatedByActor' from JSON`);
}
/** @internal */
exports.Task$inboundSchema = z
.object({
id: z.lazy(() => exports.TaskId$inboundSchema),
content_plaintext: z.string(),
deadline_at: z.nullable(z.string()),
is_completed: z.boolean(),
linked_records: z.array(z.lazy(() => exports.LinkedRecord$inboundSchema)),
assignees: z.array(z.lazy(() => exports.Assignee$inboundSchema)),
created_by_actor: z.lazy(() => exports.TaskCreatedByActor$inboundSchema),
created_at: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
"content_plaintext": "contentPlaintext",
"deadline_at": "deadlineAt",
"is_completed": "isCompleted",
"linked_records": "linkedRecords",
"created_by_actor": "createdByActor",
"created_at": "createdAt",
});
});
/** @internal */
exports.Task$outboundSchema = z.object({
id: z.lazy(() => exports.TaskId$outboundSchema),
contentPlaintext: z.string(),
deadlineAt: z.nullable(z.string()),
isCompleted: z.boolean(),
linkedRecords: z.array(z.lazy(() => exports.LinkedRecord$outboundSchema)),
assignees: z.array(z.lazy(() => exports.Assignee$outboundSchema)),
createdByActor: z.lazy(() => exports.TaskCreatedByActor$outboundSchema),
createdAt: z.string(),
}).transform((v) => {
return (0, primitives_js_1.remap)(v, {
contentPlaintext: "content_plaintext",
deadlineAt: "deadline_at",
isCompleted: "is_completed",
linkedRecords: "linked_records",
createdByActor: "created_by_actor",
createdAt: "created_at",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
var Task$;
(function (Task$) {
/** @deprecated use `Task$inboundSchema` instead. */
Task$.inboundSchema = exports.Task$inboundSchema;
/** @deprecated use `Task$outboundSchema` instead. */
Task$.outboundSchema = exports.Task$outboundSchema;
})(Task$ || (exports.Task$ = Task$ = {}));
function taskToJSON(task) {
return JSON.stringify(exports.Task$outboundSchema.parse(task));
}
function taskFromJSON(jsonString) {
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Task$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Task' from JSON`);
}
//# sourceMappingURL=task.js.map