@pmate/chat-sdk 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { type PmateBotKeyFile } from "./botKey.js";
1
+ import type { PmateBotKeyFile } from "./botKey.js";
2
2
  export type BotLoginChallenge = {
3
3
  id: string;
4
4
  app: string;
@@ -1,13 +1,10 @@
1
- import { botCredentialId } from "./botKey.js";
2
1
  const DEFAULT_AUTH_API_BASE_URL = "https://auth-api-v2.pmate.chat";
3
2
  export async function loginPmateBot(input) {
4
3
  const fetcher = input.fetchImpl ?? fetch;
5
4
  const baseUrl = (input.authBaseUrl ?? DEFAULT_AUTH_API_BASE_URL).replace(/\/+$/, "");
6
- const credentialId = botCredentialId(input.botKey);
7
5
  const challenge = await post(fetcher, baseUrl, "/accounts/bots/session/challenge", {
8
6
  app: input.botKey.app,
9
7
  name: input.botKey.name,
10
- credentialId,
11
8
  });
12
9
  const signature = await signBotChallenge(challenge, input.botKey.privateKey);
13
10
  return post(fetcher, baseUrl, "/accounts/bots/session", {
@@ -36,6 +36,10 @@ export declare class ChatClient {
36
36
  requestId?: string;
37
37
  reason?: string;
38
38
  }): Promise<ChatRuntimeMessage>;
39
+ removeFriend(input: {
40
+ to: string;
41
+ reason?: string;
42
+ }): Promise<ChatRuntimeMessage>;
39
43
  sendDm(input: {
40
44
  to: string;
41
45
  text: string;
@@ -71,6 +71,11 @@ export class ChatClient {
71
71
  reason: input.reason,
72
72
  });
73
73
  }
74
+ async removeFriend(input) {
75
+ return this.sendContactAction(input.to, "friendRemove", {
76
+ reason: input.reason,
77
+ });
78
+ }
74
79
  async sendDm(input) {
75
80
  return this.sendChat(input.to, {
76
81
  kind: "message",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/chat-sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Cross-platform PMate chat input components, voice input primitives, and ASR helpers",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",