attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
1,223 lines (1,099 loc) • 38.5 kB
text/typescript
/*
* 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";
import { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type GetV2WebhooksRequest = {
limit?: number | undefined;
offset?: number | undefined;
};
/**
* Type of event the webhook is subscribed to.
*/
export const GetV2WebhooksEventType = {
CommentCreated: "comment.created",
CommentResolved: "comment.resolved",
CommentUnresolved: "comment.unresolved",
CommentDeleted: "comment.deleted",
ListCreated: "list.created",
ListUpdated: "list.updated",
ListDeleted: "list.deleted",
ListAttributeCreated: "list-attribute.created",
ListAttributeUpdated: "list-attribute.updated",
ListEntryCreated: "list-entry.created",
ListEntryUpdated: "list-entry.updated",
ListEntryDeleted: "list-entry.deleted",
ObjectAttributeCreated: "object-attribute.created",
ObjectAttributeUpdated: "object-attribute.updated",
NoteCreated: "note.created",
NoteUpdated: "note.updated",
NoteDeleted: "note.deleted",
RecordCreated: "record.created",
RecordMerged: "record.merged",
RecordUpdated: "record.updated",
RecordDeleted: "record.deleted",
TaskCreated: "task.created",
TaskUpdated: "task.updated",
TaskDeleted: "task.deleted",
WorkspaceMemberCreated: "workspace-member.created",
} as const;
/**
* Type of event the webhook is subscribed to.
*/
export type GetV2WebhooksEventType = ClosedEnum<typeof GetV2WebhooksEventType>;
export const GetV2WebhooksDollarAndOperatorNotEquals = {
NotEquals: "not_equals",
} as const;
export type GetV2WebhooksDollarAndOperatorNotEquals = ClosedEnum<
typeof GetV2WebhooksDollarAndOperatorNotEquals
>;
export type GetV2WebhooksDollarAndNotEquals = {
field: string;
operator: GetV2WebhooksDollarAndOperatorNotEquals;
value: string;
};
export const GetV2WebhooksDollarAndOperatorEquals = {
Equals: "equals",
} as const;
export type GetV2WebhooksDollarAndOperatorEquals = ClosedEnum<
typeof GetV2WebhooksDollarAndOperatorEquals
>;
export type GetV2WebhooksDollarAndEquals = {
field: string;
operator: GetV2WebhooksDollarAndOperatorEquals;
value: string;
};
export type GetV2WebhooksDollarAndUnion =
| GetV2WebhooksDollarAndEquals
| GetV2WebhooksDollarAndNotEquals;
export type GetV2WebhooksFilter2 = {
dollarAnd: Array<
GetV2WebhooksDollarAndEquals | GetV2WebhooksDollarAndNotEquals
>;
};
export const GetV2WebhooksDollarOrOperatorNotEquals = {
NotEquals: "not_equals",
} as const;
export type GetV2WebhooksDollarOrOperatorNotEquals = ClosedEnum<
typeof GetV2WebhooksDollarOrOperatorNotEquals
>;
export type GetV2WebhooksDollarOrNotEquals = {
field: string;
operator: GetV2WebhooksDollarOrOperatorNotEquals;
value: string;
};
export const GetV2WebhooksDollarOrOperatorEquals = {
Equals: "equals",
} as const;
export type GetV2WebhooksDollarOrOperatorEquals = ClosedEnum<
typeof GetV2WebhooksDollarOrOperatorEquals
>;
export type GetV2WebhooksDollarOrEquals = {
field: string;
operator: GetV2WebhooksDollarOrOperatorEquals;
value: string;
};
export type GetV2WebhooksDollarOrUnion =
| GetV2WebhooksDollarOrEquals
| GetV2WebhooksDollarOrNotEquals;
export type GetV2WebhooksFilter1 = {
dollarOr: Array<GetV2WebhooksDollarOrEquals | GetV2WebhooksDollarOrNotEquals>;
};
/**
* Filters to determine whether the webhook event should be sent. If null, the filter always passes.
*/
export type GetV2WebhooksFilterUnion =
| GetV2WebhooksFilter1
| GetV2WebhooksFilter2;
export type GetV2WebhooksSubscription = {
/**
* Type of event the webhook is subscribed to.
*/
eventType: GetV2WebhooksEventType;
/**
* Filters to determine whether the webhook event should be sent. If null, the filter always passes.
*/
filter: GetV2WebhooksFilter1 | GetV2WebhooksFilter2 | null;
};
export type GetV2WebhooksId = {
/**
* The ID of the workspace the webhook belongs to.
*/
workspaceId: string;
/**
* The ID of the webhook.
*/
webhookId: string;
};
/**
* The state of the webhook. Webhooks marked as active and degraded will receive events, inactive ones will not. If a webhook remains in the degraded state for 7 days, it will be marked inactive.
*/
export const GetV2WebhooksStatus = {
Active: "active",
Degraded: "degraded",
Inactive: "inactive",
} as const;
/**
* The state of the webhook. Webhooks marked as active and degraded will receive events, inactive ones will not. If a webhook remains in the degraded state for 7 days, it will be marked inactive.
*/
export type GetV2WebhooksStatus = ClosedEnum<typeof GetV2WebhooksStatus>;
export type GetV2WebhooksData = {
/**
* URL where the webhook events will be delivered to.
*/
targetUrl: string;
/**
* One or more events the webhook is subscribed to.
*/
subscriptions: Array<GetV2WebhooksSubscription>;
id: GetV2WebhooksId;
/**
* The state of the webhook. Webhooks marked as active and degraded will receive events, inactive ones will not. If a webhook remains in the degraded state for 7 days, it will be marked inactive.
*/
status: GetV2WebhooksStatus;
/**
* When the webhook was created.
*/
createdAt: string;
};
/**
* Success
*/
export type GetV2WebhooksResponse = {
data: Array<GetV2WebhooksData>;
};
/** @internal */
export const GetV2WebhooksRequest$inboundSchema: z.ZodType<
GetV2WebhooksRequest,
z.ZodTypeDef,
unknown
> = z.object({
limit: z.number().int().optional(),
offset: z.number().int().optional(),
});
/** @internal */
export type GetV2WebhooksRequest$Outbound = {
limit?: number | undefined;
offset?: number | undefined;
};
/** @internal */
export const GetV2WebhooksRequest$outboundSchema: z.ZodType<
GetV2WebhooksRequest$Outbound,
z.ZodTypeDef,
GetV2WebhooksRequest
> = z.object({
limit: z.number().int().optional(),
offset: z.number().int().optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksRequest$ {
/** @deprecated use `GetV2WebhooksRequest$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksRequest$inboundSchema;
/** @deprecated use `GetV2WebhooksRequest$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksRequest$outboundSchema;
/** @deprecated use `GetV2WebhooksRequest$Outbound` instead. */
export type Outbound = GetV2WebhooksRequest$Outbound;
}
export function getV2WebhooksRequestToJSON(
getV2WebhooksRequest: GetV2WebhooksRequest,
): string {
return JSON.stringify(
GetV2WebhooksRequest$outboundSchema.parse(getV2WebhooksRequest),
);
}
export function getV2WebhooksRequestFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksRequest' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksEventType$inboundSchema: z.ZodNativeEnum<
typeof GetV2WebhooksEventType
> = z.nativeEnum(GetV2WebhooksEventType);
/** @internal */
export const GetV2WebhooksEventType$outboundSchema: z.ZodNativeEnum<
typeof GetV2WebhooksEventType
> = GetV2WebhooksEventType$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksEventType$ {
/** @deprecated use `GetV2WebhooksEventType$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksEventType$inboundSchema;
/** @deprecated use `GetV2WebhooksEventType$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksEventType$outboundSchema;
}
/** @internal */
export const GetV2WebhooksDollarAndOperatorNotEquals$inboundSchema:
z.ZodNativeEnum<typeof GetV2WebhooksDollarAndOperatorNotEquals> = z
.nativeEnum(GetV2WebhooksDollarAndOperatorNotEquals);
/** @internal */
export const GetV2WebhooksDollarAndOperatorNotEquals$outboundSchema:
z.ZodNativeEnum<typeof GetV2WebhooksDollarAndOperatorNotEquals> =
GetV2WebhooksDollarAndOperatorNotEquals$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarAndOperatorNotEquals$ {
/** @deprecated use `GetV2WebhooksDollarAndOperatorNotEquals$inboundSchema` instead. */
export const inboundSchema =
GetV2WebhooksDollarAndOperatorNotEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndOperatorNotEquals$outboundSchema` instead. */
export const outboundSchema =
GetV2WebhooksDollarAndOperatorNotEquals$outboundSchema;
}
/** @internal */
export const GetV2WebhooksDollarAndNotEquals$inboundSchema: z.ZodType<
GetV2WebhooksDollarAndNotEquals,
z.ZodTypeDef,
unknown
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarAndOperatorNotEquals$inboundSchema,
value: z.string(),
});
/** @internal */
export type GetV2WebhooksDollarAndNotEquals$Outbound = {
field: string;
operator: string;
value: string;
};
/** @internal */
export const GetV2WebhooksDollarAndNotEquals$outboundSchema: z.ZodType<
GetV2WebhooksDollarAndNotEquals$Outbound,
z.ZodTypeDef,
GetV2WebhooksDollarAndNotEquals
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarAndOperatorNotEquals$outboundSchema,
value: z.string(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarAndNotEquals$ {
/** @deprecated use `GetV2WebhooksDollarAndNotEquals$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksDollarAndNotEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndNotEquals$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksDollarAndNotEquals$outboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndNotEquals$Outbound` instead. */
export type Outbound = GetV2WebhooksDollarAndNotEquals$Outbound;
}
export function getV2WebhooksDollarAndNotEqualsToJSON(
getV2WebhooksDollarAndNotEquals: GetV2WebhooksDollarAndNotEquals,
): string {
return JSON.stringify(
GetV2WebhooksDollarAndNotEquals$outboundSchema.parse(
getV2WebhooksDollarAndNotEquals,
),
);
}
export function getV2WebhooksDollarAndNotEqualsFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksDollarAndNotEquals, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksDollarAndNotEquals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksDollarAndNotEquals' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksDollarAndOperatorEquals$inboundSchema:
z.ZodNativeEnum<typeof GetV2WebhooksDollarAndOperatorEquals> = z.nativeEnum(
GetV2WebhooksDollarAndOperatorEquals,
);
/** @internal */
export const GetV2WebhooksDollarAndOperatorEquals$outboundSchema:
z.ZodNativeEnum<typeof GetV2WebhooksDollarAndOperatorEquals> =
GetV2WebhooksDollarAndOperatorEquals$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarAndOperatorEquals$ {
/** @deprecated use `GetV2WebhooksDollarAndOperatorEquals$inboundSchema` instead. */
export const inboundSchema =
GetV2WebhooksDollarAndOperatorEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndOperatorEquals$outboundSchema` instead. */
export const outboundSchema =
GetV2WebhooksDollarAndOperatorEquals$outboundSchema;
}
/** @internal */
export const GetV2WebhooksDollarAndEquals$inboundSchema: z.ZodType<
GetV2WebhooksDollarAndEquals,
z.ZodTypeDef,
unknown
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarAndOperatorEquals$inboundSchema,
value: z.string(),
});
/** @internal */
export type GetV2WebhooksDollarAndEquals$Outbound = {
field: string;
operator: string;
value: string;
};
/** @internal */
export const GetV2WebhooksDollarAndEquals$outboundSchema: z.ZodType<
GetV2WebhooksDollarAndEquals$Outbound,
z.ZodTypeDef,
GetV2WebhooksDollarAndEquals
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarAndOperatorEquals$outboundSchema,
value: z.string(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarAndEquals$ {
/** @deprecated use `GetV2WebhooksDollarAndEquals$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksDollarAndEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndEquals$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksDollarAndEquals$outboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndEquals$Outbound` instead. */
export type Outbound = GetV2WebhooksDollarAndEquals$Outbound;
}
export function getV2WebhooksDollarAndEqualsToJSON(
getV2WebhooksDollarAndEquals: GetV2WebhooksDollarAndEquals,
): string {
return JSON.stringify(
GetV2WebhooksDollarAndEquals$outboundSchema.parse(
getV2WebhooksDollarAndEquals,
),
);
}
export function getV2WebhooksDollarAndEqualsFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksDollarAndEquals, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksDollarAndEquals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksDollarAndEquals' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksDollarAndUnion$inboundSchema: z.ZodType<
GetV2WebhooksDollarAndUnion,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => GetV2WebhooksDollarAndEquals$inboundSchema),
z.lazy(() => GetV2WebhooksDollarAndNotEquals$inboundSchema),
]);
/** @internal */
export type GetV2WebhooksDollarAndUnion$Outbound =
| GetV2WebhooksDollarAndEquals$Outbound
| GetV2WebhooksDollarAndNotEquals$Outbound;
/** @internal */
export const GetV2WebhooksDollarAndUnion$outboundSchema: z.ZodType<
GetV2WebhooksDollarAndUnion$Outbound,
z.ZodTypeDef,
GetV2WebhooksDollarAndUnion
> = z.union([
z.lazy(() => GetV2WebhooksDollarAndEquals$outboundSchema),
z.lazy(() => GetV2WebhooksDollarAndNotEquals$outboundSchema),
]);
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarAndUnion$ {
/** @deprecated use `GetV2WebhooksDollarAndUnion$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksDollarAndUnion$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndUnion$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksDollarAndUnion$outboundSchema;
/** @deprecated use `GetV2WebhooksDollarAndUnion$Outbound` instead. */
export type Outbound = GetV2WebhooksDollarAndUnion$Outbound;
}
export function getV2WebhooksDollarAndUnionToJSON(
getV2WebhooksDollarAndUnion: GetV2WebhooksDollarAndUnion,
): string {
return JSON.stringify(
GetV2WebhooksDollarAndUnion$outboundSchema.parse(
getV2WebhooksDollarAndUnion,
),
);
}
export function getV2WebhooksDollarAndUnionFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksDollarAndUnion, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksDollarAndUnion$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksDollarAndUnion' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksFilter2$inboundSchema: z.ZodType<
GetV2WebhooksFilter2,
z.ZodTypeDef,
unknown
> = z.object({
$and: z.array(
z.union([
z.lazy(() => GetV2WebhooksDollarAndEquals$inboundSchema),
z.lazy(() => GetV2WebhooksDollarAndNotEquals$inboundSchema),
]),
),
}).transform((v) => {
return remap$(v, {
"$and": "dollarAnd",
});
});
/** @internal */
export type GetV2WebhooksFilter2$Outbound = {
$and: Array<
| GetV2WebhooksDollarAndEquals$Outbound
| GetV2WebhooksDollarAndNotEquals$Outbound
>;
};
/** @internal */
export const GetV2WebhooksFilter2$outboundSchema: z.ZodType<
GetV2WebhooksFilter2$Outbound,
z.ZodTypeDef,
GetV2WebhooksFilter2
> = z.object({
dollarAnd: z.array(
z.union([
z.lazy(() => GetV2WebhooksDollarAndEquals$outboundSchema),
z.lazy(() => GetV2WebhooksDollarAndNotEquals$outboundSchema),
]),
),
}).transform((v) => {
return remap$(v, {
dollarAnd: "$and",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksFilter2$ {
/** @deprecated use `GetV2WebhooksFilter2$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksFilter2$inboundSchema;
/** @deprecated use `GetV2WebhooksFilter2$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksFilter2$outboundSchema;
/** @deprecated use `GetV2WebhooksFilter2$Outbound` instead. */
export type Outbound = GetV2WebhooksFilter2$Outbound;
}
export function getV2WebhooksFilter2ToJSON(
getV2WebhooksFilter2: GetV2WebhooksFilter2,
): string {
return JSON.stringify(
GetV2WebhooksFilter2$outboundSchema.parse(getV2WebhooksFilter2),
);
}
export function getV2WebhooksFilter2FromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksFilter2, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksFilter2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksFilter2' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksDollarOrOperatorNotEquals$inboundSchema:
z.ZodNativeEnum<typeof GetV2WebhooksDollarOrOperatorNotEquals> = z.nativeEnum(
GetV2WebhooksDollarOrOperatorNotEquals,
);
/** @internal */
export const GetV2WebhooksDollarOrOperatorNotEquals$outboundSchema:
z.ZodNativeEnum<typeof GetV2WebhooksDollarOrOperatorNotEquals> =
GetV2WebhooksDollarOrOperatorNotEquals$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarOrOperatorNotEquals$ {
/** @deprecated use `GetV2WebhooksDollarOrOperatorNotEquals$inboundSchema` instead. */
export const inboundSchema =
GetV2WebhooksDollarOrOperatorNotEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrOperatorNotEquals$outboundSchema` instead. */
export const outboundSchema =
GetV2WebhooksDollarOrOperatorNotEquals$outboundSchema;
}
/** @internal */
export const GetV2WebhooksDollarOrNotEquals$inboundSchema: z.ZodType<
GetV2WebhooksDollarOrNotEquals,
z.ZodTypeDef,
unknown
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarOrOperatorNotEquals$inboundSchema,
value: z.string(),
});
/** @internal */
export type GetV2WebhooksDollarOrNotEquals$Outbound = {
field: string;
operator: string;
value: string;
};
/** @internal */
export const GetV2WebhooksDollarOrNotEquals$outboundSchema: z.ZodType<
GetV2WebhooksDollarOrNotEquals$Outbound,
z.ZodTypeDef,
GetV2WebhooksDollarOrNotEquals
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarOrOperatorNotEquals$outboundSchema,
value: z.string(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarOrNotEquals$ {
/** @deprecated use `GetV2WebhooksDollarOrNotEquals$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksDollarOrNotEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrNotEquals$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksDollarOrNotEquals$outboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrNotEquals$Outbound` instead. */
export type Outbound = GetV2WebhooksDollarOrNotEquals$Outbound;
}
export function getV2WebhooksDollarOrNotEqualsToJSON(
getV2WebhooksDollarOrNotEquals: GetV2WebhooksDollarOrNotEquals,
): string {
return JSON.stringify(
GetV2WebhooksDollarOrNotEquals$outboundSchema.parse(
getV2WebhooksDollarOrNotEquals,
),
);
}
export function getV2WebhooksDollarOrNotEqualsFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksDollarOrNotEquals, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksDollarOrNotEquals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksDollarOrNotEquals' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksDollarOrOperatorEquals$inboundSchema: z.ZodNativeEnum<
typeof GetV2WebhooksDollarOrOperatorEquals
> = z.nativeEnum(GetV2WebhooksDollarOrOperatorEquals);
/** @internal */
export const GetV2WebhooksDollarOrOperatorEquals$outboundSchema:
z.ZodNativeEnum<typeof GetV2WebhooksDollarOrOperatorEquals> =
GetV2WebhooksDollarOrOperatorEquals$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarOrOperatorEquals$ {
/** @deprecated use `GetV2WebhooksDollarOrOperatorEquals$inboundSchema` instead. */
export const inboundSchema =
GetV2WebhooksDollarOrOperatorEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrOperatorEquals$outboundSchema` instead. */
export const outboundSchema =
GetV2WebhooksDollarOrOperatorEquals$outboundSchema;
}
/** @internal */
export const GetV2WebhooksDollarOrEquals$inboundSchema: z.ZodType<
GetV2WebhooksDollarOrEquals,
z.ZodTypeDef,
unknown
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarOrOperatorEquals$inboundSchema,
value: z.string(),
});
/** @internal */
export type GetV2WebhooksDollarOrEquals$Outbound = {
field: string;
operator: string;
value: string;
};
/** @internal */
export const GetV2WebhooksDollarOrEquals$outboundSchema: z.ZodType<
GetV2WebhooksDollarOrEquals$Outbound,
z.ZodTypeDef,
GetV2WebhooksDollarOrEquals
> = z.object({
field: z.string(),
operator: GetV2WebhooksDollarOrOperatorEquals$outboundSchema,
value: z.string(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarOrEquals$ {
/** @deprecated use `GetV2WebhooksDollarOrEquals$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksDollarOrEquals$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrEquals$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksDollarOrEquals$outboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrEquals$Outbound` instead. */
export type Outbound = GetV2WebhooksDollarOrEquals$Outbound;
}
export function getV2WebhooksDollarOrEqualsToJSON(
getV2WebhooksDollarOrEquals: GetV2WebhooksDollarOrEquals,
): string {
return JSON.stringify(
GetV2WebhooksDollarOrEquals$outboundSchema.parse(
getV2WebhooksDollarOrEquals,
),
);
}
export function getV2WebhooksDollarOrEqualsFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksDollarOrEquals, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksDollarOrEquals$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksDollarOrEquals' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksDollarOrUnion$inboundSchema: z.ZodType<
GetV2WebhooksDollarOrUnion,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => GetV2WebhooksDollarOrEquals$inboundSchema),
z.lazy(() => GetV2WebhooksDollarOrNotEquals$inboundSchema),
]);
/** @internal */
export type GetV2WebhooksDollarOrUnion$Outbound =
| GetV2WebhooksDollarOrEquals$Outbound
| GetV2WebhooksDollarOrNotEquals$Outbound;
/** @internal */
export const GetV2WebhooksDollarOrUnion$outboundSchema: z.ZodType<
GetV2WebhooksDollarOrUnion$Outbound,
z.ZodTypeDef,
GetV2WebhooksDollarOrUnion
> = z.union([
z.lazy(() => GetV2WebhooksDollarOrEquals$outboundSchema),
z.lazy(() => GetV2WebhooksDollarOrNotEquals$outboundSchema),
]);
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksDollarOrUnion$ {
/** @deprecated use `GetV2WebhooksDollarOrUnion$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksDollarOrUnion$inboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrUnion$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksDollarOrUnion$outboundSchema;
/** @deprecated use `GetV2WebhooksDollarOrUnion$Outbound` instead. */
export type Outbound = GetV2WebhooksDollarOrUnion$Outbound;
}
export function getV2WebhooksDollarOrUnionToJSON(
getV2WebhooksDollarOrUnion: GetV2WebhooksDollarOrUnion,
): string {
return JSON.stringify(
GetV2WebhooksDollarOrUnion$outboundSchema.parse(getV2WebhooksDollarOrUnion),
);
}
export function getV2WebhooksDollarOrUnionFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksDollarOrUnion, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksDollarOrUnion$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksDollarOrUnion' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksFilter1$inboundSchema: z.ZodType<
GetV2WebhooksFilter1,
z.ZodTypeDef,
unknown
> = z.object({
$or: z.array(
z.union([
z.lazy(() => GetV2WebhooksDollarOrEquals$inboundSchema),
z.lazy(() => GetV2WebhooksDollarOrNotEquals$inboundSchema),
]),
),
}).transform((v) => {
return remap$(v, {
"$or": "dollarOr",
});
});
/** @internal */
export type GetV2WebhooksFilter1$Outbound = {
$or: Array<
| GetV2WebhooksDollarOrEquals$Outbound
| GetV2WebhooksDollarOrNotEquals$Outbound
>;
};
/** @internal */
export const GetV2WebhooksFilter1$outboundSchema: z.ZodType<
GetV2WebhooksFilter1$Outbound,
z.ZodTypeDef,
GetV2WebhooksFilter1
> = z.object({
dollarOr: z.array(
z.union([
z.lazy(() => GetV2WebhooksDollarOrEquals$outboundSchema),
z.lazy(() => GetV2WebhooksDollarOrNotEquals$outboundSchema),
]),
),
}).transform((v) => {
return remap$(v, {
dollarOr: "$or",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksFilter1$ {
/** @deprecated use `GetV2WebhooksFilter1$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksFilter1$inboundSchema;
/** @deprecated use `GetV2WebhooksFilter1$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksFilter1$outboundSchema;
/** @deprecated use `GetV2WebhooksFilter1$Outbound` instead. */
export type Outbound = GetV2WebhooksFilter1$Outbound;
}
export function getV2WebhooksFilter1ToJSON(
getV2WebhooksFilter1: GetV2WebhooksFilter1,
): string {
return JSON.stringify(
GetV2WebhooksFilter1$outboundSchema.parse(getV2WebhooksFilter1),
);
}
export function getV2WebhooksFilter1FromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksFilter1, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksFilter1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksFilter1' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksFilterUnion$inboundSchema: z.ZodType<
GetV2WebhooksFilterUnion,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => GetV2WebhooksFilter1$inboundSchema),
z.lazy(() => GetV2WebhooksFilter2$inboundSchema),
]);
/** @internal */
export type GetV2WebhooksFilterUnion$Outbound =
| GetV2WebhooksFilter1$Outbound
| GetV2WebhooksFilter2$Outbound;
/** @internal */
export const GetV2WebhooksFilterUnion$outboundSchema: z.ZodType<
GetV2WebhooksFilterUnion$Outbound,
z.ZodTypeDef,
GetV2WebhooksFilterUnion
> = z.union([
z.lazy(() => GetV2WebhooksFilter1$outboundSchema),
z.lazy(() => GetV2WebhooksFilter2$outboundSchema),
]);
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksFilterUnion$ {
/** @deprecated use `GetV2WebhooksFilterUnion$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksFilterUnion$inboundSchema;
/** @deprecated use `GetV2WebhooksFilterUnion$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksFilterUnion$outboundSchema;
/** @deprecated use `GetV2WebhooksFilterUnion$Outbound` instead. */
export type Outbound = GetV2WebhooksFilterUnion$Outbound;
}
export function getV2WebhooksFilterUnionToJSON(
getV2WebhooksFilterUnion: GetV2WebhooksFilterUnion,
): string {
return JSON.stringify(
GetV2WebhooksFilterUnion$outboundSchema.parse(getV2WebhooksFilterUnion),
);
}
export function getV2WebhooksFilterUnionFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksFilterUnion, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksFilterUnion$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksFilterUnion' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksSubscription$inboundSchema: z.ZodType<
GetV2WebhooksSubscription,
z.ZodTypeDef,
unknown
> = z.object({
event_type: GetV2WebhooksEventType$inboundSchema,
filter: z.nullable(
z.union([
z.lazy(() => GetV2WebhooksFilter1$inboundSchema),
z.lazy(() => GetV2WebhooksFilter2$inboundSchema),
]),
),
}).transform((v) => {
return remap$(v, {
"event_type": "eventType",
});
});
/** @internal */
export type GetV2WebhooksSubscription$Outbound = {
event_type: string;
filter: GetV2WebhooksFilter1$Outbound | GetV2WebhooksFilter2$Outbound | null;
};
/** @internal */
export const GetV2WebhooksSubscription$outboundSchema: z.ZodType<
GetV2WebhooksSubscription$Outbound,
z.ZodTypeDef,
GetV2WebhooksSubscription
> = z.object({
eventType: GetV2WebhooksEventType$outboundSchema,
filter: z.nullable(
z.union([
z.lazy(() => GetV2WebhooksFilter1$outboundSchema),
z.lazy(() => GetV2WebhooksFilter2$outboundSchema),
]),
),
}).transform((v) => {
return remap$(v, {
eventType: "event_type",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksSubscription$ {
/** @deprecated use `GetV2WebhooksSubscription$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksSubscription$inboundSchema;
/** @deprecated use `GetV2WebhooksSubscription$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksSubscription$outboundSchema;
/** @deprecated use `GetV2WebhooksSubscription$Outbound` instead. */
export type Outbound = GetV2WebhooksSubscription$Outbound;
}
export function getV2WebhooksSubscriptionToJSON(
getV2WebhooksSubscription: GetV2WebhooksSubscription,
): string {
return JSON.stringify(
GetV2WebhooksSubscription$outboundSchema.parse(getV2WebhooksSubscription),
);
}
export function getV2WebhooksSubscriptionFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksSubscription, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksSubscription$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksSubscription' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksId$inboundSchema: z.ZodType<
GetV2WebhooksId,
z.ZodTypeDef,
unknown
> = z.object({
workspace_id: z.string(),
webhook_id: z.string(),
}).transform((v) => {
return remap$(v, {
"workspace_id": "workspaceId",
"webhook_id": "webhookId",
});
});
/** @internal */
export type GetV2WebhooksId$Outbound = {
workspace_id: string;
webhook_id: string;
};
/** @internal */
export const GetV2WebhooksId$outboundSchema: z.ZodType<
GetV2WebhooksId$Outbound,
z.ZodTypeDef,
GetV2WebhooksId
> = z.object({
workspaceId: z.string(),
webhookId: z.string(),
}).transform((v) => {
return remap$(v, {
workspaceId: "workspace_id",
webhookId: "webhook_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksId$ {
/** @deprecated use `GetV2WebhooksId$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksId$inboundSchema;
/** @deprecated use `GetV2WebhooksId$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksId$outboundSchema;
/** @deprecated use `GetV2WebhooksId$Outbound` instead. */
export type Outbound = GetV2WebhooksId$Outbound;
}
export function getV2WebhooksIdToJSON(
getV2WebhooksId: GetV2WebhooksId,
): string {
return JSON.stringify(GetV2WebhooksId$outboundSchema.parse(getV2WebhooksId));
}
export function getV2WebhooksIdFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksId, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksId$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksId' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksStatus$inboundSchema: z.ZodNativeEnum<
typeof GetV2WebhooksStatus
> = z.nativeEnum(GetV2WebhooksStatus);
/** @internal */
export const GetV2WebhooksStatus$outboundSchema: z.ZodNativeEnum<
typeof GetV2WebhooksStatus
> = GetV2WebhooksStatus$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksStatus$ {
/** @deprecated use `GetV2WebhooksStatus$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksStatus$inboundSchema;
/** @deprecated use `GetV2WebhooksStatus$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksStatus$outboundSchema;
}
/** @internal */
export const GetV2WebhooksData$inboundSchema: z.ZodType<
GetV2WebhooksData,
z.ZodTypeDef,
unknown
> = z.object({
target_url: z.string(),
subscriptions: z.array(z.lazy(() => GetV2WebhooksSubscription$inboundSchema)),
id: z.lazy(() => GetV2WebhooksId$inboundSchema),
status: GetV2WebhooksStatus$inboundSchema,
created_at: z.string(),
}).transform((v) => {
return remap$(v, {
"target_url": "targetUrl",
"created_at": "createdAt",
});
});
/** @internal */
export type GetV2WebhooksData$Outbound = {
target_url: string;
subscriptions: Array<GetV2WebhooksSubscription$Outbound>;
id: GetV2WebhooksId$Outbound;
status: string;
created_at: string;
};
/** @internal */
export const GetV2WebhooksData$outboundSchema: z.ZodType<
GetV2WebhooksData$Outbound,
z.ZodTypeDef,
GetV2WebhooksData
> = z.object({
targetUrl: z.string(),
subscriptions: z.array(
z.lazy(() => GetV2WebhooksSubscription$outboundSchema),
),
id: z.lazy(() => GetV2WebhooksId$outboundSchema),
status: GetV2WebhooksStatus$outboundSchema,
createdAt: z.string(),
}).transform((v) => {
return remap$(v, {
targetUrl: "target_url",
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 namespace GetV2WebhooksData$ {
/** @deprecated use `GetV2WebhooksData$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksData$inboundSchema;
/** @deprecated use `GetV2WebhooksData$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksData$outboundSchema;
/** @deprecated use `GetV2WebhooksData$Outbound` instead. */
export type Outbound = GetV2WebhooksData$Outbound;
}
export function getV2WebhooksDataToJSON(
getV2WebhooksData: GetV2WebhooksData,
): string {
return JSON.stringify(
GetV2WebhooksData$outboundSchema.parse(getV2WebhooksData),
);
}
export function getV2WebhooksDataFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksData, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksData$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksData' from JSON`,
);
}
/** @internal */
export const GetV2WebhooksResponse$inboundSchema: z.ZodType<
GetV2WebhooksResponse,
z.ZodTypeDef,
unknown
> = z.object({
data: z.array(z.lazy(() => GetV2WebhooksData$inboundSchema)),
});
/** @internal */
export type GetV2WebhooksResponse$Outbound = {
data: Array<GetV2WebhooksData$Outbound>;
};
/** @internal */
export const GetV2WebhooksResponse$outboundSchema: z.ZodType<
GetV2WebhooksResponse$Outbound,
z.ZodTypeDef,
GetV2WebhooksResponse
> = z.object({
data: z.array(z.lazy(() => GetV2WebhooksData$outboundSchema)),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2WebhooksResponse$ {
/** @deprecated use `GetV2WebhooksResponse$inboundSchema` instead. */
export const inboundSchema = GetV2WebhooksResponse$inboundSchema;
/** @deprecated use `GetV2WebhooksResponse$outboundSchema` instead. */
export const outboundSchema = GetV2WebhooksResponse$outboundSchema;
/** @deprecated use `GetV2WebhooksResponse$Outbound` instead. */
export type Outbound = GetV2WebhooksResponse$Outbound;
}
export function getV2WebhooksResponseToJSON(
getV2WebhooksResponse: GetV2WebhooksResponse,
): string {
return JSON.stringify(
GetV2WebhooksResponse$outboundSchema.parse(getV2WebhooksResponse),
);
}
export function getV2WebhooksResponseFromJSON(
jsonString: string,
): SafeParseResult<GetV2WebhooksResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2WebhooksResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2WebhooksResponse' from JSON`,
);
}