diff --git a/bots/api/COMMANDS.md b/bots/api/COMMANDS.md index 67cea33777..c264997d94 100644 --- a/bots/api/COMMANDS.md +++ b/bots/api/COMMANDS.md @@ -1369,7 +1369,7 @@ Determine SimpleX link type and if the bot is already connected via this link or **Parameters**: - userId: int64 -- connectTarget: [ConnectTarget](./TYPES.md#connecttarget)? +- connectTarget: [AConnectTarget](./TYPES.md#aconnecttarget)? - resolveKnown: bool - linkOwnerSig: [LinkOwnerSig](./TYPES.md#linkownersig)? @@ -1461,7 +1461,7 @@ Connect via SimpleX link or name as string in the active user profile. **Parameters**: - incognito: bool -- connTarget_: [ConnectTarget](./TYPES.md#connecttarget)? +- connTarget_: [AConnectTarget](./TYPES.md#aconnecttarget)? **Syntax**: diff --git a/bots/api/TYPES.md b/bots/api/TYPES.md index 6cfe3ab3f4..ef8623ba41 100644 --- a/bots/api/TYPES.md +++ b/bots/api/TYPES.md @@ -5,6 +5,7 @@ This file is generated automatically. - [ACIReaction](#acireaction) - [AChat](#achat) - [AChatItem](#achatitem) +- [AConnectTarget](#aconnecttarget) - [AddRelayResult](#addrelayresult) - [AddressSettings](#addresssettings) - [AgentCryptoError](#agentcryptoerror) @@ -61,7 +62,6 @@ This file is generated automatically. - [ComposedMessage](#composedmessage) - [ConnStatus](#connstatus) - [ConnType](#conntype) -- [ConnectTarget](#connecttarget) - [Connection](#connection) - [ConnectionEntity](#connectionentity) - [ConnectionErrorType](#connectionerrortype) @@ -241,6 +241,23 @@ This file is generated automatically. - chatItem: [ChatItem](#chatitem) +--- + +## AConnectTarget + +Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names. + +**Discriminated union type**: + +Name: +- type: "name" +- : [SimplexNameInfo](#simplexnameinfo) + +Link: +- type: "link" +- : string + + --- ## AddRelayResult @@ -1649,23 +1666,6 @@ Failed: - "user_contact" ---- - -## ConnectTarget - -Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names. - -**Discriminated union type**: - -Link: -- type: "link" -- : string - -Name: -- type: "name" -- : [SimplexNameInfo](#simplexnameinfo) - - --- ## Connection diff --git a/packages/simplex-chat-client/types/typescript/src/commands.ts b/packages/simplex-chat-client/types/typescript/src/commands.ts index 46a3d8b27b..775ff29df3 100644 --- a/packages/simplex-chat-client/types/typescript/src/commands.ts +++ b/packages/simplex-chat-client/types/typescript/src/commands.ts @@ -499,7 +499,7 @@ export namespace APIAddContact { // Network usage: interactive. export interface APIConnectPlan { userId: number // int64 - connectTarget?: T.ConnectTarget + connectTarget?: T.AConnectTarget resolveKnown: boolean linkOwnerSig?: T.LinkOwnerSig } @@ -532,7 +532,7 @@ export namespace APIConnect { // Network usage: interactive. export interface Connect { incognito: boolean - connTarget_?: T.ConnectTarget + connTarget_?: T.AConnectTarget } export namespace Connect { diff --git a/packages/simplex-chat-client/types/typescript/src/types.ts b/packages/simplex-chat-client/types/typescript/src/types.ts index 648ef53e3b..e11f494288 100644 --- a/packages/simplex-chat-client/types/typescript/src/types.ts +++ b/packages/simplex-chat-client/types/typescript/src/types.ts @@ -16,6 +16,27 @@ export interface AChatItem { chatInfo: ChatInfo chatItem: ChatItem } +// Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names. + +export type AConnectTarget = AConnectTarget.Name | AConnectTarget.Link + +export namespace AConnectTarget { + export type Tag = "name" | "link" + + interface Interface { + type: Tag + } + + export interface Name extends Interface { + type: "name" + : SimplexNameInfo + } + + export interface Link extends Interface { + type: "link" + : string + } +} export interface AddRelayResult { relay: UserChatRelay @@ -1865,27 +1886,6 @@ export enum ConnType { Member = "member", User_contact = "user_contact", } -// Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names. - -export type ConnectTarget = ConnectTarget.Link | ConnectTarget.Name - -export namespace ConnectTarget { - export type Tag = "link" | "name" - - interface Interface { - type: Tag - } - - export interface Link extends Interface { - type: "link" - : string - } - - export interface Name extends Interface { - type: "name" - : SimplexNameInfo - } -} export interface Connection { connId: number // int64 diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_commands.py b/packages/simplex-chat-python/src/simplex_chat/types/_commands.py index d1ee8ec2d3..ee914730eb 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_commands.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_commands.py @@ -438,7 +438,7 @@ APIAddContact_Response = CR.Invitation | CR.ChatCmdError # Network usage: interactive. class APIConnectPlan(TypedDict): userId: int # int64 - connectTarget: NotRequired["T.ConnectTarget"] + connectTarget: NotRequired["T.AConnectTarget"] resolveKnown: bool linkOwnerSig: NotRequired["T.LinkOwnerSig"] @@ -467,7 +467,7 @@ APIConnect_Response = CR.SentConfirmation | CR.ContactAlreadyExists | CR.SentInv # Network usage: interactive. class Connect(TypedDict): incognito: bool - connTarget_: NotRequired["T.ConnectTarget"] + connTarget_: NotRequired["T.AConnectTarget"] def Connect_cmd_string(self: Connect) -> str: diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_types.py b/packages/simplex-chat-python/src/simplex_chat/types/_types.py index 2c1902d7ec..f17098b4f6 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_types.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_types.py @@ -16,6 +16,20 @@ class AChatItem(TypedDict): chatInfo: "ChatInfo" chatItem: "ChatItem" +# Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names. + +class AConnectTarget_name(TypedDict): + type: Literal["name"] + : "SimplexNameInfo" + +class AConnectTarget_link(TypedDict): + type: Literal["link"] + : str + +AConnectTarget = AConnectTarget_name | AConnectTarget_link + +AConnectTarget_Tag = Literal["name", "link"] + class AddRelayResult(TypedDict): relay: "UserChatRelay" relayError: NotRequired["ChatError"] @@ -1298,20 +1312,6 @@ ConnStatus_Tag = Literal["new", "prepared", "joined", "requested", "accepted", " ConnType = Literal["contact", "member", "user_contact"] -# Connect target: SimpleX link (`CTLink`) or SimpleX name (`CTName`). Wire form is the bare string returned by `strEncode` — `simplex:/...` for links, `#name.simplex` / `@name.simplex` for names. - -class ConnectTarget_link(TypedDict): - type: Literal["link"] - : str - -class ConnectTarget_name(TypedDict): - type: Literal["name"] - : "SimplexNameInfo" - -ConnectTarget = ConnectTarget_link | ConnectTarget_name - -ConnectTarget_Tag = Literal["link", "name"] - class Connection(TypedDict): connId: int # int64 agentConnId: str