activitysmith 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -13
- package/dist/generated/apis/AppIconBadgesApi.d.ts +31 -0
- package/dist/generated/apis/AppIconBadgesApi.js +58 -0
- package/dist/generated/apis/index.d.ts +1 -0
- package/dist/generated/apis/index.js +1 -0
- package/dist/generated/models/index.d.ts +68 -41
- package/dist/src/ActivitySmith.d.ts +7 -1
- package/dist/src/ActivitySmith.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,8 +20,9 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction)
|
|
|
20
20
|
- [Live Activity Action](#live-activity-action)
|
|
21
21
|
- [Icons and Badges](#icons-and-badges)
|
|
22
22
|
- [Live Activity Colors](#live-activity-colors)
|
|
23
|
-
- [Channels](#channels)
|
|
24
23
|
- [Widgets](#widgets)
|
|
24
|
+
- [App Icon Badge Count](#app-icon-badge-count)
|
|
25
|
+
- [Channels](#channels)
|
|
25
26
|
|
|
26
27
|
## Installation
|
|
27
28
|
|
|
@@ -468,18 +469,6 @@ Choose from these colors for the Live Activity accent, including progress bars a
|
|
|
468
469
|
|
|
469
470
|
`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
|
|
470
471
|
|
|
471
|
-
## Channels
|
|
472
|
-
|
|
473
|
-
Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
|
|
474
|
-
|
|
475
|
-
```ts
|
|
476
|
-
await activitysmith.notifications.send({
|
|
477
|
-
title: "New subscription 💸",
|
|
478
|
-
message: "Customer upgraded to Pro plan",
|
|
479
|
-
channels: ["sales", "customer-success"], // Optional
|
|
480
|
-
});
|
|
481
|
-
```
|
|
482
|
-
|
|
483
472
|
## Widgets
|
|
484
473
|
|
|
485
474
|
<p align="center">
|
|
@@ -504,6 +493,62 @@ String metric values work too.
|
|
|
504
493
|
await activitysmith.metrics.update("prod.status", "healthy");
|
|
505
494
|
```
|
|
506
495
|
|
|
496
|
+
## App Icon Badge Count
|
|
497
|
+
|
|
498
|
+
<p align="center">
|
|
499
|
+
<img src="https://cdn.activitysmith.com/features/badge-count.png" alt="ActivitySmith app icon with an App Icon Badge Count" width="680" />
|
|
500
|
+
</p>
|
|
501
|
+
|
|
502
|
+
Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
|
|
503
|
+
|
|
504
|
+
Set or update the badge value.
|
|
505
|
+
|
|
506
|
+
```ts
|
|
507
|
+
await activitysmith.badgeCount(8333);
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
To clear the badge, set its value to 0.
|
|
511
|
+
|
|
512
|
+
```ts
|
|
513
|
+
await activitysmith.badgeCount(0);
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
## Channels
|
|
517
|
+
|
|
518
|
+
Use `channels` to target specific team members or devices
|
|
519
|
+
|
|
520
|
+
### Push Notifications
|
|
521
|
+
|
|
522
|
+
```ts
|
|
523
|
+
await activitysmith.notifications.send({
|
|
524
|
+
title: "New subscription 💸",
|
|
525
|
+
message: "Customer upgraded to Pro plan",
|
|
526
|
+
channels: ["sales", "customer-success"],
|
|
527
|
+
});
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### Live Activities
|
|
531
|
+
|
|
532
|
+
```ts
|
|
533
|
+
await activitysmith.liveActivities.start({
|
|
534
|
+
content_state: {
|
|
535
|
+
title: "Nightly Database Backup",
|
|
536
|
+
subtitle: "verify restore",
|
|
537
|
+
type: "progress",
|
|
538
|
+
percentage: 62,
|
|
539
|
+
},
|
|
540
|
+
channels: ["sales", "customer-success"],
|
|
541
|
+
});
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### App Icon Badge Count
|
|
545
|
+
|
|
546
|
+
```ts
|
|
547
|
+
await activitysmith.badgeCount(3, {
|
|
548
|
+
channels: ["sales", "customer-success"],
|
|
549
|
+
});
|
|
550
|
+
```
|
|
551
|
+
|
|
507
552
|
## Error Handling
|
|
508
553
|
|
|
509
554
|
```ts
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActivitySmith API
|
|
3
|
+
* Send push notifications and Live Activities to your own devices via a single API key.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from '../runtime';
|
|
13
|
+
import type { AppIconBadgeCountUpdateRequest, AppIconBadgeCountUpdateResponse } from '../models/index';
|
|
14
|
+
export interface UpdateAppIconBadgeCountRequest {
|
|
15
|
+
appIconBadgeCountUpdateRequest: AppIconBadgeCountUpdateRequest;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare class AppIconBadgesApi extends runtime.BaseAPI {
|
|
21
|
+
/**
|
|
22
|
+
* Updates the App Icon Badge Count on devices matched by API key scope and optional target channels. Send `badge: 0` to clear the count. Badge updates are independent of push notifications and do not create a push notification history item.
|
|
23
|
+
* Update App Icon Badge Count
|
|
24
|
+
*/
|
|
25
|
+
updateAppIconBadgeCountRaw(requestParameters: UpdateAppIconBadgeCountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AppIconBadgeCountUpdateResponse>>;
|
|
26
|
+
/**
|
|
27
|
+
* Updates the App Icon Badge Count on devices matched by API key scope and optional target channels. Send `badge: 0` to clear the count. Badge updates are independent of push notifications and do not create a push notification history item.
|
|
28
|
+
* Update App Icon Badge Count
|
|
29
|
+
*/
|
|
30
|
+
updateAppIconBadgeCount(requestParameters: UpdateAppIconBadgeCountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AppIconBadgeCountUpdateResponse>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* ActivitySmith API
|
|
6
|
+
* Send push notifications and Live Activities to your own devices via a single API key.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AppIconBadgesApi = void 0;
|
|
17
|
+
const runtime = require("../runtime");
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
class AppIconBadgesApi extends runtime.BaseAPI {
|
|
22
|
+
/**
|
|
23
|
+
* Updates the App Icon Badge Count on devices matched by API key scope and optional target channels. Send `badge: 0` to clear the count. Badge updates are independent of push notifications and do not create a push notification history item.
|
|
24
|
+
* Update App Icon Badge Count
|
|
25
|
+
*/
|
|
26
|
+
async updateAppIconBadgeCountRaw(requestParameters, initOverrides) {
|
|
27
|
+
if (requestParameters['appIconBadgeCountUpdateRequest'] == null) {
|
|
28
|
+
throw new runtime.RequiredError('appIconBadgeCountUpdateRequest', 'Required parameter "appIconBadgeCountUpdateRequest" was null or undefined when calling updateAppIconBadgeCount().');
|
|
29
|
+
}
|
|
30
|
+
const queryParameters = {};
|
|
31
|
+
const headerParameters = {};
|
|
32
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
33
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
34
|
+
const token = this.configuration.accessToken;
|
|
35
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
36
|
+
if (tokenString) {
|
|
37
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const response = await this.request({
|
|
41
|
+
path: `/badge`,
|
|
42
|
+
method: 'POST',
|
|
43
|
+
headers: headerParameters,
|
|
44
|
+
query: queryParameters,
|
|
45
|
+
body: requestParameters['appIconBadgeCountUpdateRequest'],
|
|
46
|
+
}, initOverrides);
|
|
47
|
+
return new runtime.JSONApiResponse(response);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Updates the App Icon Badge Count on devices matched by API key scope and optional target channels. Send `badge: 0` to clear the count. Badge updates are independent of push notifications and do not create a push notification history item.
|
|
51
|
+
* Update App Icon Badge Count
|
|
52
|
+
*/
|
|
53
|
+
async updateAppIconBadgeCount(requestParameters, initOverrides) {
|
|
54
|
+
const response = await this.updateAppIconBadgeCountRaw(requestParameters, initOverrides);
|
|
55
|
+
return await response.value();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.AppIconBadgesApi = AppIconBadgesApi;
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/* tslint:disable */
|
|
18
18
|
/* eslint-disable */
|
|
19
|
+
__exportStar(require("./AppIconBadgesApi"), exports);
|
|
19
20
|
__exportStar(require("./LiveActivitiesApi"), exports);
|
|
20
21
|
__exportStar(require("./MetricsApi"), exports);
|
|
21
22
|
__exportStar(require("./PushNotificationsApi"), exports);
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @interface ActivityMetric
|
|
5
5
|
*/
|
|
6
6
|
export interface ActivityMetric {
|
|
7
|
-
[key: string]: any | any;
|
|
8
7
|
/**
|
|
9
8
|
*
|
|
10
9
|
* @type {string}
|
|
@@ -58,7 +57,6 @@ export type ActivityMetricValue = number | string;
|
|
|
58
57
|
* @interface AlertPayload
|
|
59
58
|
*/
|
|
60
59
|
export interface AlertPayload {
|
|
61
|
-
[key: string]: any | any;
|
|
62
60
|
/**
|
|
63
61
|
*
|
|
64
62
|
* @type {string}
|
|
@@ -72,13 +70,74 @@ export interface AlertPayload {
|
|
|
72
70
|
*/
|
|
73
71
|
body?: string;
|
|
74
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* App Icon Badge Count update. Send badge 0 to clear the count.
|
|
75
|
+
* @export
|
|
76
|
+
* @interface AppIconBadgeCountUpdateRequest
|
|
77
|
+
*/
|
|
78
|
+
export interface AppIconBadgeCountUpdateRequest {
|
|
79
|
+
/**
|
|
80
|
+
* The count to show on the ActivitySmith app icon. Send 0 to clear it.
|
|
81
|
+
* @type {number}
|
|
82
|
+
* @memberof AppIconBadgeCountUpdateRequest
|
|
83
|
+
*/
|
|
84
|
+
badge: number;
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @type {ChannelTarget}
|
|
88
|
+
* @memberof AppIconBadgeCountUpdateRequest
|
|
89
|
+
*/
|
|
90
|
+
target?: ChannelTarget;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
* @export
|
|
95
|
+
* @interface AppIconBadgeCountUpdateResponse
|
|
96
|
+
*/
|
|
97
|
+
export interface AppIconBadgeCountUpdateResponse {
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @type {boolean}
|
|
101
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
102
|
+
*/
|
|
103
|
+
success: boolean;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @type {number}
|
|
107
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
108
|
+
*/
|
|
109
|
+
badge: number;
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @type {number}
|
|
113
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
114
|
+
*/
|
|
115
|
+
devices_notified: number;
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @type {number}
|
|
119
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
120
|
+
*/
|
|
121
|
+
users_notified: number;
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @type {Array<string>}
|
|
125
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
126
|
+
*/
|
|
127
|
+
effective_channel_slugs: Array<string>;
|
|
128
|
+
/**
|
|
129
|
+
*
|
|
130
|
+
* @type {string}
|
|
131
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
132
|
+
*/
|
|
133
|
+
timestamp: string;
|
|
134
|
+
}
|
|
75
135
|
/**
|
|
76
136
|
*
|
|
77
137
|
* @export
|
|
78
138
|
* @interface BadRequestError
|
|
79
139
|
*/
|
|
80
140
|
export interface BadRequestError {
|
|
81
|
-
[key: string]: any | any;
|
|
82
141
|
/**
|
|
83
142
|
*
|
|
84
143
|
* @type {string}
|
|
@@ -98,7 +157,6 @@ export interface BadRequestError {
|
|
|
98
157
|
* @interface ChannelTarget
|
|
99
158
|
*/
|
|
100
159
|
export interface ChannelTarget {
|
|
101
|
-
[key: string]: any | any;
|
|
102
160
|
/**
|
|
103
161
|
* Channel slugs. When omitted, API key scope determines recipients.
|
|
104
162
|
* @type {Array<string>}
|
|
@@ -112,7 +170,6 @@ export interface ChannelTarget {
|
|
|
112
170
|
* @interface ContentStateEnd
|
|
113
171
|
*/
|
|
114
172
|
export interface ContentStateEnd {
|
|
115
|
-
[key: string]: any | any;
|
|
116
173
|
/**
|
|
117
174
|
*
|
|
118
175
|
* @type {string}
|
|
@@ -294,7 +351,6 @@ export type ContentStateEndStepColorsEnum = typeof ContentStateEndStepColorsEnum
|
|
|
294
351
|
* @interface ContentStateStart
|
|
295
352
|
*/
|
|
296
353
|
export interface ContentStateStart {
|
|
297
|
-
[key: string]: any | any;
|
|
298
354
|
/**
|
|
299
355
|
*
|
|
300
356
|
* @type {string}
|
|
@@ -470,7 +526,6 @@ export type ContentStateStartStepColorsEnum = typeof ContentStateStartStepColors
|
|
|
470
526
|
* @interface ContentStateUpdate
|
|
471
527
|
*/
|
|
472
528
|
export interface ContentStateUpdate {
|
|
473
|
-
[key: string]: any | any;
|
|
474
529
|
/**
|
|
475
530
|
*
|
|
476
531
|
* @type {string}
|
|
@@ -646,7 +701,6 @@ export type ContentStateUpdateStepColorsEnum = typeof ContentStateUpdateStepColo
|
|
|
646
701
|
* @interface ForbiddenError
|
|
647
702
|
*/
|
|
648
703
|
export interface ForbiddenError {
|
|
649
|
-
[key: string]: any | any;
|
|
650
704
|
/**
|
|
651
705
|
*
|
|
652
706
|
* @type {string}
|
|
@@ -693,12 +747,10 @@ export interface LiveActivityAction {
|
|
|
693
747
|
method?: LiveActivityWebhookMethod;
|
|
694
748
|
/**
|
|
695
749
|
* Optional webhook payload body. Used only when type=webhook.
|
|
696
|
-
* @type {
|
|
750
|
+
* @type {object}
|
|
697
751
|
* @memberof LiveActivityAction
|
|
698
752
|
*/
|
|
699
|
-
body?:
|
|
700
|
-
[key: string]: any;
|
|
701
|
-
};
|
|
753
|
+
body?: object;
|
|
702
754
|
}
|
|
703
755
|
/**
|
|
704
756
|
*
|
|
@@ -715,7 +767,6 @@ export type LiveActivityActionType = typeof LiveActivityActionType[keyof typeof
|
|
|
715
767
|
* @interface LiveActivityAlertBadge
|
|
716
768
|
*/
|
|
717
769
|
export interface LiveActivityAlertBadge {
|
|
718
|
-
[key: string]: any | any;
|
|
719
770
|
/**
|
|
720
771
|
*
|
|
721
772
|
* @type {string}
|
|
@@ -735,7 +786,6 @@ export interface LiveActivityAlertBadge {
|
|
|
735
786
|
* @interface LiveActivityAlertIcon
|
|
736
787
|
*/
|
|
737
788
|
export interface LiveActivityAlertIcon {
|
|
738
|
-
[key: string]: any | any;
|
|
739
789
|
/**
|
|
740
790
|
* Apple SF Symbol name.
|
|
741
791
|
* @type {string}
|
|
@@ -772,7 +822,6 @@ export type LiveActivityColor = typeof LiveActivityColor[keyof typeof LiveActivi
|
|
|
772
822
|
* @interface LiveActivityEndRequest
|
|
773
823
|
*/
|
|
774
824
|
export interface LiveActivityEndRequest {
|
|
775
|
-
[key: string]: any | any;
|
|
776
825
|
/**
|
|
777
826
|
*
|
|
778
827
|
* @type {string}
|
|
@@ -804,7 +853,6 @@ export interface LiveActivityEndRequest {
|
|
|
804
853
|
* @interface LiveActivityEndResponse
|
|
805
854
|
*/
|
|
806
855
|
export interface LiveActivityEndResponse {
|
|
807
|
-
[key: string]: any | any;
|
|
808
856
|
/**
|
|
809
857
|
*
|
|
810
858
|
* @type {boolean}
|
|
@@ -842,7 +890,6 @@ export interface LiveActivityEndResponse {
|
|
|
842
890
|
* @interface LiveActivityLimitError
|
|
843
891
|
*/
|
|
844
892
|
export interface LiveActivityLimitError {
|
|
845
|
-
[key: string]: any | any;
|
|
846
893
|
/**
|
|
847
894
|
*
|
|
848
895
|
* @type {string}
|
|
@@ -874,7 +921,6 @@ export interface LiveActivityLimitError {
|
|
|
874
921
|
* @interface LiveActivityStartRequest
|
|
875
922
|
*/
|
|
876
923
|
export interface LiveActivityStartRequest {
|
|
877
|
-
[key: string]: any | any;
|
|
878
924
|
/**
|
|
879
925
|
*
|
|
880
926
|
* @type {ContentStateStart}
|
|
@@ -912,7 +958,6 @@ export interface LiveActivityStartRequest {
|
|
|
912
958
|
* @interface LiveActivityStartResponse
|
|
913
959
|
*/
|
|
914
960
|
export interface LiveActivityStartResponse {
|
|
915
|
-
[key: string]: any | any;
|
|
916
961
|
/**
|
|
917
962
|
*
|
|
918
963
|
* @type {boolean}
|
|
@@ -956,7 +1001,6 @@ export interface LiveActivityStartResponse {
|
|
|
956
1001
|
* @interface LiveActivityStreamDeleteRequest
|
|
957
1002
|
*/
|
|
958
1003
|
export interface LiveActivityStreamDeleteRequest {
|
|
959
|
-
[key: string]: any | any;
|
|
960
1004
|
/**
|
|
961
1005
|
*
|
|
962
1006
|
* @type {StreamContentState}
|
|
@@ -988,7 +1032,6 @@ export interface LiveActivityStreamDeleteRequest {
|
|
|
988
1032
|
* @interface LiveActivityStreamDeleteResponse
|
|
989
1033
|
*/
|
|
990
1034
|
export interface LiveActivityStreamDeleteResponse {
|
|
991
|
-
[key: string]: any | any;
|
|
992
1035
|
/**
|
|
993
1036
|
*
|
|
994
1037
|
* @type {boolean}
|
|
@@ -1045,7 +1088,6 @@ export type LiveActivityStreamDeleteResponseOperationEnum = typeof LiveActivityS
|
|
|
1045
1088
|
* @interface LiveActivityStreamPutResponse
|
|
1046
1089
|
*/
|
|
1047
1090
|
export interface LiveActivityStreamPutResponse {
|
|
1048
|
-
[key: string]: any | any;
|
|
1049
1091
|
/**
|
|
1050
1092
|
*
|
|
1051
1093
|
* @type {boolean}
|
|
@@ -1124,7 +1166,6 @@ export type LiveActivityStreamPutResponseOperationEnum = typeof LiveActivityStre
|
|
|
1124
1166
|
* @interface LiveActivityStreamRequest
|
|
1125
1167
|
*/
|
|
1126
1168
|
export interface LiveActivityStreamRequest {
|
|
1127
|
-
[key: string]: any | any;
|
|
1128
1169
|
/**
|
|
1129
1170
|
*
|
|
1130
1171
|
* @type {StreamContentState}
|
|
@@ -1168,7 +1209,6 @@ export interface LiveActivityStreamRequest {
|
|
|
1168
1209
|
* @interface LiveActivityUpdateRequest
|
|
1169
1210
|
*/
|
|
1170
1211
|
export interface LiveActivityUpdateRequest {
|
|
1171
|
-
[key: string]: any | any;
|
|
1172
1212
|
/**
|
|
1173
1213
|
*
|
|
1174
1214
|
* @type {string}
|
|
@@ -1200,7 +1240,6 @@ export interface LiveActivityUpdateRequest {
|
|
|
1200
1240
|
* @interface LiveActivityUpdateResponse
|
|
1201
1241
|
*/
|
|
1202
1242
|
export interface LiveActivityUpdateResponse {
|
|
1203
|
-
[key: string]: any | any;
|
|
1204
1243
|
/**
|
|
1205
1244
|
*
|
|
1206
1245
|
* @type {boolean}
|
|
@@ -1247,7 +1286,6 @@ export type LiveActivityWebhookMethod = typeof LiveActivityWebhookMethod[keyof t
|
|
|
1247
1286
|
* @interface MetricError
|
|
1248
1287
|
*/
|
|
1249
1288
|
export interface MetricError {
|
|
1250
|
-
[key: string]: any | any;
|
|
1251
1289
|
/**
|
|
1252
1290
|
*
|
|
1253
1291
|
* @type {string}
|
|
@@ -1267,7 +1305,6 @@ export interface MetricError {
|
|
|
1267
1305
|
* @interface MetricValueUpdateRequest
|
|
1268
1306
|
*/
|
|
1269
1307
|
export interface MetricValueUpdateRequest {
|
|
1270
|
-
[key: string]: any | any;
|
|
1271
1308
|
/**
|
|
1272
1309
|
*
|
|
1273
1310
|
* @type {MetricValueUpdateRequestValue}
|
|
@@ -1293,7 +1330,6 @@ export type MetricValueUpdateRequestValue = number | string;
|
|
|
1293
1330
|
* @interface MetricValueUpdateResponse
|
|
1294
1331
|
*/
|
|
1295
1332
|
export interface MetricValueUpdateResponse {
|
|
1296
|
-
[key: string]: any | any;
|
|
1297
1333
|
/**
|
|
1298
1334
|
*
|
|
1299
1335
|
* @type {boolean}
|
|
@@ -1307,7 +1343,6 @@ export interface MetricValueUpdateResponse {
|
|
|
1307
1343
|
* @interface NoRecipientsError
|
|
1308
1344
|
*/
|
|
1309
1345
|
export interface NoRecipientsError {
|
|
1310
|
-
[key: string]: any | any;
|
|
1311
1346
|
/**
|
|
1312
1347
|
*
|
|
1313
1348
|
* @type {string}
|
|
@@ -1333,7 +1368,6 @@ export interface NoRecipientsError {
|
|
|
1333
1368
|
* @interface NotFoundError
|
|
1334
1369
|
*/
|
|
1335
1370
|
export interface NotFoundError {
|
|
1336
|
-
[key: string]: any | any;
|
|
1337
1371
|
/**
|
|
1338
1372
|
*
|
|
1339
1373
|
* @type {string}
|
|
@@ -1380,12 +1414,10 @@ export interface PushNotificationAction {
|
|
|
1380
1414
|
method?: PushNotificationWebhookMethod;
|
|
1381
1415
|
/**
|
|
1382
1416
|
* Optional webhook payload body. Used only when type=webhook.
|
|
1383
|
-
* @type {
|
|
1417
|
+
* @type {object}
|
|
1384
1418
|
* @memberof PushNotificationAction
|
|
1385
1419
|
*/
|
|
1386
|
-
body?:
|
|
1387
|
-
[key: string]: any;
|
|
1388
|
-
};
|
|
1420
|
+
body?: object;
|
|
1389
1421
|
}
|
|
1390
1422
|
/**
|
|
1391
1423
|
*
|
|
@@ -1441,12 +1473,10 @@ export interface PushNotificationRequest {
|
|
|
1441
1473
|
actions?: Array<PushNotificationAction>;
|
|
1442
1474
|
/**
|
|
1443
1475
|
*
|
|
1444
|
-
* @type {
|
|
1476
|
+
* @type {object}
|
|
1445
1477
|
* @memberof PushNotificationRequest
|
|
1446
1478
|
*/
|
|
1447
|
-
payload?:
|
|
1448
|
-
[key: string]: any;
|
|
1449
|
-
};
|
|
1479
|
+
payload?: object;
|
|
1450
1480
|
/**
|
|
1451
1481
|
*
|
|
1452
1482
|
* @type {number}
|
|
@@ -1472,7 +1502,6 @@ export interface PushNotificationRequest {
|
|
|
1472
1502
|
* @interface PushNotificationResponse
|
|
1473
1503
|
*/
|
|
1474
1504
|
export interface PushNotificationResponse {
|
|
1475
|
-
[key: string]: any | any;
|
|
1476
1505
|
/**
|
|
1477
1506
|
*
|
|
1478
1507
|
* @type {boolean}
|
|
@@ -1519,7 +1548,6 @@ export type PushNotificationWebhookMethod = typeof PushNotificationWebhookMethod
|
|
|
1519
1548
|
* @interface RateLimitError
|
|
1520
1549
|
*/
|
|
1521
1550
|
export interface RateLimitError {
|
|
1522
|
-
[key: string]: any | any;
|
|
1523
1551
|
/**
|
|
1524
1552
|
*
|
|
1525
1553
|
* @type {string}
|
|
@@ -1545,7 +1573,6 @@ export type SendPushNotification429Response = LiveActivityLimitError | RateLimit
|
|
|
1545
1573
|
* @interface StreamContentState
|
|
1546
1574
|
*/
|
|
1547
1575
|
export interface StreamContentState {
|
|
1548
|
-
[key: string]: any | any;
|
|
1549
1576
|
/**
|
|
1550
1577
|
*
|
|
1551
1578
|
* @type {string}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppIconBadgesApi, LiveActivitiesApi, MetricsApi, PushNotificationsApi } from "../generated/index";
|
|
2
2
|
export interface ActivitySmithOptions {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
}
|
|
@@ -18,9 +18,13 @@ type MetricUpdateRequestBody = MetricUpdateParameters["metricValueUpdateRequest"
|
|
|
18
18
|
type MetricValue = MetricUpdateRequestBody["value"];
|
|
19
19
|
type MetricUpdateOptions = Omit<MetricUpdateRequestBody, "value">;
|
|
20
20
|
type MetricInitOverrides = Parameters<MetricsApi["updateMetricValue"]>[1];
|
|
21
|
+
type AppIconBadgeInitOverrides = Parameters<AppIconBadgesApi["updateAppIconBadgeCount"]>[1];
|
|
21
22
|
type PushSendRequest = PushRequestBody & {
|
|
22
23
|
channels?: string[];
|
|
23
24
|
};
|
|
25
|
+
export type BadgeCountOptions = {
|
|
26
|
+
channels?: string[];
|
|
27
|
+
};
|
|
24
28
|
declare const LiveActivityTypes: {
|
|
25
29
|
readonly segmentedProgress: "segmented_progress";
|
|
26
30
|
readonly progress: "progress";
|
|
@@ -131,6 +135,8 @@ export declare class ActivitySmith {
|
|
|
131
135
|
readonly notifications: NotificationsResource;
|
|
132
136
|
readonly liveActivities: LiveActivitiesResource;
|
|
133
137
|
readonly metrics: MetricsResource;
|
|
138
|
+
private readonly appIconBadgesApi;
|
|
134
139
|
constructor(opts: ActivitySmithOptions);
|
|
140
|
+
badgeCount(badge: number, options?: BadgeCountOptions, initOverrides?: AppIconBadgeInitOverrides): Promise<import("../generated/models").AppIconBadgeCountUpdateResponse>;
|
|
135
141
|
}
|
|
136
142
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActivitySmith = exports.MetricsResource = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
|
|
4
4
|
const index_1 = require("../generated/index");
|
|
5
|
-
const SDK_VERSION = "1.
|
|
5
|
+
const SDK_VERSION = "1.9.0";
|
|
6
6
|
const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
|
|
7
7
|
const SDK_HEADER_VALUE = `node-v${SDK_VERSION}`;
|
|
8
8
|
const LiveActivityTypes = {
|
|
@@ -186,6 +186,15 @@ class ActivitySmith {
|
|
|
186
186
|
this.notifications = new NotificationsResource(new index_1.PushNotificationsApi(config));
|
|
187
187
|
this.liveActivities = new LiveActivitiesResource(new index_1.LiveActivitiesApi(config));
|
|
188
188
|
this.metrics = new MetricsResource(new index_1.MetricsApi(config));
|
|
189
|
+
this.appIconBadgesApi = new index_1.AppIconBadgesApi(config);
|
|
190
|
+
}
|
|
191
|
+
badgeCount(badge, options = {}, initOverrides) {
|
|
192
|
+
return this.appIconBadgesApi.updateAppIconBadgeCount({
|
|
193
|
+
appIconBadgeCountUpdateRequest: withTargetChannels({
|
|
194
|
+
badge,
|
|
195
|
+
...options,
|
|
196
|
+
}),
|
|
197
|
+
}, initOverrides);
|
|
189
198
|
}
|
|
190
199
|
}
|
|
191
200
|
exports.ActivitySmith = ActivitySmith;
|