@matrix-widget-toolkit/api 3.2.2 → 3.3.0

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.
@@ -1024,6 +1024,28 @@ var WidgetApiImpl = /** @class */ (function () {
1024
1024
  });
1025
1025
  });
1026
1026
  };
1027
+ /** {@inheritdoc WidgetApi.getMediaConfig} */
1028
+ WidgetApiImpl.prototype.getMediaConfig = function () {
1029
+ return __awaiter$2(this, void 0, void 0, function () {
1030
+ return __generator$2(this, function (_a) {
1031
+ switch (_a.label) {
1032
+ case 0: return [4 /*yield*/, this.matrixWidgetApi.getMediaConfig()];
1033
+ case 1: return [2 /*return*/, _a.sent()];
1034
+ }
1035
+ });
1036
+ });
1037
+ };
1038
+ /** {@inheritdoc WidgetApi.uploadFile} */
1039
+ WidgetApiImpl.prototype.uploadFile = function (file) {
1040
+ return __awaiter$2(this, void 0, void 0, function () {
1041
+ return __generator$2(this, function (_a) {
1042
+ switch (_a.label) {
1043
+ case 0: return [4 /*yield*/, this.matrixWidgetApi.uploadFile(file)];
1044
+ case 1: return [2 /*return*/, _a.sent()];
1045
+ }
1046
+ });
1047
+ });
1048
+ };
1027
1049
  return WidgetApiImpl;
1028
1050
  }());
1029
1051
 
@@ -1022,6 +1022,28 @@ var WidgetApiImpl = /** @class */ (function () {
1022
1022
  });
1023
1023
  });
1024
1024
  };
1025
+ /** {@inheritdoc WidgetApi.getMediaConfig} */
1026
+ WidgetApiImpl.prototype.getMediaConfig = function () {
1027
+ return __awaiter$2(this, void 0, void 0, function () {
1028
+ return __generator$2(this, function (_a) {
1029
+ switch (_a.label) {
1030
+ case 0: return [4 /*yield*/, this.matrixWidgetApi.getMediaConfig()];
1031
+ case 1: return [2 /*return*/, _a.sent()];
1032
+ }
1033
+ });
1034
+ });
1035
+ };
1036
+ /** {@inheritdoc WidgetApi.uploadFile} */
1037
+ WidgetApiImpl.prototype.uploadFile = function (file) {
1038
+ return __awaiter$2(this, void 0, void 0, function () {
1039
+ return __generator$2(this, function (_a) {
1040
+ switch (_a.label) {
1041
+ case 0: return [4 /*yield*/, this.matrixWidgetApi.uploadFile(file)];
1042
+ case 1: return [2 /*return*/, _a.sent()];
1043
+ }
1044
+ });
1045
+ });
1046
+ };
1025
1047
  return WidgetApiImpl;
1026
1048
  }());
1027
1049
 
package/build/index.d.ts CHANGED
@@ -4,11 +4,13 @@
4
4
  */
5
5
 
6
6
  import { Capability } from 'matrix-widget-api';
7
+ import { IGetMediaConfigActionFromWidgetResponseData } from 'matrix-widget-api';
7
8
  import { IModalWidgetCreateData } from 'matrix-widget-api';
8
9
  import { IModalWidgetOpenRequestDataButton } from 'matrix-widget-api';
9
10
  import { IModalWidgetReturnData } from 'matrix-widget-api';
10
11
  import { IOpenIDCredentials } from 'matrix-widget-api';
11
12
  import { IRoomEvent } from 'matrix-widget-api';
13
+ import { IUploadFileActionFromWidgetResponseData } from 'matrix-widget-api';
12
14
  import { IWidget } from 'matrix-widget-api';
13
15
  import { IWidgetApiRequest } from 'matrix-widget-api';
14
16
  import { IWidgetApiRequestData } from 'matrix-widget-api';
@@ -744,6 +746,18 @@ export declare type WidgetApi = {
744
746
  avatarUrl?: string;
745
747
  }>;
746
748
  }>;
749
+ /**
750
+ * Get the config for the media repository.
751
+ * @returns Promise which resolves with an object containing the config.
752
+ */
753
+ getMediaConfig(): Promise<IGetMediaConfigActionFromWidgetResponseData>;
754
+ /**
755
+ * Upload a file to the media repository on the homeserver.
756
+ * @param file - The object to upload. Something that can be sent to
757
+ * XMLHttpRequest.send (typically a File).
758
+ * @returns Resolves to the location of the uploaded file.
759
+ */
760
+ uploadFile(file: XMLHttpRequestBodyInit): Promise<IUploadFileActionFromWidgetResponseData>;
747
761
  };
748
762
 
749
763
  /**
@@ -900,6 +914,10 @@ export declare class WidgetApiImpl implements WidgetApi {
900
914
  avatarUrl?: string;
901
915
  }>;
902
916
  }>;
917
+ /** {@inheritdoc WidgetApi.getMediaConfig} */
918
+ getMediaConfig(): Promise<IGetMediaConfigActionFromWidgetResponseData>;
919
+ /** {@inheritdoc WidgetApi.uploadFile} */
920
+ uploadFile(file: XMLHttpRequestBodyInit): Promise<IUploadFileActionFromWidgetResponseData>;
903
921
  }
904
922
 
905
923
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matrix-widget-toolkit/api",
3
- "version": "3.2.2",
3
+ "version": "3.3.0",
4
4
  "description": "A simplified layer on top of matrix-widget-api to use build widgets.",
5
5
  "author": "Nordeck IT + Consulting GmbH",
6
6
  "license": "Apache-2.0",