// Copyright Abridged, Inc. 2021,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 {Community} from '../models/community.model.js'; import {AccountAuthChallenge} from '../models/account-auth-challenge.model.js'; import {User} from '../models/user.model.js'; import {AccountAddressRequest} from '../models/account-address-request.model.js'; import {WalletBalance} from '../models/wallet-balance.model.js'; import {WalletConnection} from '../models/wallet-connection.model.js'; /** * The service interface is generated from OpenAPI spec with operations tagged * by AccountController. */ export interface AccountService { /** * @param reload * @returns Result set of Community model instances */ getAdministratedCommunities(reload?: boolean): Promise<{ paginationToken?: string; items?: Community[]; }>; /** * @returns OK */ getAuthChallenge(): Promise; /** * @returns Result set of Community model instances */ getUserCommunities(): Promise<{ paginationToken?: string; items?: Community[]; }>; /** * @returns Users that share at least one Ethereum address */ findLinkedUsers(): Promise<{ items?: string[]; }>; /** * @returns OK */ getUserProfile(): Promise; /** * @param _requestBody * @returns OK */ addWalletAddress(_requestBody: AccountAddressRequest): Promise; /** * @param address */ deleteWallet(address: string): Promise; /** * @param limit * @param paginationToken * @returns Result set of WalletConnection model instances */ getWallets( limit?: number, paginationToken?: string, ): Promise<{ paginationToken?: string; items?: WalletConnection[]; }>; /** */ deleteWallets(): Promise; } export class AccountServiceProvider 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: {AccountController: AccountService}; }>(this.dataSource); return service.apis['AccountController']; } }