extending channel view methods

This commit is contained in:
Roland Osborne 2024-07-01 14:09:03 -07:00
parent 47a0aa9756
commit b51e3c82e6
6 changed files with 54 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "databag-client-sdk",
"version": "0.0.12",
"version": "0.0.13",
"description": "an SDK for developing Databag applications",
"main": "./dist/index.js",
"module": "./dist/index.mjs",

View File

@ -64,8 +64,8 @@ export interface Contact {
disconnectCard(cardId: string): Promise<void>;
rejectCard(cardId: string): Promise<void>;
ignoreCard(cardId: string): Promise<void>;
resyncCard(cardId: string): Promise<void>;
flagCard(cardId: string): Promise<void>;
flagArticle(cardId: string, articleId: string): Promise<void>;
flagChannel(cardId: string, channelId: string): Promise<void>;
@ -95,6 +95,13 @@ export interface Contact {
addTag(cardId: string, channelId: string, topicId: string, type: string, value: string): Promise<string>;
removeTag(cardId: string, tagId: string): Promise<void>;
viewMoreTopics(cardId: string, channelId: string): Promise<number>;
setUnreadChannel(cardId: string, channelId: string): Promise<void>;
clearUnreadChannel(cardId: string, channelId: string): Promise<void>;
getRegistry(server: string): Promise<Profile[]>;
getRegistryImageUrl(server: string, string: guid): string;
getCardImageUrl(cardId: string): string;
getTopicAssetUrl(cardId: string, channelId: string, topicId: string, assetId: string): string;
@ -154,6 +161,10 @@ export interface Content {
getBlockedTopics(): Promise<{ channelId: string, topicId: string }[]>;
getBlockedTags(): Promise<{ channelId: string, topicId: string, tagId: string }[]>;
viewMoreTopics(channelId: string): Promise<number>;
setUnreadChannel(channelId: string): Promise<void>;
clearUnreadChannel(channelId: string): Promise<void>;
addRepeaterAccess(channelId: string, name: string): Promise<Repeater>;
removeRepeaterAccess(channelId: string, repeaterId: string): Promise<void>;

View File

@ -1,6 +1,6 @@
import { EventEmitter } from 'events';
import { type Contact } from './api';
import { type Card, type Topic, type Asset, type Repeater} from './types';
import { type Card, type Topic, type Asset, type Profile, type Repeater} from './types';
export class ContactModule implements Contact {
@ -141,7 +141,24 @@ export class ContactModule implements Contact {
}
public async removeTag(cardId: string, tagId: string): Promise<void> {
return;
}
public async viewMoreTopics(cardId: string, channelId: string): Promise<number> {
return 0;
}
public async setUnreadChannel(cardId: string, channelId: string): Promise<void> {
}
public async clearUnreadChannel(cardId: string, channelId: string): Promise<void> {
}
public getRegistry(server: string): Promise<Profile[]> {
return [];
}
public getRegistryImageUrl(server: string, string: guid): string {
return '';
}
public getTopicAssetUrl(cardId: string, channelId: string, topicId: string, assetId: string): string {

View File

@ -99,6 +99,16 @@ export class ContentModule implements Content {
return '';
}
public async viewMoreTopics(cardId: string, channelId: string): Promise<number> {
return 0;
}
public async setUnreadChannel(cardId: string, channelId: string): Promise<void> {
}
public async clearUnreadChannel(cardId: string, channelId: string): Promise<void> {
}
public async addRepeaterAccess(channelId: string, name: string): Promise<Repeater> {
return { id: '', guid: '', name: '', server: '', token: '' };
}

View File

@ -2,7 +2,8 @@ import { SessionModule } from './session';
import { NodeModule } from './node';
import { BotModule } from './bot';
import { type Session, type Node, type Bot, type SqlStore, type WebStore } from './api';
import type { Session, Node, Bot, SqlStore, WebStore } from './api';
import type { SessionParams } from './types';
export class DatabagSDK {
@ -24,15 +25,15 @@ export class DatabagSDK {
return new SessionModule(this.store, '', '');
}
public async login(handle: string, password: string, url: string): Promise<Session> {
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): Promise<Session> {
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): Promise<Session> {
public async create(handle: string, password: string, url: string, token: string, params: SessionParams): Promise<Session> {
return new SessionModule(this.store, '', '');
}

View File

@ -26,6 +26,7 @@ export type Channel = {
status: string,
transform: string
}
unread: boolean,
dataType: string,
data: string,
created: number,
@ -158,4 +159,10 @@ export type NodeConfig = {
openAccessLimit: number,
}
export type SessionParams = {
initialTopicCount: number,
channelTypes: string[],
topicTypes: string[],
tagTypes: string[],
}