glitch-javascript-sdk 0.6.4 → 0.6.6

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,7 @@
1
+ import Route from "./interface";
2
+ declare class CampaignsRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default CampaignsRoute;
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class TitlesRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default TitlesRoute;
package/dist/index.d.ts CHANGED
@@ -2100,6 +2100,234 @@ declare class SocialPosts {
2100
2100
  static view<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2101
2101
  }
2102
2102
 
2103
+ declare class Titles {
2104
+ /**
2105
+ * List all the Titles.
2106
+ *
2107
+ * @see https://api.glitch.fun/api/documentation#/Titles/edab2e3b061347b06c82258622d239e2
2108
+ *
2109
+ * @returns promise
2110
+ */
2111
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
2112
+ /**
2113
+ * Create a new title.
2114
+ *
2115
+ * @see https://api.glitch.fun/api/documentation#/Titles/storeTitle
2116
+ *
2117
+ * @param data The data to be passed when creating a title.
2118
+ *
2119
+ * @returns Promise
2120
+ */
2121
+ static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2122
+ /**
2123
+ * Update a title.
2124
+ *
2125
+ * @see https://api.glitch.fun/api/documentation#/Titles/updateTitle
2126
+ *
2127
+ * @param title_id The id of the title to update.
2128
+ * @param data The data to update.
2129
+ *
2130
+ * @returns promise
2131
+ */
2132
+ static update<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2133
+ /**
2134
+ * Retrieve the information for a single title.
2135
+ *
2136
+ * @see https://api.glitch.fun/api/documentation#/Titles/getTitleByUUID
2137
+ *
2138
+ * @param title_id The id fo the title to retrieve.
2139
+ *
2140
+ * @returns promise
2141
+ */
2142
+ static view<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2143
+ /**
2144
+ * Deletes a title.
2145
+ *
2146
+ * @see https://api.glitch.fun/api/documentation#/Titles/deleteTitle
2147
+ *
2148
+ * @param title_id The id of the title to delete.
2149
+ * @returns promise
2150
+ */
2151
+ static delete<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2152
+ /**
2153
+ * Approve a title
2154
+ *
2155
+ * @see https://api.glitch.fun/api/documentation#/Titles/approveTitle
2156
+ *
2157
+ * @param data The data to be passed when creating a title.
2158
+ *
2159
+ * @returns Promise
2160
+ */
2161
+ static approve<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2162
+ /**
2163
+ * Reject a title
2164
+ *
2165
+ * @see https://api.glitch.fun/api/documentation#/Titles/rejectTitle
2166
+ *
2167
+ * @param data The data to be passed when creating a title.
2168
+ *
2169
+ * @returns Promise
2170
+ */
2171
+ static reject<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2172
+ }
2173
+
2174
+ declare class Campaigns {
2175
+ /**
2176
+ * List all the Campaigns.
2177
+ *
2178
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/edab2e3b061347b06c82258622d239e2
2179
+ *
2180
+ * @returns promise
2181
+ */
2182
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
2183
+ /**
2184
+ * Create a new campaign.
2185
+ *
2186
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/createCampaign
2187
+ *
2188
+ * @param data The data to be passed when creating a campaign.
2189
+ *
2190
+ * @returns Promise
2191
+ */
2192
+ static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2193
+ /**
2194
+ * Update a campaign.
2195
+ *
2196
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/updateCampaign
2197
+ *
2198
+ * @param campaign_id The id of the campaign to update.
2199
+ * @param data The data to update.
2200
+ *
2201
+ * @returns promise
2202
+ */
2203
+ static update<T>(campaign_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2204
+ /**
2205
+ * Retrieve the information for a single campaign.
2206
+ *
2207
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getCampaignByUuid
2208
+ *
2209
+ * @param campaign_id The id fo the campaign to retrieve.
2210
+ *
2211
+ * @returns promise
2212
+ */
2213
+ static view<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2214
+ /**
2215
+ * Deletes a campaign.
2216
+ *
2217
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/deleteCampaign
2218
+ *
2219
+ * @param campaign_id The id of the campaign to delete.
2220
+ * @returns promise
2221
+ */
2222
+ static delete<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2223
+ /**
2224
+ * List all the campaign links.
2225
+ *
2226
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getCampaignLinks
2227
+ *
2228
+ * @returns promise
2229
+ */
2230
+ static listCampaignLinks<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2231
+ /**
2232
+ * Create a new campaign link.
2233
+ *
2234
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/storeCampaignLink
2235
+ *
2236
+ * @param data The data to be passed when creating a campaign.
2237
+ *
2238
+ * @returns Promise
2239
+ */
2240
+ static createCampaignLink<T>(campaign_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2241
+ /**
2242
+ * Update a campaign.
2243
+ *
2244
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/1bb1492981b4529693604b03aade8bf6
2245
+ *
2246
+ * @param campaign_id The id of the campaign to update.
2247
+ * @param data The data to update.
2248
+ *
2249
+ * @returns promise
2250
+ */
2251
+ static updateCampaignLink<T>(campaign_id: string, link_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2252
+ /**
2253
+ * Retrieve the information for a single campaign.
2254
+ *
2255
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getCampaignLink
2256
+ *
2257
+ * @param campaign_id The id fo the campaign to retrieve.
2258
+ *
2259
+ * @returns promise
2260
+ */
2261
+ static getCampaignLink<T>(campaign_id: string, link_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2262
+ /**
2263
+ * List all the influencers associated with a campaign.
2264
+ *
2265
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getInfluencerCampaigns
2266
+ *
2267
+ * @returns promise
2268
+ */
2269
+ static listInfluencerCampaigns<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2270
+ /**
2271
+ * Create an influencer campaign
2272
+ *
2273
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/6d834c837c5f330d6a4cef5786c45c90
2274
+ *
2275
+ * @param data The data to be passed when creating a campaign.
2276
+ *
2277
+ * @returns Promise
2278
+ */
2279
+ static createInfluencerCampaign<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2280
+ /**
2281
+ * Update an influencer campaign.
2282
+ *
2283
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/updateInfluencerCampaign
2284
+ *
2285
+ * @param campaign_id The id of the campaign to update.
2286
+ * @param data The data to update.
2287
+ *
2288
+ * @returns promise
2289
+ */
2290
+ static updateInfluencerCampaign<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2291
+ /**
2292
+ * Retrieve the information for a single campaign.
2293
+ *
2294
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/showInfluencerCampaign
2295
+ *
2296
+ * @param campaign_id The id fo the campaign to retrieve.
2297
+ *
2298
+ * @returns promise
2299
+ */
2300
+ static viewInfluencerCampaign<T>(campaign_id: string, user_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2301
+ /**
2302
+ * Mark an influencer campaign as completed.
2303
+ *
2304
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/markCompleted
2305
+ *
2306
+ * @param data The data to be passed when creating a campaign.
2307
+ *
2308
+ * @returns Promise
2309
+ */
2310
+ static markInfluencerCampaignComplete<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2311
+ /**
2312
+ * Mark an influencer campaign as incomplete.
2313
+ *
2314
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/afffdc7a0c7fc4d9740f10517c53933e
2315
+ *
2316
+ * @param data The data to be passed when creating a campaign.
2317
+ *
2318
+ * @returns Promise
2319
+ */
2320
+ static markInfluencerCampaignIncomplete<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2321
+ /**
2322
+ * Get all the links associated with an influencer's campaign.
2323
+ *
2324
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/edab2e3b061347b06c82258622d239e2
2325
+ *
2326
+ * @returns promise
2327
+ */
2328
+ static listInfluencerCampaignLinks<T>(campaign_id: string, user_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2329
+ }
2330
+
2103
2331
  interface Route {
2104
2332
  url: string;
2105
2333
  method: string;
@@ -2399,6 +2627,7 @@ declare class Glitch {
2399
2627
  };
2400
2628
  static api: {
2401
2629
  Auth: typeof Auth;
2630
+ Campaigns: typeof Campaigns;
2402
2631
  Competitions: typeof Competitions;
2403
2632
  Communities: typeof Communities;
2404
2633
  Users: typeof Users;
@@ -2409,6 +2638,7 @@ declare class Glitch {
2409
2638
  Waitlists: typeof Waitlists;
2410
2639
  Utility: typeof Utility;
2411
2640
  Tips: typeof Tips;
2641
+ Titles: typeof Titles;
2412
2642
  Social: typeof Social;
2413
2643
  SocialPosts: typeof SocialPosts;
2414
2644
  TipPackages: typeof TipPackages;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -17,21 +17,21 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "devDependencies": {
20
- "@rollup/plugin-commonjs": "^25.0.4",
21
- "@rollup/plugin-json": "^6.0.0",
22
- "@rollup/plugin-node-resolve": "^15.2.1",
23
- "@rollup/plugin-typescript": "^11.1.4",
24
- "@types/isomorphic-form-data": "^2.0.2",
25
- "@types/node": "^20.8.0",
20
+ "@rollup/plugin-commonjs": "^25.0.7",
21
+ "@rollup/plugin-json": "^6.1.0",
22
+ "@rollup/plugin-node-resolve": "^15.2.3",
23
+ "@rollup/plugin-typescript": "^11.1.5",
24
+ "@types/isomorphic-form-data": "^2.0.4",
25
+ "@types/node": "^20.10.5",
26
26
  "get-file-object-from-local-path": "^1.0.2",
27
- "rollup": "^3.29.4",
28
- "rollup-plugin-dts": "^6.0.2",
29
- "rollup-plugin-polyfill-node": "^0.12.0",
30
- "typedoc": "^0.25.1",
31
- "typescript": "^5.2.2"
27
+ "rollup": "^4.9.1",
28
+ "rollup-plugin-dts": "^6.1.0",
29
+ "rollup-plugin-polyfill-node": "^0.13.0",
30
+ "typedoc": "^0.25.4",
31
+ "typescript": "^5.3.3"
32
32
  },
33
33
  "dependencies": {
34
- "axios": "^1.5.1",
34
+ "axios": "^1.6.2",
35
35
  "buffer": "^6.0.3",
36
36
  "fast-text-encoding": "^1.0.6",
37
37
  "fetch-blob": "^4.0.0",
@@ -0,0 +1,224 @@
1
+ import CampaignsRoute from "../routes/CampaignsRoute";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class Campaigns {
7
+
8
+ /**
9
+ * List all the Campaigns.
10
+ *
11
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/edab2e3b061347b06c82258622d239e2
12
+ *
13
+ * @returns promise
14
+ */
15
+ public static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
16
+ return Requests.processRoute(CampaignsRoute.routes.listCampaigns, undefined, undefined, params);
17
+ }
18
+
19
+ /**
20
+ * Create a new campaign.
21
+ *
22
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/createCampaign
23
+ *
24
+ * @param data The data to be passed when creating a campaign.
25
+ *
26
+ * @returns Promise
27
+ */
28
+ public static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
29
+
30
+ return Requests.processRoute(CampaignsRoute.routes.createCampaign, data, undefined, params);
31
+ }
32
+
33
+ /**
34
+ * Update a campaign.
35
+ *
36
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/updateCampaign
37
+ *
38
+ * @param campaign_id The id of the campaign to update.
39
+ * @param data The data to update.
40
+ *
41
+ * @returns promise
42
+ */
43
+ public static update<T>(campaign_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
44
+
45
+ return Requests.processRoute(CampaignsRoute.routes.updateCampaign, data, { campaign_id: campaign_id }, params);
46
+ }
47
+
48
+ /**
49
+ * Retrieve the information for a single campaign.
50
+ *
51
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getCampaignByUuid
52
+ *
53
+ * @param campaign_id The id fo the campaign to retrieve.
54
+ *
55
+ * @returns promise
56
+ */
57
+ public static view<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
58
+
59
+ return Requests.processRoute(CampaignsRoute.routes.viewCampaign, {}, { campaign_id: campaign_id }, params);
60
+ }
61
+
62
+ /**
63
+ * Deletes a campaign.
64
+ *
65
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/deleteCampaign
66
+ *
67
+ * @param campaign_id The id of the campaign to delete.
68
+ * @returns promise
69
+ */
70
+ public static delete<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
71
+
72
+ return Requests.processRoute(CampaignsRoute.routes.deleteCampaign, {}, { campaign_id: campaign_id }, params);
73
+ }
74
+
75
+
76
+ /**
77
+ * List all the campaign links.
78
+ *
79
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getCampaignLinks
80
+ *
81
+ * @returns promise
82
+ */
83
+ public static listCampaignLinks<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
84
+ return Requests.processRoute(CampaignsRoute.routes.listCampaignLinks, undefined, { campaign_id: campaign_id }, params);
85
+ }
86
+
87
+ /**
88
+ * Create a new campaign link.
89
+ *
90
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/storeCampaignLink
91
+ *
92
+ * @param data The data to be passed when creating a campaign.
93
+ *
94
+ * @returns Promise
95
+ */
96
+ public static createCampaignLink<T>(campaign_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
97
+
98
+ return Requests.processRoute(CampaignsRoute.routes.createCampaign, data, { campaign_id: campaign_id }, params);
99
+ }
100
+
101
+ /**
102
+ * Update a campaign.
103
+ *
104
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/1bb1492981b4529693604b03aade8bf6
105
+ *
106
+ * @param campaign_id The id of the campaign to update.
107
+ * @param data The data to update.
108
+ *
109
+ * @returns promise
110
+ */
111
+ public static updateCampaignLink<T>(campaign_id: string, link_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
112
+
113
+ return Requests.processRoute(CampaignsRoute.routes.updateCampaign, data, { campaign_id: campaign_id, link_id: link_id }, params);
114
+ }
115
+
116
+ /**
117
+ * Retrieve the information for a single campaign.
118
+ *
119
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getCampaignLink
120
+ *
121
+ * @param campaign_id The id fo the campaign to retrieve.
122
+ *
123
+ * @returns promise
124
+ */
125
+ public static getCampaignLink<T>(campaign_id: string, link_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
126
+
127
+ return Requests.processRoute(CampaignsRoute.routes.getCampaignLink, {}, { campaign_id: campaign_id, link_id: link_id }, params);
128
+ }
129
+
130
+ /**
131
+ * List all the influencers associated with a campaign.
132
+ *
133
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/getInfluencerCampaigns
134
+ *
135
+ * @returns promise
136
+ */
137
+ public static listInfluencerCampaigns<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
138
+ return Requests.processRoute(CampaignsRoute.routes.listInfluencerCampaigns, undefined, { campaign_id: campaign_id }, params);
139
+ }
140
+
141
+ /**
142
+ * Create an influencer campaign
143
+ *
144
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/6d834c837c5f330d6a4cef5786c45c90
145
+ *
146
+ * @param data The data to be passed when creating a campaign.
147
+ *
148
+ * @returns Promise
149
+ */
150
+ public static createInfluencerCampaign<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
151
+ return Requests.processRoute(CampaignsRoute.routes.createInfluencerCampaign , data, { campaign_id: campaign_id }, params);
152
+ }
153
+
154
+ /**
155
+ * Update an influencer campaign.
156
+ *
157
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/updateInfluencerCampaign
158
+ *
159
+ * @param campaign_id The id of the campaign to update.
160
+ * @param data The data to update.
161
+ *
162
+ * @returns promise
163
+ */
164
+ public static updateInfluencerCampaign<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
165
+
166
+ return Requests.processRoute(CampaignsRoute.routes.updateInfluencerCampaign, data, { campaign_id: campaign_id, user_id: user_id }, params);
167
+ }
168
+
169
+ /**
170
+ * Retrieve the information for a single campaign.
171
+ *
172
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/showInfluencerCampaign
173
+ *
174
+ * @param campaign_id The id fo the campaign to retrieve.
175
+ *
176
+ * @returns promise
177
+ */
178
+ public static viewInfluencerCampaign<T>(campaign_id: string, user_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
179
+
180
+ return Requests.processRoute(CampaignsRoute.routes.viewInfluencerCampaign, {}, { campaign_id: campaign_id, user_id: user_id }, params);
181
+ }
182
+
183
+ /**
184
+ * Mark an influencer campaign as completed.
185
+ *
186
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/markCompleted
187
+ *
188
+ * @param data The data to be passed when creating a campaign.
189
+ *
190
+ * @returns Promise
191
+ */
192
+ public static markInfluencerCampaignComplete<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
193
+
194
+ return Requests.processRoute(CampaignsRoute.routes.markInfluencerCampaignComplete, data, { campaign_id: campaign_id, user_id: user_id }, params);
195
+ }
196
+
197
+ /**
198
+ * Mark an influencer campaign as incomplete.
199
+ *
200
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/afffdc7a0c7fc4d9740f10517c53933e
201
+ *
202
+ * @param data The data to be passed when creating a campaign.
203
+ *
204
+ * @returns Promise
205
+ */
206
+ public static markInfluencerCampaignIncomplete<T>(campaign_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
207
+
208
+ return Requests.processRoute(CampaignsRoute.routes.markInfluencerCampaignIncomplete, data, { campaign_id: campaign_id, user_id: user_id }, params);
209
+ }
210
+
211
+ /**
212
+ * Get all the links associated with an influencer's campaign.
213
+ *
214
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/edab2e3b061347b06c82258622d239e2
215
+ *
216
+ * @returns promise
217
+ */
218
+ public static listInfluencerCampaignLinks<T>(campaign_id: string, user_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
219
+ return Requests.processRoute(CampaignsRoute.routes.listInfluencerCampaignLinks , undefined, { campaign_id: campaign_id, user_id: user_id }, params);
220
+ }
221
+
222
+ }
223
+
224
+ export default Campaigns;
@@ -0,0 +1,105 @@
1
+ import TitlesRoute from "../routes/TitlesRoute";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class Titles {
7
+
8
+ /**
9
+ * List all the Titles.
10
+ *
11
+ * @see https://api.glitch.fun/api/documentation#/Titles/edab2e3b061347b06c82258622d239e2
12
+ *
13
+ * @returns promise
14
+ */
15
+ public static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
16
+ return Requests.processRoute(TitlesRoute.routes.list, undefined, undefined, params);
17
+ }
18
+
19
+ /**
20
+ * Create a new title.
21
+ *
22
+ * @see https://api.glitch.fun/api/documentation#/Titles/storeTitle
23
+ *
24
+ * @param data The data to be passed when creating a title.
25
+ *
26
+ * @returns Promise
27
+ */
28
+ public static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
29
+
30
+ return Requests.processRoute(TitlesRoute.routes.create, data, undefined, params);
31
+ }
32
+
33
+ /**
34
+ * Update a title.
35
+ *
36
+ * @see https://api.glitch.fun/api/documentation#/Titles/updateTitle
37
+ *
38
+ * @param title_id The id of the title to update.
39
+ * @param data The data to update.
40
+ *
41
+ * @returns promise
42
+ */
43
+ public static update<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
44
+
45
+ return Requests.processRoute(TitlesRoute.routes.update, data, { title_id: title_id }, params);
46
+ }
47
+
48
+ /**
49
+ * Retrieve the information for a single title.
50
+ *
51
+ * @see https://api.glitch.fun/api/documentation#/Titles/getTitleByUUID
52
+ *
53
+ * @param title_id The id fo the title to retrieve.
54
+ *
55
+ * @returns promise
56
+ */
57
+ public static view<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
58
+
59
+ return Requests.processRoute(TitlesRoute.routes.view, {}, { title_id: title_id }, params);
60
+ }
61
+
62
+ /**
63
+ * Deletes a title.
64
+ *
65
+ * @see https://api.glitch.fun/api/documentation#/Titles/deleteTitle
66
+ *
67
+ * @param title_id The id of the title to delete.
68
+ * @returns promise
69
+ */
70
+ public static delete<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
71
+
72
+ return Requests.processRoute(TitlesRoute.routes.delete, {}, { title_id: title_id }, params);
73
+ }
74
+
75
+ /**
76
+ * Approve a title
77
+ *
78
+ * @see https://api.glitch.fun/api/documentation#/Titles/approveTitle
79
+ *
80
+ * @param data The data to be passed when creating a title.
81
+ *
82
+ * @returns Promise
83
+ */
84
+ public static approve<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
85
+
86
+ return Requests.processRoute(TitlesRoute.routes.approve, data, { title_id: title_id }, params);
87
+ }
88
+
89
+ /**
90
+ * Reject a title
91
+ *
92
+ * @see https://api.glitch.fun/api/documentation#/Titles/rejectTitle
93
+ *
94
+ * @param data The data to be passed when creating a title.
95
+ *
96
+ * @returns Promise
97
+ */
98
+ public static reject<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
99
+
100
+ return Requests.processRoute(TitlesRoute.routes.reject, data, { title_id: title_id }, params);
101
+ }
102
+
103
+ }
104
+
105
+ export default Titles;
package/src/api/index.ts CHANGED
@@ -14,6 +14,8 @@ import TipEmojis from "./TipEmojis";
14
14
  import TipPackages from "./TipPackages";
