Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/schema/accounts/set-name.ts
1451 views
1
import { z } from "../../framework";
2
3
import {
4
FailedAPIOperationSchema,
5
SuccessfulAPIOperationSchema,
6
} from "../common";
7
8
import { AccountIdSchema } from "./common";
9
10
// OpenAPI spec
11
//
12
export const SetAccountNameInputSchema = z
13
.object({
14
account_id: AccountIdSchema.optional().describe(
15
`**Administrators only**. Optional account id to set name(s) for. If this field is
16
not provided, it is assumed that this operation pertains to the account id of the
17
user making the request.`,
18
),
19
username: z.string().describe("Unique username.").optional(),
20
first_name: z.string().max(254).describe("First name").optional(),
21
last_name: z.string().max(254).describe("Last name").optional(),
22
})
23
.describe(
24
`Set the username, first name, and/or last name for a user account. Only non-empty
25
field values are allowed; everything else will be omitted from the update query.`,
26
);
27
28
export const SetAccountNameOutputSchema = z.union([
29
FailedAPIOperationSchema,
30
SuccessfulAPIOperationSchema,
31
]);
32
33
export type SetAccountNameInput = z.infer<typeof SetAccountNameInputSchema>;
34
export type SetAccountNameOutput = z.infer<typeof SetAccountNameOutputSchema>;
35
36