databag/app/sdk/src/index.ts
2024-07-01 14:09:03 -07:00

51 lines
1.4 KiB
TypeScript

import { SessionModule } from './session';
import { NodeModule } from './node';
import { BotModule } from './bot';
import type { Session, Node, Bot, SqlStore, WebStore } from './api';
import type { SessionParams } from './types';
export class DatabagSDK {
private store: SqlStore | WebStore | null = null;
constructor() {
console.log("databag sdk");
}
public async initOfflineStore(sql: SqlStore): Promise<Session | null> {
this.store = sql;
// initialize
return new SessionModule(this.store, '', '');
}
public async initOnlineStore(web: WebStore): Promise<Session | null> {
this.store = web;
// initialize
return new SessionModule(this.store, '', '');
}
public async login(handle: string, password: string, url: string, params: SessionParams): Promise<Session> {
return new SessionModule(this.store, '', '');
}
public async access(token: string, url: string, params: SessionParams): Promise<Session> {
return new SessionModule(this.store, '', '');
}
public async create(handle: string, password: string, url: string, token: string, params: SessionParams): Promise<Session> {
return new SessionModule(this.store, '', '');
}
public async logout(session: Session): Promise<void> {
}
public async configure(token: string, url: string): Promise<Node> {
return new NodeModule('', '');
}
public async automate() {
return new BotModule();
}
}