glitch-javascript-sdk 0.7.6 → 0.7.8

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,51 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class Feedback {
4
+ /**
5
+ * List all the feedback that been left by users.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Feedback/listFeedback
8
+ *
9
+ * @returns promise
10
+ */
11
+ static listFeedback<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ /**
13
+ * View a particular item of feedback.
14
+ *
15
+ * @see https://api.glitch.fun/api/documentation#/Feedback/getFeedbackById
16
+ *
17
+ * @returns promise
18
+ */
19
+ static viewFeedback<T>(feedback_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
20
+ /**
21
+ * Submit feedback.
22
+ *
23
+ * @see https://api.glitch.fun/api/documentation#/Feedback/a64fe3d6f90ed1af5bbd5311a795c134
24
+ *
25
+ * @returns A promise
26
+ */
27
+ static sendFeedback<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
28
+ /**
29
+ * Submit feedback with the log file as a file.
30
+ *
31
+ * @see https://api.glitch.fun/api/documentation#/Feedback/a64fe3d6f90ed1af5bbd5311a795c134
32
+ *
33
+ * @param file The file object to upload.
34
+ * @param data Any additional data to pass along to the upload.
35
+ *
36
+ * @returns promise
37
+ */
38
+ static sendFeedbackWithFile<T>(file: File, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
39
+ /**
40
+ * Submit feedback with the log file as a blob.
41
+ *
42
+ * @see hhttps://api.glitch.fun/api/documentation#/Feedback/a64fe3d6f90ed1af5bbd5311a795c134
43
+ *
44
+ * @param blob The blob to upload.
45
+ * @param data Any additional data to pass along to the upload
46
+ *
47
+ * @returns promise
48
+ */
49
+ static sendFeedbackWithBlob<T>(blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
50
+ }
51
+ export default Feedback;
@@ -0,0 +1,38 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class Messages {
4
+ /**
5
+ * Get all the message threads that a user has particpated in.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Messages/getConversations
8
+ *
9
+ * @returns promise
10
+ */
11
+ static listMessageThreads<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ /**
13
+ * Send a new message that will be added to a thread
14
+ *
15
+ * @see https://api.glitch.fun/api/documentation#/Messages/storeMessage
16
+ *
17
+ * @returns A promise
18
+ */
19
+ static sendMessage<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
20
+ /**
21
+ * Deletes a message.
22
+ *
23
+ * @see https://api.glitch.fun/api/documentation#/Messages/destroyMessage
24
+ *
25
+ * @returns A promise
26
+ */
27
+ static deleteMessage<T>(message_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
28
+ /**
29
+ * A message thread is a thread between multiple users. Pass the user ids in the thread and it will either
30
+ * get the current thread or create a new thread.
31
+ *
32
+ * @see https://api.glitch.fun/api/documentation#/Messages/conversations
33
+ *
34
+ * @returns A promise
35
+ */
36
+ static createOrGetThread<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
37
+ }
38
+ export default Messages;
@@ -0,0 +1,69 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class Subscriptions {
4
+ /**
5
+ * Get a creator subscription for the creator program.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscription
8
+ *
9
+ * @returns promise
10
+ */
11
+ static getCreatorSubscription<T>(stripe_subscription_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ /**
13
+ * Get a s subscription plan that a community has to talk with influencers
14
+ *
15
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscription
16
+ *
17
+ * @returns promise
18
+ */
19
+ static getCommunityInfluencerSubscription<T>(community_id: string, stripe_subscription_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
20
+ /**
21
+ * List all the subscription plans that a creator has.
22
+ *
23
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscriptions
24
+ *
25
+ * @returns promise
26
+ */
27
+ static listCreatorSubscriptions<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
28
+ /**
29
+ * List all the subscription plans that a community has.
30
+ *
31
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscriptions
32
+ *
33
+ * @returns promise
34
+ */
35
+ static listCommunityInfluencerSubscriptions<T>(community_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
36
+ /**
37
+ * Create a new subscription of a content creator
38
+ *
39
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/createCreatorSubscription
40
+ *
41
+ * @returns A promise
42
+ */
43
+ static createCreatorSubscription<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
44
+ /**
45
+ * Create a new subscription of a community engaging in influencer marketing
46
+ *
47
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/createCommunityInfluencerSubscription
48
+ *
49
+ * @returns A promise
50
+ */
51
+ static createCommunityInfluencerSubscription<T>(community_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
52
+ /**
53
+ * Cancels a creator subscription
54
+ *
55
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCreatorSubscription
56
+ *
57
+ * @returns A promise
58
+ */
59
+ static cancelCreatorSubscription<T>(stripe_subscription_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
60
+ /**
61
+ * Cancels a community subscription
62
+ *
63
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCommunityInfluencerSubscription
64
+ *
65
+ * @returns A promise
66
+ */
67
+ static cancelCommunityInfluencerSubscription<T>(community_id: string, stripe_subscription_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
68
+ }
69
+ export default Subscriptions;
@@ -16,6 +16,9 @@ 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";
21
+ import Feedback from "./Feedback";
19
22
  export { Auth };
20
23
  export { Competitions };
21
24
  export { Communities };
@@ -34,3 +37,6 @@ export { TipPackagePurchases };
34
37
  export { SocialPosts };
35
38
  export { Titles };
36
39
  export { Campaigns };
40
+ export { Subscriptions };
41
+ export { Messages };
42
+ export { Feedback };
@@ -16,6 +16,9 @@ import { TipPackagePurchases } from "./api";
16
16
  import { SocialPosts } from "./api";
17
17
  import { Titles } from "./api";
18
18
  import { Campaigns } from "./api";
19
+ import { Subscriptions } from "./api";
20
+ import { Messages } from "./api";
21
+ import { Feedback } from "./api";
19
22
  import Requests from "./util/Requests";
20
23
  import Parser from "./util/Parser";
21
24
  import Session from "./util/Session";
@@ -41,8 +44,10 @@ declare class Glitch {
41
44
  Communities: typeof Communities;
42
45
  Users: typeof Users;
43
46
  Events: typeof Events;
47
+ Feedback: typeof Feedback;
44
48
  Teams: typeof Teams;
45
49
  Posts: typeof Posts;
50
+ Messages: typeof Messages;
46
51
  Templates: typeof Templates;
47
52
  Waitlists: typeof Waitlists;
48
53
  Utility: typeof Utility;
@@ -50,6 +55,7 @@ declare class Glitch {
50
55
  Titles: typeof Titles;
51
56
  Social: typeof Social;
52
57
  SocialPosts: typeof SocialPosts;
58
+ Subscriptions: typeof Subscriptions;
53
59
  TipPackages: typeof TipPackages;
54
60
  TipEmojis: typeof TipEmojis;
55
61
  TipPackagePurchases: typeof TipPackagePurchases;
package/dist/esm/index.js CHANGED
@@ -8983,6 +8983,242 @@ var Campaigns = /** @class */ (function () {
8983
8983
  return Campaigns;
8984
8984
  }());
8985
8985
 
8986
+ var SubscriptionsRoute = /** @class */ (function () {
8987
+ function SubscriptionsRoute() {
8988
+ }
8989
+ SubscriptionsRoute.routes = {
8990
+ createCreatorSubscription: { url: '/subscriptions/creators/subscribe', method: HTTP_METHODS.POST },
8991
+ getCreatorSubscription: { url: '/subscriptions/creators/{stripe_subscription_id}', method: HTTP_METHODS.GET },
8992
+ cancelCreatorSubscription: { url: '/subscriptions/creators/{stripe_subscription_id}', method: HTTP_METHODS.DELETE },
8993
+ listCreatorSubscriptions: { url: '/subscriptions/creators', method: HTTP_METHODS.GET },
8994
+ createCommunityInfluencerSubscription: { url: '/subscriptions/communities/influencers/subscribe/{community_id}', method: HTTP_METHODS.POST },
8995
+ getCommunityInfluencerSubscription: { url: '/subscriptions/communities/influencers/{community_id}/{stripe_subscription_id}', method: HTTP_METHODS.GET },
8996
+ cancelCommunityInfluencerSubscription: { url: '/subscriptions/communities/influencers/{community_id}/{stripe_subscription_id}', method: HTTP_METHODS.DELETE },
8997
+ listCommunityInfluencerSubscriptions: { url: '/subscriptions/communities/influencers/{community_id}', method: HTTP_METHODS.GET },
8998
+ };
8999
+ return SubscriptionsRoute;
9000
+ }());
9001
+
9002
+ var Subscriptions = /** @class */ (function () {
9003
+ function Subscriptions() {
9004
+ }
9005
+ /**
9006
+ * Get a creator subscription for the creator program.
9007
+ *
9008
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscription
9009
+ *
9010
+ * @returns promise
9011
+ */
9012
+ Subscriptions.getCreatorSubscription = function (stripe_subscription_id, params) {
9013
+ return Requests.processRoute(SubscriptionsRoute.routes.getCreatorSubscription, undefined, { stripe_subscription_id: stripe_subscription_id }, params);
9014
+ };
9015
+ /**
9016
+ * Get a s subscription plan that a community has to talk with influencers
9017
+ *
9018
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscription
9019
+ *
9020
+ * @returns promise
9021
+ */
9022
+ Subscriptions.getCommunityInfluencerSubscription = function (community_id, stripe_subscription_id, params) {
9023
+ return Requests.processRoute(SubscriptionsRoute.routes.getCommunityInfluencerSubscription, undefined, { community_id: community_id, stripe_subscription_id: stripe_subscription_id }, params);
9024
+ };
9025
+ /**
9026
+ * List all the subscription plans that a creator has.
9027
+ *
9028
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCreatorSubscriptions
9029
+ *
9030
+ * @returns promise
9031
+ */
9032
+ Subscriptions.listCreatorSubscriptions = function (params) {
9033
+ return Requests.processRoute(SubscriptionsRoute.routes.listCreatorSubscriptions, undefined, undefined, params);
9034
+ };
9035
+ /**
9036
+ * List all the subscription plans that a community has.
9037
+ *
9038
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/getCommunityInfluencerSubscriptions
9039
+ *
9040
+ * @returns promise
9041
+ */
9042
+ Subscriptions.listCommunityInfluencerSubscriptions = function (community_id, params) {
9043
+ return Requests.processRoute(SubscriptionsRoute.routes.listCommunityInfluencerSubscriptions, undefined, { community_id: community_id }, params);
9044
+ };
9045
+ /**
9046
+ * Create a new subscription of a content creator
9047
+ *
9048
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/createCreatorSubscription
9049
+ *
9050
+ * @returns A promise
9051
+ */
9052
+ Subscriptions.createCreatorSubscription = function (data, params) {
9053
+ return Requests.processRoute(SubscriptionsRoute.routes.createCreatorSubscription, data, {}, params);
9054
+ };
9055
+ /**
9056
+ * Create a new subscription of a community engaging in influencer marketing
9057
+ *
9058
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/createCommunityInfluencerSubscription
9059
+ *
9060
+ * @returns A promise
9061
+ */
9062
+ Subscriptions.createCommunityInfluencerSubscription = function (community_id, data, params) {
9063
+ return Requests.processRoute(SubscriptionsRoute.routes.createCommunityInfluencerSubscription, data, { community_id: community_id }, params);
9064
+ };
9065
+ /**
9066
+ * Cancels a creator subscription
9067
+ *
9068
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCreatorSubscription
9069
+ *
9070
+ * @returns A promise
9071
+ */
9072
+ Subscriptions.cancelCreatorSubscription = function (stripe_subscription_id, data, params) {
9073
+ return Requests.processRoute(SubscriptionsRoute.routes.cancelCreatorSubscription, data, { stripe_subscription_id: stripe_subscription_id }, params);
9074
+ };
9075
+ /**
9076
+ * Cancels a community subscription
9077
+ *
9078
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelCommunityInfluencerSubscription
9079
+ *
9080
+ * @returns A promise
9081
+ */
9082
+ Subscriptions.cancelCommunityInfluencerSubscription = function (community_id, stripe_subscription_id, data, params) {
9083
+ return Requests.processRoute(SubscriptionsRoute.routes.cancelCreatorSubscription, data, { community_id: community_id, stripe_subscription_id: stripe_subscription_id }, params);
9084
+ };
9085
+ return Subscriptions;
9086
+ }());
9087
+
9088
+ var MessagesRoute = /** @class */ (function () {
9089
+ function MessagesRoute() {
9090
+ }
9091
+ MessagesRoute.routes = {
9092
+ listMessageThreads: { url: '/messages', method: HTTP_METHODS.GET },
9093
+ sendMessage: { url: '/messages', method: HTTP_METHODS.POST },
9094
+ deleteMessage: { url: '/messages/{message_id}', method: HTTP_METHODS.DELETE },
9095
+ createOrGetThread: { url: '/messages/makeThread', method: HTTP_METHODS.POST },
9096
+ };
9097
+ return MessagesRoute;
9098
+ }());
9099
+
9100
+ var Messages = /** @class */ (function () {
9101
+ function Messages() {
9102
+ }
9103
+ /**
9104
+ * Get all the message threads that a user has particpated in.
9105
+ *
9106
+ * @see https://api.glitch.fun/api/documentation#/Messages/getConversations
9107
+ *
9108
+ * @returns promise
9109
+ */
9110
+ Messages.listMessageThreads = function (params) {
9111
+ return Requests.processRoute(MessagesRoute.routes.listMessageThreads, undefined, undefined, params);
9112
+ };
9113
+ /**
9114
+ * Send a new message that will be added to a thread
9115
+ *
9116
+ * @see https://api.glitch.fun/api/documentation#/Messages/storeMessage
9117
+ *
9118
+ * @returns A promise
9119
+ */
9120
+ Messages.sendMessage = function (data, params) {
9121
+ return Requests.processRoute(MessagesRoute.routes.sendMessage, data, {}, params);
9122
+ };
9123
+ /**
9124
+ * Deletes a message.
9125
+ *
9126
+ * @see https://api.glitch.fun/api/documentation#/Messages/destroyMessage
9127
+ *
9128
+ * @returns A promise
9129
+ */
9130
+ Messages.deleteMessage = function (message_id, data, params) {
9131
+ return Requests.processRoute(MessagesRoute.routes.deleteMessage, data, { message_id: message_id }, params);
9132
+ };
9133
+ /**
9134
+ * A message thread is a thread between multiple users. Pass the user ids in the thread and it will either
9135
+ * get the current thread or create a new thread.
9136
+ *
9137
+ * @see https://api.glitch.fun/api/documentation#/Messages/conversations
9138
+ *
9139
+ * @returns A promise
9140
+ */
9141
+ Messages.createOrGetThread = function (data, params) {
9142
+ return Requests.processRoute(MessagesRoute.routes.createOrGetThread, data, {}, params);
9143
+ };
9144
+ return Messages;
9145
+ }());
9146
+
9147
+ var FeedbackRoute = /** @class */ (function () {
9148
+ function FeedbackRoute() {
9149
+ }
9150
+ FeedbackRoute.routes = {
9151
+ listFeedback: { url: '/feedback', method: HTTP_METHODS.GET },
9152
+ sendFeedback: { url: '/feedback', method: HTTP_METHODS.POST },
9153
+ viewFeedback: { url: '/feedback/{feedback_id}', method: HTTP_METHODS.GET },
9154
+ };
9155
+ return FeedbackRoute;
9156
+ }());
9157
+
9158
+ var Feedback = /** @class */ (function () {
9159
+ function Feedback() {
9160
+ }
9161
+ /**
9162
+ * List all the feedback that been left by users.
9163
+ *
9164
+ * @see https://api.glitch.fun/api/documentation#/Feedback/listFeedback
9165
+ *
9166
+ * @returns promise
9167
+ */
9168
+ Feedback.listFeedback = function (params) {
9169
+ return Requests.processRoute(FeedbackRoute.routes.listFeedback, undefined, undefined, params);
9170
+ };
9171
+ /**
9172
+ * View a particular item of feedback.
9173
+ *
9174
+ * @see https://api.glitch.fun/api/documentation#/Feedback/getFeedbackById
9175
+ *
9176
+ * @returns promise
9177
+ */
9178
+ Feedback.viewFeedback = function (feedback_id, params) {
9179
+ return Requests.processRoute(FeedbackRoute.routes.viewFeedback, undefined, { feedback_id: feedback_id }, params);
9180
+ };
9181
+ /**
9182
+ * Submit feedback.
9183
+ *
9184
+ * @see https://api.glitch.fun/api/documentation#/Feedback/a64fe3d6f90ed1af5bbd5311a795c134
9185
+ *
9186
+ * @returns A promise
9187
+ */
9188
+ Feedback.sendFeedback = function (data, params) {
9189
+ return Requests.processRoute(FeedbackRoute.routes.sendFeedback, data, {}, params);
9190
+ };
9191
+ /**
9192
+ * Submit feedback with the log file as a file.
9193
+ *
9194
+ * @see https://api.glitch.fun/api/documentation#/Feedback/a64fe3d6f90ed1af5bbd5311a795c134
9195
+ *
9196
+ * @param file The file object to upload.
9197
+ * @param data Any additional data to pass along to the upload.
9198
+ *
9199
+ * @returns promise
9200
+ */
9201
+ Feedback.sendFeedbackWithFile = function (file, data, params) {
9202
+ var url = FeedbackRoute.routes.sendFeedback.url;
9203
+ return Requests.uploadFile(url, 'image', file, data);
9204
+ };
9205
+ /**
9206
+ * Submit feedback with the log file as a blob.
9207
+ *
9208
+ * @see hhttps://api.glitch.fun/api/documentation#/Feedback/a64fe3d6f90ed1af5bbd5311a795c134
9209
+ *
9210
+ * @param blob The blob to upload.
9211
+ * @param data Any additional data to pass along to the upload
9212
+ *
9213
+ * @returns promise
9214
+ */
9215
+ Feedback.sendFeedbackWithBlob = function (blob, data, params) {
9216
+ var url = FeedbackRoute.routes.sendFeedback.url;
9217
+ return Requests.uploadBlob(url, 'image', blob, data);
9218
+ };
9219
+ return Feedback;
9220
+ }());
9221
+
8986
9222
  var Parser = /** @class */ (function () {
8987
9223
  function Parser() {
8988
9224
  }
@@ -9386,8 +9622,10 @@ var Glitch = /** @class */ (function () {
9386
9622
  Communities: Communities,
9387
9623
  Users: Users,
9388
9624
  Events: Events,
9625
+ Feedback: Feedback,
9389
9626
  Teams: Teams,
9390
9627
  Posts: Posts,
9628
+ Messages: Messages,
9391
9629
  Templates: Templates,
9392
9630
  Waitlists: Waitlists,
9393
9631
  Utility: Utility,
@@ -9395,6 +9633,7 @@ var Glitch = /** @class */ (function () {
9395
9633
  Titles: Titles,
9396
9634
  Social: Social,
9397
9635
  SocialPosts: SocialPosts,
9636
+ Subscriptions: Subscriptions,
9398
9637
  TipPackages: TipPackages,
9399
9638
  TipEmojis: TipEmojis,
9400
9639
  TipPackagePurchases: TipPackagePurchases