mirror of
https://github.com/balzack/databag.git
synced 2025-04-28 04:25:15 +00:00
51 lines
1.4 KiB
TypeScript
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();
|
|
}
|
|
}
|