attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
236 lines • 9.12 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
/**
* The level of access granted to all members of the workspace for this list. `null` values represent a private list that only grants access to specific workspace members via the `workspace_member_access` property.
*/
export const WorkspaceAccess = {
FullAccess: "full-access",
ReadAndWrite: "read-and-write",
ReadOnly: "read-only",
};
/**
* The level of access to the list.
*/
export const Level = {
FullAccess: "full-access",
ReadAndWrite: "read-and-write",
ReadOnly: "read-only",
};
/**
* The type of actor. [Read more information on actor types here](/docs/actors).
*/
export const ListType = {
ApiToken: "api-token",
WorkspaceMember: "workspace-member",
System: "system",
App: "app",
};
/** @internal */
export const ListId$inboundSchema = z
.object({
workspace_id: z.string(),
list_id: z.string(),
}).transform((v) => {
return remap$(v, {
"workspace_id": "workspaceId",
"list_id": "listId",
});
});
/** @internal */
export const ListId$outboundSchema = z.object({
workspaceId: z.string(),
listId: z.string(),
}).transform((v) => {
return remap$(v, {
workspaceId: "workspace_id",
listId: "list_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var ListId$;
(function (ListId$) {
/** @deprecated use `ListId$inboundSchema` instead. */
ListId$.inboundSchema = ListId$inboundSchema;
/** @deprecated use `ListId$outboundSchema` instead. */
ListId$.outboundSchema = ListId$outboundSchema;
})(ListId$ || (ListId$ = {}));
export function listIdToJSON(listId) {
return JSON.stringify(ListId$outboundSchema.parse(listId));
}
export function listIdFromJSON(jsonString) {
return safeParse(jsonString, (x) => ListId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListId' from JSON`);
}
/** @internal */
export const WorkspaceAccess$inboundSchema = z.nativeEnum(WorkspaceAccess);
/** @internal */
export const WorkspaceAccess$outboundSchema = WorkspaceAccess$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var WorkspaceAccess$;
(function (WorkspaceAccess$) {
/** @deprecated use `WorkspaceAccess$inboundSchema` instead. */
WorkspaceAccess$.inboundSchema = WorkspaceAccess$inboundSchema;
/** @deprecated use `WorkspaceAccess$outboundSchema` instead. */
WorkspaceAccess$.outboundSchema = WorkspaceAccess$outboundSchema;
})(WorkspaceAccess$ || (WorkspaceAccess$ = {}));
/** @internal */
export const Level$inboundSchema = z.nativeEnum(Level);
/** @internal */
export const Level$outboundSchema = Level$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var Level$;
(function (Level$) {
/** @deprecated use `Level$inboundSchema` instead. */
Level$.inboundSchema = Level$inboundSchema;
/** @deprecated use `Level$outboundSchema` instead. */
Level$.outboundSchema = Level$outboundSchema;
})(Level$ || (Level$ = {}));
/** @internal */
export const WorkspaceMemberAccess$inboundSchema = z.object({
workspace_member_id: z.string(),
level: Level$inboundSchema,
}).transform((v) => {
return remap$(v, {
"workspace_member_id": "workspaceMemberId",
});
});
/** @internal */
export const WorkspaceMemberAccess$outboundSchema = z.object({
workspaceMemberId: z.string(),
level: Level$outboundSchema,
}).transform((v) => {
return remap$(v, {
workspaceMemberId: "workspace_member_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var WorkspaceMemberAccess$;
(function (WorkspaceMemberAccess$) {
/** @deprecated use `WorkspaceMemberAccess$inboundSchema` instead. */
WorkspaceMemberAccess$.inboundSchema = WorkspaceMemberAccess$inboundSchema;
/** @deprecated use `WorkspaceMemberAccess$outboundSchema` instead. */
WorkspaceMemberAccess$.outboundSchema = WorkspaceMemberAccess$outboundSchema;
})(WorkspaceMemberAccess$ || (WorkspaceMemberAccess$ = {}));
export function workspaceMemberAccessToJSON(workspaceMemberAccess) {
return JSON.stringify(WorkspaceMemberAccess$outboundSchema.parse(workspaceMemberAccess));
}
export function workspaceMemberAccessFromJSON(jsonString) {
return safeParse(jsonString, (x) => WorkspaceMemberAccess$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkspaceMemberAccess' from JSON`);
}
/** @internal */
export const ListType$inboundSchema = z
.nativeEnum(ListType);
/** @internal */
export const ListType$outboundSchema = ListType$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var ListType$;
(function (ListType$) {
/** @deprecated use `ListType$inboundSchema` instead. */
ListType$.inboundSchema = ListType$inboundSchema;
/** @deprecated use `ListType$outboundSchema` instead. */
ListType$.outboundSchema = ListType$outboundSchema;
})(ListType$ || (ListType$ = {}));
/** @internal */
export const ListCreatedByActor$inboundSchema = z.object({
id: z.nullable(z.string()).optional(),
type: z.nullable(ListType$inboundSchema).optional(),
});
/** @internal */
export const ListCreatedByActor$outboundSchema = z.object({
id: z.nullable(z.string()).optional(),
type: z.nullable(ListType$outboundSchema).optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var ListCreatedByActor$;
(function (ListCreatedByActor$) {
/** @deprecated use `ListCreatedByActor$inboundSchema` instead. */
ListCreatedByActor$.inboundSchema = ListCreatedByActor$inboundSchema;
/** @deprecated use `ListCreatedByActor$outboundSchema` instead. */
ListCreatedByActor$.outboundSchema = ListCreatedByActor$outboundSchema;
})(ListCreatedByActor$ || (ListCreatedByActor$ = {}));
export function listCreatedByActorToJSON(listCreatedByActor) {
return JSON.stringify(ListCreatedByActor$outboundSchema.parse(listCreatedByActor));
}
export function listCreatedByActorFromJSON(jsonString) {
return safeParse(jsonString, (x) => ListCreatedByActor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListCreatedByActor' from JSON`);
}
/** @internal */
export const List$inboundSchema = z
.object({
id: z.lazy(() => ListId$inboundSchema),
api_slug: z.string(),
name: z.string(),
parent_object: z.array(z.string()),
workspace_access: z.nullable(WorkspaceAccess$inboundSchema),
workspace_member_access: z.array(z.lazy(() => WorkspaceMemberAccess$inboundSchema)),
created_by_actor: z.lazy(() => ListCreatedByActor$inboundSchema),
created_at: z.string(),
}).transform((v) => {
return remap$(v, {
"api_slug": "apiSlug",
"parent_object": "parentObject",
"workspace_access": "workspaceAccess",
"workspace_member_access": "workspaceMemberAccess",
"created_by_actor": "createdByActor",
"created_at": "createdAt",
});
});
/** @internal */
export const List$outboundSchema = z.object({
id: z.lazy(() => ListId$outboundSchema),
apiSlug: z.string(),
name: z.string(),
parentObject: z.array(z.string()),
workspaceAccess: z.nullable(WorkspaceAccess$outboundSchema),
workspaceMemberAccess: z.array(z.lazy(() => WorkspaceMemberAccess$outboundSchema)),
createdByActor: z.lazy(() => ListCreatedByActor$outboundSchema),
createdAt: z.string(),
}).transform((v) => {
return remap$(v, {
apiSlug: "api_slug",
parentObject: "parent_object",
workspaceAccess: "workspace_access",
workspaceMemberAccess: "workspace_member_access",
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.
*/
export var List$;
(function (List$) {
/** @deprecated use `List$inboundSchema` instead. */
List$.inboundSchema = List$inboundSchema;
/** @deprecated use `List$outboundSchema` instead. */
List$.outboundSchema = List$outboundSchema;
})(List$ || (List$ = {}));
export function listToJSON(list) {
return JSON.stringify(List$outboundSchema.parse(list));
}
export function listFromJSON(jsonString) {
return safeParse(jsonString, (x) => List$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'List' from JSON`);
}
//# sourceMappingURL=list.js.map