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/search.ts
Views: 688
1
import { z } from "../../framework";
2
3
import { FailedAPIOperationSchema } from "../common";
4
import { AccountUserSchema } from "./common";
5
6
// OpenAPI spec
7
//
8
export const AccountSearchInputSchema = z
9
.object({
10
query: z.string()
11
.describe(`Comma- or space-delimited list of account e-mail addresses, account ids,
12
and/or first/last names to query for an account by.`),
13
})
14
.describe(
15
`Search for accounts matching a given query. If user is signed in, then their
16
account id is used to prioritize the search.`,
17
);
18
19
export const AccountSearchOutputSchema = z.union([
20
FailedAPIOperationSchema,
21
z
22
.array(AccountUserSchema)
23
.describe(
24
"List of matching accounts, sorted by last active and/or account creation date.",
25
),
26
]);
27
28
export type AccountSearchInput = z.infer<typeof AccountSearchInputSchema>;
29
export type AccountSearchOutput = z.infer<typeof AccountSearchOutputSchema>;
30
31