@olyzon/sdk 0.0.0-stage → 0.1.0-stg.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -2
- package/dist/client.d.ts +62 -0
- package/dist/client.js +104 -0
- package/dist/core/config.d.ts +153 -0
- package/dist/core/config.js +368 -0
- package/dist/core/contracts.d.ts +52 -0
- package/dist/core/contracts.js +12 -0
- package/dist/core/dpop.d.ts +39 -0
- package/dist/core/dpop.js +63 -0
- package/dist/core/errors.d.ts +34 -0
- package/dist/core/errors.js +43 -0
- package/dist/core/session.d.ts +82 -0
- package/dist/core/session.js +170 -0
- package/dist/core/transport.d.ts +38 -0
- package/dist/core/transport.js +84 -0
- package/dist/generated/index.d.ts +24 -0
- package/dist/generated/index.js +20 -0
- package/dist/generated/manifest.json +13 -0
- package/dist/generated/projects/client/client.gen.d.ts +2 -0
- package/dist/generated/projects/client/client.gen.js +216 -0
- package/dist/generated/projects/client/index.d.ts +10 -0
- package/dist/generated/projects/client/index.js +6 -0
- package/dist/generated/projects/client/types.gen.d.ts +120 -0
- package/dist/generated/projects/client/types.gen.js +2 -0
- package/dist/generated/projects/client/utils.gen.d.ts +37 -0
- package/dist/generated/projects/client/utils.gen.js +228 -0
- package/dist/generated/projects/client.gen.d.ts +12 -0
- package/dist/generated/projects/client.gen.js +3 -0
- package/dist/generated/projects/core/auth.gen.d.ts +25 -0
- package/dist/generated/projects/core/auth.gen.js +14 -0
- package/dist/generated/projects/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/projects/core/bodySerializer.gen.js +57 -0
- package/dist/generated/projects/core/params.gen.d.ts +43 -0
- package/dist/generated/projects/core/params.gen.js +109 -0
- package/dist/generated/projects/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/projects/core/pathSerializer.gen.js +106 -0
- package/dist/generated/projects/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/projects/core/queryKeySerializer.gen.js +92 -0
- package/dist/generated/projects/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/projects/core/serverSentEvents.gen.js +132 -0
- package/dist/generated/projects/core/types.gen.d.ts +83 -0
- package/dist/generated/projects/core/types.gen.js +2 -0
- package/dist/generated/projects/core/utils.gen.d.ts +19 -0
- package/dist/generated/projects/core/utils.gen.js +87 -0
- package/dist/generated/projects/index.d.ts +2 -0
- package/dist/generated/projects/index.js +2 -0
- package/dist/generated/projects/sdk.gen.d.ts +47 -0
- package/dist/generated/projects/sdk.gen.js +55 -0
- package/dist/generated/projects/types.gen.d.ts +388 -0
- package/dist/generated/projects/types.gen.js +2 -0
- package/dist/generated/projects.d.ts +54 -0
- package/dist/generated/projects.js +58 -0
- package/dist/generated/specs/projects.json +872 -0
- package/dist/generated/specs/sts.json +942 -0
- package/dist/generated/sts/client/client.gen.d.ts +2 -0
- package/dist/generated/sts/client/client.gen.js +216 -0
- package/dist/generated/sts/client/index.d.ts +10 -0
- package/dist/generated/sts/client/index.js +6 -0
- package/dist/generated/sts/client/types.gen.d.ts +120 -0
- package/dist/generated/sts/client/types.gen.js +2 -0
- package/dist/generated/sts/client/utils.gen.d.ts +37 -0
- package/dist/generated/sts/client/utils.gen.js +228 -0
- package/dist/generated/sts/client.gen.d.ts +12 -0
- package/dist/generated/sts/client.gen.js +3 -0
- package/dist/generated/sts/core/auth.gen.d.ts +25 -0
- package/dist/generated/sts/core/auth.gen.js +14 -0
- package/dist/generated/sts/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/sts/core/bodySerializer.gen.js +57 -0
- package/dist/generated/sts/core/params.gen.d.ts +43 -0
- package/dist/generated/sts/core/params.gen.js +109 -0
- package/dist/generated/sts/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/sts/core/pathSerializer.gen.js +106 -0
- package/dist/generated/sts/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/sts/core/queryKeySerializer.gen.js +92 -0
- package/dist/generated/sts/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/sts/core/serverSentEvents.gen.js +132 -0
- package/dist/generated/sts/core/types.gen.d.ts +83 -0
- package/dist/generated/sts/core/types.gen.js +2 -0
- package/dist/generated/sts/core/utils.gen.d.ts +19 -0
- package/dist/generated/sts/core/utils.gen.js +87 -0
- package/dist/generated/sts/index.d.ts +2 -0
- package/dist/generated/sts/index.js +2 -0
- package/dist/generated/sts/sdk.gen.d.ts +41 -0
- package/dist/generated/sts/sdk.gen.js +44 -0
- package/dist/generated/sts/types.gen.d.ts +445 -0
- package/dist/generated/sts/types.gen.js +2 -0
- package/dist/generated/sts.d.ts +44 -0
- package/dist/generated/sts.js +49 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +13 -0
- package/package.json +43 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from './pathSerializer.gen.js';
|
|
3
|
+
export const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
4
|
+
export const defaultPathSerializer = ({ path, url: _url }) => {
|
|
5
|
+
let url = _url;
|
|
6
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
7
|
+
if (matches) {
|
|
8
|
+
for (const match of matches) {
|
|
9
|
+
let explode = false;
|
|
10
|
+
let name = match.substring(1, match.length - 1);
|
|
11
|
+
let style = 'simple';
|
|
12
|
+
if (name.endsWith('*')) {
|
|
13
|
+
explode = true;
|
|
14
|
+
name = name.substring(0, name.length - 1);
|
|
15
|
+
}
|
|
16
|
+
if (name.startsWith('.')) {
|
|
17
|
+
name = name.substring(1);
|
|
18
|
+
style = 'label';
|
|
19
|
+
}
|
|
20
|
+
else if (name.startsWith(';')) {
|
|
21
|
+
name = name.substring(1);
|
|
22
|
+
style = 'matrix';
|
|
23
|
+
}
|
|
24
|
+
const value = path[name];
|
|
25
|
+
if (value === undefined || value === null) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === 'object') {
|
|
33
|
+
url = url.replace(match, serializeObjectParam({
|
|
34
|
+
explode,
|
|
35
|
+
name,
|
|
36
|
+
style,
|
|
37
|
+
value: value,
|
|
38
|
+
valueOnly: true,
|
|
39
|
+
}));
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (style === 'matrix') {
|
|
43
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
44
|
+
name,
|
|
45
|
+
value: value,
|
|
46
|
+
})}`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
|
|
50
|
+
url = url.replace(match, replaceValue);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return url;
|
|
54
|
+
};
|
|
55
|
+
export const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
|
|
56
|
+
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
57
|
+
let url = (baseUrl ?? '') + pathUrl;
|
|
58
|
+
if (path) {
|
|
59
|
+
url = defaultPathSerializer({ path, url });
|
|
60
|
+
}
|
|
61
|
+
let search = query ? querySerializer(query) : '';
|
|
62
|
+
if (search.startsWith('?')) {
|
|
63
|
+
search = search.substring(1);
|
|
64
|
+
}
|
|
65
|
+
if (search) {
|
|
66
|
+
url += `?${search}`;
|
|
67
|
+
}
|
|
68
|
+
return url;
|
|
69
|
+
};
|
|
70
|
+
export function getValidRequestBody(options) {
|
|
71
|
+
const hasBody = options.body !== undefined;
|
|
72
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
73
|
+
if (isSerializedBody) {
|
|
74
|
+
if ('serializedBody' in options) {
|
|
75
|
+
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== '';
|
|
76
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
77
|
+
}
|
|
78
|
+
// not all clients implement a serializedBody property (i.e., client-axios)
|
|
79
|
+
return options.body !== '' ? options.body : null;
|
|
80
|
+
}
|
|
81
|
+
// plain/text body
|
|
82
|
+
if (hasBody) {
|
|
83
|
+
return options.body;
|
|
84
|
+
}
|
|
85
|
+
// no body was provided
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { archiveProject, createProject, getProject, listProjects, moveProject, type Options, restoreProject, updateProject } from './sdk.gen.ts';
|
|
2
|
+
export type { ArchiveProjectData, ArchiveProjectError, ArchiveProjectErrors, ArchiveProjectResponse, ArchiveProjectResponses, ClientOptions, CreateProjectData, CreateProjectError, CreateProjectErrors, CreateProjectResponse, CreateProjectResponses, Forbidden, GetProjectData, GetProjectError, GetProjectErrors, GetProjectResponse, GetProjectResponses, InvalidRequest, ListProjectsData, ListProjectsError, ListProjectsErrors, ListProjectsResponse, ListProjectsResponses, MoveProjectData, MoveProjectError, MoveProjectErrors, MoveProjectResponse, MoveProjectResponses, NewProject, NotFound, Project, ProjectChange, ProjectPlace, RestoreProjectData, RestoreProjectError, RestoreProjectErrors, RestoreProjectResponse, RestoreProjectResponses, ServerError, Unauthorized, UpdateProjectData, UpdateProjectError, UpdateProjectErrors, UpdateProjectResponse, UpdateProjectResponses } from './types.gen.ts';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client/index.ts';
|
|
2
|
+
import type { ArchiveProjectData, ArchiveProjectErrors, ArchiveProjectResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, GetProjectData, GetProjectErrors, GetProjectResponses, ListProjectsData, ListProjectsErrors, ListProjectsResponses, MoveProjectData, MoveProjectErrors, MoveProjectResponses, RestoreProjectData, RestoreProjectErrors, RestoreProjectResponses, UpdateProjectData, UpdateProjectErrors, UpdateProjectResponses } from './types.gen.ts';
|
|
3
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
4
|
+
/**
|
|
5
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
6
|
+
* individual options. This might be also useful if you want to implement a
|
|
7
|
+
* custom client.
|
|
8
|
+
*/
|
|
9
|
+
client?: Client;
|
|
10
|
+
/**
|
|
11
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
12
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
13
|
+
*/
|
|
14
|
+
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The caller's workspace's projects, as a flat list: build the tree from `parentId` and `rank`.
|
|
18
|
+
* With `archived=true`, the archived ones instead: those whose parent is live can be restored.
|
|
19
|
+
*/
|
|
20
|
+
export declare const listProjects: <ThrowOnError extends boolean = false>(options?: Options<ListProjectsData, ThrowOnError>) => RequestResult<ListProjectsResponses, ListProjectsErrors, ThrowOnError>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a project at the end of its parent's children, or the workspace's root.
|
|
23
|
+
*/
|
|
24
|
+
export declare const createProject: <ThrowOnError extends boolean = false>(options: Options<CreateProjectData, ThrowOnError>) => RequestResult<CreateProjectResponses, CreateProjectErrors, ThrowOnError>;
|
|
25
|
+
/**
|
|
26
|
+
* A project of the caller's workspace, archived or not (`archivedAt` says which).
|
|
27
|
+
*/
|
|
28
|
+
export declare const getProject: <ThrowOnError extends boolean = false>(options: Options<GetProjectData, ThrowOnError>) => RequestResult<GetProjectResponses, GetProjectErrors, ThrowOnError>;
|
|
29
|
+
/**
|
|
30
|
+
* Changes a project.
|
|
31
|
+
*/
|
|
32
|
+
export declare const updateProject: <ThrowOnError extends boolean = false>(options: Options<UpdateProjectData, ThrowOnError>) => RequestResult<UpdateProjectResponses, UpdateProjectErrors, ThrowOnError>;
|
|
33
|
+
/**
|
|
34
|
+
* Archives a project with its live descendants: the list leaves them out, and nothing is created or
|
|
35
|
+
* moved under them. The root is never archived.
|
|
36
|
+
*/
|
|
37
|
+
export declare const archiveProject: <ThrowOnError extends boolean = false>(options: Options<ArchiveProjectData, ThrowOnError>) => RequestResult<ArchiveProjectResponses, ArchiveProjectErrors, ThrowOnError>;
|
|
38
|
+
/**
|
|
39
|
+
* Moves a project, with its subtree, under `parentId` after `afterId`: also reorders it among its
|
|
40
|
+
* siblings. The root never moves, and nothing moves under itself or its descendants.
|
|
41
|
+
*/
|
|
42
|
+
export declare const moveProject: <ThrowOnError extends boolean = false>(options: Options<MoveProjectData, ThrowOnError>) => RequestResult<MoveProjectResponses, MoveProjectErrors, ThrowOnError>;
|
|
43
|
+
/**
|
|
44
|
+
* Restores an archived project with exactly what was archived with it, each in its old place. As
|
|
45
|
+
* in Notion, a project inside an archived ancestor comes back only with that ancestor.
|
|
46
|
+
*/
|
|
47
|
+
export declare const restoreProject: <ThrowOnError extends boolean = false>(options: Options<RestoreProjectData, ThrowOnError>) => RequestResult<RestoreProjectResponses, RestoreProjectErrors, ThrowOnError>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { client } from './client.gen.js';
|
|
3
|
+
/**
|
|
4
|
+
* The caller's workspace's projects, as a flat list: build the tree from `parentId` and `rank`.
|
|
5
|
+
* With `archived=true`, the archived ones instead: those whose parent is live can be restored.
|
|
6
|
+
*/
|
|
7
|
+
export const listProjects = (options) => (options?.client ?? client).get({ url: '/v1/projects', ...options });
|
|
8
|
+
/**
|
|
9
|
+
* Creates a project at the end of its parent's children, or the workspace's root.
|
|
10
|
+
*/
|
|
11
|
+
export const createProject = (options) => (options.client ?? client).post({
|
|
12
|
+
url: '/v1/projects',
|
|
13
|
+
...options,
|
|
14
|
+
headers: {
|
|
15
|
+
'Content-Type': 'application/json',
|
|
16
|
+
...options.headers
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* A project of the caller's workspace, archived or not (`archivedAt` says which).
|
|
21
|
+
*/
|
|
22
|
+
export const getProject = (options) => (options.client ?? client).get({ url: '/v1/projects/{id}', ...options });
|
|
23
|
+
/**
|
|
24
|
+
* Changes a project.
|
|
25
|
+
*/
|
|
26
|
+
export const updateProject = (options) => (options.client ?? client).patch({
|
|
27
|
+
url: '/v1/projects/{id}',
|
|
28
|
+
...options,
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
...options.headers
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Archives a project with its live descendants: the list leaves them out, and nothing is created or
|
|
36
|
+
* moved under them. The root is never archived.
|
|
37
|
+
*/
|
|
38
|
+
export const archiveProject = (options) => (options.client ?? client).post({ url: '/v1/projects/{id}/archive', ...options });
|
|
39
|
+
/**
|
|
40
|
+
* Moves a project, with its subtree, under `parentId` after `afterId`: also reorders it among its
|
|
41
|
+
* siblings. The root never moves, and nothing moves under itself or its descendants.
|
|
42
|
+
*/
|
|
43
|
+
export const moveProject = (options) => (options.client ?? client).post({
|
|
44
|
+
url: '/v1/projects/{id}/move',
|
|
45
|
+
...options,
|
|
46
|
+
headers: {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
...options.headers
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Restores an archived project with exactly what was archived with it, each in its old place. As
|
|
53
|
+
* in Notion, a project inside an archived ancestor comes back only with that ancestor.
|
|
54
|
+
*/
|
|
55
|
+
export const restoreProject = (options) => (options.client ?? client).post({ url: '/v1/projects/{id}/restore', ...options });
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
export type ClientOptions = {
|
|
2
|
+
baseUrl: `${string}://specs` | (string & {});
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* The session may not perform this action (Cedar).
|
|
6
|
+
*/
|
|
7
|
+
export type Forbidden = {
|
|
8
|
+
/**
|
|
9
|
+
* Machine-readable error code.
|
|
10
|
+
*/
|
|
11
|
+
error: 'forbidden';
|
|
12
|
+
/**
|
|
13
|
+
* What went wrong, for people. Never contains internal details.
|
|
14
|
+
*/
|
|
15
|
+
error_description: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The request does not match the operation's input: every invalid field is named.
|
|
19
|
+
*/
|
|
20
|
+
export type InvalidRequest = {
|
|
21
|
+
/**
|
|
22
|
+
* Machine-readable error code.
|
|
23
|
+
*/
|
|
24
|
+
error: 'invalid_request';
|
|
25
|
+
/**
|
|
26
|
+
* What went wrong, for people. Never contains internal details.
|
|
27
|
+
*/
|
|
28
|
+
error_description: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A project to create.
|
|
32
|
+
*/
|
|
33
|
+
export type NewProject = {
|
|
34
|
+
name: string;
|
|
35
|
+
/**
|
|
36
|
+
* Its parent, in the caller's workspace. Null creates the workspace's root project, or returns it
|
|
37
|
+
* when it exists already.
|
|
38
|
+
*/
|
|
39
|
+
parentId: string | null;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
43
|
+
*/
|
|
44
|
+
export type NotFound = {
|
|
45
|
+
/**
|
|
46
|
+
* Machine-readable error code.
|
|
47
|
+
*/
|
|
48
|
+
error: 'not_found';
|
|
49
|
+
/**
|
|
50
|
+
* What went wrong, for people. Never contains internal details.
|
|
51
|
+
*/
|
|
52
|
+
error_description: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* A project: one node of its workspace's tree. A project is also what the app calls a page.
|
|
56
|
+
*/
|
|
57
|
+
export type Project = {
|
|
58
|
+
/**
|
|
59
|
+
* `prj_` and a UUID.
|
|
60
|
+
*/
|
|
61
|
+
id: string;
|
|
62
|
+
/**
|
|
63
|
+
* The workspace (Clerk org) it belongs to.
|
|
64
|
+
*/
|
|
65
|
+
org: string;
|
|
66
|
+
/**
|
|
67
|
+
* Its parent; null only for the workspace's root project.
|
|
68
|
+
*/
|
|
69
|
+
parentId: string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Its position among its siblings: sort siblings by it. Computed by the service.
|
|
72
|
+
*/
|
|
73
|
+
rank: string;
|
|
74
|
+
name: string;
|
|
75
|
+
/**
|
|
76
|
+
* Who created it: the `sub` of their session.
|
|
77
|
+
*/
|
|
78
|
+
createdBy: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
/**
|
|
82
|
+
* Set while it, or an ancestor, is archived.
|
|
83
|
+
*/
|
|
84
|
+
archivedAt?: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* A change to a project's fields. Moving it is `moveProject`.
|
|
88
|
+
*/
|
|
89
|
+
export type ProjectChange = {
|
|
90
|
+
name?: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Where to move a project.
|
|
94
|
+
*/
|
|
95
|
+
export type ProjectPlace = {
|
|
96
|
+
/**
|
|
97
|
+
* Its new parent, in the caller's workspace: its current one to reorder it.
|
|
98
|
+
*/
|
|
99
|
+
parentId: string;
|
|
100
|
+
/**
|
|
101
|
+
* The child of `parentId` to place it after; null places it first.
|
|
102
|
+
*/
|
|
103
|
+
afterId: string | null;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
107
|
+
*/
|
|
108
|
+
export type ServerError = {
|
|
109
|
+
/**
|
|
110
|
+
* Machine-readable error code.
|
|
111
|
+
*/
|
|
112
|
+
error: 'server_error';
|
|
113
|
+
/**
|
|
114
|
+
* What went wrong, for people. Never contains internal details.
|
|
115
|
+
*/
|
|
116
|
+
error_description: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
120
|
+
*/
|
|
121
|
+
export type Unauthorized = {
|
|
122
|
+
/**
|
|
123
|
+
* Machine-readable error code.
|
|
124
|
+
*/
|
|
125
|
+
error: 'invalid_token' | 'invalid_dpop_proof';
|
|
126
|
+
/**
|
|
127
|
+
* What went wrong, for people. Never contains internal details.
|
|
128
|
+
*/
|
|
129
|
+
error_description: string;
|
|
130
|
+
};
|
|
131
|
+
export type ListProjectsData = {
|
|
132
|
+
body?: never;
|
|
133
|
+
path?: never;
|
|
134
|
+
query?: {
|
|
135
|
+
archived?: boolean;
|
|
136
|
+
};
|
|
137
|
+
url: '/v1/projects';
|
|
138
|
+
};
|
|
139
|
+
export type ListProjectsErrors = {
|
|
140
|
+
/**
|
|
141
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
142
|
+
*/
|
|
143
|
+
401: Unauthorized;
|
|
144
|
+
/**
|
|
145
|
+
* The session may not perform this action (Cedar).
|
|
146
|
+
*/
|
|
147
|
+
403: Forbidden;
|
|
148
|
+
/**
|
|
149
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
150
|
+
*/
|
|
151
|
+
404: NotFound;
|
|
152
|
+
/**
|
|
153
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
154
|
+
*/
|
|
155
|
+
500: ServerError;
|
|
156
|
+
};
|
|
157
|
+
export type ListProjectsError = ListProjectsErrors[keyof ListProjectsErrors];
|
|
158
|
+
export type ListProjectsResponses = {
|
|
159
|
+
/**
|
|
160
|
+
* The request has succeeded.
|
|
161
|
+
*/
|
|
162
|
+
200: {
|
|
163
|
+
projects: Array<Project>;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
export type ListProjectsResponse = ListProjectsResponses[keyof ListProjectsResponses];
|
|
167
|
+
export type CreateProjectData = {
|
|
168
|
+
body: NewProject;
|
|
169
|
+
path?: never;
|
|
170
|
+
query?: never;
|
|
171
|
+
url: '/v1/projects';
|
|
172
|
+
};
|
|
173
|
+
export type CreateProjectErrors = {
|
|
174
|
+
/**
|
|
175
|
+
* The request does not match the operation's input: every invalid field is named.
|
|
176
|
+
*/
|
|
177
|
+
400: InvalidRequest;
|
|
178
|
+
/**
|
|
179
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
180
|
+
*/
|
|
181
|
+
401: Unauthorized;
|
|
182
|
+
/**
|
|
183
|
+
* The session may not perform this action (Cedar).
|
|
184
|
+
*/
|
|
185
|
+
403: Forbidden;
|
|
186
|
+
/**
|
|
187
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
188
|
+
*/
|
|
189
|
+
404: NotFound;
|
|
190
|
+
/**
|
|
191
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
192
|
+
*/
|
|
193
|
+
500: ServerError;
|
|
194
|
+
};
|
|
195
|
+
export type CreateProjectError = CreateProjectErrors[keyof CreateProjectErrors];
|
|
196
|
+
export type CreateProjectResponses = {
|
|
197
|
+
/**
|
|
198
|
+
* The request has succeeded and a new resource has been created as a result.
|
|
199
|
+
*/
|
|
200
|
+
201: Project;
|
|
201
|
+
};
|
|
202
|
+
export type CreateProjectResponse = CreateProjectResponses[keyof CreateProjectResponses];
|
|
203
|
+
export type GetProjectData = {
|
|
204
|
+
body?: never;
|
|
205
|
+
path: {
|
|
206
|
+
id: string;
|
|
207
|
+
};
|
|
208
|
+
query?: never;
|
|
209
|
+
url: '/v1/projects/{id}';
|
|
210
|
+
};
|
|
211
|
+
export type GetProjectErrors = {
|
|
212
|
+
/**
|
|
213
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
214
|
+
*/
|
|
215
|
+
401: Unauthorized;
|
|
216
|
+
/**
|
|
217
|
+
* The session may not perform this action (Cedar).
|
|
218
|
+
*/
|
|
219
|
+
403: Forbidden;
|
|
220
|
+
/**
|
|
221
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
222
|
+
*/
|
|
223
|
+
404: NotFound;
|
|
224
|
+
/**
|
|
225
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
226
|
+
*/
|
|
227
|
+
500: ServerError;
|
|
228
|
+
};
|
|
229
|
+
export type GetProjectError = GetProjectErrors[keyof GetProjectErrors];
|
|
230
|
+
export type GetProjectResponses = {
|
|
231
|
+
/**
|
|
232
|
+
* The request has succeeded.
|
|
233
|
+
*/
|
|
234
|
+
200: Project;
|
|
235
|
+
};
|
|
236
|
+
export type GetProjectResponse = GetProjectResponses[keyof GetProjectResponses];
|
|
237
|
+
export type UpdateProjectData = {
|
|
238
|
+
body: ProjectChange;
|
|
239
|
+
path: {
|
|
240
|
+
id: string;
|
|
241
|
+
};
|
|
242
|
+
query?: never;
|
|
243
|
+
url: '/v1/projects/{id}';
|
|
244
|
+
};
|
|
245
|
+
export type UpdateProjectErrors = {
|
|
246
|
+
/**
|
|
247
|
+
* The request does not match the operation's input: every invalid field is named.
|
|
248
|
+
*/
|
|
249
|
+
400: InvalidRequest;
|
|
250
|
+
/**
|
|
251
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
252
|
+
*/
|
|
253
|
+
401: Unauthorized;
|
|
254
|
+
/**
|
|
255
|
+
* The session may not perform this action (Cedar).
|
|
256
|
+
*/
|
|
257
|
+
403: Forbidden;
|
|
258
|
+
/**
|
|
259
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
260
|
+
*/
|
|
261
|
+
404: NotFound;
|
|
262
|
+
/**
|
|
263
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
264
|
+
*/
|
|
265
|
+
500: ServerError;
|
|
266
|
+
};
|
|
267
|
+
export type UpdateProjectError = UpdateProjectErrors[keyof UpdateProjectErrors];
|
|
268
|
+
export type UpdateProjectResponses = {
|
|
269
|
+
/**
|
|
270
|
+
* The request has succeeded.
|
|
271
|
+
*/
|
|
272
|
+
200: Project;
|
|
273
|
+
};
|
|
274
|
+
export type UpdateProjectResponse = UpdateProjectResponses[keyof UpdateProjectResponses];
|
|
275
|
+
export type ArchiveProjectData = {
|
|
276
|
+
body?: never;
|
|
277
|
+
path: {
|
|
278
|
+
id: string;
|
|
279
|
+
};
|
|
280
|
+
query?: never;
|
|
281
|
+
url: '/v1/projects/{id}/archive';
|
|
282
|
+
};
|
|
283
|
+
export type ArchiveProjectErrors = {
|
|
284
|
+
/**
|
|
285
|
+
* The request does not match the operation's input: every invalid field is named.
|
|
286
|
+
*/
|
|
287
|
+
400: InvalidRequest;
|
|
288
|
+
/**
|
|
289
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
290
|
+
*/
|
|
291
|
+
401: Unauthorized;
|
|
292
|
+
/**
|
|
293
|
+
* The session may not perform this action (Cedar).
|
|
294
|
+
*/
|
|
295
|
+
403: Forbidden;
|
|
296
|
+
/**
|
|
297
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
298
|
+
*/
|
|
299
|
+
404: NotFound;
|
|
300
|
+
/**
|
|
301
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
302
|
+
*/
|
|
303
|
+
500: ServerError;
|
|
304
|
+
};
|
|
305
|
+
export type ArchiveProjectError = ArchiveProjectErrors[keyof ArchiveProjectErrors];
|
|
306
|
+
export type ArchiveProjectResponses = {
|
|
307
|
+
/**
|
|
308
|
+
* The request has succeeded.
|
|
309
|
+
*/
|
|
310
|
+
200: Project;
|
|
311
|
+
};
|
|
312
|
+
export type ArchiveProjectResponse = ArchiveProjectResponses[keyof ArchiveProjectResponses];
|
|
313
|
+
export type MoveProjectData = {
|
|
314
|
+
body: ProjectPlace;
|
|
315
|
+
path: {
|
|
316
|
+
id: string;
|
|
317
|
+
};
|
|
318
|
+
query?: never;
|
|
319
|
+
url: '/v1/projects/{id}/move';
|
|
320
|
+
};
|
|
321
|
+
export type MoveProjectErrors = {
|
|
322
|
+
/**
|
|
323
|
+
* The request does not match the operation's input: every invalid field is named.
|
|
324
|
+
*/
|
|
325
|
+
400: InvalidRequest;
|
|
326
|
+
/**
|
|
327
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
328
|
+
*/
|
|
329
|
+
401: Unauthorized;
|
|
330
|
+
/**
|
|
331
|
+
* The session may not perform this action (Cedar).
|
|
332
|
+
*/
|
|
333
|
+
403: Forbidden;
|
|
334
|
+
/**
|
|
335
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
336
|
+
*/
|
|
337
|
+
404: NotFound;
|
|
338
|
+
/**
|
|
339
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
340
|
+
*/
|
|
341
|
+
500: ServerError;
|
|
342
|
+
};
|
|
343
|
+
export type MoveProjectError = MoveProjectErrors[keyof MoveProjectErrors];
|
|
344
|
+
export type MoveProjectResponses = {
|
|
345
|
+
/**
|
|
346
|
+
* The request has succeeded.
|
|
347
|
+
*/
|
|
348
|
+
200: Project;
|
|
349
|
+
};
|
|
350
|
+
export type MoveProjectResponse = MoveProjectResponses[keyof MoveProjectResponses];
|
|
351
|
+
export type RestoreProjectData = {
|
|
352
|
+
body?: never;
|
|
353
|
+
path: {
|
|
354
|
+
id: string;
|
|
355
|
+
};
|
|
356
|
+
query?: never;
|
|
357
|
+
url: '/v1/projects/{id}/restore';
|
|
358
|
+
};
|
|
359
|
+
export type RestoreProjectErrors = {
|
|
360
|
+
/**
|
|
361
|
+
* The request does not match the operation's input: every invalid field is named.
|
|
362
|
+
*/
|
|
363
|
+
400: InvalidRequest;
|
|
364
|
+
/**
|
|
365
|
+
* Missing, invalid or expired session, or a proof that does not match this request.
|
|
366
|
+
*/
|
|
367
|
+
401: Unauthorized;
|
|
368
|
+
/**
|
|
369
|
+
* The session may not perform this action (Cedar).
|
|
370
|
+
*/
|
|
371
|
+
403: Forbidden;
|
|
372
|
+
/**
|
|
373
|
+
* No such resource or route, or a resource the session's org cannot see.
|
|
374
|
+
*/
|
|
375
|
+
404: NotFound;
|
|
376
|
+
/**
|
|
377
|
+
* Unexpected failure: logged by the service, answered without details.
|
|
378
|
+
*/
|
|
379
|
+
500: ServerError;
|
|
380
|
+
};
|
|
381
|
+
export type RestoreProjectError = RestoreProjectErrors[keyof RestoreProjectErrors];
|
|
382
|
+
export type RestoreProjectResponses = {
|
|
383
|
+
/**
|
|
384
|
+
* The request has succeeded.
|
|
385
|
+
*/
|
|
386
|
+
200: Project;
|
|
387
|
+
};
|
|
388
|
+
export type RestoreProjectResponse = RestoreProjectResponses[keyof RestoreProjectResponses];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** The Olyzon Projects API (`projects`). */
|
|
2
|
+
import { type Input, type Transport } from "../core/transport.ts";
|
|
3
|
+
import type * as types from "./projects/types.gen.ts";
|
|
4
|
+
export type * from "./projects/types.gen.ts";
|
|
5
|
+
/** The Olyzon Projects API, each call sent through `transport` (signed, its errors `ServiceError`s). */
|
|
6
|
+
export declare function createProjectsApi(transport: Transport): {
|
|
7
|
+
/**
|
|
8
|
+
* The caller's workspace's projects, as a flat list: build the tree from `parentId` and `rank`.
|
|
9
|
+
* With `archived=true`, the archived ones instead: those whose parent is live can be restored.
|
|
10
|
+
*
|
|
11
|
+
* `GET /v1/projects`
|
|
12
|
+
*/
|
|
13
|
+
listProjects: (input?: Input<types.ListProjectsData>) => Promise<types.ListProjectsResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a project at the end of its parent's children, or the workspace's root.
|
|
16
|
+
*
|
|
17
|
+
* `POST /v1/projects`
|
|
18
|
+
*/
|
|
19
|
+
createProject: (input: Input<types.CreateProjectData>) => Promise<types.CreateProjectResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* A project of the caller's workspace, archived or not (`archivedAt` says which).
|
|
22
|
+
*
|
|
23
|
+
* `GET /v1/projects/{id}`
|
|
24
|
+
*/
|
|
25
|
+
getProject: (input: Input<types.GetProjectData>) => Promise<types.GetProjectResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Changes a project.
|
|
28
|
+
*
|
|
29
|
+
* `PATCH /v1/projects/{id}`
|
|
30
|
+
*/
|
|
31
|
+
updateProject: (input: Input<types.UpdateProjectData>) => Promise<types.UpdateProjectResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Archives a project with its live descendants: the list leaves them out, and nothing is created or
|
|
34
|
+
* moved under them. The root is never archived.
|
|
35
|
+
*
|
|
36
|
+
* `POST /v1/projects/{id}/archive`
|
|
37
|
+
*/
|
|
38
|
+
archiveProject: (input: Input<types.ArchiveProjectData>) => Promise<types.ArchiveProjectResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Moves a project, with its subtree, under `parentId` after `afterId`: also reorders it among its
|
|
41
|
+
* siblings. The root never moves, and nothing moves under itself or its descendants.
|
|
42
|
+
*
|
|
43
|
+
* `POST /v1/projects/{id}/move`
|
|
44
|
+
*/
|
|
45
|
+
moveProject: (input: Input<types.MoveProjectData>) => Promise<types.MoveProjectResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Restores an archived project with exactly what was archived with it, each in its old place. As
|
|
48
|
+
* in Notion, a project inside an archived ancestor comes back only with that ancestor.
|
|
49
|
+
*
|
|
50
|
+
* `POST /v1/projects/{id}/restore`
|
|
51
|
+
*/
|
|
52
|
+
restoreProject: (input: Input<types.RestoreProjectData>) => Promise<types.RestoreProjectResponse>;
|
|
53
|
+
};
|
|
54
|
+
export type ProjectsApi = ReturnType<typeof createProjectsApi>;
|