@deadair/sdk 0.31.2 → 0.31.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ import type { SdkFetch } from '../sdk-options.js';
2
+ import type { MessagingLinkCode, MessagingLinkList } from './types/messaging.types.js';
3
+ export declare class MessagingClient {
4
+ private fetch;
5
+ constructor(fetch: SdkFetch);
6
+ /**
7
+ * @name List messaging links
8
+ * @description The chat accounts linked to the signed-in account
9
+ */
10
+ listMessagingLinks(): Promise<MessagingLinkList>;
11
+ /**
12
+ * @name Create messaging link code
13
+ * @description A new one-time code for linking a chat account. It replaces any earlier code and stops working after ten minutes
14
+ */
15
+ createMessagingLinkCode(): Promise<MessagingLinkCode>;
16
+ /**
17
+ * @name Remove messaging link
18
+ * @description Unlink a chat account. Its operator commands are refused from the next one on
19
+ */
20
+ removeMessagingLink(pluginId: string, platformUserId: string): Promise<void>;
21
+ }
22
+ //# sourceMappingURL=messaging.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messaging.client.d.ts","sourceRoot":"","sources":["../../src/messaging/messaging.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGvF,qBAAa,eAAe;IACZ,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAEnC;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAKtD;;;OAGG;IACG,uBAAuB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAK3D;;;OAGG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrF"}
@@ -0,0 +1,2 @@
1
+ export * from './messaging.types.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/messaging/types/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { DateTime } from 'luxon';
2
+ /**
3
+ * A one-time code that links a chat account to the signed-in station account. Shown once: send it to the station's bot as `/link CODE` in a direct message
4
+ * generated from [MessagingLinkCode](../../../../../apps/api/data/contracts/messaging/messaging.types.ck#L7)
5
+ */
6
+ export interface MessagingLinkCode {
7
+ /** The code itself. Case does not matter when it is sent */
8
+ code: string;
9
+ /** When the code stops working. A new code replaces any earlier one */
10
+ expiresAt: DateTime;
11
+ }
12
+ /** Rehydrates every wire-encoded scalar in a MessagingLinkCode into its runtime type. Mutates and returns `raw`. */
13
+ export declare function reviveMessagingLinkCode(raw: MessagingLinkCode): MessagingLinkCode;
14
+ /**
15
+ * A chat account linked to the signed-in station account. Operator commands sent from it run with this account's permissions
16
+ * generated from [MessagingLink](../../../../../apps/api/data/contracts/messaging/messaging.types.ck#L12)
17
+ */
18
+ export interface MessagingLink {
19
+ /** Which messaging plugin the chat account is on, for example `deadair.telegram` */
20
+ pluginId: string;
21
+ /** The chat platform's own id for the person */
22
+ platformUserId: string;
23
+ /** What the chat platform called them when they linked */
24
+ displayName: string;
25
+ /** When the link was made */
26
+ createdAt: DateTime;
27
+ }
28
+ /** Rehydrates every wire-encoded scalar in a MessagingLink into its runtime type. Mutates and returns `raw`. */
29
+ export declare function reviveMessagingLink(raw: MessagingLink): MessagingLink;
30
+ /**
31
+ * Every chat account linked to the signed-in station account, newest first
32
+ * generated from [MessagingLinkList](../../../../../apps/api/data/contracts/messaging/messaging.types.ck#L19)
33
+ */
34
+ export interface MessagingLinkList {
35
+ links: MessagingLink[];
36
+ }
37
+ /** Rehydrates every wire-encoded scalar in a MessagingLinkList into its runtime type. Mutates and returns `raw`. */
38
+ export declare function reviveMessagingLinkList(raw: MessagingLinkList): MessagingLinkList;
39
+ //# sourceMappingURL=messaging.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messaging.types.d.ts","sourceRoot":"","sources":["../../../src/messaging/types/messaging.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUjC;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,SAAS,EAAE,QAAQ,CAAC;CACvB;AAED,oHAAoH;AACpH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,iBAAiB,GAAG,iBAAiB,CAIjF;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,EAAE,QAAQ,CAAC;CACvB;AAED,gHAAgH;AAChH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,aAAa,CAIrE;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,oHAAoH;AACpH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,iBAAiB,GAAG,iBAAiB,CASjF"}
@@ -0,0 +1,42 @@
1
+ import type { SdkFetch } from '../sdk-options.js';
2
+ import type { ListenerRequest, ListenerRequestCreate, ListenerRequestDecline, ListenerRequestList, RequestStatus, RequestableTrackList } from './types/requests.types.js';
3
+ export declare class RequestsClient {
4
+ private fetch;
5
+ constructor(fetch: SdkFetch);
6
+ /**
7
+ * @name Search requestable records
8
+ * @description Records the station could be asked to play, matching a title or an artist
9
+ */
10
+ searchRequestableRecords(query: {
11
+ q: string;
12
+ limit?: number;
13
+ }): Promise<RequestableTrackList>;
14
+ /**
15
+ * @name List requests
16
+ * @description Every recent request, for the operator deciding on them
17
+ */
18
+ listRequests(query?: {
19
+ status?: RequestStatus;
20
+ }): Promise<ListenerRequestList>;
21
+ /**
22
+ * @name Create request
23
+ * @description Ask the station to play a record. Answers with the request whatever became of it, so a refusal says why in `reason`
24
+ */
25
+ createRequest(body: ListenerRequestCreate): Promise<ListenerRequest>;
26
+ /**
27
+ * @name List my requests
28
+ * @description The signed-in account's own recent requests
29
+ */
30
+ listMyRequests(): Promise<ListenerRequestList>;
31
+ /**
32
+ * @name Grant request
33
+ * @description Let a waiting request through. It goes into the running order once its audio is here
34
+ */
35
+ grantRequest(id: string): Promise<ListenerRequest>;
36
+ /**
37
+ * @name Decline request
38
+ * @description Turn a request down. One already in the running order is left there; take it out of the order instead
39
+ */
40
+ declineRequest(id: string, body: ListenerRequestDecline): Promise<ListenerRequest>;
41
+ }
42
+ //# sourceMappingURL=requests.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.client.d.ts","sourceRoot":"","sources":["../../src/requests/requests.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EACR,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACvB,MAAM,2BAA2B,CAAC;AAGnC,qBAAa,cAAc;IACX,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAEnC;;;OAGG;IACG,wBAAwB,CAAC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQnG;;;OAGG;IACG,YAAY,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,aAAa,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQpF;;;OAGG;IACG,aAAa,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC;IAS1E;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAKpD;;;OAGG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAKxD;;;OAGG;IACG,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;CAQ3F"}
@@ -0,0 +1,2 @@
1
+ export * from './requests.types.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/requests/types/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { DateTime } from 'luxon';
2
+ /**
3
+ * A record the station holds and could be asked for
4
+ * generated from [RequestableTrack](../../../../../apps/api/data/contracts/requests/requests.types.ck#L7)
5
+ */
6
+ export interface RequestableTrack {
7
+ /** What to send as `trackId` to make the request */
8
+ trackId: string;
9
+ title: string;
10
+ /** The lead artist */
11
+ artist: string;
12
+ album?: string;
13
+ year?: number;
14
+ }
15
+ /**
16
+ * generated from [RequestStatus](../../../../../apps/api/data/contracts/requests/requests.types.ck#L19)
17
+ */
18
+ export type RequestStatus = 'waiting' | 'pending' | 'queued' | 'aired' | 'declined' | 'expired';
19
+ /**
20
+ * generated from [RequestSource](../../../../../apps/api/data/contracts/requests/requests.types.ck#L21)
21
+ */
22
+ export type RequestSource = 'app' | 'chat';
23
+ /**
24
+ * Ask the station to play a record
25
+ * generated from [ListenerRequestCreate](../../../../../apps/api/data/contracts/requests/requests.types.ck#L41)
26
+ */
27
+ export interface ListenerRequestCreate {
28
+ /** A record from the request search */
29
+ trackId: string;
30
+ /** What the station should call you. Omitted, you are "a listener": your account's email address is never shown or read out */
31
+ name?: string;
32
+ /** Dedicate it to somebody. The station may say this name on air */
33
+ dedicateTo?: string;
34
+ /** A few words to go with it. The presenter may put them in their own words on air, and leaves out anything unfit to broadcast; the words themselves are never read out */
35
+ message?: string;
36
+ }
37
+ /**
38
+ * Turn a request down
39
+ * generated from [ListenerRequestDecline](../../../../../apps/api/data/contracts/requests/requests.types.ck#L48)
40
+ */
41
+ export interface ListenerRequestDecline {
42
+ /** What to tell the listener. Omit for a plain no */
43
+ reason?: string;
44
+ }
45
+ /**
46
+ * Records matching a search, best matches first
47
+ * generated from [RequestableTrackList](../../../../../apps/api/data/contracts/requests/requests.types.ck#L15)
48
+ */
49
+ export interface RequestableTrackList {
50
+ tracks: RequestableTrack[];
51
+ }
52
+ /**
53
+ * A record somebody asked the station to play, and what became of it
54
+ * generated from [ListenerRequest](../../../../../apps/api/data/contracts/requests/requests.types.ck#L23)
55
+ */
56
+ export interface ListenerRequest {
57
+ id: string;
58
+ /** `waiting` for an operator to approve it, `pending` while its audio is fetched or a place is found for it, `queued` in the running order, `aired` once heard, `declined` or `expired` when it never will be */
59
+ status: RequestStatus;
60
+ /** The record, as it was called when it was asked for */
61
+ title: string;
62
+ artist: string;
63
+ /** Who asked, by the name their account or chat platform gave */
64
+ requesterName: string;
65
+ /** Whether it came from an app or a chat platform */
66
+ source: RequestSource;
67
+ /** When it was asked for */
68
+ createdAt: DateTime;
69
+ /** Why it was declined or expired, in the station's words or an operator's */
70
+ reason?: string;
71
+ /** When it aired */
72
+ airedAt?: DateTime;
73
+ /** Who the listener dedicated it to */
74
+ dedicateTo?: string;
75
+ /** What the listener asked to have said with it, in their own words */
76
+ message?: string;
77
+ }
78
+ /** Rehydrates every wire-encoded scalar in a ListenerRequest into its runtime type. Mutates and returns `raw`. */
79
+ export declare function reviveListenerRequest(raw: ListenerRequest): ListenerRequest;
80
+ /**
81
+ * Requests, newest first
82
+ * generated from [ListenerRequestList](../../../../../apps/api/data/contracts/requests/requests.types.ck#L37)
83
+ */
84
+ export interface ListenerRequestList {
85
+ requests: ListenerRequest[];
86
+ }
87
+ /** Rehydrates every wire-encoded scalar in a ListenerRequestList into its runtime type. Mutates and returns `raw`. */
88
+ export declare function reviveListenerRequestList(raw: ListenerRequestList): ListenerRequestList;
89
+ //# sourceMappingURL=requests.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.types.d.ts","sourceRoot":"","sources":["../../../src/requests/types/requests.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUjC;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAEhG;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,+HAA+H;IAC/H,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2KAA2K;IAC3K,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,iNAAiN;IACjN,MAAM,EAAE,aAAa,CAAC;IACtB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,MAAM,EAAE,aAAa,CAAC;IACtB,4BAA4B;IAC5B,SAAS,EAAE,QAAQ,CAAC;IACpB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,kHAAkH;AAClH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAO3E;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,sHAAsH;AACtH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,mBAAmB,CASvF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deadair/sdk",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "description": "A typed client for the deadair station's HTTP API, generated from the same contracts the station serves.",
5
5
  "keywords": [
6
6
  "deadair",