import DocumentNotary from "le-coffre-resources/dist/Notary/DocumentNotary"; import BaseCustomer from "../BaseCustomer"; export interface IGetDocumentNotaryparams { where?: {}; include?: {}; orderBy?: {}; } export default class DocumentsNotary extends BaseCustomer { private static instance: DocumentsNotary; private readonly baseURl = this.namespaceUrl.concat("/documents_notary"); private constructor() { super(); } public static getInstance() { if (!this.instance) { return new this(); } else { return this.instance; } } public async get(q: IGetDocumentNotaryparams): Promise { const url = new URL(this.baseURl); const query = { q }; Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value))); try { return await this.getRequest(url); } catch (err) { this.onError(err); return Promise.reject(err); } } public async getByUid(uid: string, q?: any): Promise { const url = new URL(this.baseURl.concat(`/${uid}`)); const query = { q }; Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value))); try { return await this.getRequest(url); } catch (err) { this.onError(err); return Promise.reject(err); } } }