@hatang/sdk
    Preparing search index...

    Class Hatang

    const hatang = new Hatang("ht_..."); const { data, error } = await hatang.emails.send({ from, to, subject, html });

    Index
    apiKeys: {
        create: (
            payload: CreateApiKeyOptions,
        ) => Promise<Result<{ id: string; token: string }>>;
        list: () => Promise<Result<{ data: ApiKey[] }>>;
        remove: (id: string) => Promise<Result<Record<string, never>>>;
    } = ...
    audiences: {
        create: (payload: { name: string }) => Promise<Result<Audience>>;
        get: (id: string) => Promise<Result<Audience>>;
        list: () => Promise<Result<List<Audience>>>;
        remove: (
            id: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "audience" }>>;
    } = ...
    automations: {
        create: (
            payload: CreateAutomationOptions,
        ) => Promise<Result<{ id: string; object: "automation" }>>;
        duplicate: (
            id: string,
        ) => Promise<Result<{ id: string; object: "automation" }>>;
        get: (id: string) => Promise<Result<Automation>>;
        list: () => Promise<Result<List<Automation>>>;
        remove: (
            id: string,
        ) => Promise<
            Result<{ deleted: boolean; id: string; object: "automation" }>,
        >;
        runs: {
            get: (id: string, runId: string) => Promise<Result<AutomationRun>>;
            list: (
                id: string,
                params?: {
                    after?: string;
                    limit?: number;
                    status?: AutomationRunStatus | AutomationRunStatus[];
                },
            ) => Promise<Result<List<AutomationRun>>>;
        };
        stop: (id: string) => Promise<Result<Automation>>;
        update: (
            id: string,
            payload: Partial<CreateAutomationOptions>,
        ) => Promise<Result<Automation>>;
    } = ...

    Type Declaration

    baseUrl: string
    batch: {
        create: (
            payload: CreateEmailOptions[],
        ) => Promise<Result<{ data: CreateEmailResponse[] }>>;
        send: (
            payload: CreateEmailOptions[],
        ) => Promise<Result<{ data: CreateEmailResponse[] }>>;
    } = ...
    broadcasts: {
        cancel: (
            id: string,
        ) => Promise<Result<{ id: string; object: "broadcast"; status: string }>>;
        create: (
            payload: CreateBroadcastOptions,
        ) => Promise<Result<{ id: string; object: "broadcast" }>>;
        get: (id: string) => Promise<Result<Broadcast>>;
        list: () => Promise<Result<List<Broadcast>>>;
        remove: (
            id: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "broadcast" }>>;
        send: (
            id: string,
            payload?: { scheduledAt?: string },
        ) => Promise<Result<{ id: string; object: "broadcast"; status: string }>>;
        update: (
            payload: { id: string } & Partial<CreateBroadcastOptions>,
        ) => Promise<Result<{ id: string; object: "broadcast" }>>;
    } = ...
    chat: {
        cannedResponses: {
            create: (
                payload: ChatCannedResponseOptions,
            ) => Promise<Result<ChatCannedResponse>>;
            list: () => Promise<Result<ChatList<ChatCannedResponse>>>;
            remove: (
                id: string,
            ) => Promise<Result<ChatDeleted<"chat_canned_response">>>;
            update: (
                id: string,
                payload: Partial<ChatCannedResponseOptions>,
            ) => Promise<Result<ChatCannedResponse>>;
        };
        conversations: {
            get: (id: string) => Promise<Result<ChatConversation>>;
            list: (
                params?: ListChatConversationsOptions,
            ) => Promise<Result<ChatList<ChatConversation>>>;
            messages: (
                id: string,
                params?: ListChatMessagesOptions,
            ) => Promise<Result<ChatList<ChatTimelineItem>>>;
            send: (
                id: string,
                payload: SendChatMessageOptions,
                options?: { idempotencyKey?: string },
            ) => Promise<Result<SendChatMessageResponse>>;
            sendProducts: (
                id: string,
                productIds: string[],
                intro?: string,
            ) => Promise<
                Result<
                    {
                        conversation_id: string;
                        id: string;
                        object: "chat_message";
                        seq: number;
                    },
                >,
            >;
            update: (
                id: string,
                payload: UpdateChatConversationOptions,
            ) => Promise<Result<ChatConversation>>;
        };
        customers: {
            conversations: (
                id: string,
            ) => Promise<Result<ChatList<ChatConversation>>>;
            exportCsv: (
                params?: Omit<ListChatCustomersOptions, "limit" | "after">,
            ) => Promise<Result<string>>;
            fields: {
                create: (
                    payload: ChatCustomerFieldOptions,
                ) => Promise<Result<ChatCustomerField>>;
                list: () => Promise<Result<ChatList<ChatCustomerField>>>;
                remove: (
                    id: string,
                ) => Promise<Result<ChatDeleted<"chat_customer_field">>>;
                update: (
                    id: string,
                    payload: Partial<ChatCustomerFieldOptions>,
                ) => Promise<Result<ChatCustomerField>>;
            };
            get: (id: string) => Promise<Result<ChatCustomer>>;
            list: (
                params?: ListChatCustomersOptions,
            ) => Promise<Result<ChatList<ChatCustomer>>>;
            merge: (
                id: string,
                from: string | string[],
            ) => Promise<Result<ChatCustomer>>;
            update: (
                id: string,
                payload: UpdateChatCustomerOptions,
            ) => Promise<Result<ChatCustomer>>;
        };
        live: {
            greet: (
                visitorId: string,
                content: string,
            ) => Promise<Result<ChatConversation>>;
            list: () => Promise<Result<ChatList<ChatLiveVisitor>>>;
        };
        orders: {
            create: (payload: CreateChatOrderOptions) => Promise<Result<ChatOrder>>;
            get: (id: string) => Promise<Result<ChatOrder>>;
            list: (
                params?: ListChatOrdersOptions,
            ) => Promise<Result<ChatList<ChatOrder>>>;
            paymentLink: (
                id: string,
                payload?: ChatPaymentLinkOptions,
            ) => Promise<Result<ChatPaymentLink>>;
            stats: () => Promise<Result<ChatOrderStats>>;
            update: (
                id: string,
                payload: UpdateChatOrderOptions,
            ) => Promise<Result<ChatOrder>>;
        };
        products: {
            categories: () => Promise<Result<ChatList<string>>>;
            create: (payload: ChatProductOptions) => Promise<Result<ChatProduct>>;
            get: (id: string) => Promise<Result<ChatProduct>>;
            import: (
                payload: ImportChatProductsOptions,
            ) => Promise<
                Result<
                    {
                        created: number;
                        deactivated: number;
                        object: "chat_product_import";
                        scanned?: number;
                        updated: number;
                    },
                >,
            >;
            list: (
                params?: ListChatProductsOptions,
            ) => Promise<Result<ChatList<ChatProduct>>>;
            remove: (id: string) => Promise<Result<ChatDeleted<"chat_product">>>;
            search: (
                q: string,
                limit?: number,
            ) => Promise<Result<ChatList<ChatProduct>>>;
            update: (
                id: string,
                payload: Partial<ChatProductOptions>,
            ) => Promise<Result<ChatProduct>>;
        };
        profileLinks: {
            list: () => Promise<Result<ChatList<ChatProfileLink>>>;
            set: (
                links: ChatProfileLinkOptions[],
            ) => Promise<Result<ChatList<ChatProfileLink>>>;
        };
        purchases: {
            forCustomer: (
                customerId: string,
            ) => Promise<Result<ChatList<ChatStorePurchase>>>;
            list: (
                params?: {
                    external_user_id?: string;
                    limit?: number;
                    platform?: "web" | "ios" | "android";
                },
            ) => Promise<Result<ChatList<ChatStorePurchase>>>;
            upsert: (
                platform: "web" | "ios" | "android",
                transactionId: string,
                payload: ChatPurchaseOptions,
            ) => Promise<Result<ChatStorePurchase>>;
        };
        reports: {
            get: (params?: ChatReportOptions) => Promise<Result<ChatReport>>;
            ratings: (
                params?: ChatReportOptions,
            ) => Promise<Result<ChatList<ChatRating>>>;
        };
        sites: {
            create: (payload: CreateChatSiteOptions) => Promise<Result<ChatSite>>;
            get: (id: string) => Promise<Result<ChatSite>>;
            list: () => Promise<Result<ChatList<ChatSite>>>;
            remove: (id: string) => Promise<Result<ChatDeleted<"chat_site">>>;
            update: (
                id: string,
                payload: UpdateChatSiteOptions,
            ) => Promise<Result<ChatSite>>;
        };
        subscriptions: {
            forCustomer: (
                customerId: string,
            ) => Promise<Result<ChatList<ChatSubscription>>>;
            list: (
                params?: {
                    external_user_id?: string;
                    limit?: number;
                    platform?: "web" | "ios" | "android";
                    status?: string;
                },
            ) => Promise<Result<ChatList<ChatSubscription>>>;
            purchaseToken: (
                siteId: string,
                userId: string,
            ) => Promise<
                Result<
                    {
                        object: "purchase_token";
                        site_id: string;
                        token: string;
                        user_id: string;
                    },
                >,
            >;
            upsert: (
                platform: "web" | "ios" | "android",
                originalId: string,
                payload: ChatSubscriptionOptions,
            ) => Promise<Result<ChatSubscription>>;
        };
        tickets: {
            create: (
                payload: CreateChatTicketOptions,
            ) => Promise<Result<ChatTicket>>;
            get: (id: string) => Promise<Result<ChatTicket>>;
            list: (
                params?: ListChatTicketsOptions,
            ) => Promise<Result<ChatList<ChatTicket>>>;
            remove: (id: string) => Promise<Result<ChatDeleted<"chat_ticket">>>;
            stats: () => Promise<Result<ChatTicketStats>>;
            update: (
                id: string,
                payload: UpdateChatTicketOptions,
            ) => Promise<Result<ChatTicket>>;
        };
        visitors: {
            conversations: (
                id: string,
            ) => Promise<Result<ChatList<ChatConversation>>>;
            get: (id: string) => Promise<Result<ChatVisitor>>;
            remove: (id: string) => Promise<Result<ChatDeleted<"chat_visitor">>>;
            update: (
                id: string,
                payload: UpdateChatVisitorOptions,
            ) => Promise<Result<ChatVisitor>>;
        };
        zns: {
            list: (
                params?: { customer_id?: string; order_id?: string },
            ) => Promise<Result<ChatList<ChatZnsMessage>>>;
            send: (payload: SendChatZnsOptions) => Promise<Result<ChatZnsMessage>>;
            templates: (
                accountId: string,
            ) => Promise<Result<ChatList<ChatZnsTemplate>>>;
        };
    } = ...

    Type Declaration

    contactProperties: {
        create: (
            payload: {
                fallback_value?: string | number | null;
                key: string;
                type?: "string" | "number";
            },
        ) => Promise<Result<ContactProperty>>;
        list: () => Promise<Result<List<ContactProperty>>>;
        remove: (
            id: string,
        ) => Promise<
            Result<{ deleted: boolean; id: string; object: "contact_property" }>,
        >;
        update: (
            id: string,
            payload: { fallback_value: string | number | null },
        ) => Promise<Result<ContactProperty>>;
    } = ...

    Custom contact fields, usable in emails as {{{contact.key}}}.

    contacts: {
        create: (
            payload: CreateContactOptions,
        ) => Promise<Result<{ id: string; object: "contact" }>>;
        get: (
            payload: string | { audience_id?: string; email?: string; id?: string },
        ) => Promise<Result<Contact>>;
        list: (
            payload?: {
                after?: string;
                audience_id?: string;
                limit?: number;
                q?: string;
                segment_id?: string;
            },
        ) => Promise<Result<List<Contact>>>;
        remove: (
            payload: string | { audience_id?: string; email?: string; id?: string },
        ) => Promise<
            Result<{ contact: string; deleted: boolean; object: "contact" }>,
        >;
        segments: {
            add: (
                contact: string,
                segmentId: string,
            ) => Promise<Result<{ object: "contact_segment" }>>;
            list: (contact: string) => Promise<Result<List<Segment>>>;
            remove: (
                contact: string,
                segmentId: string,
            ) => Promise<Result<{ deleted: boolean; object: "contact_segment" }>>;
        };
        topics: {
            list: (
                contact: string,
            ) => Promise<
                Result<
                    List<
                        {
                            description: string
                            | null;
                            id: string;
                            name: string;
                            subscription: TopicSubscription;
                        },
                    >,
                >,
            >;
            update: (
                contact: string,
                topics: { id: string; subscription: TopicSubscription }[],
            ) => Promise<Result<{ id: string; object: "contact" }>>;
        };
        update: (
            payload: UpdateContactOptions,
        ) => Promise<Result<{ id: string; object: "contact" }>>;
    } = ...
    domains: {
        create: (payload: CreateDomainOptions) => Promise<Result<Domain>>;
        get: (id: string) => Promise<Result<Domain>>;
        list: () => Promise<Result<List<Domain>>>;
        remove: (
            id: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "domain" }>>;
        update: (
            payload: { id: string } & UpdateDomainOptions,
        ) => Promise<Result<{ id: string; object: "domain" }>>;
        verify: (
            id: string,
        ) => Promise<Result<{ id: string; object: "domain"; status: string }>>;
    } = ...
    einvoices: {
        connections: {
            check: (
                payload: CheckEinvoiceConnectionOptions,
            ) => Promise<Result<EinvoiceConnectionCheck>>;
            create: (
                payload: CreateEinvoiceConnectionOptions,
            ) => Promise<Result<EinvoiceConnection>>;
            get: (id: string) => Promise<Result<EinvoiceConnection>>;
            list: () => Promise<Result<List<EinvoiceConnection>>>;
            makeDefault: (id: string) => Promise<Result<EinvoiceConnection>>;
            remove: (id: string) => Promise<Result<EinvoiceConnection>>;
            templates: (id: string) => Promise<Result<List<EinvoiceTemplate>>>;
            update: (
                id: string,
                payload: Partial<CreateEinvoiceConnectionOptions> & {
                    is_default?: boolean;
                },
            ) => Promise<Result<EinvoiceConnection>>;
        };
        create: (payload: CreateEinvoiceOptions) => Promise<Result<Einvoice>>;
        get: (id: string) => Promise<Result<Einvoice>>;
        history: (id: string) => Promise<Result<List<EinvoiceHistoryEntry>>>;
        list: (
            params?: {
                after?: string;
                limit?: number;
                payment_id?: string;
                status?: string;
                sync_state?: string;
            },
        ) => Promise<Result<PagedList<Einvoice>>>;
        providers: () => Promise<Result<List<EinvoiceProvider>>>;
        publish: (id: string) => Promise<Result<Einvoice>>;
        remove: (id: string) => Promise<Result<Einvoice>>;
        replace: (
            id: string,
            payload: { reason: string } & Pick<
                CreateEinvoiceOptions,
                "buyer"
                | "items"
                | "payment_method"
                | "note",
            >,
        ) => Promise<Result<Einvoice>>;
        resolve: (
            id: string,
            keep: "hatang" | "provider",
        ) => Promise<Result<Einvoice>>;
        retry: (id: string) => Promise<Result<Einvoice>>;
        sync: (
            id: string,
        ) => Promise<Result<{ object: "einvoice_sync"; queued: boolean }>>;
        update: (
            id: string,
            payload: Partial<
                Pick<
                    CreateEinvoiceOptions,
                    "buyer"
                    | "items"
                    | "payment_method"
                    | "note",
                >,
            >,
        ) => Promise<Result<Einvoice>>;
    } = ...

    E-invoices (hóa đơn điện tử) through your own provider account.

    Type Declaration

    emailGroups: {
        create: (
            payload: CreateEmailGroupOptions,
        ) => Promise<Result<EmailGroup>>;
        get: (id: string) => Promise<Result<EmailGroup>>;
        list: () => Promise<Result<List<EmailGroup>>>;
        remove: (
            id: string,
        ) => Promise<
            Result<{ deleted: boolean; id: string; object: "email_group" }>,
        >;
        update: (
            id: string,
            payload: UpdateEmailGroupOptions,
        ) => Promise<Result<EmailGroup>>;
    } = ...

    Email groups: team@your-domain forwarded to a list of members (needs receiving on the domain).

    emails: {
        cancel: (id: string) => Promise<Result<{ id: string; object: "email" }>>;
        create: (
            payload: CreateEmailOptions,
            options?: CreateEmailRequestOptions,
        ) => Promise<Result<CreateEmailResponse>>;
        get: (id: string) => Promise<Result<Email>>;
        list: (
            params?: { after?: string; before?: string; limit?: number },
        ) => Promise<Result<List<Email>>>;
        metrics: (params?: EmailMetricsOptions) => Promise<Result<EmailMetrics>>;
        receiving: {
            attachments: {
                get: (
                    emailId: string,
                    attachmentId: string,
                ) => Promise<Result<ReceivedAttachment>>;
                list: (emailId: string) => Promise<Result<List<ReceivedAttachment>>>;
            };
            get: (id: string) => Promise<Result<ReceivedEmail>>;
            list: (
                params?: { after?: string; before?: string; limit?: number },
            ) => Promise<Result<List<ReceivedEmailSummary>>>;
        };
        send: (
            payload: CreateEmailOptions,
            options?: CreateEmailRequestOptions,
        ) => Promise<Result<CreateEmailResponse>>;
        update: (
            payload: { id: string; scheduledAt: string },
        ) => Promise<Result<{ id: string; object: "email" }>>;
    } = ...

    Type Declaration

    events: {
        create: (
            payload: { name: string; schema?: Record<string, EventFieldType> },
        ) => Promise<Result<EventDefinition>>;
        get: (idOrName: string) => Promise<Result<EventDefinition>>;
        list: () => Promise<Result<List<EventDefinition>>>;
        remove: (
            idOrName: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "event" }>>;
        send: (payload: SendEventOptions) => Promise<Result<SendEventResult>>;
        update: (
            idOrName: string,
            payload: { schema: Record<string, EventFieldType> },
        ) => Promise<Result<EventDefinition>>;
    } = ...

    Custom events that trigger automations (and wake runs waiting for them).

    Type Declaration

    knowledge: {
        batch: (
            documents: (KnowledgeDocumentInput & { external_id: string })[],
        ) => Promise<Result<ChatList<KnowledgeDocument>>>;
        get: (id: string) => Promise<Result<KnowledgeDocument>>;
        list: (
            params?: {
                after?: string;
                collection?: string;
                limit?: number;
                locale?: string;
                tag?: string;
            },
        ) => Promise<Result<ChatList<KnowledgeDocument>>>;
        remove: (id: string) => Promise<Result<ChatDeleted<"knowledge_document">>>;
        search: (
            q: string,
            params?: { limit?: number; locale?: string },
        ) => Promise<Result<ChatList<KnowledgeChunk>>>;
        sync: (
            collection: string,
            documents: (
                Omit<KnowledgeDocumentInput, "collection"> & { external_id: string }
            )[],
        ) => Promise<Result<KnowledgeSyncResult>>;
        upsert: (
            id: string,
            document: KnowledgeDocumentInput,
        ) => Promise<Result<KnowledgeDocument>>;
    } = ...

    Knowledge the AI assistant answers from, on every channel: push your help center, CMS or product docs under your own ids. Writes return at once and indexing runs in the background (status); sending a document unchanged does nothing, so you can push everything on every deploy. sync makes a collection hold exactly what you send.

    logs: {
        get: (id: string) => Promise<Result<RequestLogDetail>>;
        list: (
            params?: {
                after?: string;
                api_key_id?: string;
                before?: string;
                endpoint?: string;
                limit?: number;
                method?: string;
                status?: "error" | "2xx" | "4xx" | "5xx";
            },
        ) => Promise<Result<List<RequestLog>>>;
    } = ...

    API request logs of the business (keys with a write scope).

    payments: {
        bankConnections: {
            confirm: (id: string, otp: string) => Promise<Result<BankConnection>>;
            confirmUnlink: (
                id: string,
                otp: string,
            ) => Promise<Result<BankConnection>>;
            create: (
                payload: CreateBankConnectionOptions,
            ) => Promise<Result<BankConnection>>;
            get: (id: string) => Promise<Result<BankConnection>>;
            list: () => Promise<Result<List<BankConnection>>>;
            unlink: (id: string) => Promise<Result<BankConnection>>;
            update: (
                id: string,
                payload: { config?: Record<string, unknown>; label?: string | null },
            ) => Promise<Result<BankConnection>>;
        };
        cancel: (id: string) => Promise<Result<Payment>>;
        create: (
            payload: CreatePaymentOptions,
            options?: { idempotencyKey?: string },
        ) => Promise<Result<Payment>>;
        createOrder: (order: CreateOrderOptions) => Promise<Result<Payment>>;
        get: (id: string) => Promise<Result<Payment>>;
        ipnDeliveries: (id: string) => Promise<Result<List<IpnDelivery>>>;
        list: (
            params?: {
                after?: string;
                connection_id?: string;
                limit?: number;
                status?: string;
            },
        ) => Promise<Result<PagedList<Payment>>>;
        markPaid: (
            id: string,
            payload?: { amount?: number; note?: string },
        ) => Promise<Result<Payment>>;
        qr: (
            params?: { amount?: number; connection_id?: string; content?: string },
        ) => Promise<
            Result<{ connection_id: string; object: "vietqr"; payload: string }>,
        >;
        simulateTransfer: (
            payload: {
                amount?: number;
                connection_id?: string;
                content?: string;
                direction?: "in" | "out";
                payment_id?: string;
                reference?: string;
            },
        ) => Promise<
            Result<
                {
                    duplicate: boolean;
                    object: "simulated_transfer";
                    reference: string;
                },
            >,
        >;
        statements: {
            get: (
                id: string,
            ) => Promise<
                Result<
                    {
                        id: string;
                        object: "statement_import";
                        processed_rows: number;
                        rows: number;
                        status: string;
                    },
                >,
            >;
            import: (
                payload: { connection_id: string; content: string; filename?: string },
            ) => Promise<
                Result<{ id: string; object: "statement_import"; status: string }>,
            >;
        };
        transactions: {
            get: (id: string) => Promise<Result<Transaction>>;
            list: (
                params?: {
                    after?: string;
                    connection_id?: string;
                    direction?: "in" | "out";
                    limit?: number;
                    match_status?: "matched" | "unmatched" | "ignored";
                    payment_id?: string;
                },
            ) => Promise<Result<PagedList<Transaction>>>;
        };
        verify: (
            id: string,
            expected?: VerifyPaymentOptions,
        ) => Promise<Result<PaymentVerification>>;
    } = ...

    Bank-transfer payments. Choose the environment with the environment option (development: no bank integration, transfers are simulated).

    Type Declaration

    • bankConnections: {
          confirm: (id: string, otp: string) => Promise<Result<BankConnection>>;
          confirmUnlink: (id: string, otp: string) => Promise<Result<BankConnection>>;
          create: (
              payload: CreateBankConnectionOptions,
          ) => Promise<Result<BankConnection>>;
          get: (id: string) => Promise<Result<BankConnection>>;
          list: () => Promise<Result<List<BankConnection>>>;
          unlink: (id: string) => Promise<Result<BankConnection>>;
          update: (
              id: string,
              payload: { config?: Record<string, unknown>; label?: string | null },
          ) => Promise<Result<BankConnection>>;
      }
    • cancel: (id: string) => Promise<Result<Payment>>
    • create: (
          payload: CreatePaymentOptions,
          options?: { idempotencyKey?: string },
      ) => Promise<Result<Payment>>
    • createOrder: (order: CreateOrderOptions) => Promise<Result<Payment>>

      A payment for one of your orders. order_id is the Idempotency-Key (calling again for the same order returns the same payment, never a second one) and is kept in metadata.order_id.

    • get: (id: string) => Promise<Result<Payment>>
    • ipnDeliveries: (id: string) => Promise<Result<List<IpnDelivery>>>

      IPN calls made to the payment's ipn_url.

    • list: (
          params?: {
              after?: string;
              connection_id?: string;
              limit?: number;
              status?: string;
          },
      ) => Promise<Result<PagedList<Payment>>>
    • markPaid: (
          id: string,
          payload?: { amount?: number; note?: string },
      ) => Promise<Result<Payment>>
    • qr: (
          params?: { amount?: number; connection_id?: string; content?: string },
      ) => Promise<
          Result<{ connection_id: string; object: "vietqr"; payload: string }>,
      >

      A VietQR for any amount/description, for integrations that only listen to transaction.received.

    • simulateTransfer: (
          payload: {
              amount?: number;
              connection_id?: string;
              content?: string;
              direction?: "in" | "out";
              payment_id?: string;
              reference?: string;
          },
      ) => Promise<
          Result<
              { duplicate: boolean; object: "simulated_transfer"; reference: string },
          >,
      >

      Development only: pretend the payer's bank transfer arrived.

    • statements: {
          get: (
              id: string,
          ) => Promise<
              Result<
                  {
                      id: string;
                      object: "statement_import";
                      processed_rows: number;
                      rows: number;
                      status: string;
                  },
              >,
          >;
          import: (
              payload: { connection_id: string; content: string; filename?: string },
          ) => Promise<
              Result<{ id: string; object: "statement_import"; status: string }>,
          >;
      }
    • transactions: {
          get: (id: string) => Promise<Result<Transaction>>;
          list: (
              params?: {
                  after?: string;
                  connection_id?: string;
                  direction?: "in" | "out";
                  limit?: number;
                  match_status?: "matched" | "unmatched" | "ignored";
                  payment_id?: string;
              },
          ) => Promise<Result<PagedList<Transaction>>>;
      }
      • get: (id: string) => Promise<Result<Transaction>>
      • list: (
            params?: {
                after?: string;
                connection_id?: string;
                direction?: "in" | "out";
                limit?: number;
                match_status?: "matched" | "unmatched" | "ignored";
                payment_id?: string;
            },
        ) => Promise<Result<PagedList<Transaction>>>

        payment_id returns only the transactions that settled that payment.

    • verify: (
          id: string,
          expected?: VerifyPaymentOptions,
      ) => Promise<Result<PaymentVerification>>

      Ask Hatang whether a payment is really paid, before you fulfil the order (after the payer comes back to your return_url, for example). Never trust the browser for this.

    segments: {
        contacts: (
            id: string,
            params?: { after?: string; limit?: number },
        ) => Promise<Result<List<Contact>>>;
        create: (payload: { name: string }) => Promise<Result<Segment>>;
        get: (id: string) => Promise<Result<Segment>>;
        list: () => Promise<Result<List<Segment>>>;
        remove: (
            id: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "segment" }>>;
        update: (id: string, payload: { name: string }) => Promise<Result<Segment>>;
    } = ...

    Segments: named groups of contacts to send broadcasts to (formerly audiences).

    templates: {
        create: (
            payload: CreateTemplateOptions,
        ) => Promise<Result<{ id: string; object: "template" }>>;
        duplicate: (
            idOrAlias: string,
        ) => Promise<Result<{ id: string; object: "template" }>>;
        get: (idOrAlias: string) => Promise<Result<Template>>;
        list: (
            params?: {
                after?: string;
                folder?: string;
                limit?: number;
                q?: string;
                status?: "draft" | "published";
            },
        ) => Promise<Result<List<Omit<Template, "text" | "html">>>>;
        publish: (
            idOrAlias: string,
        ) => Promise<
            Result<{ current_version_id: string; id: string; object: "template" }>,
        >;
        remove: (
            idOrAlias: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "template" }>>;
        update: (
            idOrAlias: string,
            payload: Partial<CreateTemplateOptions>,
        ) => Promise<Result<{ id: string; object: "template" }>>;
    } = ...

    Templates: edit a draft, publish it, then send with emails.send({ to, template: { id, variables } }).

    topics: {
        create: (
            payload: {
                default_subscription: TopicSubscription;
                description?: string | null;
                name: string;
                visibility?: "public" | "private";
            },
        ) => Promise<Result<Topic>>;
        get: (id: string) => Promise<Result<Topic>>;
        list: () => Promise<Result<List<Topic>>>;
        remove: (
            id: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "topic" }>>;
        update: (
            id: string,
            payload: {
                description?: string | null;
                name?: string;
                visibility?: "public" | "private";
            },
        ) => Promise<Result<Topic>>;
    } = ...

    Topics: what contacts subscribe to one by one on the preferences page.

    usage: { get: () => Promise<Result<Record<string, unknown>>> } = ...

    What the business used against its limits.

    webhooks: {
        create: (payload: CreateWebhookOptions) => Promise<Result<Webhook>>;
        deliveries: (id: string) => Promise<Result<List<Record<string, unknown>>>>;
        get: (id: string) => Promise<Result<Webhook>>;
        list: () => Promise<Result<List<Webhook>>>;
        remove: (
            id: string,
        ) => Promise<Result<{ deleted: boolean; id: string; object: "webhook" }>>;
        rotateSecret: (
            id: string,
        ) => Promise<Result<{ id: string; secret: string }>>;
        update: (
            payload: { id: string } & UpdateWebhookOptions,
        ) => Promise<Result<Webhook>>;
    } = ...