88 lines
2.2 KiB
TypeScript
88 lines
2.2 KiB
TypeScript
import type { Backend } from "./Backend";
|
|
import { store } from "@/lib/mock/store";
|
|
|
|
/** The default backend: the in-memory mock store, wrapped as async. */
|
|
export const mockBackend: Backend = {
|
|
async bootstrap() {
|
|
return store.bootstrap();
|
|
},
|
|
async listChannels() {
|
|
return store.channels;
|
|
},
|
|
async createChannel(input) {
|
|
return store.createChannel(input);
|
|
},
|
|
async addMember(channelId, userId) {
|
|
return store.addMember(channelId, userId);
|
|
},
|
|
async removeMember(channelId, userId) {
|
|
return store.removeMember(channelId, userId);
|
|
},
|
|
async markRead(channelId) {
|
|
return store.markRead(channelId);
|
|
},
|
|
async setStatus(text, emoji, clearAt) {
|
|
return store.setStatus(text, emoji, clearAt);
|
|
},
|
|
async updateMe(patch) {
|
|
return store.updateMe(patch);
|
|
},
|
|
async channelMessages(channelId) {
|
|
return store.channelMessages(channelId);
|
|
},
|
|
async thread(channelId, parentId) {
|
|
return store.thread(channelId, parentId);
|
|
},
|
|
async send(channelId, body, opts) {
|
|
return store.send(channelId, body, opts);
|
|
},
|
|
async editMessage(_channelId, messageId, body) {
|
|
return store.editMessage(messageId, body);
|
|
},
|
|
async deleteMessage(_channelId, messageId) {
|
|
return { ok: store.deleteMessage(messageId) };
|
|
},
|
|
async savedMessages() {
|
|
return store.savedMessages();
|
|
},
|
|
async threadParents() {
|
|
return store.threadParents();
|
|
},
|
|
async react(_channelId, messageId, emoji) {
|
|
return store.react(messageId, emoji);
|
|
},
|
|
async pin(_channelId, messageId) {
|
|
return store.pin(messageId);
|
|
},
|
|
async save(_channelId, messageId) {
|
|
return store.save(messageId);
|
|
},
|
|
async listInbox(state) {
|
|
return store.listInbox(state);
|
|
},
|
|
async patchInbox(id, state) {
|
|
return store.patchInbox(id, state);
|
|
},
|
|
async listTickets(scope) {
|
|
return store.listTickets(scope);
|
|
},
|
|
async getTicket(id) {
|
|
return store.getTicket(id);
|
|
},
|
|
async patchTicket(id, state) {
|
|
return store.patchTicket(id, state);
|
|
},
|
|
async replyTicket(id, body) {
|
|
return store.replyTicket(id, body);
|
|
},
|
|
async availability() {
|
|
return store.availability;
|
|
},
|
|
async search(q) {
|
|
return store.search(q);
|
|
},
|
|
async notifications() {
|
|
return store.notifications;
|
|
},
|
|
};
|