CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/schema/accounts/profile.ts
Views: 688
1
import { z } from "../../framework";
2
3
import { FailedAPIOperationSchema } from "../common";
4
5
import { AccountIdSchema } from "./common";
6
import { RequestNoCacheSchema } from "../common";
7
8
// OpenAPI spec
9
//
10
export const AccountProfileInputSchema = z
11
.object({
12
account_id: AccountIdSchema.optional(),
13
noCache: RequestNoCacheSchema.optional(),
14
})
15
.describe(
16
`Get the *public* profile for a given account or the private profile of the user
17
making the request. This is public information if user the user knows the account_id.
18
It is the color, the name, and the image.`,
19
);
20
21
export const AccountProfileOutputSchema = z.union([
22
FailedAPIOperationSchema,
23
z.object({
24
profile: z
25
.object({
26
account_id: AccountIdSchema,
27
first_name: z.string().describe("First name of account holder."),
28
last_name: z.string().describe("Last name of account holder."),
29
image: z
30
.string()
31
.describe(
32
`Account avatar image. This value may be used directly in the \`src\`
33
attribute of an HTML \`image\` tag`,
34
)
35
.optional(),
36
color: z
37
.string()
38
.describe(
39
`Background color for account avatar if an image is not provided.`,
40
)
41
.optional(),
42
name: z
43
.union([z.string().describe("Account username"), z.null()])
44
.describe(
45
`Account username. This is used to provide a nice URL for public content
46
associated with this account.`,
47
),
48
is_admin: z
49
.boolean()
50
.describe("_Included when the full profile is returned.")
51
.optional(),
52
is_partner: z
53
.boolean()
54
.describe("_Included when the full profile is returned.")
55
.optional(),
56
is_anonymous: z
57
.boolean()
58
.describe("_Included when the full profile is returned.")
59
.optional(),
60
email_address: z.string().describe("The account e-mail address."),
61
})
62
.describe("An object containing account profile information."),
63
}),
64
]);
65
66
export type AccountProfileInput = z.infer<typeof AccountProfileInputSchema>;
67
export type AccountProfileOutput = z.infer<typeof AccountProfileOutputSchema>;
68
69