@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
52 lines (46 loc) • 1.6 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
export type V2KeysAddRolesRequestBody = {
/**
* Specifies which key receives the additional roles using the database identifier returned from `createKey`.
*
* @remarks
* Do not confuse this with the actual API key string that users include in requests.
* Added roles supplement existing roles and permissions without replacing them.
* Role assignments take effect immediately but may take up to 30 seconds to propagate across all regions.
*/
keyId: string;
/**
* Assigns additional roles to the key through direct assignment to existing workspace roles.
*
* @remarks
* Operations are idempotent - adding existing roles has no effect and causes no errors.
*
* All roles must already exist in the workspace - roles cannot be created automatically.
* Invalid roles cause the entire operation to fail atomically, ensuring consistent state.
*/
roles: Array<string>;
};
/** @internal */
export type V2KeysAddRolesRequestBody$Outbound = {
keyId: string;
roles: Array<string>;
};
/** @internal */
export const V2KeysAddRolesRequestBody$outboundSchema: z.ZodType<
V2KeysAddRolesRequestBody$Outbound,
z.ZodTypeDef,
V2KeysAddRolesRequestBody
> = z.object({
keyId: z.string(),
roles: z.array(z.string()),
});
export function v2KeysAddRolesRequestBodyToJSON(
v2KeysAddRolesRequestBody: V2KeysAddRolesRequestBody,
): string {
return JSON.stringify(
V2KeysAddRolesRequestBody$outboundSchema.parse(v2KeysAddRolesRequestBody),
);
}