// Copyright Abridged, Inc. 2022,2024. All Rights Reserved. // Node module: @collabland/sdk // This file is licensed under the MIT License. // License text available at https://opensource.org/license/mit/ import {inject, Provider} from '@loopback/core'; import {getService, RestDataSource} from '../datasources/index.js'; import {MiniAppManifest} from '../models/mini-app-manifest.model.js'; /** * The service interface is generated from OpenAPI spec with operations tagged * by MiniAppController. */ export interface MiniAppService { /** * @param communityId * @param appId * @param _requestBody * @returns OK */ installMiniApp( communityId: string, appId: string, _requestBody: {}, ): Promise; /** * @param communityId * @param appId */ uninstallMiniApp(communityId: string, appId: string): Promise; /** * @param communityId * @param installedOnly * @returns OK */ getMiniAppsForCommunity( communityId: string, installedOnly?: boolean, ): Promise; } export class MiniAppServiceProvider implements Provider { constructor( // rest must match the name property in the datasource json file @inject('datasources.rest') protected dataSource: RestDataSource = new RestDataSource(), ) {} async value(): Promise { const service = await getService<{ apis: {MiniAppController: MiniAppService}; }>(this.dataSource); return service.apis['MiniAppController']; } }