@macro-inc/sdk 0.0.1
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/README.md +177 -0
- package/dist/chunk-5HAKQN23.js +1263 -0
- package/dist/chunk-77EI4LSQ.js +2492 -0
- package/dist/chunk-CTKR64MY.js +1436 -0
- package/dist/chunk-JXIQT5TH.js +1467 -0
- package/dist/chunk-P4DTO6VD.js +830 -0
- package/dist/chunk-PAAFJYGO.js +967 -0
- package/dist/chunk-QNUS5BC5.js +913 -0
- package/dist/chunk-SGAHIERJ.js +1235 -0
- package/dist/chunk-V45LUJDI.js +838 -0
- package/dist/chunk-YRUXFEZM.js +1044 -0
- package/dist/generated/agent-harness/client/client.gen.d.ts +2 -0
- package/dist/generated/agent-harness/client/index.d.ts +10 -0
- package/dist/generated/agent-harness/client/types.gen.d.ts +120 -0
- package/dist/generated/agent-harness/client/utils.gen.d.ts +37 -0
- package/dist/generated/agent-harness/client.gen.d.ts +12 -0
- package/dist/generated/agent-harness/core/auth.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/params.gen.d.ts +43 -0
- package/dist/generated/agent-harness/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/agent-harness/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/agent-harness/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/agent-harness/core/types.gen.d.ts +83 -0
- package/dist/generated/agent-harness/core/utils.gen.d.ts +19 -0
- package/dist/generated/agent-harness/index.d.ts +2 -0
- package/dist/generated/agent-harness/index.js +6 -0
- package/dist/generated/agent-harness/sdk.gen.d.ts +84 -0
- package/dist/generated/agent-harness/types.gen.d.ts +539 -0
- package/dist/generated/auth/client/client.gen.d.ts +2 -0
- package/dist/generated/auth/client/index.d.ts +10 -0
- package/dist/generated/auth/client/types.gen.d.ts +120 -0
- package/dist/generated/auth/client/utils.gen.d.ts +37 -0
- package/dist/generated/auth/client.gen.d.ts +12 -0
- package/dist/generated/auth/core/auth.gen.d.ts +25 -0
- package/dist/generated/auth/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/auth/core/params.gen.d.ts +43 -0
- package/dist/generated/auth/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/auth/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/auth/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/auth/core/types.gen.d.ts +83 -0
- package/dist/generated/auth/core/utils.gen.d.ts +19 -0
- package/dist/generated/auth/index.d.ts +2 -0
- package/dist/generated/auth/index.js +6 -0
- package/dist/generated/auth/sdk.gen.d.ts +383 -0
- package/dist/generated/auth/types.gen.d.ts +2175 -0
- package/dist/generated/cognition/client/client.gen.d.ts +2 -0
- package/dist/generated/cognition/client/index.d.ts +10 -0
- package/dist/generated/cognition/client/types.gen.d.ts +120 -0
- package/dist/generated/cognition/client/utils.gen.d.ts +37 -0
- package/dist/generated/cognition/client.gen.d.ts +12 -0
- package/dist/generated/cognition/core/auth.gen.d.ts +25 -0
- package/dist/generated/cognition/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/cognition/core/params.gen.d.ts +43 -0
- package/dist/generated/cognition/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/cognition/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/cognition/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/cognition/core/types.gen.d.ts +83 -0
- package/dist/generated/cognition/core/utils.gen.d.ts +19 -0
- package/dist/generated/cognition/index.d.ts +2 -0
- package/dist/generated/cognition/index.js +6 -0
- package/dist/generated/cognition/sdk.gen.d.ts +224 -0
- package/dist/generated/cognition/types.gen.d.ts +2484 -0
- package/dist/generated/connection/client/client.gen.d.ts +2 -0
- package/dist/generated/connection/client/index.d.ts +10 -0
- package/dist/generated/connection/client/types.gen.d.ts +120 -0
- package/dist/generated/connection/client/utils.gen.d.ts +37 -0
- package/dist/generated/connection/client.gen.d.ts +12 -0
- package/dist/generated/connection/core/auth.gen.d.ts +25 -0
- package/dist/generated/connection/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/connection/core/params.gen.d.ts +43 -0
- package/dist/generated/connection/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/connection/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/connection/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/connection/core/types.gen.d.ts +83 -0
- package/dist/generated/connection/core/utils.gen.d.ts +19 -0
- package/dist/generated/connection/index.d.ts +2 -0
- package/dist/generated/connection/index.js +839 -0
- package/dist/generated/connection/sdk.gen.d.ts +38 -0
- package/dist/generated/connection/types.gen.d.ts +235 -0
- package/dist/generated/contacts/client/client.gen.d.ts +2 -0
- package/dist/generated/contacts/client/index.d.ts +10 -0
- package/dist/generated/contacts/client/types.gen.d.ts +120 -0
- package/dist/generated/contacts/client/utils.gen.d.ts +37 -0
- package/dist/generated/contacts/client.gen.d.ts +12 -0
- package/dist/generated/contacts/core/auth.gen.d.ts +25 -0
- package/dist/generated/contacts/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/contacts/core/params.gen.d.ts +43 -0
- package/dist/generated/contacts/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/contacts/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/contacts/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/contacts/core/types.gen.d.ts +83 -0
- package/dist/generated/contacts/core/utils.gen.d.ts +19 -0
- package/dist/generated/contacts/index.d.ts +2 -0
- package/dist/generated/contacts/index.js +6 -0
- package/dist/generated/contacts/sdk.gen.d.ts +43 -0
- package/dist/generated/contacts/types.gen.d.ts +52 -0
- package/dist/generated/email/client/client.gen.d.ts +2 -0
- package/dist/generated/email/client/index.d.ts +10 -0
- package/dist/generated/email/client/types.gen.d.ts +120 -0
- package/dist/generated/email/client/utils.gen.d.ts +37 -0
- package/dist/generated/email/client.gen.d.ts +12 -0
- package/dist/generated/email/core/auth.gen.d.ts +25 -0
- package/dist/generated/email/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/email/core/params.gen.d.ts +43 -0
- package/dist/generated/email/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/email/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/email/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/email/core/types.gen.d.ts +83 -0
- package/dist/generated/email/core/utils.gen.d.ts +19 -0
- package/dist/generated/email/index.d.ts +2 -0
- package/dist/generated/email/index.js +6 -0
- package/dist/generated/email/sdk.gen.d.ts +254 -0
- package/dist/generated/email/types.gen.d.ts +2614 -0
- package/dist/generated/notification/client/client.gen.d.ts +2 -0
- package/dist/generated/notification/client/index.d.ts +10 -0
- package/dist/generated/notification/client/types.gen.d.ts +120 -0
- package/dist/generated/notification/client/utils.gen.d.ts +37 -0
- package/dist/generated/notification/client.gen.d.ts +12 -0
- package/dist/generated/notification/core/auth.gen.d.ts +25 -0
- package/dist/generated/notification/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/notification/core/params.gen.d.ts +43 -0
- package/dist/generated/notification/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/notification/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/notification/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/notification/core/types.gen.d.ts +83 -0
- package/dist/generated/notification/core/utils.gen.d.ts +19 -0
- package/dist/generated/notification/index.d.ts +2 -0
- package/dist/generated/notification/index.js +6 -0
- package/dist/generated/notification/sdk.gen.d.ts +118 -0
- package/dist/generated/notification/types.gen.d.ts +1352 -0
- package/dist/generated/properties/client/client.gen.d.ts +2 -0
- package/dist/generated/properties/client/index.d.ts +10 -0
- package/dist/generated/properties/client/types.gen.d.ts +120 -0
- package/dist/generated/properties/client/utils.gen.d.ts +37 -0
- package/dist/generated/properties/client.gen.d.ts +12 -0
- package/dist/generated/properties/core/auth.gen.d.ts +25 -0
- package/dist/generated/properties/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/properties/core/params.gen.d.ts +43 -0
- package/dist/generated/properties/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/properties/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/properties/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/properties/core/types.gen.d.ts +83 -0
- package/dist/generated/properties/core/utils.gen.d.ts +19 -0
- package/dist/generated/properties/index.d.ts +2 -0
- package/dist/generated/properties/index.js +6 -0
- package/dist/generated/properties/sdk.gen.d.ts +158 -0
- package/dist/generated/properties/types.gen.d.ts +1288 -0
- package/dist/generated/scheduled-action/client/client.gen.d.ts +2 -0
- package/dist/generated/scheduled-action/client/index.d.ts +10 -0
- package/dist/generated/scheduled-action/client/types.gen.d.ts +120 -0
- package/dist/generated/scheduled-action/client/utils.gen.d.ts +37 -0
- package/dist/generated/scheduled-action/client.gen.d.ts +12 -0
- package/dist/generated/scheduled-action/core/auth.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/params.gen.d.ts +43 -0
- package/dist/generated/scheduled-action/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/scheduled-action/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/scheduled-action/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/scheduled-action/core/types.gen.d.ts +83 -0
- package/dist/generated/scheduled-action/core/utils.gen.d.ts +19 -0
- package/dist/generated/scheduled-action/index.d.ts +2 -0
- package/dist/generated/scheduled-action/index.js +845 -0
- package/dist/generated/scheduled-action/sdk.gen.d.ts +42 -0
- package/dist/generated/scheduled-action/types.gen.d.ts +241 -0
- package/dist/generated/search/client/client.gen.d.ts +2 -0
- package/dist/generated/search/client/index.d.ts +10 -0
- package/dist/generated/search/client/types.gen.d.ts +120 -0
- package/dist/generated/search/client/utils.gen.d.ts +37 -0
- package/dist/generated/search/client.gen.d.ts +12 -0
- package/dist/generated/search/core/auth.gen.d.ts +25 -0
- package/dist/generated/search/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/search/core/params.gen.d.ts +43 -0
- package/dist/generated/search/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/search/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/search/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/search/core/types.gen.d.ts +83 -0
- package/dist/generated/search/core/utils.gen.d.ts +19 -0
- package/dist/generated/search/index.d.ts +2 -0
- package/dist/generated/search/index.js +6 -0
- package/dist/generated/search/sdk.gen.d.ts +44 -0
- package/dist/generated/search/types.gen.d.ts +2194 -0
- package/dist/generated/static-files/client/client.gen.d.ts +2 -0
- package/dist/generated/static-files/client/index.d.ts +10 -0
- package/dist/generated/static-files/client/types.gen.d.ts +120 -0
- package/dist/generated/static-files/client/utils.gen.d.ts +37 -0
- package/dist/generated/static-files/client.gen.d.ts +12 -0
- package/dist/generated/static-files/core/auth.gen.d.ts +25 -0
- package/dist/generated/static-files/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/static-files/core/params.gen.d.ts +43 -0
- package/dist/generated/static-files/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/static-files/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/static-files/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/static-files/core/types.gen.d.ts +83 -0
- package/dist/generated/static-files/core/utils.gen.d.ts +19 -0
- package/dist/generated/static-files/index.d.ts +2 -0
- package/dist/generated/static-files/index.js +842 -0
- package/dist/generated/static-files/sdk.gen.d.ts +43 -0
- package/dist/generated/static-files/types.gen.d.ts +214 -0
- package/dist/generated/storage/client/client.gen.d.ts +2 -0
- package/dist/generated/storage/client/index.d.ts +10 -0
- package/dist/generated/storage/client/types.gen.d.ts +120 -0
- package/dist/generated/storage/client/utils.gen.d.ts +37 -0
- package/dist/generated/storage/client.gen.d.ts +12 -0
- package/dist/generated/storage/core/auth.gen.d.ts +25 -0
- package/dist/generated/storage/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/storage/core/params.gen.d.ts +43 -0
- package/dist/generated/storage/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/storage/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/storage/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/storage/core/types.gen.d.ts +83 -0
- package/dist/generated/storage/core/utils.gen.d.ts +19 -0
- package/dist/generated/storage/index.d.ts +2 -0
- package/dist/generated/storage/index.js +6 -0
- package/dist/generated/storage/sdk.gen.d.ts +858 -0
- package/dist/generated/storage/types.gen.d.ts +12105 -0
- package/dist/generated/unfurl/client/client.gen.d.ts +2 -0
- package/dist/generated/unfurl/client/index.d.ts +10 -0
- package/dist/generated/unfurl/client/types.gen.d.ts +120 -0
- package/dist/generated/unfurl/client/utils.gen.d.ts +37 -0
- package/dist/generated/unfurl/client.gen.d.ts +12 -0
- package/dist/generated/unfurl/core/auth.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/params.gen.d.ts +43 -0
- package/dist/generated/unfurl/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/unfurl/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/unfurl/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/unfurl/core/types.gen.d.ts +83 -0
- package/dist/generated/unfurl/core/utils.gen.d.ts +19 -0
- package/dist/generated/unfurl/index.d.ts +2 -0
- package/dist/generated/unfurl/index.js +835 -0
- package/dist/generated/unfurl/sdk.gen.d.ts +47 -0
- package/dist/generated/unfurl/types.gen.d.ts +125 -0
- package/dist/src/config.d.ts +51 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +45 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +18 -0
- package/dist/src/entities/bots/namespace.d.ts +25 -0
- package/dist/src/entities/calls/call-record.d.ts +55 -0
- package/dist/src/entities/calls/namespace.d.ts +9 -0
- package/dist/src/entities/channels/channel.d.ts +88 -0
- package/dist/src/entities/channels/message.d.ts +64 -0
- package/dist/src/entities/channels/namespace.d.ts +30 -0
- package/dist/src/entities/channels/post.d.ts +20 -0
- package/dist/src/entities/channels/thread.d.ts +30 -0
- package/dist/src/entities/chats/chat.d.ts +55 -0
- package/dist/src/entities/chats/namespace.d.ts +14 -0
- package/dist/src/entities/crm/comment.d.ts +43 -0
- package/dist/src/entities/crm/company.d.ts +70 -0
- package/dist/src/entities/crm/contact.d.ts +48 -0
- package/dist/src/entities/crm/namespace.d.ts +22 -0
- package/dist/src/entities/documents/comment.d.ts +41 -0
- package/dist/src/entities/documents/document.d.ts +130 -0
- package/dist/src/entities/documents/namespace.d.ts +43 -0
- package/dist/src/entities/documents/system-skill.d.ts +16 -0
- package/dist/src/entities/email/attachment.d.ts +36 -0
- package/dist/src/entities/email/label.d.ts +31 -0
- package/dist/src/entities/email/link.d.ts +29 -0
- package/dist/src/entities/email/message.d.ts +58 -0
- package/dist/src/entities/email/namespace.d.ts +49 -0
- package/dist/src/entities/email/thread.d.ts +88 -0
- package/dist/src/entities/entity.d.ts +101 -0
- package/dist/src/entities/favorites/namespace.d.ts +19 -0
- package/dist/src/entities/foreign/foreign-entity.d.ts +30 -0
- package/dist/src/entities/foreign/namespace.d.ts +7 -0
- package/dist/src/entities/notifications/namespace.d.ts +29 -0
- package/dist/src/entities/notifications/notification.d.ts +50 -0
- package/dist/src/entities/pins/namespace.d.ts +19 -0
- package/dist/src/entities/projects/namespace.d.ts +13 -0
- package/dist/src/entities/projects/project.d.ts +42 -0
- package/dist/src/entities/properties/namespace.d.ts +47 -0
- package/dist/src/entities/properties/property-definition.d.ts +45 -0
- package/dist/src/entities/properties/property-option.d.ts +32 -0
- package/dist/src/entities/search.d.ts +23 -0
- package/dist/src/entities/tasks/namespace.d.ts +21 -0
- package/dist/src/entities/tasks/task.d.ts +34 -0
- package/dist/src/entities/teams/namespace.d.ts +12 -0
- package/dist/src/entities/teams/team.d.ts +40 -0
- package/dist/src/entities/users/namespace.d.ts +10 -0
- package/dist/src/entities/users/user.d.ts +43 -0
- package/dist/src/entities/webhooks/namespace.d.ts +31 -0
- package/dist/src/entities/webhooks/webhook.d.ts +88 -0
- package/dist/src/events/hydrate/channel.d.ts +85 -0
- package/dist/src/events/hydrate/document.d.ts +54 -0
- package/dist/src/events/receiver.d.ts +51 -0
- package/dist/src/events/types.d.ts +40 -0
- package/dist/src/events/verify.d.ts +13 -0
- package/dist/src/local-portmap.d.ts +8 -0
- package/dist/src/macro.d.ts +62 -0
- package/dist/src/macro.js +4215 -0
- package/dist/src/mentions.d.ts +37 -0
- package/dist/src/raw.d.ts +12 -0
- package/dist/src/utils/client.d.ts +53 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/lazy.d.ts +18 -0
- package/dist/src/utils/pagination.d.ts +7 -0
- package/dist/src/utils/unwrap.d.ts +23 -0
- package/package.json +49 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
|
|
2
|
+
import type { GetUnfurlBulkData, GetUnfurlBulkErrors, GetUnfurlBulkResponses, GetUnfurlData, GetUnfurlErrors, GetUnfurlResponses, ProxyRequestHandlerData } from './types.gen';
|
|
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
|
+
declare class HeyApiClient {
|
|
17
|
+
protected client: Client;
|
|
18
|
+
constructor(args?: {
|
|
19
|
+
client?: Client;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
declare class HeyApiRegistry<T> {
|
|
23
|
+
private readonly defaultKey;
|
|
24
|
+
private readonly instances;
|
|
25
|
+
get(key?: string): T;
|
|
26
|
+
set(value: T, key?: string): void;
|
|
27
|
+
}
|
|
28
|
+
export declare class Sdk extends HeyApiClient {
|
|
29
|
+
static readonly __registry: HeyApiRegistry<Sdk>;
|
|
30
|
+
constructor(args?: {
|
|
31
|
+
client?: Client;
|
|
32
|
+
key?: string;
|
|
33
|
+
});
|
|
34
|
+
proxyRequestHandler<ThrowOnError extends boolean = false>(options: Options<ProxyRequestHandlerData, ThrowOnError>): RequestResult<unknown, unknown, ThrowOnError>;
|
|
35
|
+
/**
|
|
36
|
+
* Unfurl the URL passed via the `url` query parameter and return its
|
|
37
|
+
* extracted metadata (title, description, image, favicon).
|
|
38
|
+
*
|
|
39
|
+
* On success returns `200` with a [`GetUnfurlResponse`] body. On any
|
|
40
|
+
* failure returns `500` with a JSON `null` body — the response type is an
|
|
41
|
+
* `Option<GetUnfurlResponse>` so this contract is reflected in the
|
|
42
|
+
* signature and OpenAPI spec.
|
|
43
|
+
*/
|
|
44
|
+
getUnfurl<ThrowOnError extends boolean = false>(options: Options<GetUnfurlData, ThrowOnError>): RequestResult<GetUnfurlResponses, GetUnfurlErrors, ThrowOnError>;
|
|
45
|
+
getUnfurlBulk<ThrowOnError extends boolean = false>(options: Options<GetUnfurlBulkData, ThrowOnError>): RequestResult<GetUnfurlBulkResponses, GetUnfurlBulkErrors, ThrowOnError>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export type ClientOptions = {
|
|
2
|
+
baseUrl: `${string}://${string}` | (string & {});
|
|
3
|
+
};
|
|
4
|
+
export type GetUnfurlBulkBody = {
|
|
5
|
+
url_list: Array<string>;
|
|
6
|
+
};
|
|
7
|
+
export type GetUnfurlBulkResponse = {
|
|
8
|
+
responses: Vec;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Query parameters for `GET /unfurl`.
|
|
12
|
+
*/
|
|
13
|
+
export type GetUnfurlQueryParams = {
|
|
14
|
+
/**
|
|
15
|
+
* The URL to unfurl.
|
|
16
|
+
*/
|
|
17
|
+
url: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Unfurl response for a single URL: the URL itself plus any metadata that
|
|
21
|
+
* was extracted from the page's `<head>` (title, description, image,
|
|
22
|
+
* favicon).
|
|
23
|
+
*/
|
|
24
|
+
export type GetUnfurlResponse = {
|
|
25
|
+
/**
|
|
26
|
+
* The page description (from `og:description`), if any.
|
|
27
|
+
*/
|
|
28
|
+
description?: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* The page's favicon URL, if any.
|
|
31
|
+
*/
|
|
32
|
+
favicon_url?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* The page's preview image URL (from `og:image`), if any.
|
|
35
|
+
*/
|
|
36
|
+
image_url?: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* The page title (from custom URL parser, Open Graph, or `<title>`).
|
|
39
|
+
*/
|
|
40
|
+
title: string;
|
|
41
|
+
/**
|
|
42
|
+
* The URL that was unfurled.
|
|
43
|
+
*/
|
|
44
|
+
url: string;
|
|
45
|
+
};
|
|
46
|
+
export type ProxyParams = {
|
|
47
|
+
url: string;
|
|
48
|
+
};
|
|
49
|
+
export type Vec = Array<null | {
|
|
50
|
+
/**
|
|
51
|
+
* The page description (from `og:description`), if any.
|
|
52
|
+
*/
|
|
53
|
+
description?: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* The page's favicon URL, if any.
|
|
56
|
+
*/
|
|
57
|
+
favicon_url?: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* The page's preview image URL (from `og:image`), if any.
|
|
60
|
+
*/
|
|
61
|
+
image_url?: string | null;
|
|
62
|
+
/**
|
|
63
|
+
* The page title (from custom URL parser, Open Graph, or `<title>`).
|
|
64
|
+
*/
|
|
65
|
+
title: string;
|
|
66
|
+
/**
|
|
67
|
+
* The URL that was unfurled.
|
|
68
|
+
*/
|
|
69
|
+
url: string;
|
|
70
|
+
}>;
|
|
71
|
+
export type ProxyRequestHandlerData = {
|
|
72
|
+
body?: never;
|
|
73
|
+
path?: never;
|
|
74
|
+
query: {
|
|
75
|
+
/**
|
|
76
|
+
* The url to proxy from
|
|
77
|
+
*/
|
|
78
|
+
url: string;
|
|
79
|
+
};
|
|
80
|
+
url: '/proxy';
|
|
81
|
+
};
|
|
82
|
+
export type GetUnfurlData = {
|
|
83
|
+
body?: never;
|
|
84
|
+
path?: never;
|
|
85
|
+
query: {
|
|
86
|
+
/**
|
|
87
|
+
* The URL to unfurl.
|
|
88
|
+
*/
|
|
89
|
+
url: string;
|
|
90
|
+
};
|
|
91
|
+
url: '/unfurl';
|
|
92
|
+
};
|
|
93
|
+
export type GetUnfurlErrors = {
|
|
94
|
+
/**
|
|
95
|
+
* Unfurl failed; response body is JSON null.
|
|
96
|
+
*/
|
|
97
|
+
500: null | GetUnfurlResponse;
|
|
98
|
+
};
|
|
99
|
+
export type GetUnfurlError = GetUnfurlErrors[keyof GetUnfurlErrors];
|
|
100
|
+
export type GetUnfurlResponses = {
|
|
101
|
+
/**
|
|
102
|
+
* Unfurled metadata for the URL.
|
|
103
|
+
*/
|
|
104
|
+
200: GetUnfurlResponse;
|
|
105
|
+
};
|
|
106
|
+
export type GetUnfurlResponse2 = GetUnfurlResponses[keyof GetUnfurlResponses];
|
|
107
|
+
export type GetUnfurlBulkData = {
|
|
108
|
+
/**
|
|
109
|
+
* JSON list of URLs
|
|
110
|
+
*/
|
|
111
|
+
body: GetUnfurlBulkBody;
|
|
112
|
+
path?: never;
|
|
113
|
+
query?: never;
|
|
114
|
+
url: '/unfurl/bulk';
|
|
115
|
+
};
|
|
116
|
+
export type GetUnfurlBulkErrors = {
|
|
117
|
+
401: string;
|
|
118
|
+
404: string;
|
|
119
|
+
500: string;
|
|
120
|
+
};
|
|
121
|
+
export type GetUnfurlBulkError = GetUnfurlBulkErrors[keyof GetUnfurlBulkErrors];
|
|
122
|
+
export type GetUnfurlBulkResponses = {
|
|
123
|
+
200: GetUnfurlBulkResponse;
|
|
124
|
+
};
|
|
125
|
+
export type GetUnfurlBulkResponse2 = GetUnfurlBulkResponses[keyof GetUnfurlBulkResponses];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type Env = 'dev' | 'prod' | 'local';
|
|
2
|
+
/** The backend services the SDK talks to. Note `search` and `properties` are
|
|
3
|
+
* served on the storage host, so they point there. */
|
|
4
|
+
export type ServiceName = 'agent-harness' | 'storage' | 'auth' | 'email' | 'cognition' | 'notification' | 'properties' | 'search' | 'scheduled-action' | 'static-files' | 'connection' | 'contacts' | 'unfurl';
|
|
5
|
+
export declare const WEB_APP_URLS: Record<Env, string>;
|
|
6
|
+
export declare const HOSTS: Record<Env, Record<ServiceName, string>>;
|
|
7
|
+
/** A bearer token, or a (possibly async) function that returns one — the
|
|
8
|
+
* function form lets you refresh tokens without reconfiguring. */
|
|
9
|
+
export type TokenSource = string | (() => string | Promise<string>);
|
|
10
|
+
/** Access scope for bot-authenticated requests. `user` acts with the
|
|
11
|
+
* requested-as user's access (requires `requestedAs`); `team` acts with the
|
|
12
|
+
* bot's owning team's access (team-owned bots only). */
|
|
13
|
+
export type BotScope = 'user' | 'team';
|
|
14
|
+
/** How the SDK authenticates with Macro.
|
|
15
|
+
*
|
|
16
|
+
* - `user`: a human's Macro API token, sent as `Authorization: Bearer`.
|
|
17
|
+
* - `bot`: an `mbot_` API key, sent as `x-macro-bot-token` together with
|
|
18
|
+
* `x-macro-bot-scope`. When `scope` is omitted it defaults to `user` when
|
|
19
|
+
* `requestedAs` is set (user scope requires an acting user) and `team`
|
|
20
|
+
* otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export type MacroAuth = {
|
|
23
|
+
type: 'user';
|
|
24
|
+
token: TokenSource;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'bot';
|
|
27
|
+
token: TokenSource;
|
|
28
|
+
scope?: BotScope;
|
|
29
|
+
};
|
|
30
|
+
/** Options passed to `new Macro(opts)` and stored on `MacroClient`. */
|
|
31
|
+
export interface MacroOpts {
|
|
32
|
+
/** How to authenticate. Takes precedence over `token`. Falls back to the
|
|
33
|
+
* MACRO_API_KEY (user auth) or MACRO_BOT_TOKEN (bot auth) env var. */
|
|
34
|
+
auth?: MacroAuth;
|
|
35
|
+
/** Shorthand for `auth: { type: 'user', token }`. */
|
|
36
|
+
token?: TokenSource;
|
|
37
|
+
/** Which Macro environment to talk to. Falls back to the MACRO_ENV env
|
|
38
|
+
* var, then `'prod'`. */
|
|
39
|
+
env?: Env;
|
|
40
|
+
/** Override individual service hosts (e.g. point one at localhost). */
|
|
41
|
+
hosts?: Partial<Record<ServiceName, string>>;
|
|
42
|
+
/** Override the web app base URL (e.g. for local frontend dev). Also reads MACRO_WEB_URL. */
|
|
43
|
+
webAppUrl?: string;
|
|
44
|
+
/** Signing secret for verifying incoming webhooks. Falls back to MACRO_WEBHOOK_SECRET. */
|
|
45
|
+
webhookSecret?: string;
|
|
46
|
+
wsVerify?: string;
|
|
47
|
+
/** User id the bot acts for, sent as `x-macro-bot-for-macro-user-id` on
|
|
48
|
+
* every request. Bot auth only. Set via `macro.requestedAs(user)` rather
|
|
49
|
+
* than directly. */
|
|
50
|
+
requestedAs?: string;
|
|
51
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AgentAction, AgentActionId, AgentSessionLogResponse, AgentSessionResponse, SandboxSize } from '../../../generated/agent-harness/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
/** A managed or externally hosted coding-agent session. */
|
|
5
|
+
export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
|
|
6
|
+
/** A handle to an agent session by id. Details load on first access. */
|
|
7
|
+
static byId(client: MacroClient, id: string): AgentSession;
|
|
8
|
+
/** Create a managed session, optionally delivering its first prompt. */
|
|
9
|
+
static createManaged(client: MacroClient, opts?: {
|
|
10
|
+
prompt?: string;
|
|
11
|
+
}): Promise<AgentSession>;
|
|
12
|
+
protected fetch(): Promise<AgentSessionResponse>;
|
|
13
|
+
/** The session's user-facing display name. */
|
|
14
|
+
readonly name: () => Promise<string>;
|
|
15
|
+
/** The model currently configured for the session. */
|
|
16
|
+
readonly model: () => Promise<string>;
|
|
17
|
+
/** The agent harness implementation serving the session. */
|
|
18
|
+
readonly harness: () => Promise<string>;
|
|
19
|
+
/** The repository the agent works with, when one was supplied. */
|
|
20
|
+
readonly repoUrl: () => Promise<string | undefined>;
|
|
21
|
+
/** The directory in which the agent harness runs. */
|
|
22
|
+
readonly workspace: () => Promise<string>;
|
|
23
|
+
/** The session's latest runtime status. */
|
|
24
|
+
readonly status: () => Promise<import("../../../generated/agent-harness").SessionStatusDto>;
|
|
25
|
+
/** Compute tier of the managed sandbox. */
|
|
26
|
+
readonly sandboxSize: () => Promise<SandboxSize>;
|
|
27
|
+
/** When the session was created. */
|
|
28
|
+
readonly createdAt: () => Promise<string>;
|
|
29
|
+
/** When the session was last modified. */
|
|
30
|
+
readonly modifiedAt: () => Promise<string>;
|
|
31
|
+
/** Rename this session. */
|
|
32
|
+
rename(name: string): Promise<void>;
|
|
33
|
+
/** Resize this session's sandbox and remember the size as the owner's default. */
|
|
34
|
+
setSandboxSize(size: SandboxSize): Promise<SandboxSize>;
|
|
35
|
+
/** The caller's default sandbox size for new `@coder` sessions. */
|
|
36
|
+
static defaultSandboxSize(client: MacroClient): Promise<SandboxSize>;
|
|
37
|
+
/** Set the caller's default sandbox size for the next `@coder` mention. */
|
|
38
|
+
static setDefaultSandboxSize(client: MacroClient, size: SandboxSize): Promise<SandboxSize>;
|
|
39
|
+
/** Send a prompt or lifecycle operation to the live agent session. */
|
|
40
|
+
control(action: AgentAction): Promise<AgentActionId>;
|
|
41
|
+
/** Read the complete raw protocol log for this session. */
|
|
42
|
+
log(): Promise<AgentSessionLogResponse>;
|
|
43
|
+
/** Delete this session and any live resources it owns. */
|
|
44
|
+
delete(): Promise<void>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SandboxSize } from '../../../generated/agent-harness/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { AgentSession } from './agent-session';
|
|
4
|
+
/** Entry point for coding-agent sessions. */
|
|
5
|
+
export declare class AgentSessionNamespace {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: MacroClient);
|
|
8
|
+
/** A handle to an agent session by id. Details load on first access. */
|
|
9
|
+
byId(id: string): AgentSession;
|
|
10
|
+
/** Create a managed agent session. */
|
|
11
|
+
createManaged(opts?: {
|
|
12
|
+
prompt?: string;
|
|
13
|
+
}): Promise<AgentSession>;
|
|
14
|
+
/** The caller's default sandbox size for new `@coder` sessions. */
|
|
15
|
+
defaultSandboxSize(): Promise<SandboxSize>;
|
|
16
|
+
/** Set the caller's default sandbox size for the next `@coder` mention. */
|
|
17
|
+
setDefaultSandboxSize(size: SandboxSize): Promise<SandboxSize>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Bot, BotChannel } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
/**
|
|
4
|
+
* The authenticated bot's identity. Only meaningful with bot auth
|
|
5
|
+
* (`auth: { type: 'bot', token }`).
|
|
6
|
+
*/
|
|
7
|
+
export declare class BotsNamespace {
|
|
8
|
+
private readonly client;
|
|
9
|
+
constructor(client: MacroClient);
|
|
10
|
+
/**
|
|
11
|
+
* The authenticated bot's own record. Requires bot auth; with a user API
|
|
12
|
+
* key this throws (a user token has no bot identity).
|
|
13
|
+
*/
|
|
14
|
+
me(): Promise<Bot>;
|
|
15
|
+
/**
|
|
16
|
+
* Channels containing the authenticated bot. Requires bot auth.
|
|
17
|
+
*/
|
|
18
|
+
channels(): Promise<BotChannel[]>;
|
|
19
|
+
/**
|
|
20
|
+
* The authenticated bot's canonical principal id (`bot|<uuid>`) — the form
|
|
21
|
+
* used for bot mentions, senders, and webhook `ids` filters. Cached on the
|
|
22
|
+
* client; see {@link MacroClient.myPrincipalId}.
|
|
23
|
+
*/
|
|
24
|
+
myPrincipalId(): Promise<string>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { GetCallRecordResponses } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Channel } from '../channels/channel';
|
|
4
|
+
import { FavoritableEntity } from '../entity';
|
|
5
|
+
import { User } from '../users/user';
|
|
6
|
+
type CallRecordDetail = GetCallRecordResponses[200];
|
|
7
|
+
/** A Macro call record (an archived, or still active, channel call). */
|
|
8
|
+
export declare class CallRecord extends FavoritableEntity<CallRecordDetail> {
|
|
9
|
+
/** Favorites identify call records as `call`. */
|
|
10
|
+
readonly entityType = "call";
|
|
11
|
+
protected fetch(): Promise<CallRecordDetail>;
|
|
12
|
+
/** A handle to a call record by id. Details load on first access. */
|
|
13
|
+
static byId(client: MacroClient, id: string): CallRecord;
|
|
14
|
+
/** The call's display name (user-supplied or AI-generated; unset while active). */
|
|
15
|
+
readonly name: () => Promise<string | undefined>;
|
|
16
|
+
/** The channel the call belongs to. */
|
|
17
|
+
readonly channel: () => Promise<Channel>;
|
|
18
|
+
/** The display name of the channel the call belongs to. */
|
|
19
|
+
readonly channelName: () => Promise<string | undefined>;
|
|
20
|
+
/** The user who started the call. */
|
|
21
|
+
readonly creator: () => Promise<User>;
|
|
22
|
+
/** Whether the call is still in progress. */
|
|
23
|
+
readonly isActive: () => Promise<boolean>;
|
|
24
|
+
/** The call's status (undefined until set). */
|
|
25
|
+
readonly status: () => Promise<NonNullable<import("../../../generated/storage").CallStatus | null | undefined> | undefined>;
|
|
26
|
+
/** The realtime room the call runs in. */
|
|
27
|
+
readonly roomName: () => Promise<string>;
|
|
28
|
+
/** When the call started. */
|
|
29
|
+
readonly startedAt: () => Promise<string>;
|
|
30
|
+
/** When the call ended (undefined if still active). */
|
|
31
|
+
readonly endedAt: () => Promise<string | undefined>;
|
|
32
|
+
/** Call duration in milliseconds (undefined if still active). */
|
|
33
|
+
readonly durationMs: () => Promise<number | undefined>;
|
|
34
|
+
/** AI-generated summary of the call, once summarization has run. */
|
|
35
|
+
readonly summary: () => Promise<string | undefined>;
|
|
36
|
+
/** Transcript segments, ordered by sequence number. */
|
|
37
|
+
readonly transcript: () => Promise<import("../../../generated/storage").CallRecordTranscriptSegment[]>;
|
|
38
|
+
/** Participants, both active and historic. */
|
|
39
|
+
readonly participants: () => Promise<import("../../../generated/storage").CallRecordParticipant[]>;
|
|
40
|
+
/** Whether the recording is shared with the team. */
|
|
41
|
+
readonly shareWithTeam: () => Promise<boolean>;
|
|
42
|
+
/** URL of the call recording, once available. */
|
|
43
|
+
readonly recordingUrl: () => Promise<string | undefined>;
|
|
44
|
+
/** URL of the recording preview (thumbnail), once available. */
|
|
45
|
+
readonly recordingPreviewUrl: () => Promise<string | undefined>;
|
|
46
|
+
/** When the recording started, if it was recorded. */
|
|
47
|
+
readonly recordingStartedAt: () => Promise<string | undefined>;
|
|
48
|
+
/** Rename the call or clear the custom name. */
|
|
49
|
+
rename(name: string | null): Promise<void>;
|
|
50
|
+
/** Delete the call record. */
|
|
51
|
+
delete(): Promise<void>;
|
|
52
|
+
/** Search calls by name and transcript, most relevant first, auto-paginated. */
|
|
53
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<CallRecord, any, any>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { SearchOpts } from '../search';
|
|
3
|
+
import { CallRecord } from './call-record';
|
|
4
|
+
export declare class CallRecordNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: MacroClient);
|
|
7
|
+
byId(id: string): CallRecord;
|
|
8
|
+
search(query: string, opts?: SearchOpts): AsyncGenerator<CallRecord>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ChannelType, GetChannelAttachmentsResponses, GetChannelParticipantsResponses, GetChannelResponses, TypingAction } from '../../../generated/storage/types.gen';
|
|
2
|
+
import { type RichMessage } from '../../mentions';
|
|
3
|
+
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import { PropertiedEntity } from '../entity';
|
|
5
|
+
import type { Team } from '../teams/team';
|
|
6
|
+
import type { User } from '../users/user';
|
|
7
|
+
import { Message } from './message';
|
|
8
|
+
import type { Thread } from './thread';
|
|
9
|
+
type ChannelDetail = GetChannelResponses[200];
|
|
10
|
+
/** A member of a channel, with their role and join time. */
|
|
11
|
+
export type ChannelParticipant = GetChannelParticipantsResponses[200][number];
|
|
12
|
+
/** A file or entity attached to a message in a channel. */
|
|
13
|
+
export type ChannelAttachment = GetChannelAttachmentsResponses[200]['items'][number];
|
|
14
|
+
/**
|
|
15
|
+
* A channel.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Channel extends PropertiedEntity<ChannelDetail> {
|
|
18
|
+
/** Favorites identify channels as `channel`. */
|
|
19
|
+
readonly entityType = "channel";
|
|
20
|
+
/** The properties service identifies channels as `CHANNEL`. */
|
|
21
|
+
protected readonly propertyEntityType = "CHANNEL";
|
|
22
|
+
protected fetch(): Promise<ChannelDetail>;
|
|
23
|
+
/** A handle to a channel by id. Details load on first access. */
|
|
24
|
+
static byId(client: MacroClient, id: string): Channel;
|
|
25
|
+
/** Open (creating if needed) the DM channel with a user. */
|
|
26
|
+
static dm(client: MacroClient, recipient: User): Promise<Channel>;
|
|
27
|
+
/** Open (creating if needed) the private group channel with a set of users. */
|
|
28
|
+
static private(client: MacroClient, recipients: User[]): Promise<Channel>;
|
|
29
|
+
/** Create a channel. The caller becomes the owner. */
|
|
30
|
+
static create(client: MacroClient, opts: {
|
|
31
|
+
type: ChannelType;
|
|
32
|
+
name?: string;
|
|
33
|
+
/** Participants to add, excluding the owner. */
|
|
34
|
+
participants?: User[];
|
|
35
|
+
/** Team, for team channels. */
|
|
36
|
+
team?: Team;
|
|
37
|
+
}): Promise<Channel>;
|
|
38
|
+
/** The channel's display name, resolved from the viewer's perspective. */
|
|
39
|
+
readonly name: () => Promise<string>;
|
|
40
|
+
/** The channel's type (e.g. `public`, `dm`, `private`). */
|
|
41
|
+
readonly type: () => Promise<ChannelType>;
|
|
42
|
+
/**
|
|
43
|
+
* Post a message. Plain text, or a rich body composed with `msg`.
|
|
44
|
+
*
|
|
45
|
+
* Works with a channel webhook token as well as a normal one — see
|
|
46
|
+
* {@link postToChannel} for which endpoint that picks and what it costs.
|
|
47
|
+
*/
|
|
48
|
+
send(body: string | RichMessage, opts?: {
|
|
49
|
+
thread?: Thread;
|
|
50
|
+
}): Promise<Message>;
|
|
51
|
+
/** The messages in this channel, most recent first, auto-paginated. */
|
|
52
|
+
messages(opts?: {
|
|
53
|
+
pageSize?: number;
|
|
54
|
+
}): AsyncGenerator<Message>;
|
|
55
|
+
/** A handle to a message in this channel by id. */
|
|
56
|
+
message(id: string): Message;
|
|
57
|
+
/** Rename the channel. */
|
|
58
|
+
rename(name: string): Promise<void>;
|
|
59
|
+
/** Delete the channel. This is not reversible. */
|
|
60
|
+
delete(): Promise<void>;
|
|
61
|
+
/** Join the channel as the current user. */
|
|
62
|
+
join(): Promise<void>;
|
|
63
|
+
/** A reusable code that lets a user join this channel. */
|
|
64
|
+
joinCode(): Promise<string>;
|
|
65
|
+
/** Leave the channel as the current user. */
|
|
66
|
+
leave(): Promise<void>;
|
|
67
|
+
/** The channel's members, with their roles and join times. */
|
|
68
|
+
participants(): Promise<ChannelParticipant[]>;
|
|
69
|
+
/** Add users to the channel. */
|
|
70
|
+
addParticipants(users: User[]): Promise<void>;
|
|
71
|
+
/** Remove users from the channel. */
|
|
72
|
+
removeParticipants(users: User[]): Promise<void>;
|
|
73
|
+
/** Broadcast a typing indicator, optionally scoped to a thread. */
|
|
74
|
+
typing(action: TypingAction, opts?: {
|
|
75
|
+
thread?: Thread;
|
|
76
|
+
}): Promise<void>;
|
|
77
|
+
/** The attachments posted in this channel, auto-paginated. */
|
|
78
|
+
attachments(opts?: {
|
|
79
|
+
pageSize?: number;
|
|
80
|
+
/** Filter by type: `static` for images/videos, `dss` for documents. */
|
|
81
|
+
type?: string;
|
|
82
|
+
}): AsyncGenerator<ChannelAttachment>;
|
|
83
|
+
/** The channel's URL in the Macro web app. */
|
|
84
|
+
webUrl(): string;
|
|
85
|
+
/** Search channels by content, most relevant first, auto-paginated. */
|
|
86
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<Channel, any, any>;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { GetChannelMessagesResponses, GetMessageWithContextResponses, GetThreadRepliesResponses } from '../../../generated/storage/types.gen';
|
|
2
|
+
import { type RichMessage, type SimpleMention } from '../../mentions';
|
|
3
|
+
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import { FavoritableEntity } from '../entity';
|
|
5
|
+
import { User } from '../users/user';
|
|
6
|
+
import { Channel } from './channel';
|
|
7
|
+
import { Thread } from './thread';
|
|
8
|
+
type ChannelMessage = GetChannelMessagesResponses[200]['items'][number];
|
|
9
|
+
type ThreadReply = GetThreadRepliesResponses[200][number];
|
|
10
|
+
type ContextMessage = GetMessageWithContextResponses[200]['messages'][number];
|
|
11
|
+
/** The API's representation of a channel message, in any of the forms it's returned. */
|
|
12
|
+
export type MessageData = ChannelMessage | ThreadReply | ContextMessage;
|
|
13
|
+
/**
|
|
14
|
+
* A message in a channel. A thin handle: `id` and `channelId` are known up
|
|
15
|
+
* front, and record-backed fields (`content`, `author`) load lazily on first
|
|
16
|
+
* access and cache. Actions carry the ids for you.
|
|
17
|
+
*/
|
|
18
|
+
export declare class Message extends FavoritableEntity<MessageData> {
|
|
19
|
+
readonly channelId: string;
|
|
20
|
+
/** Entities mentioned in this message. Populated for event-delivered
|
|
21
|
+
* messages; empty otherwise, since the REST API doesn't return mentions inline. */
|
|
22
|
+
readonly mentions: SimpleMention[];
|
|
23
|
+
/** Favorites identify channel messages as `channel_message`. */
|
|
24
|
+
readonly entityType = "channel_message";
|
|
25
|
+
private constructor();
|
|
26
|
+
protected fetch(): Promise<MessageData>;
|
|
27
|
+
/** A handle to a message by id. Fields load on first access. */
|
|
28
|
+
static byId(client: MacroClient, channelId: string, id: string, mentions?: SimpleMention[]): Message;
|
|
29
|
+
/** Build a message from a list-endpoint record (pre-seeded, no fetch). */
|
|
30
|
+
static from(client: MacroClient, data: ChannelMessage, mentions?: SimpleMention[]): Message;
|
|
31
|
+
/** Build a message from a thread-reply record (pre-seeded, no fetch). */
|
|
32
|
+
static fromReply(client: MacroClient, channelId: string, reply: ThreadReply, mentions?: SimpleMention[]): Message;
|
|
33
|
+
/** Build a message from a webhook event record (pre-seeded, no fetch). */
|
|
34
|
+
static received(client: MacroClient, channelId: string, data: MessageData, mentions?: SimpleMention[]): Message;
|
|
35
|
+
/** The message body. */
|
|
36
|
+
readonly content: () => Promise<string>;
|
|
37
|
+
/** When the message was created. */
|
|
38
|
+
readonly createdAt: () => Promise<string>;
|
|
39
|
+
/** When the message was last edited, if it has been. */
|
|
40
|
+
readonly editedAt: () => Promise<string | undefined>;
|
|
41
|
+
/** When the message was last updated. */
|
|
42
|
+
readonly updatedAt: () => Promise<string>;
|
|
43
|
+
/** The user who sent this message. */
|
|
44
|
+
author(): Promise<User>;
|
|
45
|
+
/** The channel this message is in. */
|
|
46
|
+
channel(): Channel;
|
|
47
|
+
/** The thread rooted at this message. */
|
|
48
|
+
thread(): Thread;
|
|
49
|
+
/** Add an emoji reaction to this message. */
|
|
50
|
+
react(emoji: string): Promise<this>;
|
|
51
|
+
/** Remove one of your emoji reactions from this message. */
|
|
52
|
+
unreact(emoji: string): Promise<this>;
|
|
53
|
+
/**
|
|
54
|
+
* Replace this message's body.
|
|
55
|
+
*
|
|
56
|
+
* @param body - Plain text, or a rich body composed with {@link msg}.
|
|
57
|
+
*/
|
|
58
|
+
edit(body: string | RichMessage): Promise<this>;
|
|
59
|
+
/** Delete this message. */
|
|
60
|
+
delete(): Promise<void>;
|
|
61
|
+
/** Post a reply in this message's thread. */
|
|
62
|
+
reply(body: string | RichMessage): Promise<Message>;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChannelType } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { SearchOpts } from '../search';
|
|
4
|
+
import type { Team } from '../teams/team';
|
|
5
|
+
import type { User } from '../users/user';
|
|
6
|
+
import { Channel } from './channel';
|
|
7
|
+
export declare class ChannelNamespace {
|
|
8
|
+
private readonly client;
|
|
9
|
+
constructor(client: MacroClient);
|
|
10
|
+
byId(id: string): Channel;
|
|
11
|
+
dm(recipient: User): Promise<Channel>;
|
|
12
|
+
/** Open (creating if needed) the private group channel with a set of users. */
|
|
13
|
+
private(recipients: User[]): Promise<Channel>;
|
|
14
|
+
/** Create a channel. The caller becomes the owner. */
|
|
15
|
+
create(opts: {
|
|
16
|
+
type: ChannelType;
|
|
17
|
+
name?: string;
|
|
18
|
+
/** Participants to add, excluding the owner. */
|
|
19
|
+
participants?: User[];
|
|
20
|
+
/** Team, for team channels. */
|
|
21
|
+
team?: Team;
|
|
22
|
+
}): Promise<Channel>;
|
|
23
|
+
/** All channels the authenticated user is a member of. */
|
|
24
|
+
list(): Promise<Channel[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Search channels by name (client-side fuzzy filter on the full channel list)
|
|
27
|
+
* or by content (server-side unified search).
|
|
28
|
+
*/
|
|
29
|
+
search(query: string, opts?: SearchOpts): AsyncGenerator<Channel>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RichMessage } from '../../mentions';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { Channel } from './channel';
|
|
4
|
+
import type { Thread } from './thread';
|
|
5
|
+
/**
|
|
6
|
+
* Post a message using the endpoint supported by the caller's credentials.
|
|
7
|
+
*
|
|
8
|
+
* Most credentials use `POST /channels/{id}/message`. User-owned bots without
|
|
9
|
+
* an acting user instead use `POST /channels/{id}/webhook`, which authorizes
|
|
10
|
+
* through channel membership. The bot owner is read from `GET /bots/me` and
|
|
11
|
+
* cached by the client.
|
|
12
|
+
*
|
|
13
|
+
* The webhook endpoint supports content only. Mentions in `<m-*>` tags still
|
|
14
|
+
* work, but threads and attachments are not supported.
|
|
15
|
+
*
|
|
16
|
+
* Posting to a `Thread` puts the message in that thread; to a `Channel`, at the
|
|
17
|
+
* channel root. One target rather than a channel plus a thread id, so the two
|
|
18
|
+
* can't disagree.
|
|
19
|
+
*/
|
|
20
|
+
export declare function postToChannel(client: MacroClient, target: Channel | Thread, body: RichMessage): Promise<string>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type RichMessage } from '../../mentions';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Channel } from './channel';
|
|
4
|
+
import { Message } from './message';
|
|
5
|
+
/**
|
|
6
|
+
* A thread within a channel, rooted at a top-level message. Replies and
|
|
7
|
+
* thread-scoped posting live here.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Thread {
|
|
10
|
+
private readonly client;
|
|
11
|
+
readonly channelId: string;
|
|
12
|
+
/** The id of the message this thread hangs off. */
|
|
13
|
+
readonly rootId: string;
|
|
14
|
+
constructor(client: MacroClient, channelId: string,
|
|
15
|
+
/** The id of the message this thread hangs off. */
|
|
16
|
+
rootId: string);
|
|
17
|
+
/** The channel this thread is in. */
|
|
18
|
+
channel(): Channel;
|
|
19
|
+
/** The message this thread hangs off. */
|
|
20
|
+
root(): Message;
|
|
21
|
+
/** List the replies in this thread, oldest first. */
|
|
22
|
+
replies(): Promise<Message[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Post a reply in this thread.
|
|
25
|
+
*
|
|
26
|
+
* @param body - Plain text, or a rich body composed with {@link msg}.
|
|
27
|
+
* @returns The created reply.
|
|
28
|
+
*/
|
|
29
|
+
reply(body: string | RichMessage): Promise<Message>;
|
|
30
|
+
}
|