@usehercules/sdk 1.3.0 → 1.5.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/CHANGELOG.md +20 -0
- package/LICENSE +1 -1
- package/package.json +1 -1
- package/resources/beta/beta.d.mts +4 -0
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -0
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +4 -0
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +4 -0
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.mts +1 -0
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -0
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +3 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -0
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/pay/coupons.d.mts +1 -1
- package/resources/beta/pay/coupons.d.ts +1 -1
- package/resources/beta/pay/customers.d.mts +1 -1
- package/resources/beta/pay/customers.d.ts +1 -1
- package/resources/beta/pay/entitlements.d.mts +4 -22
- package/resources/beta/pay/entitlements.d.mts.map +1 -1
- package/resources/beta/pay/entitlements.d.ts +4 -22
- package/resources/beta/pay/entitlements.d.ts.map +1 -1
- package/resources/beta/pay/entitlements.js +3 -4
- package/resources/beta/pay/entitlements.js.map +1 -1
- package/resources/beta/pay/entitlements.mjs +3 -4
- package/resources/beta/pay/entitlements.mjs.map +1 -1
- package/resources/beta/pay/pay.d.mts +76 -16
- package/resources/beta/pay/pay.d.mts.map +1 -1
- package/resources/beta/pay/pay.d.ts +76 -16
- package/resources/beta/pay/pay.d.ts.map +1 -1
- package/resources/beta/pay/pay.js.map +1 -1
- package/resources/beta/pay/pay.mjs.map +1 -1
- package/resources/beta/pay/products/entitlements.d.mts +1 -1
- package/resources/beta/pay/products/entitlements.d.ts +1 -1
- package/resources/beta/pay/products/index.d.mts +1 -0
- package/resources/beta/pay/products/index.d.mts.map +1 -1
- package/resources/beta/pay/products/index.d.ts +1 -0
- package/resources/beta/pay/products/index.d.ts.map +1 -1
- package/resources/beta/pay/products/index.js +3 -1
- package/resources/beta/pay/products/index.js.map +1 -1
- package/resources/beta/pay/products/index.mjs +1 -0
- package/resources/beta/pay/products/index.mjs.map +1 -1
- package/resources/beta/pay/products/products.d.mts +45 -14
- package/resources/beta/pay/products/products.d.mts.map +1 -1
- package/resources/beta/pay/products/products.d.ts +45 -14
- package/resources/beta/pay/products/products.d.ts.map +1 -1
- package/resources/beta/pay/products/products.js +4 -0
- package/resources/beta/pay/products/products.js.map +1 -1
- package/resources/beta/pay/products/products.mjs +4 -0
- package/resources/beta/pay/products/products.mjs.map +1 -1
- package/resources/beta/pay/products/variants.d.mts +206 -0
- package/resources/beta/pay/products/variants.d.mts.map +1 -0
- package/resources/beta/pay/products/variants.d.ts +206 -0
- package/resources/beta/pay/products/variants.d.ts.map +1 -0
- package/resources/beta/pay/products/variants.js +56 -0
- package/resources/beta/pay/products/variants.js.map +1 -0
- package/resources/beta/pay/products/variants.mjs +52 -0
- package/resources/beta/pay/products/variants.mjs.map +1 -0
- package/resources/beta/push-notifications/index.d.mts +3 -0
- package/resources/beta/push-notifications/index.d.mts.map +1 -0
- package/resources/beta/push-notifications/index.d.ts +3 -0
- package/resources/beta/push-notifications/index.d.ts.map +1 -0
- package/resources/beta/push-notifications/index.js +9 -0
- package/resources/beta/push-notifications/index.js.map +1 -0
- package/resources/beta/push-notifications/index.mjs +4 -0
- package/resources/beta/push-notifications/index.mjs.map +1 -0
- package/resources/beta/push-notifications/push-notifications.d.mts +78 -0
- package/resources/beta/push-notifications/push-notifications.d.mts.map +1 -0
- package/resources/beta/push-notifications/push-notifications.d.ts +78 -0
- package/resources/beta/push-notifications/push-notifications.d.ts.map +1 -0
- package/resources/beta/push-notifications/push-notifications.js +32 -0
- package/resources/beta/push-notifications/push-notifications.js.map +1 -0
- package/resources/beta/push-notifications/push-notifications.mjs +27 -0
- package/resources/beta/push-notifications/push-notifications.mjs.map +1 -0
- package/resources/beta/push-notifications/subscriptions.d.mts +74 -0
- package/resources/beta/push-notifications/subscriptions.d.mts.map +1 -0
- package/resources/beta/push-notifications/subscriptions.d.ts +74 -0
- package/resources/beta/push-notifications/subscriptions.d.ts.map +1 -0
- package/resources/beta/push-notifications/subscriptions.js +23 -0
- package/resources/beta/push-notifications/subscriptions.js.map +1 -0
- package/resources/beta/push-notifications/subscriptions.mjs +19 -0
- package/resources/beta/push-notifications/subscriptions.mjs.map +1 -0
- package/resources/beta/push-notifications.d.mts +2 -0
- package/resources/beta/push-notifications.d.mts.map +1 -0
- package/resources/beta/push-notifications.d.ts +2 -0
- package/resources/beta/push-notifications.d.ts.map +1 -0
- package/resources/beta/push-notifications.js +6 -0
- package/resources/beta/push-notifications.js.map +1 -0
- package/resources/beta/push-notifications.mjs +3 -0
- package/resources/beta/push-notifications.mjs.map +1 -0
- package/src/resources/beta/beta.ts +18 -0
- package/src/resources/beta/index.ts +6 -0
- package/src/resources/beta/pay/coupons.ts +1 -1
- package/src/resources/beta/pay/customers.ts +1 -1
- package/src/resources/beta/pay/entitlements.ts +4 -26
- package/src/resources/beta/pay/pay.ts +87 -17
- package/src/resources/beta/pay/products/entitlements.ts +1 -1
- package/src/resources/beta/pay/products/index.ts +10 -0
- package/src/resources/beta/pay/products/products.ts +70 -14
- package/src/resources/beta/pay/products/variants.ts +279 -0
- package/src/resources/beta/push-notifications/index.ts +14 -0
- package/src/resources/beta/push-notifications/push-notifications.ts +112 -0
- package/src/resources/beta/push-notifications/subscriptions.ts +96 -0
- package/src/resources/beta/push-notifications.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as SubscriptionsAPI from './subscriptions';
|
|
5
|
+
import {
|
|
6
|
+
SubscriptionCreateParams,
|
|
7
|
+
SubscriptionCreateResponse,
|
|
8
|
+
SubscriptionDeleteResponse,
|
|
9
|
+
Subscriptions,
|
|
10
|
+
} from './subscriptions';
|
|
11
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
12
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
13
|
+
|
|
14
|
+
export class PushNotifications extends APIResource {
|
|
15
|
+
subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Enables push notifications for the app by generating VAPID keys. Idempotent -
|
|
19
|
+
* returns existing keys if already enabled. Hercules recommends calling this
|
|
20
|
+
* during app initialization.
|
|
21
|
+
*/
|
|
22
|
+
enable(options?: RequestOptions): APIPromise<PushNotificationEnableResponse> {
|
|
23
|
+
return this._client.post('/v1/push-notifications/enable', options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Sends push notifications to specified visitors. Omit visitorIds to broadcast to
|
|
28
|
+
* all subscribers. Returns the count of successful and failed deliveries.
|
|
29
|
+
*/
|
|
30
|
+
send(body: PushNotificationSendParams, options?: RequestOptions): APIPromise<PushNotificationSendResponse> {
|
|
31
|
+
return this._client.post('/v1/push-notifications/send', { body, ...options });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Response containing the VAPID public key for push subscriptions.
|
|
37
|
+
*/
|
|
38
|
+
export interface PushNotificationEnableResponse {
|
|
39
|
+
/**
|
|
40
|
+
* VAPID public key for push subscription (base64url encoded)
|
|
41
|
+
*/
|
|
42
|
+
vapidPublicKey: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Result of the send operation with success and failure counts.
|
|
47
|
+
*/
|
|
48
|
+
export interface PushNotificationSendResponse {
|
|
49
|
+
/**
|
|
50
|
+
* Number of notifications that failed to send
|
|
51
|
+
*/
|
|
52
|
+
failed: number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Number of notifications successfully sent
|
|
56
|
+
*/
|
|
57
|
+
sent: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface PushNotificationSendParams {
|
|
61
|
+
/**
|
|
62
|
+
* Notification title
|
|
63
|
+
*/
|
|
64
|
+
title: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Badge URL for mobile devices
|
|
68
|
+
*/
|
|
69
|
+
badge?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Notification body text
|
|
73
|
+
*/
|
|
74
|
+
body?: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Custom data payload to include with the notification
|
|
78
|
+
*/
|
|
79
|
+
data?: { [key: string]: unknown };
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Icon URL
|
|
83
|
+
*/
|
|
84
|
+
icon?: string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* URL to open when notification is clicked
|
|
88
|
+
*/
|
|
89
|
+
url?: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Visitor IDs to send to. Omit to broadcast to all subscribers.
|
|
93
|
+
*/
|
|
94
|
+
visitorIds?: Array<string>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
PushNotifications.Subscriptions = Subscriptions;
|
|
98
|
+
|
|
99
|
+
export declare namespace PushNotifications {
|
|
100
|
+
export {
|
|
101
|
+
type PushNotificationEnableResponse as PushNotificationEnableResponse,
|
|
102
|
+
type PushNotificationSendResponse as PushNotificationSendResponse,
|
|
103
|
+
type PushNotificationSendParams as PushNotificationSendParams,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
Subscriptions as Subscriptions,
|
|
108
|
+
type SubscriptionCreateResponse as SubscriptionCreateResponse,
|
|
109
|
+
type SubscriptionDeleteResponse as SubscriptionDeleteResponse,
|
|
110
|
+
type SubscriptionCreateParams as SubscriptionCreateParams,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
6
|
+
import { path } from '../../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Subscriptions extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Registers a push subscription for a visitor. Upserts by endpoint to handle
|
|
11
|
+
* re-subscriptions gracefully.
|
|
12
|
+
*/
|
|
13
|
+
create(body: SubscriptionCreateParams, options?: RequestOptions): APIPromise<SubscriptionCreateResponse> {
|
|
14
|
+
return this._client.post('/v1/push-notifications/subscriptions', { body, ...options });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Removes a push subscription by ID.
|
|
19
|
+
*/
|
|
20
|
+
delete(id: string, options?: RequestOptions): APIPromise<SubscriptionDeleteResponse> {
|
|
21
|
+
return this._client.delete(path`/v1/push-notifications/subscriptions/${id}`, options);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The created or updated subscription.
|
|
27
|
+
*/
|
|
28
|
+
export interface SubscriptionCreateResponse {
|
|
29
|
+
/**
|
|
30
|
+
* Subscription ID
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Result of the unsubscribe operation.
|
|
37
|
+
*/
|
|
38
|
+
export interface SubscriptionDeleteResponse {
|
|
39
|
+
/**
|
|
40
|
+
* Whether the subscription was removed
|
|
41
|
+
*/
|
|
42
|
+
success: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface SubscriptionCreateParams {
|
|
46
|
+
/**
|
|
47
|
+
* Web Push subscription object from pushManager.subscribe()
|
|
48
|
+
*/
|
|
49
|
+
subscription: SubscriptionCreateParams.Subscription;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Unique identifier for the subscriber (e.g., userId)
|
|
53
|
+
*/
|
|
54
|
+
visitorId: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export namespace SubscriptionCreateParams {
|
|
58
|
+
/**
|
|
59
|
+
* Web Push subscription object from pushManager.subscribe()
|
|
60
|
+
*/
|
|
61
|
+
export interface Subscription {
|
|
62
|
+
/**
|
|
63
|
+
* Push service endpoint URL
|
|
64
|
+
*/
|
|
65
|
+
endpoint: string;
|
|
66
|
+
|
|
67
|
+
keys: Subscription.Keys;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Subscription expiration timestamp
|
|
71
|
+
*/
|
|
72
|
+
expirationTime?: number | null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export namespace Subscription {
|
|
76
|
+
export interface Keys {
|
|
77
|
+
/**
|
|
78
|
+
* Authentication secret (base64url encoded)
|
|
79
|
+
*/
|
|
80
|
+
auth: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* P-256 Diffie-Hellman public key (base64url encoded)
|
|
84
|
+
*/
|
|
85
|
+
p256dh: string;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export declare namespace Subscriptions {
|
|
91
|
+
export {
|
|
92
|
+
type SubscriptionCreateResponse as SubscriptionCreateResponse,
|
|
93
|
+
type SubscriptionDeleteResponse as SubscriptionDeleteResponse,
|
|
94
|
+
type SubscriptionCreateParams as SubscriptionCreateParams,
|
|
95
|
+
};
|
|
96
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.5.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.5.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|