glitch-javascript-sdk 0.3.3 → 0.3.4

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/index.d.ts CHANGED
@@ -1412,6 +1412,28 @@ declare class Posts {
1412
1412
  * @returns Promise
1413
1413
  */
1414
1414
  static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1415
+ /**
1416
+ * Create a new post with a file. The file should either be an image or video.
1417
+ *
1418
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
1419
+ *
1420
+ * @param file The file object to upload.
1421
+ * @param data Any additional data to pass along to the upload.
1422
+ *
1423
+ * @returns promise
1424
+ */
1425
+ static createWithFile<T>(file: File, data?: object): AxiosPromise<Response<T>>;
1426
+ /**
1427
+ * Create a new post with a blob. The blob should either be an image or video.
1428
+ *
1429
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
1430
+ *
1431
+ * @param file The blob to upload.
1432
+ * @param data Any additional data to pass along to the upload.
1433
+ *
1434
+ * @returns promise
1435
+ */
1436
+ static createWithBlob<T>(blob: Blob, data?: object): AxiosPromise<Response<T>>;
1415
1437
  /**
1416
1438
  * Update a post.
1417
1439
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Posts.ts CHANGED
@@ -30,6 +30,37 @@ class Posts {
30
30
  return Requests.processRoute(PostsRoute.routes.create, data, undefined, params);
31
31
  }
32
32
 
33
+ /**
34
+ * Create a new post with a file. The file should either be an image or video.
35
+ *
36
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
37
+ *
38
+ * @param file The file object to upload.
39
+ * @param data Any additional data to pass along to the upload.
40
+ *
41
+ * @returns promise
42
+ */
43
+ public static createWithFile<T>(file : File, data? : object): AxiosPromise<Response<T>> {
44
+
45
+ return Requests.uploadFile(PostsRoute.routes.create.url, 'file', file, data);
46
+ }
47
+
48
+ /**
49
+ * Create a new post with a blob. The blob should either be an image or video.
50
+ *
51
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
52
+ *
53
+ * @param file The blob to upload.
54
+ * @param data Any additional data to pass along to the upload.
55
+ *
56
+ * @returns promise
57
+ */
58
+ public static createWithBlob<T>(blob : Blob, data? : object): AxiosPromise<Response<T>> {
59
+
60
+ return Requests.uploadBlob(PostsRoute.routes.create.url, 'file', blob, data);
61
+ }
62
+
63
+
33
64
  /**
34
65
  * Update a post.
35
66
  *