@livespace/api 0.0.0-stage → 0.1.0

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.
@@ -0,0 +1,4 @@
1
+ // Generated by scripts/build-definition.mjs from v2's OpenAPI file (Livespace API 2.0.0).
2
+ // Don't edit: change spec/overrides.json or the generator, and run it again.
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/generated/types.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,6EAA6E"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `@livespace/api`: the User API's definition, generated from v2's OpenAPI file. The types, the
3
+ * operation table, the typed façade over an `invoke` of your own, and the pure translation
4
+ * between a call and HTTP. No transport: the caller adds the address, credentials and `fetch`
5
+ * (ADR 0011).
6
+ */
7
+ export { buildUserApi, type UserApiCall } from "./build-facade.js";
8
+ export type * from "./generated/facade.js";
9
+ export { USER_API_OPERATIONS, USER_API_SCOPES, USER_API_VERSION, type UserApiOperation, type UserApiOperationKey, type UserApiScope, } from "./generated/operations.js";
10
+ export type * as UserApiTypes from "./generated/types.js";
11
+ export type { UserApiCallOptions } from "./options.js";
12
+ export { API_RESPONSE_HEADERS, type ApiProblem, type ApiQueryValue, type ApiResponseHeaders, type DescribedRequest, type HeaderSource, type UserApiRefusal, type UserApiRequest, type UserApiResponse, checkRequest, describeRequest, readResponse, toRequest, } from "./translate.js";
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `@livespace/api`: the User API's definition, generated from v2's OpenAPI file. The types, the
3
+ * operation table, the typed façade over an `invoke` of your own, and the pure translation
4
+ * between a call and HTTP. No transport: the caller adds the address, credentials and `fetch`
5
+ * (ADR 0011).
6
+ */
7
+ export { buildUserApi } from "./build-facade.js";
8
+ export { USER_API_OPERATIONS, USER_API_SCOPES, USER_API_VERSION, } from "./generated/operations.js";
9
+ export { API_RESPONSE_HEADERS, checkRequest, describeRequest, readResponse, toRequest, } from "./translate.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAoB,MAAM,mBAAmB,CAAA;AAElE,OAAO,EACN,mBAAmB,EACnB,eAAe,EACf,gBAAgB,GAIhB,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EACN,oBAAoB,EASpB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,SAAS,GACT,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,5 @@
1
+ /** Options every API façade method takes, after its own arguments. */
2
+ export type UserApiCallOptions = {
3
+ /** How long to wait for an answer, in milliseconds, before failing with `timeout`. */
4
+ timeoutMs?: number;
5
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * The translation between a façade call and HTTP, pure: no `fetch`, no address, no credential.
3
+ * Whoever calls the User API (or v2) adds those. One reading of the operation table, so a plugin's
4
+ * message, plugin-slot's request and Studio's checks can't disagree on what a call means.
5
+ *
6
+ * façade call ──toRequest──▶ UserApiRequest ──describeRequest──▶ method, path, query, headers, body
7
+ * status, headers, JSON ──readResponse──▶ result, or v2's problem
8
+ *
9
+ * A `UserApiRequest` is also what a plugin sends its host (the SDK's `api-request`, with an id),
10
+ * and `checkRequest` is what the host runs on one it receives.
11
+ */
12
+ import type { UserApiCall } from "./build-facade.js";
13
+ import { type UserApiOperation } from "./generated/operations.js";
14
+ /** A query value. An array is sent comma-separated, as v2 takes one. */
15
+ export type ApiQueryValue = string | number | boolean | readonly (string | number | boolean)[];
16
+ /**
17
+ * One call of an operation, as it travels: by its key in `USER_API_OPERATIONS`, with a value for
18
+ * each `{name}` of its path, its query or body, and the representation and idempotency key.
19
+ */
20
+ export type UserApiRequest = {
21
+ operation: string;
22
+ params: {
23
+ path?: Record<string, string>;
24
+ query?: Record<string, ApiQueryValue>;
25
+ body?: unknown;
26
+ };
27
+ /** One the operation lists; absent, the default. */
28
+ representation?: string;
29
+ /** For an operation that takes one: made once per call, so a retry can't write twice. */
30
+ idempotencyKey?: string;
31
+ };
32
+ /** Why a call never became a request: it names no operation, or its arguments don't fit it. */
33
+ export type UserApiRefusal = {
34
+ error: "unknown_operation" | "invalid_params";
35
+ message: string;
36
+ };
37
+ /**
38
+ * The response headers that pass on to a caller, lower-cased. Nothing else crosses: no cookie, no
39
+ * authorisation.
40
+ */
41
+ export declare const API_RESPONSE_HEADERS: readonly ["x-request-id", "retry-after", "location", "idempotent-replayed", "x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-ratelimit-daily-remaining"];
42
+ export type ApiResponseHeaders = Partial<Record<(typeof API_RESPONSE_HEADERS)[number], string>>;
43
+ /**
44
+ * An RFC 9457 problem, as v2 answers a refusal or a fault. `type` is a URI from v2's closed list
45
+ * (`…/problems/insufficient-scope`); `requestId` is what support asks for. Some types add members
46
+ * (`violations`, `conflicts`).
47
+ */
48
+ export type ApiProblem = {
49
+ type: string;
50
+ title: string;
51
+ status: number;
52
+ detail: string;
53
+ requestId?: string;
54
+ [member: string]: unknown;
55
+ };
56
+ /** A request, ready for a transport to add the address and credentials and send. */
57
+ export type DescribedRequest = {
58
+ method: UserApiOperation["method"];
59
+ /** v2's path with the values in it, encoded: `/deals/42/notes`. */
60
+ path: string;
61
+ /** The query string, without `?`; empty for none. */
62
+ query: string;
63
+ headers: Record<string, string>;
64
+ /** The JSON body as text, when there is one. */
65
+ body?: string;
66
+ };
67
+ export type UserApiResponse = {
68
+ ok: true;
69
+ status: number;
70
+ body: unknown;
71
+ headers: ApiResponseHeaders;
72
+ } | {
73
+ ok: false;
74
+ status: number;
75
+ problem: ApiProblem;
76
+ headers: ApiResponseHeaders;
77
+ };
78
+ /**
79
+ * A façade call as a request: the path's values checked, the query without the values left
80
+ * `undefined`, the empty body a variant sends, and an idempotency key from `newKey` where the
81
+ * operation takes one. Refused when an id isn't a non-empty string or the representation isn't
82
+ * one the operation lists.
83
+ */
84
+ export declare function toRequest(call: UserApiCall, newKey: () => string): UserApiRequest | UserApiRefusal;
85
+ /**
86
+ * Whether a request names an operation and fits it: a non-empty value for each `{name}` of its
87
+ * path, only the input it takes (a query, or a body, which may be left out), and a
88
+ * representation it lists. `undefined` when it does. For a host, before it sends anything.
89
+ */
90
+ export declare function checkRequest(request: UserApiRequest): UserApiRefusal | undefined;
91
+ /**
92
+ * The HTTP request for a call: method, filled path, query (arrays comma-joined), `Accept` for the
93
+ * representation, `Content-Type` for the body (a variant's own media type), `Idempotency-Key`,
94
+ * and the body as JSON. Refused as `checkRequest` refuses.
95
+ */
96
+ export declare function describeRequest(request: UserApiRequest): DescribedRequest | UserApiRefusal;
97
+ /** Response headers, as `fetch` gives them or as a plain record. */
98
+ export type HeaderSource = {
99
+ get(name: string): string | null;
100
+ } | Record<string, string | undefined>;
101
+ /**
102
+ * An answer, read: on 2xx the body (`null` for 204), else v2's problem, or one made from the
103
+ * status when the body isn't a problem. Only the headers in `API_RESPONSE_HEADERS` pass. The
104
+ * body is the transport's, parsed: an answer that isn't JSON is its to refuse.
105
+ */
106
+ export declare function readResponse(status: number, headers: HeaderSource, body: unknown): UserApiResponse;
@@ -0,0 +1,198 @@
1
+ /**
2
+ * The translation between a façade call and HTTP, pure: no `fetch`, no address, no credential.
3
+ * Whoever calls the User API (or v2) adds those. One reading of the operation table, so a plugin's
4
+ * message, plugin-slot's request and Studio's checks can't disagree on what a call means.
5
+ *
6
+ * façade call ──toRequest──▶ UserApiRequest ──describeRequest──▶ method, path, query, headers, body
7
+ * status, headers, JSON ──readResponse──▶ result, or v2's problem
8
+ *
9
+ * A `UserApiRequest` is also what a plugin sends its host (the SDK's `api-request`, with an id),
10
+ * and `checkRequest` is what the host runs on one it receives.
11
+ */
12
+ import { USER_API_OPERATIONS, } from "./generated/operations.js";
13
+ /**
14
+ * The response headers that pass on to a caller, lower-cased. Nothing else crosses: no cookie, no
15
+ * authorisation.
16
+ */
17
+ export const API_RESPONSE_HEADERS = [
18
+ "x-request-id",
19
+ "retry-after",
20
+ "location",
21
+ "idempotent-replayed",
22
+ "x-ratelimit-limit",
23
+ "x-ratelimit-remaining",
24
+ "x-ratelimit-reset",
25
+ "x-ratelimit-daily-remaining",
26
+ ];
27
+ const OPERATIONS = USER_API_OPERATIONS;
28
+ const PARAM = /\{([^}]+)\}/g;
29
+ const JSON_TYPE = "application/json";
30
+ const pathNames = (operation) => [...operation.path.matchAll(PARAM)].map(([, name]) => name);
31
+ /**
32
+ * A façade call as a request: the path's values checked, the query without the values left
33
+ * `undefined`, the empty body a variant sends, and an idempotency key from `newKey` where the
34
+ * operation takes one. Refused when an id isn't a non-empty string or the representation isn't
35
+ * one the operation lists.
36
+ */
37
+ export function toRequest(call, newKey) {
38
+ const { operation } = call;
39
+ const path = {};
40
+ for (const [name, value] of Object.entries(call.path)) {
41
+ if (typeof value !== "string" || value === "") {
42
+ return {
43
+ error: "invalid_params",
44
+ message: `${operation.name}() needs ${name} as a non-empty string.`,
45
+ };
46
+ }
47
+ path[name] = value;
48
+ }
49
+ const { representation } = call.options;
50
+ if (representation !== undefined &&
51
+ representation !== "default" &&
52
+ !(representation in (operation.representations ?? {}))) {
53
+ return {
54
+ error: "invalid_params",
55
+ message: `${operation.name}() has no representation "${representation}".`,
56
+ };
57
+ }
58
+ const params = { path };
59
+ if (call.query !== undefined) {
60
+ // `undefined` means "not given": left out, as JSON would.
61
+ params.query = Object.fromEntries(Object.entries(call.query).filter(([, v]) => v !== undefined));
62
+ }
63
+ if (call.body !== undefined) {
64
+ params.body = call.body;
65
+ }
66
+ return {
67
+ operation: call.key,
68
+ params,
69
+ ...(representation !== undefined && representation !== "default"
70
+ ? { representation }
71
+ : {}),
72
+ ...(operation.idempotencyKey ? { idempotencyKey: newKey() } : {}),
73
+ };
74
+ }
75
+ /**
76
+ * Whether a request names an operation and fits it: a non-empty value for each `{name}` of its
77
+ * path, only the input it takes (a query, or a body, which may be left out), and a
78
+ * representation it lists. `undefined` when it does. For a host, before it sends anything.
79
+ */
80
+ export function checkRequest(request) {
81
+ const operation = OPERATIONS[request.operation];
82
+ if (!operation) {
83
+ return {
84
+ error: "unknown_operation",
85
+ message: `There's no operation ${request.operation}.`,
86
+ };
87
+ }
88
+ const { path = {}, query } = request.params;
89
+ const missing = pathNames(operation).find((name) => !path[name]);
90
+ if (missing !== undefined) {
91
+ return {
92
+ error: "invalid_params",
93
+ message: `${operation.name}() needs ${missing}.`,
94
+ };
95
+ }
96
+ if (operation.input !== "query" && query !== undefined) {
97
+ return {
98
+ error: "invalid_params",
99
+ message: `${operation.name}() takes no query.`,
100
+ };
101
+ }
102
+ if (operation.input !== "body" && "body" in request.params) {
103
+ return {
104
+ error: "invalid_params",
105
+ message: `${operation.name}() takes no body.`,
106
+ };
107
+ }
108
+ if (request.representation !== undefined &&
109
+ !(request.representation in (operation.representations ?? {}))) {
110
+ return {
111
+ error: "invalid_params",
112
+ message: `${operation.name}() has no representation "${request.representation}".`,
113
+ };
114
+ }
115
+ return undefined;
116
+ }
117
+ /**
118
+ * The HTTP request for a call: method, filled path, query (arrays comma-joined), `Accept` for the
119
+ * representation, `Content-Type` for the body (a variant's own media type), `Idempotency-Key`,
120
+ * and the body as JSON. Refused as `checkRequest` refuses.
121
+ */
122
+ export function describeRequest(request) {
123
+ const refused = checkRequest(request);
124
+ if (refused) {
125
+ return refused;
126
+ }
127
+ const operation = OPERATIONS[request.operation];
128
+ const values = request.params.path ?? {};
129
+ const path = operation.path.replace(PARAM, (_, name) => encodeURIComponent(values[name]));
130
+ const search = new URLSearchParams();
131
+ for (const [name, value] of Object.entries(request.params.query ?? {})) {
132
+ search.append(name, Array.isArray(value) ? value.join(",") : String(value));
133
+ }
134
+ const headers = {
135
+ Accept: (request.representation &&
136
+ operation.representations?.[request.representation]) ||
137
+ JSON_TYPE,
138
+ };
139
+ const hasBody = "body" in request.params;
140
+ if (hasBody) {
141
+ headers["Content-Type"] = operation.contentType ?? JSON_TYPE;
142
+ }
143
+ if (operation.idempotencyKey && request.idempotencyKey !== undefined) {
144
+ headers["Idempotency-Key"] = request.idempotencyKey;
145
+ }
146
+ return {
147
+ method: operation.method,
148
+ path,
149
+ query: search.toString(),
150
+ headers,
151
+ ...(hasBody ? { body: JSON.stringify(request.params.body) } : {}),
152
+ };
153
+ }
154
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
155
+ /**
156
+ * An answer, read: on 2xx the body (`null` for 204), else v2's problem, or one made from the
157
+ * status when the body isn't a problem. Only the headers in `API_RESPONSE_HEADERS` pass. The
158
+ * body is the transport's, parsed: an answer that isn't JSON is its to refuse.
159
+ */
160
+ export function readResponse(status, headers, body) {
161
+ const read = typeof headers.get === "function"
162
+ ? (name) => headers.get(name)
163
+ : (name) => {
164
+ const record = headers;
165
+ const key = Object.keys(record).find((k) => k.toLowerCase() === name);
166
+ return key === undefined ? null : (record[key] ?? null);
167
+ };
168
+ const passed = {};
169
+ for (const name of API_RESPONSE_HEADERS) {
170
+ const value = read(name);
171
+ if (value !== null) {
172
+ passed[name] = value;
173
+ }
174
+ }
175
+ if (status >= 200 && status < 300) {
176
+ return {
177
+ ok: true,
178
+ status,
179
+ body: status === 204 ? null : body,
180
+ headers: passed,
181
+ };
182
+ }
183
+ const problem = isRecord(body) && typeof body.type === "string"
184
+ ? {
185
+ title: "",
186
+ detail: "",
187
+ ...body,
188
+ status: typeof body.status === "number" ? body.status : status,
189
+ }
190
+ : {
191
+ type: "about:blank",
192
+ title: `HTTP ${status}`,
193
+ status,
194
+ detail: "",
195
+ };
196
+ return { ok: false, status, problem, headers: passed };
197
+ }
198
+ //# sourceMappingURL=translate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transl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E,IAAI;YACR,MAAM;YACN,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;YAClC,OAAO,EAAE,MAAM;SACf,CAAA;KACD;IACD,MAAM,OAAO,GACZ,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;QAC9C,CAAC,CAAE;YACD,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,GAAG,IAAI;YACP,MAAM,EAAE,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;SAC/C;QACjB,CAAC,CAAC;YACA,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,QAAQ,MAAM,EAAE;YACvB,MAAM;YACN,MAAM,EAAE,EAAE;SACV,CAAA;IACJ,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AACvD,CAAC"}
@@ -0,0 +1,241 @@
1
+ <!-- Generated by scripts/build-definition.mjs from v2's OpenAPI file (Livespace API 2.0.0). Don't edit. -->
2
+
3
+ # The User API, method by method
4
+
5
+ Every method of the API façade, `api`: v2's resources, as the viewing user. The arguments are the
6
+ record ids in the path, then a `body` or a `query`, then `options` (`representation`, where
7
+ one is listed, and what the transport takes, such as `timeoutMs`). Each method's types and full
8
+ description are in its TypeScript declaration.
9
+
10
+ A method needs one of its scopes ("by record": the scope of each record type it touches): a
11
+ plugin declares them, a service key carries them. And the viewer must be allowed to do it.
12
+
13
+ ## users
14
+
15
+ - `api.users.list(query?, options?)`: Lists users. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write` or `crm:note:read` or `crm:email:read` or `crm:call:read`.
16
+ - `api.users.me(options?)`: Returns the integration user bound to this key. Scopes: no scope.
17
+ - `api.users.get(id, options?)`: Returns one user. Scopes: `crm:person:read` or `crm:company:read` or `crm:deal:read` or `crm:note:read` or `crm:email:read` or `crm:call:read`.
18
+
19
+ ## emails
20
+
21
+ - `api.emails.list(query, options?)`: Lists emails for a related person, company or deal. Scopes: `crm:email:read`.
22
+
23
+ ## people
24
+
25
+ - `api.people.create(body, options?)`: Creates a person. Scopes: `crm:person:write`.
26
+ - `api.people.createWithCompany(body, options?)`: Creates a person together with a new company. Scopes: `crm:person:write`.
27
+ - `api.people.search(body, options?)`: Searches people. Scopes: `crm:person:read`. Representations: `minimal`.
28
+ - `api.people.get(id, options?)`: Returns one person. Scopes: `crm:person:read`. Representations: `minimal`.
29
+ - `api.people.update(id, body, options?)`: Updates a person. Scopes: `crm:person:write`.
30
+ - `api.people.delete(id, options?)`: Deletes a person. Scopes: `crm:person:delete`.
31
+ - `api.people.notes.list(id, query?, options?)`: Lists notes for a person. Scopes: `crm:note:read`.
32
+ - `api.people.notes.create(id, body, options?)`: Creates a note on a person. Scopes: `crm:note:write`.
33
+ - `api.people.emails.list(id, query?, options?)`: Lists emails for a person. Scopes: `crm:email:read`.
34
+ - `api.people.calls.list(id, query?, options?)`: Lists calls for a person. Scopes: `crm:call:read`.
35
+ - `api.people.calls.create(id, body, options?)`: Logs a call on a person. Scopes: `crm:call:write`.
36
+ - `api.people.tasks.create(id, body, options?)`: Creates a task on a person. Scopes: `crm:task:write`.
37
+ - `api.people.tasks.update(id, taskId, body?, options?)`: Updates a task on a person. Scopes: `crm:task:write`.
38
+ - `api.people.tasks.complete(id, taskId, options?)`: Completes a task on a person. Scopes: `crm:task:write`.
39
+ - `api.people.tasks.reopen(id, taskId, options?)`: Reopens a task on a person. Scopes: `crm:task:write`.
40
+
41
+ ## companies
42
+
43
+ - `api.companies.create(body, options?)`: Creates a company. Scopes: `crm:company:write`.
44
+ - `api.companies.search(body, options?)`: Searches companies. Scopes: `crm:company:read`. Representations: `minimal`.
45
+ - `api.companies.get(id, options?)`: Returns one company. Scopes: `crm:company:read`. Representations: `minimal`.
46
+ - `api.companies.update(id, body, options?)`: Updates a company. Scopes: `crm:company:write`.
47
+ - `api.companies.delete(id, options?)`: Deletes a company. Scopes: `crm:company:delete`.
48
+ - `api.companies.notes.list(id, query?, options?)`: Lists notes for a company. Scopes: `crm:note:read`.
49
+ - `api.companies.notes.create(id, body, options?)`: Creates a note on a company. Scopes: `crm:note:write`.
50
+ - `api.companies.emails.list(id, query?, options?)`: Lists emails for a company. Scopes: `crm:email:read`.
51
+ - `api.companies.calls.list(id, query?, options?)`: Lists calls for a company. Scopes: `crm:call:read`.
52
+ - `api.companies.calls.create(id, body, options?)`: Logs a call on a company. Scopes: `crm:call:write`.
53
+ - `api.companies.tasks.create(id, body, options?)`: Creates a task on a company. Scopes: `crm:task:write`.
54
+ - `api.companies.tasks.update(id, taskId, body?, options?)`: Updates a task on a company. Scopes: `crm:task:write`.
55
+ - `api.companies.tasks.complete(id, taskId, options?)`: Completes a task on a company. Scopes: `crm:task:write`.
56
+ - `api.companies.tasks.reopen(id, taskId, options?)`: Reopens a task on a company. Scopes: `crm:task:write`.
57
+
58
+ ## deals
59
+
60
+ - `api.deals.create(body, options?)`: Creates or copies a deal. Scopes: `crm:deal:write`.
61
+ - `api.deals.copy(body, options?)`: Copies a deal into another sales process. Scopes: `crm:deal:write`.
62
+ - `api.deals.search(body, options?)`: Searches deals. Scopes: `crm:deal:read`. Representations: `minimal`, `extended`.
63
+ - `api.deals.get(id, options?)`: Returns one deal. Scopes: `crm:deal:read`. Representations: `minimal`.
64
+ - `api.deals.update(id, body, options?)`: Updates a deal. Scopes: `crm:deal:write`.
65
+ - `api.deals.changeStatus(id, body, options?)`: Changes a deal's status. Scopes: `crm:deal:write`.
66
+ - `api.deals.delete(id, options?)`: Deletes a deal. Scopes: `crm:deal:delete`.
67
+ - `api.deals.notes.list(id, query?, options?)`: Lists notes for a deal. Scopes: `crm:note:read`.
68
+ - `api.deals.notes.create(id, body, options?)`: Creates a note on a deal. Scopes: `crm:note:write`.
69
+ - `api.deals.emails.list(id, query?, options?)`: Lists emails for a deal. Scopes: `crm:email:read`.
70
+ - `api.deals.calls.list(id, query?, options?)`: Lists calls for a deal. Scopes: `crm:call:read`.
71
+ - `api.deals.calls.create(id, body, options?)`: Logs a call on a deal. Scopes: `crm:call:write`.
72
+ - `api.deals.products.list(id, query?, options?)`: Lists the product lines of a deal. Scopes: `crm:deal:read`.
73
+ - `api.deals.products.create(id, body, options?)`: Adds a product line to a deal. Scopes: `crm:deal:write`.
74
+ - `api.deals.products.createMany(id, body, options?)`: Adds several product lines to a deal, all or none. Scopes: `crm:deal:write`.
75
+ - `api.deals.products.get(id, lineId, options?)`: Reads one product line of a deal. Scopes: `crm:deal:read`.
76
+ - `api.deals.products.update(id, lineId, body, options?)`: Changes a product line of a deal. Scopes: `crm:deal:write`.
77
+ - `api.deals.products.delete(id, lineId, options?)`: Removes a product line from a deal. Scopes: `crm:deal:write`.
78
+ - `api.deals.costs.list(id, query?, options?)`: Lists the cost lines of a deal. Scopes: `crm:deal:read`.
79
+ - `api.deals.costs.create(id, body, options?)`: Adds a cost line to a deal. Scopes: `crm:deal:write`.
80
+ - `api.deals.costs.createMany(id, body, options?)`: Adds several cost lines to a deal, all or none. Scopes: `crm:deal:write`.
81
+ - `api.deals.budget.get(id, options?)`: Reads the budget summary of a deal. Scopes: `crm:deal:read`.
82
+ - `api.deals.costs.get(id, lineId, options?)`: Reads one cost line of a deal. Scopes: `crm:deal:read`.
83
+ - `api.deals.costs.update(id, lineId, body, options?)`: Changes a cost line of a deal. Scopes: `crm:deal:write`.
84
+ - `api.deals.costs.delete(id, lineId, options?)`: Removes a cost line from a deal. Scopes: `crm:deal:write`.
85
+ - `api.deals.process.get(id, options?)`: Reads the process progress of a deal. Scopes: `crm:deal:read`.
86
+ - `api.deals.process.update(id, body, options?)`: Completes or reopens steps of a deal's process. Scopes: `crm:deal:write`.
87
+ - `api.deals.tasks.create(id, body, options?)`: Creates a task on a deal. Scopes: `crm:task:write`.
88
+ - `api.deals.tasks.update(id, taskId, body?, options?)`: Updates a task on a deal. Scopes: `crm:task:write`.
89
+ - `api.deals.tasks.complete(id, taskId, options?)`: Completes a task on a deal. Scopes: `crm:task:write`.
90
+ - `api.deals.tasks.reopen(id, taskId, options?)`: Reopens a task on a deal. Scopes: `crm:task:write`.
91
+
92
+ ## notes
93
+
94
+ - `api.notes.list(query?, options?)`: Lists every note the caller may read. Scopes: `crm:note:read`.
95
+ - `api.notes.create(body, options?)`: Creates a dashboard note. Scopes: `crm:note:write`.
96
+ - `api.notes.get(id, options?)`: Returns one note. Scopes: `crm:note:read`.
97
+ - `api.notes.update(id, body, options?)`: Updates a note. Scopes: `crm:note:write`.
98
+ - `api.notes.delete(id, options?)`: Deletes a note. Scopes: `crm:note:delete`.
99
+
100
+ ## calls
101
+
102
+ - `api.calls.get(id, options?)`: Returns one call. Scopes: `crm:call:read`.
103
+ - `api.calls.update(id, body, options?)`: Updates a call. Scopes: `crm:call:write`.
104
+ - `api.calls.delete(id, options?)`: Deletes a call. Scopes: `crm:call:delete`.
105
+
106
+ ## notifications
107
+
108
+ - `api.notifications.create(body, options?)`: Creates a notification. Scopes: `crm:notification:write`.
109
+
110
+ ## (the API itself)
111
+
112
+ - `api.search(query, options?)`: Searches people, companies, deals, notes, spaces and users. Scopes: `crm:person:read` or `crm:company:read` or `crm:deal:read` or `crm:note:read`.
113
+
114
+ ## dictionaries
115
+
116
+ - `api.dictionaries.sources.list(query?, options?)`: Lists acquisition sources. Scopes: `crm:person:read` or `crm:person:write` or `crm:dictionary:read`.
117
+ - `api.dictionaries.sources.create(body, options?)`: Creates a source. Scopes: `crm:dictionary:write`.
118
+ - `api.dictionaries.sources.get(id, options?)`: Returns one acquisition source. Scopes: `crm:person:read` or `crm:person:write` or `crm:dictionary:read`.
119
+ - `api.dictionaries.sources.rename(id, body, options?)`: Renames a source. Scopes: `crm:dictionary:write`.
120
+ - `api.dictionaries.sources.delete(id, options?)`: Deletes a source. Scopes: `crm:dictionary:delete`.
121
+ - `api.dictionaries.consentStatuses.list(query?, options?)`: Lists consent statuses. Scopes: `crm:dictionary:read` or `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write`.
122
+ - `api.dictionaries.consentStatuses.create(body, options?)`: Creates a consent status. Scopes: `crm:dictionary:write`.
123
+ - `api.dictionaries.consentStatuses.get(id, options?)`: Returns one consent status. Scopes: `crm:dictionary:read` or `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write`.
124
+ - `api.dictionaries.consentStatuses.rename(id, body, options?)`: Renames a consent status. Scopes: `crm:dictionary:write`.
125
+ - `api.dictionaries.consentStatuses.delete(id, options?)`: Deletes a consent status. Scopes: `crm:dictionary:delete`.
126
+ - `api.dictionaries.positions.list(query?, options?)`: Lists person positions. Scopes: `crm:person:read` or `crm:person:write`.
127
+ - `api.dictionaries.positions.get(id, options?)`: Returns one person position. Scopes: `crm:person:read` or `crm:person:write`.
128
+ - `api.dictionaries.dealReasons.list(query?, options?)`: Lists deal reasons. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:dictionary:read`.
129
+ - `api.dictionaries.dealReasons.create(body, options?)`: Creates a deal reason. Scopes: `crm:dictionary:write`.
130
+ - `api.dictionaries.dealReasons.get(id, options?)`: Returns one deal reason. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:dictionary:read`.
131
+ - `api.dictionaries.dealReasons.update(id, body, options?)`: Updates a deal reason. Scopes: `crm:dictionary:write`.
132
+ - `api.dictionaries.dealReasons.delete(id, options?)`: Deletes a deal reason. Scopes: `crm:dictionary:delete`.
133
+ - `api.dictionaries.personGroups.list(query?, options?)`: Lists person groups. Scopes: `crm:person:read` or `crm:person:write` or `crm:dictionary:read`.
134
+ - `api.dictionaries.personGroups.create(body, options?)`: Creates a person group. Scopes: `crm:dictionary:write`.
135
+ - `api.dictionaries.personGroups.get(id, options?)`: Returns one person group. Scopes: `crm:person:read` or `crm:person:write` or `crm:dictionary:read`.
136
+ - `api.dictionaries.personGroups.update(id, body, options?)`: Renames a person group. Scopes: `crm:dictionary:write`.
137
+ - `api.dictionaries.personGroups.delete(id, options?)`: Deletes a person group. Scopes: `crm:dictionary:delete`.
138
+ - `api.dictionaries.dealGroups.list(query?, options?)`: Lists deal groups. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:dictionary:read`.
139
+ - `api.dictionaries.dealGroups.create(body, options?)`: Creates a deal group. Scopes: `crm:dictionary:write`.
140
+ - `api.dictionaries.dealGroups.get(id, options?)`: Returns one deal group. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:dictionary:read`.
141
+ - `api.dictionaries.dealGroups.update(id, body, options?)`: Renames a deal group. Scopes: `crm:dictionary:write`.
142
+ - `api.dictionaries.dealGroups.delete(id, options?)`: Deletes a deal group. Scopes: `crm:dictionary:delete`.
143
+ - `api.dictionaries.people.fields.list(query?, options?)`: Lists the additional fields on the person form. Scopes: `crm:person:read` or `crm:person:write`.
144
+ - `api.dictionaries.people.fields.get(id, options?)`: Returns one person field. Scopes: `crm:person:read` or `crm:person:write`.
145
+ - `api.dictionaries.teams.list(query?, options?)`: Lists teams. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write`.
146
+ - `api.dictionaries.teams.get(id, options?)`: Returns one team. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write`.
147
+ - `api.dictionaries.roles.list(query?, options?)`: Lists roles. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write`.
148
+ - `api.dictionaries.roles.get(id, options?)`: Returns one role. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write`.
149
+ - `api.dictionaries.currencies.list(query?, options?)`: Lists currencies. Scopes: `crm:deal:read` or `crm:deal:write`.
150
+ - `api.dictionaries.currencies.get(code, options?)`: Returns one currency. Scopes: `crm:deal:read` or `crm:deal:write`.
151
+ - `api.dictionaries.relationTypes.list(query?, options?)`: Lists relation types. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write` or `crm:dictionary:read`.
152
+ - `api.dictionaries.relationTypes.create(body, options?)`: Creates a relation type. Scopes: `crm:dictionary:write`.
153
+ - `api.dictionaries.relationTypes.get(id, options?)`: Returns one relation type. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write` or `crm:dictionary:read`.
154
+ - `api.dictionaries.relationTypes.update(id, body, options?)`: Relabels a relation type. Scopes: `crm:dictionary:write`.
155
+ - `api.dictionaries.relationTypes.delete(id, options?)`: Deletes a relation type. Scopes: `crm:dictionary:delete`.
156
+ - `api.dictionaries.tasks.fields.list(query?, options?)`: Lists the additional fields on the task form. Scopes: `crm:task:read` or `crm:task:write`.
157
+ - `api.dictionaries.tasks.fields.get(id, options?)`: Returns one task field. Scopes: `crm:task:read` or `crm:task:write`.
158
+ - `api.dictionaries.teams.members.list(id, query?, options?)`: Lists the members of a team. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write`.
159
+ - `api.dictionaries.processes.list(query?, options?)`: Lists sales processes. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:sales-process:read`.
160
+ - `api.dictionaries.processes.get(id, options?)`: Returns one sales process. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:sales-process:read`.
161
+ - `api.dictionaries.companies.fields.list(query?, options?)`: Lists the additional fields on the company form. Scopes: `crm:company:read` or `crm:company:write`.
162
+ - `api.dictionaries.companies.fields.get(id, options?)`: Returns one company field. Scopes: `crm:company:read` or `crm:company:write`.
163
+ - `api.dictionaries.addresses.fields.list(query?, options?)`: Lists the additional fields on the address form. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write`.
164
+ - `api.dictionaries.addresses.fields.get(id, options?)`: Returns one address field. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write`.
165
+ - `api.dictionaries.deals.fields.list(query?, options?)`: Lists the additional fields on the deal form. Scopes: `crm:deal:read` or `crm:deal:write`.
166
+ - `api.dictionaries.deals.fields.get(id, options?)`: Returns one deal field. Scopes: `crm:deal:read` or `crm:deal:write`.
167
+ - `api.dictionaries.taskTypes.list(query?, options?)`: Lists task types. Scopes: `crm:task:read` or `crm:task:write` or `crm:dictionary:read`.
168
+ - `api.dictionaries.taskTypes.create(body, options?)`: Creates a task type. Scopes: `crm:dictionary:write`.
169
+ - `api.dictionaries.taskTypes.get(id, options?)`: Returns one task type. Scopes: `crm:task:read` or `crm:task:write` or `crm:dictionary:read`.
170
+ - `api.dictionaries.taskTypes.update(id, body, options?)`: Updates a task type. Scopes: `crm:dictionary:write`.
171
+ - `api.dictionaries.taskTypes.delete(id, options?)`: Deletes a task type. Scopes: `crm:dictionary:delete`.
172
+ - `api.dictionaries.taskStatuses.list(query?, options?)`: Lists task statuses. Scopes: `crm:task:read` or `crm:task:write` or `crm:dictionary:read`.
173
+ - `api.dictionaries.taskStatuses.create(body, options?)`: Creates a task status. Scopes: `crm:dictionary:write`.
174
+ - `api.dictionaries.taskStatuses.get(id, options?)`: Returns one task status. Scopes: `crm:task:read` or `crm:task:write` or `crm:dictionary:read`.
175
+ - `api.dictionaries.taskStatuses.update(id, body, options?)`: Updates a task status. Scopes: `crm:dictionary:write`.
176
+ - `api.dictionaries.taskStatuses.delete(id, options?)`: Deletes a task status. Scopes: `crm:dictionary:delete`.
177
+ - `api.dictionaries.tags.list(query?, options?)`: Lists tag names. Scopes: `crm:person:read` or `crm:person:write` or `crm:company:read` or `crm:company:write` or `crm:deal:read` or `crm:deal:write`.
178
+
179
+ ## relations
180
+
181
+ - `api.relations.create(body, options?)`: Links two records. Scopes: by record, from `crm:person:write`, `crm:company:write`, `crm:deal:write`.
182
+ - `api.relations.get(id, options?)`: Reads one relation. Scopes: by record, from `crm:person:read`, `crm:person:write`, `crm:company:read`, `crm:company:write`, `crm:deal:read`, `crm:deal:write`.
183
+ - `api.relations.delete(id, options?)`: Unlinks two records. Scopes: by record, from `crm:person:write`, `crm:company:write`, `crm:deal:write`.
184
+
185
+ ## salesProcesses
186
+
187
+ - `api.salesProcesses.list(query?, options?)`: Lists sales processes. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:sales-process:read`.
188
+ - `api.salesProcesses.create(body, options?)`: Creates a sales process. Scopes: `crm:sales-process:write`.
189
+ - `api.salesProcesses.get(id, options?)`: Returns one sales process. Scopes: `crm:deal:read` or `crm:deal:write` or `crm:sales-process:read`.
190
+ - `api.salesProcesses.update(id, body, options?)`: Updates a sales process. Scopes: `crm:sales-process:write`.
191
+ - `api.salesProcesses.delete(id, options?)`: Deletes a sales process. Scopes: `crm:sales-process:delete`.
192
+
193
+ ## tasks
194
+
195
+ - `api.tasks.search(body, options?)`: Searches tasks. Scopes: `crm:task:read` or `crm:task:write`. Representations: `minimal`.
196
+ - `api.tasks.create(body, options?)`: Creates a task. Scopes: `crm:task:write`.
197
+ - `api.tasks.get(id, options?)`: Returns one task. Scopes: `crm:task:read` or `crm:task:write`. Representations: `minimal`.
198
+ - `api.tasks.update(id, body?, options?)`: Updates a task. Scopes: `crm:task:write`.
199
+ - `api.tasks.complete(id, options?)`: Completes a task. Scopes: `crm:task:write`.
200
+ - `api.tasks.reopen(id, options?)`: Reopens a task. Scopes: `crm:task:write`.
201
+ - `api.tasks.delete(id, options?)`: Deletes a task. Scopes: `crm:task:delete`.
202
+
203
+ ## products
204
+
205
+ - `api.products.create(body, options?)`: Creates a product. Scopes: `crm:product-catalog:write`.
206
+ - `api.products.search(body, options?)`: Searches products. Scopes: `crm:product-catalog:read`.
207
+ - `api.products.get(id, options?)`: Returns one product. Scopes: `crm:product-catalog:read`.
208
+ - `api.products.update(id, body, options?)`: Updates a product. Scopes: `crm:product-catalog:write`.
209
+ - `api.products.delete(id, options?)`: Deletes a product. Scopes: `crm:product-catalog:delete`.
210
+
211
+ ## metadata
212
+
213
+ - `api.metadata.products.capabilities.get(options?)`: Reads the product and cost catalog capabilities. Scopes: `crm:product-catalog:read` or `crm:cost-catalog:read`.
214
+
215
+ ## productGroups
216
+
217
+ - `api.productGroups.list(query?, options?)`: Lists product groups. Scopes: `crm:product-catalog:read`.
218
+ - `api.productGroups.create(body, options?)`: Creates a product group. Scopes: `crm:product-catalog:write`.
219
+ - `api.productGroups.get(id, options?)`: Returns one product group. Scopes: `crm:product-catalog:read`.
220
+ - `api.productGroups.update(id, body, options?)`: Renames a product group. Scopes: `crm:product-catalog:write`.
221
+ - `api.productGroups.delete(id, options?)`: Deletes a product group. Scopes: `crm:product-catalog:delete`.
222
+ - `api.productGroups.members.list(id, query?, options?)`: Lists the products of one product group. Scopes: `crm:product-catalog:read`.
223
+ - `api.productGroups.members.add(id, body, options?)`: Moves products into a product group. Scopes: `crm:product-catalog:write`.
224
+
225
+ ## costs
226
+
227
+ - `api.costs.create(body, options?)`: Creates a cost. Scopes: `crm:cost-catalog:write`.
228
+ - `api.costs.search(body, options?)`: Searches costs. Scopes: `crm:cost-catalog:read`.
229
+ - `api.costs.get(id, options?)`: Returns one cost. Scopes: `crm:cost-catalog:read`.
230
+ - `api.costs.update(id, body, options?)`: Updates a cost. Scopes: `crm:cost-catalog:write`.
231
+ - `api.costs.delete(id, options?)`: Deletes a cost. Scopes: `crm:cost-catalog:delete`.
232
+
233
+ ## costGroups
234
+
235
+ - `api.costGroups.list(query?, options?)`: Lists cost groups. Scopes: `crm:cost-catalog:read`.
236
+ - `api.costGroups.create(body, options?)`: Creates a cost group. Scopes: `crm:cost-catalog:write`.
237
+ - `api.costGroups.get(id, options?)`: Returns one cost group. Scopes: `crm:cost-catalog:read`.
238
+ - `api.costGroups.update(id, body, options?)`: Renames a cost group. Scopes: `crm:cost-catalog:write`.
239
+ - `api.costGroups.delete(id, options?)`: Deletes a cost group. Scopes: `crm:cost-catalog:delete`.
240
+ - `api.costGroups.members.list(id, query?, options?)`: Lists the costs of one cost group. Scopes: `crm:cost-catalog:read`.
241
+ - `api.costGroups.members.add(id, body, options?)`: Moves costs into a cost group. Scopes: `crm:cost-catalog:write`.