lemmy-js-client 0.20.0-image-api-rework.3 → 0.20.0-image-api-rework.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/http.js CHANGED
@@ -19,7 +19,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
19
19
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
20
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
21
  };
22
- var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers, _LemmyHttp_pictrsUrl, _LemmyHttp_fetchFunction, _LemmyHttp_buildFullUrl, _LemmyHttp_wrapper;
22
+ var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers, _LemmyHttp_fetchFunction, _LemmyHttp_buildFullUrl, _LemmyHttp_wrapper;
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.LemmyHttp = void 0;
25
25
  const other_types_1 = require("./other_types");
@@ -43,10 +43,8 @@ class LemmyHttp {
43
43
  _LemmyHttp_instances.add(this);
44
44
  _LemmyHttp_apiUrl.set(this, void 0);
45
45
  _LemmyHttp_headers.set(this, {});
46
- _LemmyHttp_pictrsUrl.set(this, void 0);
47
46
  _LemmyHttp_fetchFunction.set(this, fetch.bind(globalThis));
48
47
  __classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${other_types_1.VERSION}`, "f");
49
- __classPrivateFieldSet(this, _LemmyHttp_pictrsUrl, `${baseUrl}/pictrs/image`, "f");
50
48
  if (options === null || options === void 0 ? void 0 : options.headers) {
51
49
  __classPrivateFieldSet(this, _LemmyHttp_headers, options.headers, "f");
52
50
  }
@@ -999,7 +997,7 @@ class LemmyHttp {
999
997
  uploadImage(_a, options_1) {
1000
998
  return __awaiter(this, arguments, void 0, function* ({ image }, options) {
1001
999
  const formData = createFormData(image);
1002
- const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f"), Object.assign(Object.assign({}, options), { method: HttpType.Post, body: formData, headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f") }));
1000
+ const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, "/api/v4/image", Object.assign(Object.assign({}, options), { method: HttpType.Post, body: formData, headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f") }));
1003
1001
  return response.json();
1004
1002
  });
1005
1003
  }
@@ -1011,7 +1009,7 @@ class LemmyHttp {
1011
1009
  userUploadAvatar(_a, options_1) {
1012
1010
  return __awaiter(this, arguments, void 0, function* ({ image }, options) {
1013
1011
  const formData = createFormData(image);
1014
- const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f"), Object.assign(Object.assign({}, options), { method: HttpType.Post, body: formData, headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f") }));
1012
+ const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, "/api/v4/account/avatar", Object.assign(Object.assign({}, options), { method: HttpType.Post, body: formData, headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f") }));
1015
1013
  return response.json();
1016
1014
  });
1017
1015
  }
@@ -1043,7 +1041,7 @@ class LemmyHttp {
1043
1041
  }
1044
1042
  }
1045
1043
  exports.LemmyHttp = LemmyHttp;
1046
- _LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHttp_pictrsUrl = new WeakMap(), _LemmyHttp_fetchFunction = new WeakMap(), _LemmyHttp_instances = new WeakSet(), _LemmyHttp_buildFullUrl = function _LemmyHttp_buildFullUrl(endpoint) {
1044
+ _LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHttp_fetchFunction = new WeakMap(), _LemmyHttp_instances = new WeakSet(), _LemmyHttp_buildFullUrl = function _LemmyHttp_buildFullUrl(endpoint) {
1047
1045
  return `${__classPrivateFieldGet(this, _LemmyHttp_apiUrl, "f")}${endpoint}`;
1048
1046
  }, _LemmyHttp_wrapper = function _LemmyHttp_wrapper(type_, endpoint, form, options) {
1049
1047
  return __awaiter(this, void 0, void 0, function* () {
@@ -1,4 +1,4 @@
1
1
  export type ImageGetParams = {
2
- file_type: string | null;
3
- max_size: number | null;
2
+ file_type?: string;
3
+ max_size?: number;
4
4
  };
@@ -1,5 +1,5 @@
1
1
  export type ImageProxyParams = {
2
2
  url: string;
3
- file_type: string | null;
4
- max_size: number | null;
3
+ file_type?: string;
4
+ max_size?: number;
5
5
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
3
  "description": "A javascript / typescript client for Lemmy",
4
- "version": "0.20.0-image-api-rework.3",
4
+ "version": "0.20.0-image-api-rework.4",
5
5
  "author": "Dessalines <tyhou13@gmx.com>",
6
6
  "license": "AGPL-3.0",
7
7
  "main": "./dist/index.js",