glitch-javascript-sdk 0.7.6 → 0.7.7
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/dist/cjs/index.js +163 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Messages.d.ts +38 -0
- package/dist/esm/api/Subscriptions.d.ts +69 -0
- package/dist/esm/api/index.d.ts +4 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +163 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/MessagesRoute.d.ts +7 -0
- package/dist/esm/routes/SubscriptionsRoute.d.ts +7 -0
- package/dist/index.d.ts +105 -0
- package/package.json +1 -1
- package/src/api/Messages.ts +57 -0
- package/src/api/Subscriptions.ts +99 -0
- package/src/api/index.ts +5 -1
- package/src/index.ts +4 -0
- package/src/routes/MessagesRoute.ts +15 -0
- package/src/routes/SubscriptionsRoute.ts +20 -0
package/dist/index.d.ts
CHANGED
|
@@ -2392,6 +2392,109 @@ declare class Campaigns {
|
|
|
2392
2392
|
static listInfluencerCampaignLinks<T>(campaign_id: string, user_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2393
2393
|
}
|
|
2394
2394
|
|
|
2395
|
+
declare class Subscriptions {
|
|
2396
|
+
/**
|
|
2397
|
+
* Get a creator subscription for the creator program.
|
|
2398
|
+
*
|
|
2399
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscription
|
|
2400
|
+
*
|
|
2401
|
+
* @returns promise
|
|
2402
|
+
*/
|
|
2403
|
+
static getCreatorSubscription<T>(stripe_subscription_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2404
|
+
/**
|
|
2405
|
+
* Get a s subscription plan that a community has to talk with influencers
|
|
2406
|
+
*
|
|
2407
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscription
|
|
2408
|
+
*
|
|
2409
|
+
* @returns promise
|
|
2410
|
+
*/
|
|
2411
|
+
static getCommunityInfluencerSubscription<T>(community_id: string, stripe_subscription_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2412
|
+
/**
|
|
2413
|
+
* List all the subscription plans that a creator has.
|
|
2414
|
+
*
|
|
2415
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscriptions
|
|
2416
|
+
*
|
|
2417
|
+
* @returns promise
|
|
2418
|
+
*/
|
|
2419
|
+
static listCreatorSubscriptions<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2420
|
+
/**
|
|
2421
|
+
* List all the subscription plans that a community has.
|
|
2422
|
+
*
|
|
2423
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscriptions
|
|
2424
|
+
*
|
|
2425
|
+
* @returns promise
|
|
2426
|
+
*/
|
|
2427
|
+
static listCommunityInfluencerSubscriptions<T>(community_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2428
|
+
/**
|
|
2429
|
+
* Create a new subscription of a content creator
|
|
2430
|
+
*
|
|
2431
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/createCreatorSubscription
|
|
2432
|
+
*
|
|
2433
|
+
* @returns A promise
|
|
2434
|
+
*/
|
|
2435
|
+
static createCreatorSubscription<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2436
|
+
/**
|
|
2437
|
+
* Create a new subscription of a community engaging in influencer marketing
|
|
2438
|
+
*
|
|
2439
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/createCommunityInfluencerSubscription
|
|
2440
|
+
*
|
|
2441
|
+
* @returns A promise
|
|
2442
|
+
*/
|
|
2443
|
+
static createCommunityInfluencerSubscription<T>(community_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2444
|
+
/**
|
|
2445
|
+
* Cancels a creator subscription
|
|
2446
|
+
*
|
|
2447
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCreatorSubscription
|
|
2448
|
+
*
|
|
2449
|
+
* @returns A promise
|
|
2450
|
+
*/
|
|
2451
|
+
static cancelCreatorSubscription<T>(stripe_subscription_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2452
|
+
/**
|
|
2453
|
+
* Cancels a community subscription
|
|
2454
|
+
*
|
|
2455
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCommunityInfluencerSubscription
|
|
2456
|
+
*
|
|
2457
|
+
* @returns A promise
|
|
2458
|
+
*/
|
|
2459
|
+
static cancelCommunityInfluencerSubscription<T>(community_id: string, stripe_subscription_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
declare class Messages {
|
|
2463
|
+
/**
|
|
2464
|
+
* Get all the message threads that a user has particpated in.
|
|
2465
|
+
*
|
|
2466
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/getConversations
|
|
2467
|
+
*
|
|
2468
|
+
* @returns promise
|
|
2469
|
+
*/
|
|
2470
|
+
static listMessageThreads<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2471
|
+
/**
|
|
2472
|
+
* Send a new message that will be added to a thread
|
|
2473
|
+
*
|
|
2474
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/storeMessage
|
|
2475
|
+
*
|
|
2476
|
+
* @returns A promise
|
|
2477
|
+
*/
|
|
2478
|
+
static sendMessage<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2479
|
+
/**
|
|
2480
|
+
* Deletes a message.
|
|
2481
|
+
*
|
|
2482
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/destroyMessage
|
|
2483
|
+
*
|
|
2484
|
+
* @returns A promise
|
|
2485
|
+
*/
|
|
2486
|
+
static deleteMessage<T>(message_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2487
|
+
/**
|
|
2488
|
+
* A message thread is a thread between multiple users. Pass the user ids in the thread and it will either
|
|
2489
|
+
* get the current thread or create a new thread.
|
|
2490
|
+
*
|
|
2491
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/conversations
|
|
2492
|
+
*
|
|
2493
|
+
* @returns A promise
|
|
2494
|
+
*/
|
|
2495
|
+
static createOrGetThread<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2395
2498
|
interface Route {
|
|
2396
2499
|
url: string;
|
|
2397
2500
|
method: string;
|
|
@@ -2698,6 +2801,7 @@ declare class Glitch {
|
|
|
2698
2801
|
Events: typeof Events;
|
|
2699
2802
|
Teams: typeof Teams;
|
|
2700
2803
|
Posts: typeof Posts;
|
|
2804
|
+
Messages: typeof Messages;
|
|
2701
2805
|
Templates: typeof Templates;
|
|
2702
2806
|
Waitlists: typeof Waitlists;
|
|
2703
2807
|
Utility: typeof Utility;
|
|
@@ -2705,6 +2809,7 @@ declare class Glitch {
|
|
|
2705
2809
|
Titles: typeof Titles;
|
|
2706
2810
|
Social: typeof Social;
|
|
2707
2811
|
SocialPosts: typeof SocialPosts;
|
|
2812
|
+
Subscriptions: typeof Subscriptions;
|
|
2708
2813
|
TipPackages: typeof TipPackages;
|
|
2709
2814
|
TipEmojis: typeof TipEmojis;
|
|
2710
2815
|
TipPackagePurchases: typeof TipPackagePurchases;
|
package/package.json
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import MessagesRoute from "../routes/MessagesRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class Messages {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get all the message threads that a user has particpated in.
|
|
10
|
+
*
|
|
11
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/getConversations
|
|
12
|
+
*
|
|
13
|
+
* @returns promise
|
|
14
|
+
*/
|
|
15
|
+
public static listMessageThreads<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
16
|
+
return Requests.processRoute(MessagesRoute.routes.listMessageThreads, undefined, undefined, params);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Send a new message that will be added to a thread
|
|
21
|
+
*
|
|
22
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/storeMessage
|
|
23
|
+
*
|
|
24
|
+
* @returns A promise
|
|
25
|
+
*/
|
|
26
|
+
public static sendMessage<T>(data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
|
|
27
|
+
return Requests.processRoute(MessagesRoute.routes.sendMessage, data, {}, params);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Deletes a message.
|
|
32
|
+
*
|
|
33
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/destroyMessage
|
|
34
|
+
*
|
|
35
|
+
* @returns A promise
|
|
36
|
+
*/
|
|
37
|
+
public static deleteMessage<T>(message_id: string, data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
|
|
38
|
+
return Requests.processRoute(MessagesRoute.routes.deleteMessage, data, {message_id : message_id}, params);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A message thread is a thread between multiple users. Pass the user ids in the thread and it will either
|
|
43
|
+
* get the current thread or create a new thread.
|
|
44
|
+
*
|
|
45
|
+
* @see https://api.glitch.fun/api/documentation#/Messages/conversations
|
|
46
|
+
*
|
|
47
|
+
* @returns A promise
|
|
48
|
+
*/
|
|
49
|
+
public static createOrGetThread<T>(data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
|
|
50
|
+
return Requests.processRoute(MessagesRoute.routes.createOrGetThread, data, {}, params);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default Messages;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import SubscriptionsRoute from "../routes/SubscriptionsRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class Subscriptions {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get a creator subscription for the creator program.
|
|
10
|
+
*
|
|
11
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscription
|
|
12
|
+
*
|
|
13
|
+
* @returns promise
|
|
14
|
+
*/
|
|
15
|
+
public static getCreatorSubscription<T>(stripe_subscription_id : string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
16
|
+
return Requests.processRoute(SubscriptionsRoute.routes.getCreatorSubscription, undefined, {stripe_subscription_id : stripe_subscription_id}, params);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get a s subscription plan that a community has to talk with influencers
|
|
21
|
+
*
|
|
22
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscription
|
|
23
|
+
*
|
|
24
|
+
* @returns promise
|
|
25
|
+
*/
|
|
26
|
+
public static getCommunityInfluencerSubscription<T>(community_id : string, stripe_subscription_id : string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
27
|
+
return Requests.processRoute(SubscriptionsRoute.routes.getCommunityInfluencerSubscription, undefined, {community_id : community_id, stripe_subscription_id : stripe_subscription_id}, params);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* List all the subscription plans that a creator has.
|
|
32
|
+
*
|
|
33
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscriptions
|
|
34
|
+
*
|
|
35
|
+
* @returns promise
|
|
36
|
+
*/
|
|
37
|
+
public static listCreatorSubscriptions<T>( params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
38
|
+
return Requests.processRoute(SubscriptionsRoute.routes.listCreatorSubscriptions, undefined, undefined, params);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* List all the subscription plans that a community has.
|
|
43
|
+
*
|
|
44
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscriptions
|
|
45
|
+
*
|
|
46
|
+
* @returns promise
|
|
47
|
+
*/
|
|
48
|
+
public static listCommunityInfluencerSubscriptions<T>(community_id : string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
49
|
+
return Requests.processRoute(SubscriptionsRoute.routes.listCommunityInfluencerSubscriptions, undefined, {community_id : community_id}, params);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create a new subscription of a content creator
|
|
54
|
+
*
|
|
55
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/createCreatorSubscription
|
|
56
|
+
*
|
|
57
|
+
* @returns A promise
|
|
58
|
+
*/
|
|
59
|
+
public static createCreatorSubscription<T>(data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
|
|
60
|
+
return Requests.processRoute(SubscriptionsRoute.routes.createCreatorSubscription, data, {}, params);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Create a new subscription of a community engaging in influencer marketing
|
|
65
|
+
*
|
|
66
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/createCommunityInfluencerSubscription
|
|
67
|
+
*
|
|
68
|
+
* @returns A promise
|
|
69
|
+
*/
|
|
70
|
+
public static createCommunityInfluencerSubscription<T>(community_id : string, data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
|
|
71
|
+
return Requests.processRoute(SubscriptionsRoute.routes.createCommunityInfluencerSubscription, data, {community_id: community_id}, params);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Cancels a creator subscription
|
|
76
|
+
*
|
|
77
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCreatorSubscription
|
|
78
|
+
*
|
|
79
|
+
* @returns A promise
|
|
80
|
+
*/
|
|
81
|
+
public static cancelCreatorSubscription<T>(stripe_subscription_id: string, data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
|
|
82
|
+
return Requests.processRoute(SubscriptionsRoute.routes.cancelCreatorSubscription, data, {stripe_subscription_id : stripe_subscription_id}, params);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Cancels a community subscription
|
|
87
|
+
*
|
|
88
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCommunityInfluencerSubscription
|
|
89
|
+
*
|
|
90
|
+
* @returns A promise
|
|
91
|
+
*/
|
|
92
|
+
public static cancelCommunityInfluencerSubscription<T>(community_id : string, stripe_subscription_id: string, data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
|
|
93
|
+
return Requests.processRoute(SubscriptionsRoute.routes.cancelCreatorSubscription, data, {community_id: community_id, stripe_subscription_id : stripe_subscription_id}, params);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default Subscriptions;
|
package/src/api/index.ts
CHANGED
|
@@ -16,6 +16,8 @@ import TipPackagePurchases from "./TipPackagePurchases";
|
|
|
16
16
|
import SocialPosts from "./SocialPosts";
|
|
17
17
|
import Titles from "./Titles";
|
|
18
18
|
import Campaigns from "./Campaigns";
|
|
19
|
+
import Subscriptions from "./Subscriptions";
|
|
20
|
+
import Messages from "./Messages";
|
|
19
21
|
|
|
20
22
|
export {Auth};
|
|
21
23
|
export {Competitions};
|
|
@@ -34,4 +36,6 @@ export {TipPackages};
|
|
|
34
36
|
export {TipPackagePurchases};
|
|
35
37
|
export {SocialPosts};
|
|
36
38
|
export {Titles};
|
|
37
|
-
export {Campaigns};
|
|
39
|
+
export {Campaigns};
|
|
40
|
+
export {Subscriptions};
|
|
41
|
+
export {Messages};
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,8 @@ import { TipPackagePurchases } from "./api";
|
|
|
20
20
|
import { SocialPosts } from "./api";
|
|
21
21
|
import {Titles} from "./api";
|
|
22
22
|
import {Campaigns} from "./api";
|
|
23
|
+
import {Subscriptions} from "./api";
|
|
24
|
+
import {Messages} from "./api";
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
|
|
@@ -61,6 +63,7 @@ class Glitch {
|
|
|
61
63
|
Events: Events,
|
|
62
64
|
Teams: Teams,
|
|
63
65
|
Posts: Posts,
|
|
66
|
+
Messages : Messages,
|
|
64
67
|
Templates : Templates,
|
|
65
68
|
Waitlists: Waitlists,
|
|
66
69
|
Utility : Utility,
|
|
@@ -68,6 +71,7 @@ class Glitch {
|
|
|
68
71
|
Titles : Titles,
|
|
69
72
|
Social : Social,
|
|
70
73
|
SocialPosts : SocialPosts,
|
|
74
|
+
Subscriptions : Subscriptions,
|
|
71
75
|
TipPackages : TipPackages,
|
|
72
76
|
TipEmojis : TipEmojis ,
|
|
73
77
|
TipPackagePurchases: TipPackagePurchases
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class MessagesRoute {
|
|
5
|
+
|
|
6
|
+
public static routes: { [key: string]: Route } = {
|
|
7
|
+
listMessageThreads: { url: '/messages', method: HTTP_METHODS.GET },
|
|
8
|
+
sendMessage: { url: '/message', method: HTTP_METHODS.POST },
|
|
9
|
+
deleteMessage: { url: '/message/{message_id}', method: HTTP_METHODS.DELETE },
|
|
10
|
+
createOrGetThread: { url: '/messages/makeThread', method: HTTP_METHODS.POST },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default MessagesRoute;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class SubscriptionsRoute {
|
|
5
|
+
|
|
6
|
+
public static routes: { [key: string]: Route } = {
|
|
7
|
+
createCreatorSubscription: { url: '/subscriptions/creators/subscribe', method: HTTP_METHODS.POST },
|
|
8
|
+
getCreatorSubscription: { url: '/subscriptions/creators/{stripe_subscription_id}', method: HTTP_METHODS.GET },
|
|
9
|
+
cancelCreatorSubscription: { url: '/subscriptions/creators/{stripe_subscription_id}', method: HTTP_METHODS.DELETE },
|
|
10
|
+
listCreatorSubscriptions: { url: '/subscriptions/creators', method: HTTP_METHODS.GET },
|
|
11
|
+
|
|
12
|
+
createCommunityInfluencerSubscription: { url: '/subscriptions/communities/influencers/subscribe/{community_id}', method: HTTP_METHODS.POST },
|
|
13
|
+
getCommunityInfluencerSubscription: { url: '/subscriptions/communities/influencers/{community_id}/{stripe_subscription_id}', method: HTTP_METHODS.GET },
|
|
14
|
+
cancelCommunityInfluencerSubscription: { url: '/subscriptions/communities/influencers/{community_id}/{stripe_subscription_id}', method: HTTP_METHODS.DELETE },
|
|
15
|
+
listCommunityInfluencerSubscriptions: { url: '/subscriptions/communities/influencers/{community_id}', method: HTTP_METHODS.GET },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SubscriptionsRoute;
|