// Copyright Abridged, Inc. 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 {UserAd} from '../models/user-ad.model.js'; import {UserAdsQualifications} from '../models/user-ads-qualifications.model.js'; /** * The service interface is generated from OpenAPI spec with operations tagged * by UserAdsController. */ export interface UserAdsService { /** * @param communityPK */ getCommunityChains(communityPK: string): Promise; /** * @param deviceType * @returns OK */ getAd(deviceType?: string): Promise; /** * @param testnetEth A flag to check testnet ETH * @param arbEth A flag to test Arb ETH * @param arbArb A flag to test Arb ARB * @returns OK */ getQualifications( testnetEth?: boolean, arbEth?: boolean, arbArb?: boolean, ): Promise; } export class UserAdsServiceProvider 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: {UserAdsController: UserAdsService}; }>(this.dataSource); return service.apis['UserAdsController']; } }