@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
142 lines (132 loc) • 3.76 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as types from "../../types/primitives.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* Change the agreement type to a different configured type.
*
* @remarks
* Only present when the agreement type is mutable.
*/
export type AgreementActionsChangeType = {
/**
* The URL for the change-type action.
*/
href?: string | undefined;
/**
* The HTTP method for the action.
*/
method?: string | undefined;
/**
* Human-readable description of the action.
*/
description?: string | undefined;
};
/**
* Available actions on the agreement. Actions are conditionally present based on the current state of the resource.
*
* @remarks
*/
export type AgreementActions = {
/**
* Change the agreement type to a different configured type.
*
* @remarks
* Only present when the agreement type is mutable.
*/
changeType?: AgreementActionsChangeType | undefined;
};
/** @internal */
export const AgreementActionsChangeType$inboundSchema: z.ZodType<
AgreementActionsChangeType,
z.ZodTypeDef,
unknown
> = z.object({
href: types.optional(types.string()),
method: types.optional(types.string()),
description: types.optional(types.string()),
});
/** @internal */
export type AgreementActionsChangeType$Outbound = {
href?: string | undefined;
method?: string | undefined;
description?: string | undefined;
};
/** @internal */
export const AgreementActionsChangeType$outboundSchema: z.ZodType<
AgreementActionsChangeType$Outbound,
z.ZodTypeDef,
AgreementActionsChangeType
> = z.object({
href: z.string().optional(),
method: z.string().optional(),
description: z.string().optional(),
});
export function agreementActionsChangeTypeToJSON(
agreementActionsChangeType: AgreementActionsChangeType,
): string {
return JSON.stringify(
AgreementActionsChangeType$outboundSchema.parse(agreementActionsChangeType),
);
}
export function agreementActionsChangeTypeFromJSON(
jsonString: string,
): SafeParseResult<AgreementActionsChangeType, SDKValidationError> {
return safeParse(
jsonString,
(x) => AgreementActionsChangeType$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AgreementActionsChangeType' from JSON`,
);
}
/** @internal */
export const AgreementActions$inboundSchema: z.ZodType<
AgreementActions,
z.ZodTypeDef,
unknown
> = z.object({
change_type: types.optional(
z.lazy(() => AgreementActionsChangeType$inboundSchema),
),
}).transform((v) => {
return remap$(v, {
"change_type": "changeType",
});
});
/** @internal */
export type AgreementActions$Outbound = {
change_type?: AgreementActionsChangeType$Outbound | undefined;
};
/** @internal */
export const AgreementActions$outboundSchema: z.ZodType<
AgreementActions$Outbound,
z.ZodTypeDef,
AgreementActions
> = z.object({
changeType: z.lazy(() => AgreementActionsChangeType$outboundSchema)
.optional(),
}).transform((v) => {
return remap$(v, {
changeType: "change_type",
});
});
export function agreementActionsToJSON(
agreementActions: AgreementActions,
): string {
return JSON.stringify(
AgreementActions$outboundSchema.parse(agreementActions),
);
}
export function agreementActionsFromJSON(
jsonString: string,
): SafeParseResult<AgreementActions, SDKValidationError> {
return safeParse(
jsonString,
(x) => AgreementActions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AgreementActions' from JSON`,
);
}