Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 0709b4e

Browse files
authored
Expose apps/widgets (#30)
1 parent 2d76021 commit 0709b4e

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

src/ModuleApi.ts

+38
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { PlainSubstitution, TranslationStringsObject } from "./types/translation
2020
import { DialogContent, DialogProps } from "./components/DialogContent";
2121
import { AccountAuthInfo } from "./types/AccountAuthInfo";
2222
import { ModuleUiDialogOptions } from "./types/ModuleUiDialogOptions";
23+
import { App } from "./types/App";
24+
import { Container } from "./types/Container";
2325

2426
/**
2527
* A module API surface for the react-sdk. Provides a stable API for modules to
@@ -120,4 +122,40 @@ export interface ModuleApi {
120122
* @returns The config value verbatim.
121123
*/
122124
getConfigValue<T>(namespace: string, key: string): T | undefined;
125+
126+
/**
127+
* Gets the apps for a given room.
128+
*
129+
* @param roomId The room ID to get the apps for.
130+
* @returns The apps for the given room.
131+
*/
132+
getApps(roomId: string): Array<App>;
133+
134+
/**
135+
* Gets the avatar URL for an app.
136+
*
137+
* @param app The app to get the avatar URL for.
138+
* @param width The width of the avatar.
139+
* @param height The height of the avatar.
140+
* @param resizeMethod The resize method to use, either "crop" or "scale".
141+
*/
142+
getAppAvatarUrl(app: App, width?: number, height?: number, resizeMethod?: string): string | null;
143+
144+
/**
145+
* Checks if an app is in a container for a given room.
146+
*
147+
* @param app The app to check.
148+
* @param container The container to check.
149+
* @param roomId The room ID to check.
150+
*/
151+
isAppInContainer(app: App, container: Container, roomId: string): boolean;
152+
153+
/**
154+
* Moves apps to containers for a given room.
155+
*
156+
* @param app The app to move.
157+
* @param container The container to move the app to.
158+
* @param roomId The room ID to move the app in.
159+
*/
160+
moveAppToContainer(app: App, container: Container, roomId: string): void;
123161
}

src/types/App.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
Copyright 2023 Nordeck IT + Consulting GmbH
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
export interface App {
18+
avatar_url?: string;
19+
id: string;
20+
name?: string;
21+
type: string;
22+
}

src/types/Container.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
Copyright 2023 Nordeck IT + Consulting GmbH
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
export type Container = "center" | "right" | "top";

0 commit comments

Comments
 (0)