From b51e3c82e690876ca5b7385c413c4909cd1ba132 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Mon, 1 Jul 2024 14:09:03 -0700 Subject: [PATCH] extending channel view methods --- app/sdk/package.json | 2 +- app/sdk/src/api.ts | 13 ++++++++++++- app/sdk/src/contact.ts | 21 +++++++++++++++++++-- app/sdk/src/content.ts | 10 ++++++++++ app/sdk/src/index.ts | 9 +++++---- app/sdk/src/types.ts | 7 +++++++ 6 files changed, 54 insertions(+), 8 deletions(-) diff --git a/app/sdk/package.json b/app/sdk/package.json index 5873595f..23243990 100644 --- a/app/sdk/package.json +++ b/app/sdk/package.json @@ -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", diff --git a/app/sdk/src/api.ts b/app/sdk/src/api.ts index 6a2249be..dec9b0a8 100644 --- a/app/sdk/src/api.ts +++ b/app/sdk/src/api.ts @@ -64,8 +64,8 @@ export interface Contact { disconnectCard(cardId: string): Promise; rejectCard(cardId: string): Promise; ignoreCard(cardId: string): Promise; - resyncCard(cardId: string): Promise; + flagCard(cardId: string): Promise; flagArticle(cardId: string, articleId: string): Promise; flagChannel(cardId: string, channelId: string): Promise; @@ -95,6 +95,13 @@ export interface Contact { addTag(cardId: string, channelId: string, topicId: string, type: string, value: string): Promise; removeTag(cardId: string, tagId: string): Promise; + viewMoreTopics(cardId: string, channelId: string): Promise; + setUnreadChannel(cardId: string, channelId: string): Promise; + clearUnreadChannel(cardId: string, channelId: string): Promise; + + getRegistry(server: string): Promise; + 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; + setUnreadChannel(channelId: string): Promise; + clearUnreadChannel(channelId: string): Promise; + addRepeaterAccess(channelId: string, name: string): Promise; removeRepeaterAccess(channelId: string, repeaterId: string): Promise; diff --git a/app/sdk/src/contact.ts b/app/sdk/src/contact.ts index a47c2ec4..181b8c2d 100644 --- a/app/sdk/src/contact.ts +++ b/app/sdk/src/contact.ts @@ -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 { - return; + } + + public async viewMoreTopics(cardId: string, channelId: string): Promise { + return 0; + } + + public async setUnreadChannel(cardId: string, channelId: string): Promise { + } + + public async clearUnreadChannel(cardId: string, channelId: string): Promise { + } + + public getRegistry(server: string): Promise { + return []; + } + + public getRegistryImageUrl(server: string, string: guid): string { + return ''; } public getTopicAssetUrl(cardId: string, channelId: string, topicId: string, assetId: string): string { diff --git a/app/sdk/src/content.ts b/app/sdk/src/content.ts index 4235f671..72c99fa0 100644 --- a/app/sdk/src/content.ts +++ b/app/sdk/src/content.ts @@ -99,6 +99,16 @@ export class ContentModule implements Content { return ''; } + public async viewMoreTopics(cardId: string, channelId: string): Promise { + return 0; + } + + public async setUnreadChannel(cardId: string, channelId: string): Promise { + } + + public async clearUnreadChannel(cardId: string, channelId: string): Promise { + } + public async addRepeaterAccess(channelId: string, name: string): Promise { return { id: '', guid: '', name: '', server: '', token: '' }; } diff --git a/app/sdk/src/index.ts b/app/sdk/src/index.ts index e6e16e91..f040f1c8 100644 --- a/app/sdk/src/index.ts +++ b/app/sdk/src/index.ts @@ -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 { + public async login(handle: string, password: string, url: string, params: SessionParams): Promise { return new SessionModule(this.store, '', ''); } - public async access(token: string, url: string): Promise { + public async access(token: string, url: string, params: SessionParams): Promise { return new SessionModule(this.store, '', ''); } - public async create(handle: string, password: string, url: string, token: string): Promise { + public async create(handle: string, password: string, url: string, token: string, params: SessionParams): Promise { return new SessionModule(this.store, '', ''); } diff --git a/app/sdk/src/types.ts b/app/sdk/src/types.ts index 5d6d9179..ddc1a65a 100644 --- a/app/sdk/src/types.ts +++ b/app/sdk/src/types.ts @@ -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[], +}