// Copyright Abridged, Inc. 2023,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'; /** * The service interface is generated from OpenAPI spec with operations tagged * by AnalyticsController. */ export interface AnalyticsService { /** * @param communityId * @param range * @param _requestBody * @returns OK */ getRolesPie( communityId: string, range: string | undefined, _requestBody: { color?: number; id?: string; name?: string; }[], ): Promise<{}[]>; /** * @param communityId * @param range * @param _requestBody * @returns OK */ getRolesAdded( communityId: string, range: string | undefined, _requestBody: { color?: number; id?: string; name?: string; }[], ): Promise<{}[]>; /** * @param communityId * @param range * @returns OK */ getLetsGo(communityId: string, range?: string): Promise<{}[]>; /** * @param communityId * @param range * @returns OK */ getWalletConnections(communityId: string, range?: string): Promise<{}[]>; } export class AnalyticsServiceProvider 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: {AnalyticsController: AnalyticsService}; }>(this.dataSource); return service.apis['AnalyticsController']; } }