@macro-inc/sdk 0.0.1 → 0.2.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/README.md +628 -21
- package/dist/{chunk-5HAKQN23.js → chunk-7LVVPVNT.js} +70 -57
- package/dist/{chunk-JXIQT5TH.js → chunk-7YJ6Y7HJ.js} +234 -16
- package/dist/chunk-LMJW65ML.js +836 -0
- package/dist/{chunk-SGAHIERJ.js → chunk-OGE7WXJE.js} +16 -0
- package/dist/chunk-PRUFPW3B.js +943 -0
- package/dist/{chunk-CTKR64MY.js → chunk-QVBNNMQS.js} +242 -367
- package/dist/{chunk-QNUS5BC5.js → chunk-SUINKDXF.js} +30 -84
- package/dist/{chunk-77EI4LSQ.js → chunk-ZQXOHNDB.js} +1518 -386
- package/dist/generated/agent-harness/index.d.ts +1 -1
- package/dist/generated/agent-harness/index.js +1 -1
- package/dist/generated/agent-harness/sdk.gen.d.ts +174 -4
- package/dist/generated/agent-harness/types.gen.d.ts +2511 -189
- package/dist/generated/auth/index.d.ts +1 -1
- package/dist/generated/auth/index.js +1 -1
- package/dist/generated/auth/sdk.gen.d.ts +106 -8
- package/dist/generated/auth/types.gen.d.ts +1473 -116
- package/dist/generated/calendar/client/client.gen.d.ts +2 -0
- package/dist/generated/calendar/client/index.d.ts +10 -0
- package/dist/generated/calendar/client/types.gen.d.ts +120 -0
- package/dist/generated/calendar/client/utils.gen.d.ts +37 -0
- package/dist/generated/calendar/client.gen.d.ts +12 -0
- package/dist/generated/calendar/core/auth.gen.d.ts +25 -0
- package/dist/generated/calendar/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/calendar/core/params.gen.d.ts +43 -0
- package/dist/generated/calendar/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/calendar/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/calendar/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/calendar/core/types.gen.d.ts +83 -0
- package/dist/generated/calendar/core/utils.gen.d.ts +19 -0
- package/dist/generated/calendar/index.d.ts +2 -0
- package/dist/generated/calendar/index.js +6 -0
- package/dist/generated/calendar/sdk.gen.d.ts +95 -0
- package/dist/generated/calendar/types.gen.d.ts +1091 -0
- package/dist/generated/cognition/index.d.ts +1 -1
- package/dist/generated/cognition/index.js +1 -1
- package/dist/generated/cognition/sdk.gen.d.ts +6 -1
- package/dist/generated/cognition/types.gen.d.ts +304 -36
- package/dist/generated/connection/types.gen.d.ts +1 -1
- package/dist/generated/email/index.d.ts +1 -1
- package/dist/generated/email/index.js +1 -1
- package/dist/generated/email/sdk.gen.d.ts +32 -27
- package/dist/generated/email/types.gen.d.ts +586 -409
- package/dist/generated/notification/index.d.ts +1 -1
- package/dist/generated/notification/types.gen.d.ts +384 -19
- package/dist/generated/properties/types.gen.d.ts +8 -5
- package/dist/generated/scheduled-action/index.d.ts +1 -1
- package/dist/generated/scheduled-action/index.js +3 -842
- package/dist/generated/scheduled-action/sdk.gen.d.ts +3 -1
- package/dist/generated/scheduled-action/types.gen.d.ts +277 -41
- package/dist/generated/search/index.d.ts +1 -1
- package/dist/generated/search/types.gen.d.ts +262 -43
- package/dist/generated/storage/index.d.ts +1 -1
- package/dist/generated/storage/index.js +1 -1
- package/dist/generated/storage/sdk.gen.d.ts +678 -107
- package/dist/generated/storage/types.gen.d.ts +14827 -5995
- package/dist/generated/unfurl/index.d.ts +1 -1
- package/dist/generated/unfurl/index.js +3 -832
- package/dist/generated/unfurl/types.gen.d.ts +20 -0
- package/dist/src/config.d.ts +33 -13
- package/dist/src/entities/agent-sessions/agent-session.d.ts +150 -6
- package/dist/src/entities/agent-sessions/code-execution.d.ts +43 -0
- package/dist/src/entities/agent-sessions/conversation.d.ts +54 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +23 -5
- package/dist/src/entities/agent-sessions/queued-action.d.ts +46 -0
- package/dist/src/entities/agent-sessions/review.d.ts +107 -0
- package/dist/src/entities/agent-sessions/tool-approval.d.ts +21 -0
- package/dist/src/entities/agents/agent.d.ts +47 -0
- package/dist/src/entities/agents/namespace.d.ts +13 -0
- package/dist/src/entities/ai/namespace.d.ts +24 -0
- package/dist/src/entities/api-keys/api-key.d.ts +17 -0
- package/dist/src/entities/api-keys/namespace.d.ts +18 -0
- package/dist/src/entities/calendar/calendar.d.ts +35 -0
- package/dist/src/entities/calendar/event.d.ts +123 -0
- package/dist/src/entities/calendar/event.test.d.ts +1 -0
- package/dist/src/entities/calendar/namespace.d.ts +111 -0
- package/dist/src/entities/calendar/replacement.d.ts +15 -0
- package/dist/src/entities/calls/call-record.d.ts +62 -6
- package/dist/src/entities/calls/message.d.ts +33 -0
- package/dist/src/entities/channels/activity.d.ts +24 -0
- package/dist/src/entities/channels/channel.d.ts +44 -3
- package/dist/src/entities/channels/labels.d.ts +39 -0
- package/dist/src/entities/channels/message.d.ts +9 -17
- package/dist/src/entities/channels/namespace.d.ts +6 -0
- package/dist/src/entities/channels/picture.d.ts +11 -0
- package/dist/src/entities/channels/post.d.ts +1 -1
- package/dist/src/entities/channels/thread.d.ts +5 -0
- package/dist/src/entities/chats/chat.d.ts +11 -1
- package/dist/src/entities/chats/generation.d.ts +46 -0
- package/dist/src/entities/crm/comment.d.ts +55 -34
- package/dist/src/entities/crm/company.d.ts +42 -10
- package/dist/src/entities/crm/contact.d.ts +42 -10
- package/dist/src/entities/crm/namespace.d.ts +18 -1
- package/dist/src/entities/crm/pipeline.d.ts +122 -0
- package/dist/src/entities/crm/pipelines.d.ts +14 -0
- package/dist/src/entities/databases/column.d.ts +75 -0
- package/dist/src/entities/databases/database.d.ts +272 -0
- package/dist/src/entities/databases/namespace.d.ts +21 -0
- package/dist/src/entities/databases/query.d.ts +86 -0
- package/dist/src/entities/databases/row.d.ts +27 -0
- package/dist/src/entities/databases/table.d.ts +61 -0
- package/dist/src/entities/databases/view.d.ts +40 -0
- package/dist/src/entities/databases/webhook.d.ts +32 -0
- package/dist/src/entities/documents/anchor.d.ts +29 -0
- package/dist/src/entities/documents/comment.d.ts +25 -22
- package/dist/src/entities/documents/document.d.ts +60 -12
- package/dist/src/entities/documents/namespace.d.ts +30 -0
- package/dist/src/entities/documents/version.d.ts +22 -0
- package/dist/src/entities/email/draft.d.ts +79 -0
- package/dist/src/entities/email/filter.d.ts +34 -0
- package/dist/src/entities/email/link.d.ts +6 -4
- package/dist/src/entities/email/message.d.ts +12 -1
- package/dist/src/entities/email/namespace.d.ts +34 -1
- package/dist/src/entities/email/thread.d.ts +23 -1
- package/dist/src/entities/entity-mentions/mention.d.ts +16 -0
- package/dist/src/entities/entity-mentions/namespace.d.ts +12 -0
- package/dist/src/entities/entity.d.ts +7 -0
- package/dist/src/entities/favorites/namespace.d.ts +14 -2
- package/dist/src/entities/foreign/foreign-entity.d.ts +2 -0
- package/dist/src/entities/foreign/namespace.d.ts +40 -0
- package/dist/src/entities/forms/form.d.ts +227 -0
- package/dist/src/entities/forms/namespace.d.ts +18 -0
- package/dist/src/entities/forms/question.d.ts +37 -0
- package/dist/src/entities/forms/response.d.ts +32 -0
- package/dist/src/entities/forms/section.d.ts +19 -0
- package/dist/src/entities/github-pull-requests/namespace.d.ts +12 -0
- package/dist/src/entities/github-pull-requests/pull-request.d.ts +52 -0
- package/dist/src/entities/harnesses/harness.d.ts +19 -0
- package/dist/src/entities/harnesses/namespace.d.ts +33 -0
- package/dist/src/entities/harnesses/pairing.d.ts +39 -0
- package/dist/src/entities/initiatives/initiative.d.ts +50 -0
- package/dist/src/entities/initiatives/namespace.d.ts +13 -0
- package/dist/src/entities/meetings/meeting.d.ts +38 -0
- package/dist/src/entities/meetings/namespace.d.ts +18 -0
- package/dist/src/entities/messages/thread.d.ts +101 -0
- package/dist/src/entities/notifications/notification.d.ts +6 -3
- package/dist/src/entities/notifications/notification.test.d.ts +1 -0
- package/dist/src/entities/projects/project.d.ts +7 -0
- package/dist/src/entities/reference.d.ts +82 -0
- package/dist/src/entities/routines/namespace.d.ts +15 -0
- package/dist/src/entities/routines/routine.d.ts +115 -0
- package/dist/src/entities/sharing/access.d.ts +65 -0
- package/dist/src/entities/sharing/permissions.d.ts +13 -0
- package/dist/src/entities/tasks/namespace.d.ts +4 -0
- package/dist/src/entities/tasks/task.d.ts +6 -0
- package/dist/src/entities/unfurls/namespace.d.ts +10 -0
- package/dist/src/entities/webhooks/webhook.d.ts +3 -1
- package/dist/src/entities/workspace/items.d.ts +7 -0
- package/dist/src/entities/workspace/namespace.d.ts +83 -0
- package/dist/src/entities/workspace/query.d.ts +12 -0
- package/dist/src/entities/workspace/types.d.ts +96 -0
- package/dist/src/events/hydrate/agentSession.d.ts +192 -0
- package/dist/src/events/hydrate/channel.d.ts +2 -39
- package/dist/src/events/hydrate/message.d.ts +70 -0
- package/dist/src/events/receiver.d.ts +57 -19
- package/dist/src/events/types.d.ts +3 -1
- package/dist/src/macro.d.ts +80 -3
- package/dist/src/macro.js +8832 -2784
- package/dist/src/utils/activity.d.ts +11 -0
- package/dist/src/utils/activity.test.d.ts +1 -0
- package/dist/src/utils/client.d.ts +10 -1
- package/dist/src/utils/concurrency.d.ts +5 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/pagination.d.ts +9 -4
- package/package.json +11 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Agent as AgentRecord, CreateAgentRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Channel } from '../channels/channel';
|
|
4
|
+
import { MacroEntity } from '../entity';
|
|
5
|
+
import { Harness } from '../harnesses/harness';
|
|
6
|
+
import type { Team } from '../teams/team';
|
|
7
|
+
/** Agent creation and replacement settings. */
|
|
8
|
+
export type AgentOptions = Omit<CreateAgentRequest, 'channel_ids' | 'team_id' | 'harness_id' | 'auto_accept_permissions' | 'avatar_url' | 'channel_scope' | 'default_model' | 'is_coding'> & {
|
|
9
|
+
/** Channels the agent can access. */
|
|
10
|
+
channels?: Channel[];
|
|
11
|
+
/** Owning team. */
|
|
12
|
+
team?: Team;
|
|
13
|
+
/** Host running the agent. */
|
|
14
|
+
host?: Harness;
|
|
15
|
+
/** Whether tool permissions are automatically accepted. */
|
|
16
|
+
autoAcceptPermissions?: boolean;
|
|
17
|
+
/** Avatar URL. */
|
|
18
|
+
avatarUrl?: string;
|
|
19
|
+
/** Channel visibility policy. */
|
|
20
|
+
channelScope: CreateAgentRequest['channel_scope'];
|
|
21
|
+
/** Default model. */
|
|
22
|
+
defaultModel: string;
|
|
23
|
+
/** Whether this is a coding agent. */
|
|
24
|
+
isCoding: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** A configurable agent backed by a bot identity. */
|
|
27
|
+
export declare class Agent extends MacroEntity<AgentRecord> {
|
|
28
|
+
/** Construct a lazy agent handle. */
|
|
29
|
+
static byId(client: MacroClient, id: string): Agent;
|
|
30
|
+
/** Seed from a listed or created agent. */
|
|
31
|
+
static from(client: MacroClient, record: AgentRecord): Agent;
|
|
32
|
+
protected fetch(): Promise<AgentRecord>;
|
|
33
|
+
/** Display name. */
|
|
34
|
+
readonly name: () => Promise<string>;
|
|
35
|
+
/** Agent instructions. */
|
|
36
|
+
readonly instructions: () => Promise<string>;
|
|
37
|
+
/** Default model. */
|
|
38
|
+
readonly defaultModel: () => Promise<string>;
|
|
39
|
+
/** Visible channels. */
|
|
40
|
+
readonly channels: () => Promise<Channel[]>;
|
|
41
|
+
/** Host running this agent. */
|
|
42
|
+
readonly host: () => Promise<Harness | undefined>;
|
|
43
|
+
/** Replace agent settings. */
|
|
44
|
+
update(options: AgentOptions): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/** Convert entity references into the generated agent request. */
|
|
47
|
+
export declare function agentBody(options: AgentOptions): CreateAgentRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import { Agent, type AgentOptions } from './agent';
|
|
3
|
+
/** Configurable agents. */
|
|
4
|
+
export declare class AgentNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: MacroClient);
|
|
7
|
+
/** Construct a lazy agent handle. */
|
|
8
|
+
byId(id: string): Agent;
|
|
9
|
+
/** All accessible agents. */
|
|
10
|
+
list(): Promise<Agent[]>;
|
|
11
|
+
/** Create an agent. */
|
|
12
|
+
create(options: AgentOptions): Promise<Agent>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DecisionRequest, DecisionResponse, StructuredCompletionRequest, StructuredCompletionResponse, UsageRequest } from '../../../generated/cognition/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { User } from '../users/user';
|
|
4
|
+
export type { DecisionRequest, DecisionResponse, StructuredCompletionRequest, StructuredCompletionResponse, };
|
|
5
|
+
/** Shared cognition endpoints, charged to the authenticated acting user. */
|
|
6
|
+
export declare class AiNamespace {
|
|
7
|
+
private readonly client;
|
|
8
|
+
/** Read AI usage over a time range, optionally restricting it to users. */
|
|
9
|
+
usage(options?: Omit<UsageRequest, 'include_users'> & {
|
|
10
|
+
users?: User[];
|
|
11
|
+
}): Promise<import("../../../generated/cognition").UsageSummary>;
|
|
12
|
+
constructor(client: MacroClient);
|
|
13
|
+
/**
|
|
14
|
+
* Generate an answer matching a JSON Schema. Set toolset to { type: 'none' }
|
|
15
|
+
* to use only supplied context. Other toolsets can perform the requested
|
|
16
|
+
* actions; always inspect outcome and toolActivity, including interruptions.
|
|
17
|
+
*/
|
|
18
|
+
structuredCompletion(request: StructuredCompletionRequest): Promise<StructuredCompletionResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Ask named yes/no questions about JSON input. Each probability estimates
|
|
21
|
+
* yes, from 0 to 1. This classifies supplied data without running tools.
|
|
22
|
+
*/
|
|
23
|
+
decide(request: DecisionRequest): Promise<DecisionResponse>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { UserApiKeyInfo } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
/** A user API key's metadata. Secrets are returned only at creation. */
|
|
5
|
+
export declare class UserApiKey extends MacroEntity<UserApiKeyInfo> {
|
|
6
|
+
/** Construct a lazy key handle. */
|
|
7
|
+
static byId(client: MacroClient, id: string): UserApiKey;
|
|
8
|
+
/** Seed from metadata, deliberately excluding the secret. */
|
|
9
|
+
static from(client: MacroClient, record: UserApiKeyInfo): UserApiKey;
|
|
10
|
+
protected fetch(): Promise<UserApiKeyInfo>;
|
|
11
|
+
/** Human readable label. */
|
|
12
|
+
readonly name: () => Promise<string>;
|
|
13
|
+
/** Creation time. */
|
|
14
|
+
readonly createdAt: () => Promise<string>;
|
|
15
|
+
/** Revoke this key. */
|
|
16
|
+
delete(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import { UserApiKey } from './api-key';
|
|
3
|
+
/** User API key management. */
|
|
4
|
+
export declare class ApiKeyNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: MacroClient);
|
|
7
|
+
/** Construct a lazy key handle. */
|
|
8
|
+
byId(id: string): UserApiKey;
|
|
9
|
+
/** List metadata for the caller's API keys. */
|
|
10
|
+
list(): Promise<UserApiKey[]>;
|
|
11
|
+
/** Create a key. Save the secret now; it cannot be retrieved later. */
|
|
12
|
+
create(name: string): Promise<{
|
|
13
|
+
key: UserApiKey;
|
|
14
|
+
secret: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** Exchange an email address for a Macro API token, subject to server authorization. */
|
|
17
|
+
tokenForEmail(email: string): Promise<import("../../../generated/auth").MacroApiTokenResponse>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { VisibleCalendar } from '../../../generated/calendar/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Link } from '../email/link';
|
|
4
|
+
import { MacroEntity } from '../entity';
|
|
5
|
+
/**
|
|
6
|
+
* A calendar visible to the requester across their connected inboxes: a
|
|
7
|
+
* free-to-construct handle whose detail resolves from the caller's calendar
|
|
8
|
+
* list. There is no fetch-by-id endpoint, so a bare {@link Calendar.byId}
|
|
9
|
+
* handle loads its detail by listing the caller's calendars and matching on id.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Calendar extends MacroEntity<VisibleCalendar> {
|
|
12
|
+
/** Set whether this calendar contributes to the caller's availability. */
|
|
13
|
+
setContributesToAvailability(contributesToAvailability: boolean): Promise<void>;
|
|
14
|
+
protected fetch(): Promise<VisibleCalendar>;
|
|
15
|
+
/** A handle to a calendar by id. Detail loads on first access. */
|
|
16
|
+
static byId(client: MacroClient, id: string): Calendar;
|
|
17
|
+
/** The caller's visible calendars, primaries and writable first. */
|
|
18
|
+
static list(client: MacroClient): Promise<Calendar[]>;
|
|
19
|
+
/** Provider display name. */
|
|
20
|
+
readonly name: () => Promise<string>;
|
|
21
|
+
/** Connected inbox address that syncs this calendar. */
|
|
22
|
+
readonly emailAddress: () => Promise<string>;
|
|
23
|
+
/** Whether this is its account's primary calendar. */
|
|
24
|
+
readonly isPrimary: () => Promise<boolean>;
|
|
25
|
+
/** Whether the grant can create and modify events on this calendar. */
|
|
26
|
+
readonly isWritable: () => Promise<boolean>;
|
|
27
|
+
/** Whether this is a subscribed system calendar (holidays, birthdays). */
|
|
28
|
+
readonly isSubscription: () => Promise<boolean>;
|
|
29
|
+
/** Provider color, when set. */
|
|
30
|
+
readonly color: () => Promise<string | undefined>;
|
|
31
|
+
/** A persistent per-calendar sync failure, surfaced for settings badges. */
|
|
32
|
+
readonly syncError: () => Promise<string | undefined>;
|
|
33
|
+
/** The connected inbox (email link) that syncs this calendar. */
|
|
34
|
+
readonly emailLink: () => Promise<Link>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { AttendeeResponseStatus, CalendarAttendeeInputBody, CalendarDeletionScopeParam, CalendarEvent as CalendarEventRecord, CalendarRsvpScopeParam, CalendarUpdateScopeParam, ConferenceChange, EventReminders, EventTime, EventTransparency, EventVisibility, OutOfOfficeProperties } from '../../../generated/calendar/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import { Calendar } from './calendar';
|
|
5
|
+
import { CalendarReplacement } from './replacement';
|
|
6
|
+
/** Fields to change on an event; omitted fields are left untouched. */
|
|
7
|
+
export interface UpdateEventOptions {
|
|
8
|
+
/** Replacement title; an empty string clears it. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Replacement description; an empty string clears it. */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** Replacement location; an empty string clears it. */
|
|
13
|
+
location?: string;
|
|
14
|
+
/** Replacement time. */
|
|
15
|
+
time?: EventTime;
|
|
16
|
+
/** Replacement attendee list. */
|
|
17
|
+
attendees?: CalendarAttendeeInputBody[];
|
|
18
|
+
/** Replacement recurrence properties; an empty list clears them. */
|
|
19
|
+
recurrenceLines?: string[];
|
|
20
|
+
/** Replacement visibility. */
|
|
21
|
+
visibility?: EventVisibility;
|
|
22
|
+
/** Replacement availability behavior. */
|
|
23
|
+
transparency?: EventTransparency;
|
|
24
|
+
/** Replacement reminder configuration. */
|
|
25
|
+
reminders?: EventReminders;
|
|
26
|
+
/** Provider conference change; omit to retain it. Outlook removal requires a
|
|
27
|
+
* separately confirmed replacement via prepareReplacement(). */
|
|
28
|
+
conference?: ConferenceChange;
|
|
29
|
+
/** Replacement out-of-office properties, applied only to an event that is
|
|
30
|
+
* already out-of-office. */
|
|
31
|
+
outOfOffice?: OutOfOfficeProperties;
|
|
32
|
+
/** How much of a recurring series the update covers. Omit to let
|
|
33
|
+
* `recurrenceId` decide. */
|
|
34
|
+
scope?: CalendarUpdateScopeParam;
|
|
35
|
+
/** Original-start key of the occurrence the update targets. */
|
|
36
|
+
recurrenceId?: string;
|
|
37
|
+
/** Calendar whose copy of the event is patched, for a multi-calendar event.
|
|
38
|
+
* Omit to patch the canonical copy. */
|
|
39
|
+
calendar?: Calendar;
|
|
40
|
+
}
|
|
41
|
+
/** How a deletion is scoped across a recurring series. */
|
|
42
|
+
export interface DeleteEventOptions {
|
|
43
|
+
/** Deletion scope; defaults to the entire event or series. */
|
|
44
|
+
scope?: CalendarDeletionScopeParam;
|
|
45
|
+
/** Original-start key of the occurrence a scoped deletion targets. */
|
|
46
|
+
recurrenceId?: string;
|
|
47
|
+
/** Calendar whose copy of the event is deleted, for a multi-calendar event.
|
|
48
|
+
* Omit to delete the canonical copy. */
|
|
49
|
+
calendar?: Calendar;
|
|
50
|
+
}
|
|
51
|
+
/** The RSVP to record and how it is scoped across a recurring series. */
|
|
52
|
+
export interface RsvpEventOptions {
|
|
53
|
+
/** The response to record for the connected account. */
|
|
54
|
+
response: AttendeeResponseStatus;
|
|
55
|
+
/** How much of a recurring series the response covers. Omit to let
|
|
56
|
+
* `recurrenceId` decide. */
|
|
57
|
+
scope?: CalendarRsvpScopeParam;
|
|
58
|
+
/** Original-start key of the occurrence the response targets. */
|
|
59
|
+
recurrenceId?: string;
|
|
60
|
+
/** Calendar whose copy of the event is answered, for a multi-calendar event.
|
|
61
|
+
* Omit to answer on the canonical copy. */
|
|
62
|
+
calendar?: Calendar;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A Macro calendar event: a handle exposing the event's synced fields and the
|
|
66
|
+
* mutations that act on it ({@link CalendarEvent.update},
|
|
67
|
+
* {@link CalendarEvent.delete}, {@link CalendarEvent.rsvp}).
|
|
68
|
+
*
|
|
69
|
+
* The calendar service has no fetch-by-id endpoint, so a handle reads its
|
|
70
|
+
* fields only when seeded with a record — as returned by
|
|
71
|
+
* {@link CalendarEvent.update}, {@link CalendarEvent.rsvp}, or
|
|
72
|
+
* `calendar.createEvent`. A bare {@link CalendarEvent.byId} handle can drive
|
|
73
|
+
* mutations, but reading a field on it throws.
|
|
74
|
+
*/
|
|
75
|
+
export declare class CalendarEvent extends MacroEntity<CalendarEventRecord> {
|
|
76
|
+
protected fetch(): Promise<CalendarEventRecord>;
|
|
77
|
+
/** A handle to a calendar event by id, for driving mutations. Reading a
|
|
78
|
+
* field on it throws (there is no fetch-by-id endpoint). */
|
|
79
|
+
static byId(client: MacroClient, id: string): CalendarEvent;
|
|
80
|
+
/** A handle seeded with a synced event record; reads resolve without a fetch. */
|
|
81
|
+
static fromRecord(client: MacroClient, record: CalendarEventRecord): CalendarEvent;
|
|
82
|
+
/** Display title. */
|
|
83
|
+
readonly title: () => Promise<string>;
|
|
84
|
+
/** Optional event body. */
|
|
85
|
+
readonly description: () => Promise<string | undefined>;
|
|
86
|
+
/** Optional physical or virtual location label. */
|
|
87
|
+
readonly location: () => Promise<string | undefined>;
|
|
88
|
+
/** Timed or all-day shape. */
|
|
89
|
+
readonly time: () => Promise<EventTime>;
|
|
90
|
+
/** Event status. */
|
|
91
|
+
readonly status: () => Promise<import("../../../generated/calendar").EventStatus>;
|
|
92
|
+
/** Attendees on the canonical copy. */
|
|
93
|
+
readonly attendees: () => Promise<import("../../../generated/calendar").CalendarAttendee[]>;
|
|
94
|
+
/** Availability behavior. */
|
|
95
|
+
readonly transparency: () => Promise<EventTransparency>;
|
|
96
|
+
/** Whether the canonical source's calendar prohibits editing. */
|
|
97
|
+
readonly isReadOnly: () => Promise<boolean>;
|
|
98
|
+
/** Raw RFC 5545 recurrence properties (`RRULE`, `RDATE`, `EXDATE`). */
|
|
99
|
+
readonly recurrenceLines: () => Promise<string[]>;
|
|
100
|
+
/** The calendar the canonical source belongs to, when known. */
|
|
101
|
+
readonly calendar: () => Promise<Calendar | undefined>;
|
|
102
|
+
/** The full synced event record. Available on a seeded handle (from create /
|
|
103
|
+
* update / rsvp); a bare `byId` handle throws (no fetch-by-id endpoint). */
|
|
104
|
+
record(): Promise<CalendarEventRecord>;
|
|
105
|
+
/** Update the event and return a handle to its synced record. */
|
|
106
|
+
update(options: UpdateEventOptions): Promise<CalendarEvent>;
|
|
107
|
+
/** Delete the event (or a scoped part of a recurring series) at its provider. */
|
|
108
|
+
delete(options?: DeleteEventOptions): Promise<void>;
|
|
109
|
+
/** Preview an organizer replacement without cancelling or sending invitations.
|
|
110
|
+
* Review replacement.status() before explicitly calling replacement.confirm(). */
|
|
111
|
+
prepareReplacement(options: {
|
|
112
|
+
removeConference: boolean;
|
|
113
|
+
recurrenceId?: string;
|
|
114
|
+
calendar?: Calendar;
|
|
115
|
+
}): Promise<CalendarReplacement>;
|
|
116
|
+
/** Open this calendar copy in its provider for actions unavailable through its API. */
|
|
117
|
+
providerUrl(options?: {
|
|
118
|
+
recurrenceId?: string;
|
|
119
|
+
calendar?: Calendar;
|
|
120
|
+
}): Promise<string | undefined>;
|
|
121
|
+
/** Record the requester's RSVP and return a handle to the synced record. */
|
|
122
|
+
rsvp(options: RsvpEventOptions): Promise<CalendarEvent>;
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { CalendarAttendeeInputBody, ConferenceChange, EventReminders, EventTime, EventTransparency, EventVisibility, OutOfOfficeProperties, TeamCalendarSharing } from '../../../generated/calendar/types.gen';
|
|
2
|
+
import type { ListOccurrencesData, ListTeamCalendarData, ListTeamOutOfOfficeData } from '../../../generated/storage/types.gen';
|
|
3
|
+
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import type { Link } from '../email/link';
|
|
5
|
+
import { User } from '../users/user';
|
|
6
|
+
import { Calendar } from './calendar';
|
|
7
|
+
import { CalendarEvent } from './event';
|
|
8
|
+
import { CalendarReplacement } from './replacement';
|
|
9
|
+
/** Fields for a new calendar event. */
|
|
10
|
+
export interface CreateEventOptions {
|
|
11
|
+
/** Display title. */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Timed or all-day shape. */
|
|
14
|
+
time: EventTime;
|
|
15
|
+
/** Optional event body. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Optional location label. */
|
|
18
|
+
location?: string;
|
|
19
|
+
/** Invited attendees. */
|
|
20
|
+
attendees?: CalendarAttendeeInputBody[];
|
|
21
|
+
/** Raw RFC 5545 recurrence properties (`RRULE`, `RDATE`, `EXDATE`). */
|
|
22
|
+
recurrenceLines?: string[];
|
|
23
|
+
/** Event visibility. */
|
|
24
|
+
visibility?: EventVisibility;
|
|
25
|
+
/** Availability behavior. */
|
|
26
|
+
transparency?: EventTransparency;
|
|
27
|
+
/** Reminder configuration; omit to keep the calendar defaults. */
|
|
28
|
+
reminders?: EventReminders;
|
|
29
|
+
/** Conference to attach; omit to create the event without one. */
|
|
30
|
+
conference?: ConferenceChange;
|
|
31
|
+
/** Mint a Macro call with the event; its join link lands in the description
|
|
32
|
+
* and location. Cannot be combined with `conference`. */
|
|
33
|
+
macroCall?: boolean;
|
|
34
|
+
/** Out-of-office properties; present to create an out-of-office event. */
|
|
35
|
+
outOfOffice?: OutOfOfficeProperties;
|
|
36
|
+
/** Exact calendar to create the event on; takes precedence over the inbox
|
|
37
|
+
* default. */
|
|
38
|
+
calendar?: Calendar;
|
|
39
|
+
/** Connected inbox whose primary calendar receives the event; defaults to the
|
|
40
|
+
* requester's primary inbox. */
|
|
41
|
+
emailLink?: Link;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The calendar surface: the caller's visible calendars, event creation, and
|
|
45
|
+
* handles to individual events and calendars. Backed by calendar_service (the
|
|
46
|
+
* SDK reaches it on the gateway's `/calendar` route).
|
|
47
|
+
*/
|
|
48
|
+
export declare class CalendarNamespace {
|
|
49
|
+
private readonly client;
|
|
50
|
+
/** Calendar availability settings, each referring to a typed calendar. */
|
|
51
|
+
availabilityCalendars(): Promise<{
|
|
52
|
+
calendar: Calendar;
|
|
53
|
+
name: string;
|
|
54
|
+
isPrimary: boolean;
|
|
55
|
+
contributesToAvailability: boolean;
|
|
56
|
+
}[]>;
|
|
57
|
+
/** Current sharing preference for the team calendar. */
|
|
58
|
+
teamSharing(): Promise<TeamCalendarSharing>;
|
|
59
|
+
/** Replace the team calendar sharing preference. */
|
|
60
|
+
setTeamSharing(sharing: TeamCalendarSharing): Promise<TeamCalendarSharing>;
|
|
61
|
+
/** Calendar occurrences in a viewport, automatically paginated. */
|
|
62
|
+
occurrences(options: Omit<ListOccurrencesData['query'], 'cursor'>): AsyncGenerator<{
|
|
63
|
+
event: CalendarEvent;
|
|
64
|
+
occurrence: import("../../../generated/storage").CalendarOccurrence;
|
|
65
|
+
}, any, any>;
|
|
66
|
+
/** A page of team availability, including its roster and continuation cursor. */
|
|
67
|
+
teamPage(options: NonNullable<ListTeamCalendarData['query']>): Promise<{
|
|
68
|
+
items: ({
|
|
69
|
+
owner: User;
|
|
70
|
+
kind: "busy";
|
|
71
|
+
contributesToAvailability: boolean;
|
|
72
|
+
id: string;
|
|
73
|
+
time: import("../../../generated/storage").EventTime;
|
|
74
|
+
} | {
|
|
75
|
+
owner: User;
|
|
76
|
+
details: import("../../../generated/storage").TeamCalendarDetails;
|
|
77
|
+
kind: "details";
|
|
78
|
+
contributesToAvailability: boolean;
|
|
79
|
+
id: string;
|
|
80
|
+
time: import("../../../generated/storage").EventTime;
|
|
81
|
+
})[];
|
|
82
|
+
members: {
|
|
83
|
+
user: User;
|
|
84
|
+
sharing: import("../../../generated/storage").TeamCalendarSharing;
|
|
85
|
+
coverage: import("../../../generated/storage").TeamCalendarCoverage;
|
|
86
|
+
}[];
|
|
87
|
+
nextCursor: string | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
/** Teammates' out-of-office occurrences in a bounded viewport. Check hasMore for truncation. */
|
|
90
|
+
teamOutOfOffice(options: NonNullable<ListTeamOutOfOfficeData['query']>): Promise<{
|
|
91
|
+
items: {
|
|
92
|
+
event: CalendarEvent;
|
|
93
|
+
owner: User;
|
|
94
|
+
occurrenceKey: string;
|
|
95
|
+
time: import("../../../generated/storage").EventTime;
|
|
96
|
+
title: string | undefined;
|
|
97
|
+
}[];
|
|
98
|
+
hasMore: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
constructor(client: MacroClient);
|
|
101
|
+
/** The caller's visible calendars, primaries and writable first. */
|
|
102
|
+
calendars(): Promise<Calendar[]>;
|
|
103
|
+
/** A handle to a calendar by id. Detail loads on first access. */
|
|
104
|
+
calendar(id: string): Calendar;
|
|
105
|
+
/** A handle to a calendar event by id, for driving mutations. */
|
|
106
|
+
event(id: string): CalendarEvent;
|
|
107
|
+
/** Recover a saved replacement, including after its original event was retired. */
|
|
108
|
+
replacement(operationId: string): CalendarReplacement;
|
|
109
|
+
/** Create a calendar event and return a handle to its synced record. */
|
|
110
|
+
createEvent(options: CreateEventOptions): Promise<CalendarEvent>;
|
|
111
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CalendarReplacementView } from '../../../generated/calendar/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
/** Durable organizer replacement, recoverable even after the original event is retired. */
|
|
4
|
+
export declare class CalendarReplacement {
|
|
5
|
+
private readonly client;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
constructor(client: MacroClient, id: string);
|
|
8
|
+
/** Read progress without initiating provider writes. */
|
|
9
|
+
status(): Promise<CalendarReplacementView>;
|
|
10
|
+
/** Confirm the reviewed cancellation and reinvitation, or resume that same operation.
|
|
11
|
+
* Present the preview and obtain the organizer's confirmation before the first call. */
|
|
12
|
+
confirm(): Promise<CalendarReplacementView>;
|
|
13
|
+
/** Discard an unconfirmed preview. Confirmed operations must be recovered, not discarded. */
|
|
14
|
+
discard(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -1,20 +1,57 @@
|
|
|
1
|
-
import type { GetCallRecordResponses } from '../../../generated/storage/types.gen';
|
|
1
|
+
import type { EditCallTranscriptRequest, GetCallRecordResponses } from '../../../generated/storage/types.gen';
|
|
2
2
|
import type { MacroClient } from '../../utils/client';
|
|
3
3
|
import { Channel } from '../channels/channel';
|
|
4
4
|
import { FavoritableEntity } from '../entity';
|
|
5
|
+
import { Meeting } from '../meetings/meeting';
|
|
6
|
+
import { MessageThread, type TimelineOptions } from '../messages/thread';
|
|
7
|
+
import { EntityAccess } from '../sharing/access';
|
|
5
8
|
import { User } from '../users/user';
|
|
9
|
+
import { CallMessage } from './message';
|
|
6
10
|
type CallRecordDetail = GetCallRecordResponses[200];
|
|
7
|
-
/** A Macro call record (an archived
|
|
11
|
+
/** A Macro call record (an archived or still active call). */
|
|
8
12
|
export declare class CallRecord extends FavoritableEntity<CallRecordDetail> {
|
|
13
|
+
/** A shared message thread scoped to this resource. */
|
|
14
|
+
messageThreadById(id: string): MessageThread;
|
|
15
|
+
/** A mixed message and activity timeline page. */
|
|
16
|
+
timelinePage(selection?: TimelineOptions<CallMessage>): Promise<{
|
|
17
|
+
entries: ({
|
|
18
|
+
type: "activity";
|
|
19
|
+
activity: {
|
|
20
|
+
actor: User;
|
|
21
|
+
action: string;
|
|
22
|
+
actor_id: string;
|
|
23
|
+
id: string;
|
|
24
|
+
occurred_at: string;
|
|
25
|
+
payload?: unknown;
|
|
26
|
+
};
|
|
27
|
+
message?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
type: "message";
|
|
30
|
+
message: CallMessage;
|
|
31
|
+
activity?: undefined;
|
|
32
|
+
})[];
|
|
33
|
+
nextCursor: import("../../../generated/storage").MessageCursor | undefined;
|
|
34
|
+
previousCursor: import("../../../generated/storage").MessageCursor | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
/** Access requests and direct user grants. */
|
|
37
|
+
readonly access: EntityAccess;
|
|
38
|
+
/** Get or create a shareable meeting for this call. */
|
|
39
|
+
meeting(): Promise<Meeting>;
|
|
40
|
+
/** Update custom speaker assignments in the transcript. */
|
|
41
|
+
editTranscript(assignments: EditCallTranscriptRequest['assignments']): Promise<void>;
|
|
42
|
+
/** Toggle the server's share-with-team setting and return its new value. */
|
|
43
|
+
toggleTeamShare(): Promise<boolean>;
|
|
9
44
|
/** Favorites identify call records as `call`. */
|
|
10
45
|
readonly entityType = "call";
|
|
11
46
|
protected fetch(): Promise<CallRecordDetail>;
|
|
12
47
|
/** A handle to a call record by id. Details load on first access. */
|
|
13
48
|
static byId(client: MacroClient, id: string): CallRecord;
|
|
49
|
+
/** A message in this call's persistent chat. Fields load on first access. */
|
|
50
|
+
message(id: string): CallMessage;
|
|
14
51
|
/** The call's display name (user-supplied or AI-generated; unset while active). */
|
|
15
52
|
readonly name: () => Promise<string | undefined>;
|
|
16
|
-
/** The channel the call belongs to. */
|
|
17
|
-
readonly channel: () => Promise<Channel>;
|
|
53
|
+
/** The channel the call belongs to, if it is a channel call. */
|
|
54
|
+
readonly channel: () => Promise<Channel | undefined>;
|
|
18
55
|
/** The display name of the channel the call belongs to. */
|
|
19
56
|
readonly channelName: () => Promise<string | undefined>;
|
|
20
57
|
/** The user who started the call. */
|
|
@@ -35,9 +72,21 @@ export declare class CallRecord extends FavoritableEntity<CallRecordDetail> {
|
|
|
35
72
|
readonly summary: () => Promise<string | undefined>;
|
|
36
73
|
/** Transcript segments, ordered by sequence number. */
|
|
37
74
|
readonly transcript: () => Promise<import("../../../generated/storage").CallRecordTranscriptSegment[]>;
|
|
38
|
-
/**
|
|
75
|
+
/** Macro-account participants, both active and historic. */
|
|
39
76
|
readonly participants: () => Promise<import("../../../generated/storage").CallRecordParticipant[]>;
|
|
40
|
-
/**
|
|
77
|
+
/** Current and past guests; each id matches its transcript speaker id. */
|
|
78
|
+
readonly guests: () => Promise<import("../../../generated/storage").CallRecordGuest[]>;
|
|
79
|
+
/**
|
|
80
|
+
* The canonical access level granted to the creator's team once the call is
|
|
81
|
+
* archived, or null when it is not shared. Calls only ever grant `'view'`;
|
|
82
|
+
* while the call is live this is null and {@link CallRecord.shareWithTeam}
|
|
83
|
+
* carries the pending toggle.
|
|
84
|
+
*/
|
|
85
|
+
readonly teamShareAccessLevel: () => Promise<NonNullable<import("../../../generated/storage").AccessLevel | null | undefined> | undefined>;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the call is shared with the creator's team: the pending toggle
|
|
88
|
+
* while the call is live, the canonical grant once it is archived.
|
|
89
|
+
*/
|
|
41
90
|
readonly shareWithTeam: () => Promise<boolean>;
|
|
42
91
|
/** URL of the call recording, once available. */
|
|
43
92
|
readonly recordingUrl: () => Promise<string | undefined>;
|
|
@@ -47,6 +96,13 @@ export declare class CallRecord extends FavoritableEntity<CallRecordDetail> {
|
|
|
47
96
|
readonly recordingStartedAt: () => Promise<string | undefined>;
|
|
48
97
|
/** Rename the call or clear the custom name. */
|
|
49
98
|
rename(name: string | null): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Share the call with the creator's team (view access), or unshare it.
|
|
101
|
+
* While the call is live this sets the pending toggle any participant with
|
|
102
|
+
* edit access may change; once archived only the call's creator may change
|
|
103
|
+
* it and the API answers 403 otherwise.
|
|
104
|
+
*/
|
|
105
|
+
setTeamShare(shared: boolean): Promise<void>;
|
|
50
106
|
/** Delete the call record. */
|
|
51
107
|
delete(): Promise<void>;
|
|
52
108
|
/** Search calls by name and transcript, most relevant first, auto-paginated. */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Message as MessageRecord } from '../../../generated/storage/types.gen';
|
|
2
|
+
import { type RichMessage } from '../../mentions';
|
|
3
|
+
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import { MacroEntity } from '../entity';
|
|
5
|
+
import { User } from '../users/user';
|
|
6
|
+
import { CallRecord } from './call-record';
|
|
7
|
+
/** A message in a call's single persistent chat thread. */
|
|
8
|
+
export declare class CallMessage extends MacroEntity<MessageRecord> {
|
|
9
|
+
readonly callId: string;
|
|
10
|
+
private constructor();
|
|
11
|
+
private get path();
|
|
12
|
+
protected fetch(): Promise<MessageRecord>;
|
|
13
|
+
/** A handle to a message by id. Fields load on first access. */
|
|
14
|
+
static byId(client: MacroClient, callId: string, id: string): CallMessage;
|
|
15
|
+
/** Build a message from its record without another fetch. */
|
|
16
|
+
static from(client: MacroClient, callId: string, record: MessageRecord): CallMessage;
|
|
17
|
+
/** The message body (markdown). */
|
|
18
|
+
readonly content: () => Promise<string>;
|
|
19
|
+
/** When the message was created. */
|
|
20
|
+
readonly createdAt: () => Promise<string>;
|
|
21
|
+
/** When the message was last updated. */
|
|
22
|
+
readonly updatedAt: () => Promise<string>;
|
|
23
|
+
/** The call whose chat contains this message. */
|
|
24
|
+
call(): CallRecord;
|
|
25
|
+
/** The user who sent this message. */
|
|
26
|
+
author(): Promise<User>;
|
|
27
|
+
/** Reply in the call's canonical thread, including when this is a reply. */
|
|
28
|
+
reply(body: string | RichMessage): Promise<CallMessage>;
|
|
29
|
+
/** Replace this message's body. */
|
|
30
|
+
edit(body: string | RichMessage): Promise<this>;
|
|
31
|
+
/** Delete this message, preserving the rest of the call's chat. */
|
|
32
|
+
delete(): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ActivityType, ApiActivity } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { User } from '../users/user';
|
|
4
|
+
import type { Channel } from './channel';
|
|
5
|
+
/** A user's channel activity marker. */
|
|
6
|
+
export declare class ChannelActivity {
|
|
7
|
+
private readonly client;
|
|
8
|
+
/** Related channel. */
|
|
9
|
+
readonly channel: Channel;
|
|
10
|
+
private readonly record;
|
|
11
|
+
constructor(client: MacroClient,
|
|
12
|
+
/** Related channel. */
|
|
13
|
+
channel: Channel, record: ApiActivity);
|
|
14
|
+
/** Activity identity. */
|
|
15
|
+
get id(): string;
|
|
16
|
+
/** User who interacted. */
|
|
17
|
+
user(): User;
|
|
18
|
+
/** Creation time. */
|
|
19
|
+
createdAt(): string;
|
|
20
|
+
/** Record a view or interaction in this channel. */
|
|
21
|
+
recordInteraction(type: ActivityType): Promise<ChannelActivity>;
|
|
22
|
+
/** Serialize activity without credentials. */
|
|
23
|
+
toJSON(): ApiActivity;
|
|
24
|
+
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { ChannelType, GetChannelAttachmentsResponses, GetChannelParticipantsResponses, GetChannelResponses,
|
|
1
|
+
import type { ActivityType, ChannelType, GetChannelAttachmentsResponses, GetChannelParticipantsResponses, GetChannelResponses, MessageCursor } from '../../../generated/storage/types.gen';
|
|
2
2
|
import { type RichMessage } from '../../mentions';
|
|
3
3
|
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import { AgentConversation } from '../agent-sessions/conversation';
|
|
4
5
|
import { PropertiedEntity } from '../entity';
|
|
6
|
+
import { MessageThread, type TimelineOptions } from '../messages/thread';
|
|
5
7
|
import type { Team } from '../teams/team';
|
|
6
8
|
import type { User } from '../users/user';
|
|
9
|
+
import { ChannelActivity } from './activity';
|
|
7
10
|
import { Message } from './message';
|
|
11
|
+
import type { ChannelPicture } from './picture';
|
|
8
12
|
import type { Thread } from './thread';
|
|
9
13
|
type ChannelDetail = GetChannelResponses[200];
|
|
10
14
|
/** A member of a channel, with their role and join time. */
|
|
@@ -15,6 +19,35 @@ export type ChannelAttachment = GetChannelAttachmentsResponses[200]['items'][num
|
|
|
15
19
|
* A channel.
|
|
16
20
|
*/
|
|
17
21
|
export declare class Channel extends PropertiedEntity<ChannelDetail> {
|
|
22
|
+
/** Record a view or interaction in this channel. */
|
|
23
|
+
recordActivity(type: ActivityType): Promise<ChannelActivity>;
|
|
24
|
+
/** Set an uploaded profile picture, or clear it. */
|
|
25
|
+
setPicture(picture?: ChannelPicture): Promise<void>;
|
|
26
|
+
/** A shared message thread scoped to this resource. */
|
|
27
|
+
messageThreadById(id: string): MessageThread;
|
|
28
|
+
/** A mixed message and activity timeline page. */
|
|
29
|
+
timelinePage(selection?: TimelineOptions<Message>): Promise<{
|
|
30
|
+
entries: ({
|
|
31
|
+
type: "activity";
|
|
32
|
+
activity: {
|
|
33
|
+
actor: User;
|
|
34
|
+
action: string;
|
|
35
|
+
actor_id: string;
|
|
36
|
+
id: string;
|
|
37
|
+
occurred_at: string;
|
|
38
|
+
payload?: unknown;
|
|
39
|
+
};
|
|
40
|
+
message?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
type: "message";
|
|
43
|
+
message: Message;
|
|
44
|
+
activity?: undefined;
|
|
45
|
+
})[];
|
|
46
|
+
nextCursor: MessageCursor | undefined;
|
|
47
|
+
previousCursor: MessageCursor | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
/** Conversations maintained by agents in this channel. */
|
|
50
|
+
agentConversations(): Promise<AgentConversation[]>;
|
|
18
51
|
/** Favorites identify channels as `channel`. */
|
|
19
52
|
readonly entityType = "channel";
|
|
20
53
|
/** The properties service identifies channels as `CHANNEL`. */
|
|
@@ -48,10 +81,18 @@ export declare class Channel extends PropertiedEntity<ChannelDetail> {
|
|
|
48
81
|
send(body: string | RichMessage, opts?: {
|
|
49
82
|
thread?: Thread;
|
|
50
83
|
}): Promise<Message>;
|
|
51
|
-
/**
|
|
84
|
+
/** Root messages in this channel, most recent first, auto-paginated. */
|
|
52
85
|
messages(opts?: {
|
|
53
86
|
pageSize?: number;
|
|
54
87
|
}): AsyncGenerator<Message>;
|
|
88
|
+
/**
|
|
89
|
+
* Root messages created or replied to at or after `after`, most recent
|
|
90
|
+
* first, auto-paginated. Use it to catch up after a disconnect.
|
|
91
|
+
*/
|
|
92
|
+
messagesAfter(after: Date | string, opts?: {
|
|
93
|
+
pageSize?: number;
|
|
94
|
+
}): AsyncGenerator<Message>;
|
|
95
|
+
private timeline;
|
|
55
96
|
/** A handle to a message in this channel by id. */
|
|
56
97
|
message(id: string): Message;
|
|
57
98
|
/** Rename the channel. */
|
|
@@ -71,7 +112,7 @@ export declare class Channel extends PropertiedEntity<ChannelDetail> {
|
|
|
71
112
|
/** Remove users from the channel. */
|
|
72
113
|
removeParticipants(users: User[]): Promise<void>;
|
|
73
114
|
/** Broadcast a typing indicator, optionally scoped to a thread. */
|
|
74
|
-
typing(action:
|
|
115
|
+
typing(action: 'start' | 'stop', opts?: {
|
|
75
116
|
thread?: Thread;
|
|
76
117
|
}): Promise<void>;
|
|
77
118
|
/** The attachments posted in this channel, auto-paginated. */
|