15
15
  import TipPackagePurchases from "./TipPackagePurchases";
16
16
  import SocialPosts from "./SocialPosts";
17
+ import Titles from "./Titles";
18
+ import Campaigns from "./Campaigns";
17
19
 
18
20
  export {Auth};
19
21
  export {Competitions};
@@ -30,4 +32,6 @@ export {Tips};
30
32
  export {TipEmojis};
31
33
  export {TipPackages};
32
34
  export {TipPackagePurchases};
33
- export {SocialPosts};
35
+ export {SocialPosts};
36
+ export {Titles};
37
+ export {Campaigns};
package/src/index.ts CHANGED
@@ -18,6 +18,8 @@ import { TipPackages } from "./api";
18
18
  import { TipEmojis } from "./api";
19
19
  import { TipPackagePurchases } from "./api";
20
20
  import { SocialPosts } from "./api";
21
+ import {Titles} from "./api";
22
+ import {Campaigns} from "./api";
21
23
 
22
24
 
23
25
 
@@ -50,6 +52,7 @@ class Glitch {
50
52
 
51
53
  public static api = {
52
54
  Auth: Auth,
55
+ Campaigns : Campaigns,
53
56
  Competitions: Competitions,
54
57
  Communities : Communities,
55
58
  Users: Users,
@@ -60,6 +63,7 @@ class Glitch {
60
63
  Waitlists: Waitlists,
61
64
  Utility : Utility,
62
65
  Tips: Tips,
66
+ Titles : Titles,
63
67
  Social : Social,
64
68
  SocialPosts : SocialPosts,
65
69
  TipPackages : TipPackages,