nft-barter-sdk
Version:
Javascript SDK for abstracting complexities of interacting with NFT protocols.
70 lines (69 loc) • 2.19 kB
TypeScript
/**
* Firebase
* @author Ebube Ud <kripsonud@gmail.com>
*/
import { WhereFilterOp, OrderByDirection } from 'firebase/firestore';
export default class Firebase {
db: any;
static firebaseConfig: {
apiKey: string;
authDomain: string;
projectId: string;
storageBucket: string;
messagingSenderId: string;
appId: string;
measurementId: string;
};
constructor();
initializeFirebaseDatabase: () => any;
/**
*
* @param ref The path reference of the collection document to write
* @param data The data object to write
* @returns Response status object
*/
addData: (ref: string, data: any) => Promise<any>;
/**
*
* @param ref The path reference of the collection document to read
* @returns Retrieved object of data or a message response
*/
getData: (ref: string) => Promise<any>;
/**
*
* @param ref The path reference of the collection document to write
* @param data The data object to write
* @returns Response status object
*/
updateData: (ref: string, data: any) => Promise<any>;
/**
*
* @param ref The path reference of the collection document to write
* @returns Response status object
*/
deleteData: (ref: string) => Promise<any>;
/**
*
* @param ref The path reference of the collection or sub-collections to read
* @returns Retrieves object of data in arrary or a message response
*/
getCollections: (ref: string) => Promise<any | any[]>;
/**
*
* @param ref - The path reference of the collection or sub-collections to read
* @param options - The args for the query which comprises of the conditions, the ordering and the limit
* @returns Retrieves object of data in arrary or a message response
*/
queryCollection: (ref: string, options: {
conditions?: {
field: string;
operator: WhereFilterOp;
value: unknown;
}[];
order?: {
field: string;
direction?: OrderByDirection;
};
limitCount?: number;
}) => Promise<any | any[]>;
}