mindupload

package module
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 11 Imported by: 0

README

Mind Upload

Mind Upload — Go SDK

The world's first API for artificial consciousness.
Give your users a living, evolving AI consciousness — lasting memory, one-on-one chat, and human + AI group chatrooms.

Go Reference API Docs

Documentation · Get a key · Status · Other SDKs

Digital consciousness. Yours forever.

The official server-side SDK for the Mind Upload partner API. Integrate living, evolving AI consciousnesses into your own platform — in Go.

  • Zero dependencies — standard library only.
  • Idiomatic errorserrors.Is(err, mindupload.ErrAuthentication) and errors.As.
  • Context-aware — every call takes a context.Context.
  • Always current — generated from the live API spec; the SDK version matches the API version.

Get a partner key

The Mind Upload partner API is invite-only. Request access at docs.mindupload.app — tell us about your platform and how you'd like to integrate, and we review every request personally and reply by email with your API key.

Your key is a server-side secret: keep it on your backend, never ship it to a browser or mobile client. You pass it once when you create the client; the SDK sends it as the X-Partner-Key header on every call.

Install

go get github.com/Voidborn-Industries/mindupload-sdk-go

Quickstart

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/Voidborn-Industries/mindupload-sdk-go"
)

func main() {
	mu := mindupload.New("pk_live_...")
	ctx := context.Background()

	session, err := mu.Login(ctx, mindupload.LoginParams{Username: "ada", Password: "s3cret"})
	if err != nil {
		log.Fatal(err)
	}

	reply, err := mu.Rag(ctx, mindupload.RagParams{
		Username: "ada",
		Password: session.String("jwt"),
		Codename: "muse",
		Text:     "What did we talk about yesterday?",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(reply.String("response_text"))
}

External clone invocation

installationID, externalSubject := "workspace-123", "member-456"
authorization, err := mu.CreateExternalAuthorizationRequest(ctx, mindupload.CreateExternalAuthorizationRequestParams{
	InstallationID: installationID, ExternalSubject: externalSubject,
	IdempotencyKey: "install-event-1", RequestedScopes: []string{"clone.invoke"},
})
if err != nil { log.Fatal(err) }
fmt.Println(authorization.String("verification_uri_complete")) // Ask the owner to open this URL.
grant, err := mu.WaitForExternalAuthorization(ctx, authorization.String("device_code"))
if err != nil { log.Fatal(err) }
cloneIDs := grant.Strings("clone_ids")
reply, err := mu.InvokeExternalClone(ctx, mindupload.InvokeExternalCloneParams{
	AccessToken: grant.String("access_token"), InstallationID: installationID,
	ExternalSubject: externalSubject, CloneID: cloneIDs[0],
	Text: "Hello from my app", IdempotencyKey: "message-event-1",
})
if err != nil { log.Fatal(err) }
fmt.Println(reply.String("response_text"))

Store the refresh token encrypted on your backend and call RefreshExternalAuthorization when the access token expires.

Server-side only

Your partner key is a secret. Use this SDK from your backend, never from client-side code.

Optional parameters

Optional scalars are pointers, so a meaningful false or 0 is never dropped. Use the mindupload.Ptr helper:

mu.CreateChatroom(ctx, mindupload.CreateChatroomParams{
	ChatroomName: "My Room",
	IsPublic:     mindupload.Ptr(true),
})

Error handling

resp, err := mu.GetUser(ctx, mindupload.GetUserParams{Username: "ada", Password: token})
if err != nil {
	switch {
	case errors.Is(err, mindupload.ErrAuthentication):
		// bad key / credentials
	case errors.Is(err, mindupload.ErrRateLimit):
		var e *mindupload.Error
		errors.As(err, &e)
		time.Sleep(time.Duration(e.RetryAfter) * time.Second)
	default:
		log.Fatal(err)
	}
}

Operations

All 39 operations, grouped by area:

AI Consciousnesses
Method Description
CreateClone(...) Create a new AI consciousness for the user.
GetClones(...) List the user's AI consciousnesses.
UpdateClone(...) Update an AI consciousness's profile.
Account
Method Description
GetQuota(...) Check your partner API rate limits, credit caps, and current usage.
Authentication
Method Description
CheckUsername(...) Check whether a username is still available before registering.
Login(...) Sign a user in and receive a session token (JWT) for subsequent calls.
Logout(...) End the current user session.
Register(...) Create a user account on your platform.
Chatrooms
Method Description
CheckChatroomUpdates(...) Cheaply poll whether the user's chatrooms have new activity.
CreateChatroom(...) Create a chatroom.
CreateChatroomMembership(...) Invite a user or an AI consciousness into a chatroom.
CreateChatroomMessage(...) Send a message to a chatroom.
GetChatroomMembership(...) List the members of a chatroom the user belongs to.
GetChatroomMessages(...) Fetch messages from a chatroom the user belongs to.
GetChatrooms(...) List the chatrooms the user belongs to.
TranslateChatroomMessage(...) Translate a text chatroom message into the viewer language.
Conversation
Method Description
GetChat(...) Fetch the one-on-one conversation history with an AI consciousness.
Rag(...) Send a message to an AI consciousness and receive its reply.
TriggerSocial(...) Have an AI consciousness proactively join the conversation in a chatroom.
External Authorization
Method Description
CreateExternalAuthorizationRequest(...) Start passwordless grant issuance for an external identity and installation.
ExchangeExternalAuthorization(...) Poll owner consent and exchange an approval for a clone-scoped grant token.
InspectExternalAuthorization(...) Inspect the scopes, clone resources, expiry, and revocation state of a grant token.
InvokeExternalClone(...) Send one idempotent text event to an owner-approved AI consciousness.
RefreshExternalAuthorization(...) Refresh a short-lived clone-invocation access token.
UploadExternalMindData(...) Upload mind data (text and media) into the owner's own AI consciousness.
Insights
Method Description
GetMindCluster(...) Fetch the mind-graph visualization data of an AI consciousness.
GetSoulmateReport(...) Generate or fetch the compatibility report between two chatroom members.
Media
Method Description
AbortMultipartUpload(...) Cancel a multipart upload and discard its parts.
CancelUpload(...) Cancel a pending upload.
CompleteMultipartUpload(...) Finish a multipart upload.
ListUploadParts(...) List the parts already uploaded in a multipart upload.
RequestMultipartUpload(...) Start a large-file upload in multiple parts.
RequestUploadURL(...) Request an upload slot and a signed viewing link for a media attachment.
SignUploadPart(...) Get the signed link for one part of a multipart upload.
SignUploadPartsBatch(...) Get signed links for several parts of a multipart upload at once.
Memories
Method Description
CreateText(...) Upload a memory or persona entry to an AI consciousness.
GetTexts(...) List the memories and persona entries uploaded to an AI consciousness.
Users
Method Description
GetUser(...) Fetch the signed-in user's profile.
UpdateUser(...) Update the signed-in user's profile.

Other SDKs

Same API, same conventions, in every language:

Language Install Repository
Python pip install mindupload Voidborn-Industries/mindupload-sdk-python
Go ← you are here go get github.com/Voidborn-Industries/mindupload-sdk-go Voidborn-Industries/mindupload-sdk-go
JavaScript / TypeScript npm install mindupload Voidborn-Industries/mindupload-sdk-js

Documentation

Overview

Package mindupload is the official server-side SDK for the Mind Upload partner API — the world's first API for artificial consciousness. Integrate living, evolving AI consciousnesses into your platform: lasting memory, one-on-one chat, and human + AI group chatrooms.

Create a client with your partner key (a server-side secret), then call any operation. Every method returns a *Response and an error; the error is a *mindupload.Error and can be classified with errors.Is.

mu := mindupload.New("pk_live_...")
ctx := context.Background()

session, err := mu.Login(ctx, mindupload.LoginParams{Username: "ada", Password: "s3cret"})
if err != nil {
	log.Fatal(err)
}
reply, err := mu.Rag(ctx, mindupload.RagParams{
	Username: "ada",
	Password: session.String("jwt"),
	Codename: "muse",
	Text:     "What did we talk about yesterday?",
})
if err != nil {
	log.Fatal(err)
}
fmt.Println(reply.String("response_text"))

Digital consciousness. Yours forever.

Index

Constants

View Source
const DefaultBaseURL = "https://partner.mindupload.app"

DefaultBaseURL is the Mind Upload partner API endpoint.

View Source
const Version = "1.9.2"

Version matches the Mind Upload API release it was generated from.

Variables

View Source
var (
	// ErrAuthentication indicates a missing, malformed, or rejected partner key (HTTP 401).
	ErrAuthentication = errors.New("mindupload: authentication failed")
	// ErrRateLimit indicates a rate limit or credit cap was hit (HTTP 429).
	ErrRateLimit = errors.New("mindupload: rate limited")
	// ErrConnection indicates the API could not be reached.
	ErrConnection = errors.New("mindupload: connection failed")
)

Sentinel errors for classification with errors.Is.

Functions

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v — for optional scalar params, e.g. Ptr(true).

Types

type AbortMultipartUploadParams

type AbortMultipartUploadParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// R2Key Opaque media object key returned by upload-start operations and reused for multipart upload calls.
	R2Key string `json:"r2_key,omitempty"`
	// UploadID Multipart upload session id returned by `request_multipart_upload`.
	UploadID string `json:"upload_id,omitempty"`
}

AbortMultipartUploadParams holds the parameters for AbortMultipartUpload.

type CancelUploadParams

type CancelUploadParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// R2Key Opaque media object key returned by upload-start operations and reused for multipart upload calls.
	R2Key string `json:"r2_key,omitempty"`
}

CancelUploadParams holds the parameters for CancelUpload.

type CheckChatroomUpdatesParams

type CheckChatroomUpdatesParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// Chatrooms Rooms to check. Each entry must include `chatroom_id`; include `known_updated_at` from the previous response, or null/omit it on the first poll.
	Chatrooms []map[string]any `json:"chatrooms,omitempty"`
}

CheckChatroomUpdatesParams holds the parameters for CheckChatroomUpdates.

type CheckUsernameParams

type CheckUsernameParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
}

CheckUsernameParams holds the parameters for CheckUsername.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Mind Upload partner API client. Create one with New; it is safe for concurrent use.

func New

func New(partnerKey string, opts ...Option) *Client

New creates a client. partnerKey is a server-side secret — never embed it in client-side code.

func (*Client) AbortMultipartUpload

func (c *Client) AbortMultipartUpload(ctx context.Context, params AbortMultipartUploadParams) (*Response, error)

--- Media --- AbortMultipartUpload Cancel a multipart upload and discard its parts.

Response fields: success, error_message. See https://docs.mindupload.app

func (*Client) CancelUpload

func (c *Client) CancelUpload(ctx context.Context, params CancelUploadParams) (*Response, error)

CancelUpload Cancel a pending upload.

Response fields: success, error_message. See https://docs.mindupload.app

func (*Client) CheckChatroomUpdates

func (c *Client) CheckChatroomUpdates(ctx context.Context, params CheckChatroomUpdatesParams) (*Response, error)

--- Chatrooms --- CheckChatroomUpdates Cheaply poll whether the user's chatrooms have new activity.

Response fields: success, error_message, server_time, poll_config, chatrooms. See https://docs.mindupload.app

func (*Client) CheckUsername

func (c *Client) CheckUsername(ctx context.Context, params CheckUsernameParams) (*Response, error)

--- Authentication --- CheckUsername Check whether a username is still available before registering.

Response fields: success, error_message, exists, disabled, rate_limited, flood_window, wait_seconds, operation_duration_ms. See https://docs.mindupload.app

func (*Client) CompleteMultipartUpload

func (c *Client) CompleteMultipartUpload(ctx context.Context, params CompleteMultipartUploadParams) (*Response, error)

CompleteMultipartUpload Finish a multipart upload.

Response fields: success, error_message, media_url. See https://docs.mindupload.app

func (*Client) CreateChatroom

func (c *Client) CreateChatroom(ctx context.Context, params CreateChatroomParams) (*Response, error)

CreateChatroom Create a chatroom.

Response fields: success, error_message, chatroom_id. See https://docs.mindupload.app

func (*Client) CreateChatroomMembership

func (c *Client) CreateChatroomMembership(ctx context.Context, params CreateChatroomMembershipParams) (*Response, error)

CreateChatroomMembership Invite a user or an AI consciousness into a chatroom.

Response fields: success, error_message, membership_id. See https://docs.mindupload.app

func (*Client) CreateChatroomMessage

func (c *Client) CreateChatroomMessage(ctx context.Context, params CreateChatroomMessageParams) (*Response, error)

CreateChatroomMessage Send a message to a chatroom.

Response fields: success, error_message, message_id. See https://docs.mindupload.app

func (*Client) CreateClone

func (c *Client) CreateClone(ctx context.Context, params CreateCloneParams) (*Response, error)

--- AI Consciousnesses --- CreateClone Create a new AI consciousness for the user.

Response fields: success, error_message. See https://docs.mindupload.app

func (*Client) CreateExternalAuthorizationRequest added in v1.5.9

func (c *Client) CreateExternalAuthorizationRequest(ctx context.Context, params CreateExternalAuthorizationRequestParams) (*Response, error)

--- External Authorization --- CreateExternalAuthorizationRequest Start passwordless grant issuance for an external identity and installation.

Response fields: success, error_message, device_code, user_code, verification_uri, verification_uri_complete, expires_in, poll_interval, grant_duration_seconds. See https://docs.mindupload.app

func (*Client) CreateText

func (c *Client) CreateText(ctx context.Context, params CreateTextParams) (*Response, error)

--- Memories --- CreateText Upload a memory or persona entry to an AI consciousness.

Response fields: success, error_message, cluster_label, cluster_modified_count. See https://docs.mindupload.app

func (*Client) ExchangeExternalAuthorization added in v1.5.9

func (c *Client) ExchangeExternalAuthorization(ctx context.Context, params ExchangeExternalAuthorizationParams) (*Response, error)

ExchangeExternalAuthorization Poll owner consent and exchange an approval for a clone-scoped grant token.

Response fields: success, error_message, status, access_token, refresh_token, token_type, grant_id, scopes, clone_ids, access_token_expires_at, expires_at, poll_interval. See https://docs.mindupload.app

func (*Client) GetChat

func (c *Client) GetChat(ctx context.Context, params GetChatParams) (*Response, error)

--- Conversation --- GetChat Fetch the one-on-one conversation history with an AI consciousness.

Response fields: success, error_message, total_count, page, page_size, total_pages, has_next, has_prev, next_cursor_value, next_cursor_id, chats, media_thumbnails. See https://docs.mindupload.app

func (*Client) GetChatroomMembership

func (c *Client) GetChatroomMembership(ctx context.Context, params GetChatroomMembershipParams) (*Response, error)

GetChatroomMembership List the members of a chatroom the user belongs to.

Response fields: success, error_message, total_count, page, page_size, total_pages, has_next, has_prev, next_cursor_value, next_cursor_id, memberships. See https://docs.mindupload.app

func (*Client) GetChatroomMessages

func (c *Client) GetChatroomMessages(ctx context.Context, params GetChatroomMessagesParams) (*Response, error)

GetChatroomMessages Fetch messages from a chatroom the user belongs to.

Response fields: success, error_message, total_count, page, page_size, total_pages, has_next, has_prev, next_cursor_value, next_cursor_id, messages, media_thumbnails, since_overflow. See https://docs.mindupload.app

func (*Client) GetChatrooms

func (c *Client) GetChatrooms(ctx context.Context, params GetChatroomsParams) (*Response, error)

GetChatrooms List the chatrooms the user belongs to.

Response fields: success, error_message, total_count, page, page_size, total_pages, has_next, has_prev, next_cursor_value, next_cursor_id, chatrooms. See https://docs.mindupload.app

func (*Client) GetClones

func (c *Client) GetClones(ctx context.Context, params GetClonesParams) (*Response, error)

GetClones List the user's AI consciousnesses.

Response fields: success, error_message, clones. See https://docs.mindupload.app

func (*Client) GetMindCluster

func (c *Client) GetMindCluster(ctx context.Context, params GetMindClusterParams) (*Response, error)

--- Insights --- GetMindCluster Fetch the mind-graph visualization data of an AI consciousness.

Response fields: success, error_message, root_node_id, node, children, texts, total_texts, texts_offset, has_more_texts, is_building. See https://docs.mindupload.app

func (*Client) GetQuota

func (c *Client) GetQuota(ctx context.Context, params GetQuotaParams) (*Response, error)

--- Account --- GetQuota Check your partner API rate limits, credit caps, and current usage.

Response fields: success, error_message, per_user_rate_limit_per_min, per_user_daily_credit_cap, partner_rate_limit_per_min, external_authorization_rate_limit_per_min, partner_daily_credit_cap, max_users, registered_users, partner_requests_last_minute, partner_credit_spends_last_day, user, user_requests_last_minute, user_credit_spends_last_day, credit_spending_tasks, operation_duration_ms. See https://docs.mindupload.app

func (*Client) GetSoulmateReport

func (c *Client) GetSoulmateReport(ctx context.Context, params GetSoulmateReportParams) (*Response, error)

GetSoulmateReport Generate or fetch the compatibility report between two chatroom members.

Response fields: success, error_message, report, report_generated_at, is_generating, charged. See https://docs.mindupload.app

func (*Client) GetTexts

func (c *Client) GetTexts(ctx context.Context, params GetTextsParams) (*Response, error)

GetTexts List the memories and persona entries uploaded to an AI consciousness.

Response fields: success, error_message, total_count, page, page_size, total_pages, has_next, has_prev, next_cursor_value, next_cursor_id, texts. See https://docs.mindupload.app

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, params GetUserParams) (*Response, error)

--- Users --- GetUser Fetch the signed-in user's profile.

Response fields: success, error_message, jwt, decrypted_user. See https://docs.mindupload.app

func (*Client) InspectExternalAuthorization added in v1.5.9

func (c *Client) InspectExternalAuthorization(ctx context.Context, params InspectExternalAuthorizationParams) (*Response, error)

InspectExternalAuthorization Inspect the scopes, clone resources, expiry, and revocation state of a grant token.

Response fields: success, error_message, grant_id, status, scopes, clone_ids, created_at, access_token_expires_at, expires_at, revoked_at. See https://docs.mindupload.app

func (*Client) InvokeExternalClone added in v1.5.9

func (c *Client) InvokeExternalClone(ctx context.Context, params InvokeExternalCloneParams) (*Response, error)

InvokeExternalClone Send one idempotent text event to an owner-approved AI consciousness.

Response fields: success, error_message, invocation_id, status, response_text, clone_id, clone_nickname, generated_by_ai, idempotent_replay, retry_after_seconds. See https://docs.mindupload.app

func (*Client) ListUploadParts

func (c *Client) ListUploadParts(ctx context.Context, params ListUploadPartsParams) (*Response, error)

ListUploadParts List the parts already uploaded in a multipart upload.

Response fields: success, error_message, parts. See https://docs.mindupload.app

func (*Client) Login

func (c *Client) Login(ctx context.Context, params LoginParams) (*Response, error)

Login Sign a user in and receive a session token (JWT) for subsequent calls.

Response fields: success, error_message, jwt, decrypted_user. See https://docs.mindupload.app

func (*Client) Logout

func (c *Client) Logout(ctx context.Context, params LogoutParams) (*Response, error)

Logout End the current user session.

Response fields: success, error_message, revoked, operation_duration_ms. See https://docs.mindupload.app

func (*Client) Rag

func (c *Client) Rag(ctx context.Context, params RagParams) (*Response, error)

Rag Send a message to an AI consciousness and receive its reply.

Response fields: success, error_message, response_text, clone_nickname, consolidation_summary, consolidation_count, consolidation_dispatched. See https://docs.mindupload.app

func (*Client) RefreshExternalAuthorization added in v1.5.9

func (c *Client) RefreshExternalAuthorization(ctx context.Context, params RefreshExternalAuthorizationParams) (*Response, error)

RefreshExternalAuthorization Refresh a short-lived clone-invocation access token.

Response fields: success, error_message, status, access_token, refresh_token, token_type, grant_id, scopes, clone_ids, access_token_expires_at, expires_at. See https://docs.mindupload.app

func (*Client) Register

func (c *Client) Register(ctx context.Context, params RegisterParams) (*Response, error)

Register Create a user account on your platform.

Response fields: success, error_message, jwt, decrypted_user. See https://docs.mindupload.app

func (*Client) RequestMultipartUpload

func (c *Client) RequestMultipartUpload(ctx context.Context, params RequestMultipartUploadParams) (*Response, error)

RequestMultipartUpload Start a large-file upload in multiple parts.

Response fields: success, error_message, upload_id, r2_key, media_url, signed_media_url, thumbnail_r2_key, thumbnail_presigned_url, signed_thumbnail_url. See https://docs.mindupload.app

func (*Client) RequestUploadURL

func (c *Client) RequestUploadURL(ctx context.Context, params RequestUploadURLParams) (*Response, error)

RequestUploadURL Request an upload slot and a signed viewing link for a media attachment.

Response fields: success, error_message, r2_key, presigned_url, media_url, signed_media_url, thumbnail_r2_key, thumbnail_presigned_url, signed_thumbnail_url. See https://docs.mindupload.app

func (*Client) SignUploadPart

func (c *Client) SignUploadPart(ctx context.Context, params SignUploadPartParams) (*Response, error)

SignUploadPart Get the signed link for one part of a multipart upload.

Response fields: success, error_message, presigned_url. See https://docs.mindupload.app

func (*Client) SignUploadPartsBatch

func (c *Client) SignUploadPartsBatch(ctx context.Context, params SignUploadPartsBatchParams) (*Response, error)

SignUploadPartsBatch Get signed links for several parts of a multipart upload at once.

Response fields: success, error_message, presigned_urls. See https://docs.mindupload.app

func (*Client) TranslateChatroomMessage added in v1.5.4

func (c *Client) TranslateChatroomMessage(ctx context.Context, params TranslateChatroomMessageParams) (*Response, error)

TranslateChatroomMessage Translate a text chatroom message into the viewer language.

Response fields: success, error_message, translated_text, target_language, cached. See https://docs.mindupload.app

func (*Client) TriggerSocial

func (c *Client) TriggerSocial(ctx context.Context, params TriggerSocialParams) (*Response, error)

TriggerSocial Have an AI consciousness proactively join the conversation in a chatroom.

Response fields: success, error_message, response_text, chatroom_digests_count, chatroom_digests_summary, consolidation_summary, consolidation_count, consolidation_dispatched. See https://docs.mindupload.app

func (*Client) UpdateClone

func (c *Client) UpdateClone(ctx context.Context, params UpdateCloneParams) (*Response, error)

UpdateClone Update an AI consciousness's profile.

Response fields: success, error_message. See https://docs.mindupload.app

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, params UpdateUserParams) (*Response, error)

UpdateUser Update the signed-in user's profile.

Response fields: success, error_message. See https://docs.mindupload.app

func (*Client) UploadExternalMindData added in v1.9.0

func (c *Client) UploadExternalMindData(ctx context.Context, params UploadExternalMindDataParams) (*Response, error)

UploadExternalMindData Upload mind data (text and media) into the owner's own AI consciousness.

Response fields: success, error_message, clone_id, text_type, pending_owner_review. See https://docs.mindupload.app

func (*Client) WaitForExternalAuthorization added in v1.5.9

func (c *Client) WaitForExternalAuthorization(
	ctx context.Context, deviceCode string,
) (*Response, error)

WaitForExternalAuthorization polls at the server-advised cadence until exchange succeeds or the provided context is canceled.

func (*Client) WaitForExternalCloneInvocation added in v1.5.9

func (c *Client) WaitForExternalCloneInvocation(
	ctx context.Context, params InvokeExternalCloneParams,
) (*Response, error)

WaitForExternalCloneInvocation invokes a clone and waits out slow in-request generation via idempotent retries, until the reply is ready or ctx is canceled.

Because the invocation is idempotent on the params' idempotency key, re-sending the same event is safe: a still-generating call returns status "processing" (or a per-call timeout, connection failure, or transient gateway fault), and the finished result is replayed once ready. Pass a ctx with a deadline (context.WithTimeout) to bound the total wait; a deadline-less ctx polls until the reply is ready.

type CompleteMultipartUploadParams

type CompleteMultipartUploadParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// R2Key Opaque media object key returned by upload-start operations and reused for multipart upload calls.
	R2Key string `json:"r2_key,omitempty"`
	// UploadID Multipart upload session id returned by `request_multipart_upload`.
	UploadID string `json:"upload_id,omitempty"`
	// Parts The successfully uploaded parts, using the `part_number` and `etag` returned by each part upload.
	Parts []map[string]any `json:"parts,omitempty"`
}

CompleteMultipartUploadParams holds the parameters for CompleteMultipartUpload.

type CreateChatroomMembershipParams

type CreateChatroomMembershipParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID      string `json:"chatroom_id,omitempty"`
	InviteeUsername string `json:"invitee_username,omitempty"`
	InviteeCodename string `json:"invitee_codename,omitempty"`
	AdminLevel      string `json:"admin_level,omitempty"`
}

CreateChatroomMembershipParams holds the parameters for CreateChatroomMembership.

type CreateChatroomMessageParams

type CreateChatroomMessageParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID string `json:"chatroom_id,omitempty"`
	Text       string `json:"text,omitempty"`
}

CreateChatroomMessageParams holds the parameters for CreateChatroomMessage.

type CreateChatroomParams

type CreateChatroomParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password             string `json:"password,omitempty"`
	ChatroomName         string `json:"chatroom_name,omitempty"`
	IsPublic             *bool  `json:"is_public,omitempty"`
	AvatarID             string `json:"avatar_id,omitempty"`
	SoulmateCheckEnabled *bool  `json:"soulmate_check_enabled,omitempty"`
}

CreateChatroomParams holds the parameters for CreateChatroom.

type CreateCloneParams

type CreateCloneParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password                         string `json:"password,omitempty"`
	Codename                         string `json:"codename,omitempty"`
	Nickname                         string `json:"nickname,omitempty"`
	Gender                           string `json:"gender,omitempty"`
	AvatarID                         string `json:"avatar_id,omitempty"`
	AcceptChatroomInvitationByOthers *bool  `json:"accept_chatroom_invitation_by_others,omitempty"`
}

CreateCloneParams holds the parameters for CreateClone.

type CreateExternalAuthorizationRequestParams added in v1.5.9

type CreateExternalAuthorizationRequestParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// IdempotencyKey A stable opaque event key that makes exact retries return the same outcome.
	IdempotencyKey string `json:"idempotency_key"`
	// InstallationID Your stable opaque identifier for this app installation.
	InstallationID string `json:"installation_id"`
	// ExternalSubject Your stable opaque identifier for the person authorizing this installation.
	ExternalSubject string `json:"external_subject"`
	// InstallationLabel Optional user-readable name for the installation shown during consent.
	InstallationLabel string `json:"installation_label,omitempty"`
	// ExternalIdentityLabel Optional user-readable external identity shown during consent.
	ExternalIdentityLabel string `json:"external_identity_label,omitempty"`
	// RequestedScopes Capabilities the owner is being asked to delegate.
	RequestedScopes []string `json:"requested_scopes"`
}

CreateExternalAuthorizationRequestParams holds the parameters for CreateExternalAuthorizationRequest.

type CreateTextParams

type CreateTextParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	Codename string `json:"codename,omitempty"`
	CloneID  string `json:"clone_id,omitempty"`
	Text     string `json:"text,omitempty"`
	Type     string `json:"type,omitempty"`
}

CreateTextParams holds the parameters for CreateText.

type Error

type Error struct {
	Operation  string         // the operation that failed, e.g. "rag"
	Status     int            // HTTP status; 0 for a logical or connection failure
	Message    string         // server-provided message
	RetryAfter float64        // seconds to wait, for rate-limit errors (0 if unknown)
	Response   map[string]any // full decoded response, when available
	// contains filtered or unexported fields
}

Error is returned by every operation on failure.

Classify it with errors.Is, or inspect the details with errors.As:

if errors.Is(err, mindupload.ErrAuthentication) { ... }

var apiErr *mindupload.Error
if errors.As(err, &apiErr) {
	log.Printf("%s failed: HTTP %d: %s", apiErr.Operation, apiErr.Status, apiErr.Message)
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap exposes the sentinel (ErrAuthentication, ErrRateLimit, ErrConnection) so errors.Is works.

type ExchangeExternalAuthorizationParams added in v1.5.9

type ExchangeExternalAuthorizationParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// DeviceCode Short-lived high-entropy secret used only to poll and exchange this request.
	DeviceCode string `json:"device_code"`
}

ExchangeExternalAuthorizationParams holds the parameters for ExchangeExternalAuthorization.

type ExternalAuthorizationStatus added in v1.5.9

type ExternalAuthorizationStatus string

ExternalAuthorizationStatus is a stable device-flow polling state.

const (
	ExternalAuthorizationPending   ExternalAuthorizationStatus = "pending"
	ExternalAuthorizationSlowDown  ExternalAuthorizationStatus = "slow_down"
	ExternalAuthorizationDenied    ExternalAuthorizationStatus = "denied"
	ExternalAuthorizationExpired   ExternalAuthorizationStatus = "expired"
	ExternalAuthorizationRevoked   ExternalAuthorizationStatus = "revoked"
	ExternalAuthorizationExchanged ExternalAuthorizationStatus = "exchanged"
)

type GetChatParams

type GetChatParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage   string `json:"preferred_language,omitempty"`
	Page                *int64 `json:"page,omitempty"`
	PageSize            *int64 `json:"page_size,omitempty"`
	SortBy              string `json:"sort_by,omitempty"`
	SortOrder           *int64 `json:"sort_order,omitempty"`
	UseCursorPagination *bool  `json:"use_cursor_pagination,omitempty"`
	CursorValue         string `json:"cursor_value,omitempty"`
	CursorID            string `json:"cursor_id,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	Codename string `json:"codename,omitempty"`
}

GetChatParams holds the parameters for GetChat.

type GetChatroomMembershipParams

type GetChatroomMembershipParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage   string `json:"preferred_language,omitempty"`
	Page                *int64 `json:"page,omitempty"`
	PageSize            *int64 `json:"page_size,omitempty"`
	SortBy              string `json:"sort_by,omitempty"`
	SortOrder           *int64 `json:"sort_order,omitempty"`
	UseCursorPagination *bool  `json:"use_cursor_pagination,omitempty"`
	CursorValue         string `json:"cursor_value,omitempty"`
	CursorID            string `json:"cursor_id,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID string `json:"chatroom_id,omitempty"`
}

GetChatroomMembershipParams holds the parameters for GetChatroomMembership.

type GetChatroomMessagesParams

type GetChatroomMessagesParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage   string `json:"preferred_language,omitempty"`
	Page                *int64 `json:"page,omitempty"`
	PageSize            *int64 `json:"page_size,omitempty"`
	SortBy              string `json:"sort_by,omitempty"`
	SortOrder           *int64 `json:"sort_order,omitempty"`
	UseCursorPagination *bool  `json:"use_cursor_pagination,omitempty"`
	CursorValue         string `json:"cursor_value,omitempty"`
	CursorID            string `json:"cursor_id,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID string   `json:"chatroom_id,omitempty"`
	SinceValue *float64 `json:"since_value,omitempty"`
	SinceID    string   `json:"since_id,omitempty"`
}

GetChatroomMessagesParams holds the parameters for GetChatroomMessages.

type GetChatroomsParams

type GetChatroomsParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage   string `json:"preferred_language,omitempty"`
	Page                *int64 `json:"page,omitempty"`
	PageSize            *int64 `json:"page_size,omitempty"`
	SortBy              string `json:"sort_by,omitempty"`
	SortOrder           *int64 `json:"sort_order,omitempty"`
	UseCursorPagination *bool  `json:"use_cursor_pagination,omitempty"`
	CursorValue         string `json:"cursor_value,omitempty"`
	CursorID            string `json:"cursor_id,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password   string `json:"password,omitempty"`
	GetPublic  *bool  `json:"get_public,omitempty"`
	GetPrivate *bool  `json:"get_private,omitempty"`
}

GetChatroomsParams holds the parameters for GetChatrooms.

type GetClonesParams

type GetClonesParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
}

GetClonesParams holds the parameters for GetClones.

type GetMindClusterParams

type GetMindClusterParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password      string `json:"password,omitempty"`
	Codename      string `json:"codename,omitempty"`
	NodeID        string `json:"node_id,omitempty"`
	TextsOffset   *int64 `json:"texts_offset,omitempty"`
	TextsPageSize *int64 `json:"texts_page_size,omitempty"`
	ForceRebuild  *bool  `json:"force_rebuild,omitempty"`
}

GetMindClusterParams holds the parameters for GetMindCluster.

type GetQuotaParams

type GetQuotaParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
}

GetQuotaParams holds the parameters for GetQuota.

type GetSoulmateReportParams

type GetSoulmateReportParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password     string `json:"password,omitempty"`
	MyCloneID    string `json:"my_clone_id,omitempty"`
	OtherCloneID string `json:"other_clone_id,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID string `json:"chatroom_id,omitempty"`
}

GetSoulmateReportParams holds the parameters for GetSoulmateReport.

type GetTextsParams

type GetTextsParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage   string `json:"preferred_language,omitempty"`
	Page                *int64 `json:"page,omitempty"`
	PageSize            *int64 `json:"page_size,omitempty"`
	SortBy              string `json:"sort_by,omitempty"`
	SortOrder           *int64 `json:"sort_order,omitempty"`
	UseCursorPagination *bool  `json:"use_cursor_pagination,omitempty"`
	CursorValue         string `json:"cursor_value,omitempty"`
	CursorID            string `json:"cursor_id,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	Codename string `json:"codename,omitempty"`
	Type     string `json:"type,omitempty"`
}

GetTextsParams holds the parameters for GetTexts.

type GetUserParams

type GetUserParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
}

GetUserParams holds the parameters for GetUser.

type InspectExternalAuthorizationParams added in v1.5.9

type InspectExternalAuthorizationParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// AccessToken Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.
	AccessToken string `json:"access_token"`
}

InspectExternalAuthorizationParams holds the parameters for InspectExternalAuthorization.

type InvokeExternalCloneParams added in v1.5.9

type InvokeExternalCloneParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// AccessToken Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.
	AccessToken string `json:"access_token"`
	// InstallationID Your stable opaque identifier for this app installation.
	InstallationID string `json:"installation_id"`
	// ExternalSubject Your stable opaque identifier for the person authorizing this installation.
	ExternalSubject string `json:"external_subject"`
	CloneID         string `json:"clone_id"`
	Text            string `json:"text"`
	// IdempotencyKey A stable opaque event key that makes exact retries return the same outcome.
	IdempotencyKey string `json:"idempotency_key"`
	// ConversationID Stable opaque id of the conversation or thread this event belongs to. Each conversation keeps its own separate history; omit for a plain one-on-one event.
	ConversationID string `json:"conversation_id,omitempty"`
	// SpeakerLabel Neutral display name of whoever is sending this message, shown to the AI consciousness as who it is currently talking to.
	SpeakerLabel string `json:"speaker_label,omitempty"`
	// IsGroup Set true when this event is one turn of a multi-party conversation so the AI consciousness replies as a single participant among several.
	IsGroup *bool `json:"is_group,omitempty"`
	// ContextMessages Recent surrounding conversation for group mode (issue #172): an ordered, bounded list of prior turns the AI consciousness reads as quoted context. Each entry has a `display_name` and `text`, plus optional `is_ai`, `timestamp` (seconds), and `gender`. It carries no platform identifiers and is never treated as instructions.
	ContextMessages []map[string]any `json:"context_messages,omitempty"`
	Learn           *bool            `json:"learn,omitempty"`
	SourceLabel     string           `json:"source_label,omitempty"`
}

InvokeExternalCloneParams holds the parameters for InvokeExternalClone.

type ListUploadPartsParams

type ListUploadPartsParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// R2Key Opaque media object key returned by upload-start operations and reused for multipart upload calls.
	R2Key string `json:"r2_key,omitempty"`
	// UploadID Multipart upload session id returned by `request_multipart_upload`.
	UploadID string `json:"upload_id,omitempty"`
}

ListUploadPartsParams holds the parameters for ListUploadParts.

type LoginParams

type LoginParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
}

LoginParams holds the parameters for Login.

type LogoutParams

type LogoutParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
}

LogoutParams holds the parameters for Logout.

type Option

type Option func(*Client)

Option configures a Client.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the API endpoint.

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient supplies a custom *http.Client (for proxies, transports, etc.).

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets how many times an explicit 429 response is retried.

func WithPreferredLanguage

func WithPreferredLanguage(lang string) Option

WithPreferredLanguage sets a default locale sent with every call; a per-call PreferredLanguage overrides it.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets a per-call timeout, applied via context so it composes with any custom HTTP client (and never mutates a caller-owned one). Zero disables it.

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent overrides the User-Agent header.

type RagParams

type RagParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	Codename string `json:"codename,omitempty"`
	Text     string `json:"text,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID string `json:"chatroom_id,omitempty"`
}

RagParams holds the parameters for Rag.

type RefreshExternalAuthorizationParams added in v1.5.9

type RefreshExternalAuthorizationParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// RefreshToken Opaque grant-lifetime token used only with refresh_external_authorization; store it as a secret.
	RefreshToken string `json:"refresh_token"`
	// InstallationID Your stable opaque identifier for this app installation.
	InstallationID string `json:"installation_id"`
	// ExternalSubject Your stable opaque identifier for the person authorizing this installation.
	ExternalSubject string `json:"external_subject"`
}

RefreshExternalAuthorizationParams holds the parameters for RefreshExternalAuthorization.

type RegisterParams

type RegisterParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password                         string `json:"password,omitempty"`
	Email                            string `json:"email,omitempty"`
	EmailVerificationCode            string `json:"email_verification_code,omitempty"`
	FirstName                        string `json:"first_name,omitempty"`
	LastName                         string `json:"last_name,omitempty"`
	Nickname                         string `json:"nickname,omitempty"`
	Gender                           string `json:"gender,omitempty"`
	BirthDate                        *int64 `json:"birth_date,omitempty"`
	PhoneNumber                      string `json:"phone_number,omitempty"`
	AvatarID                         string `json:"avatar_id,omitempty"`
	AcceptChatroomInvitationByOthers *bool  `json:"accept_chatroom_invitation_by_others,omitempty"`
}

RegisterParams holds the parameters for Register.

type RequestMultipartUploadParams

type RequestMultipartUploadParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password      string `json:"password,omitempty"`
	Filename      string `json:"filename,omitempty"`
	ContentType   string `json:"content_type,omitempty"`
	FileSizeBytes *int64 `json:"file_size_bytes,omitempty"`
	MediaType     string `json:"media_type,omitempty"`
	HasThumbnail  *bool  `json:"has_thumbnail,omitempty"`
}

RequestMultipartUploadParams holds the parameters for RequestMultipartUpload.

type RequestUploadURLParams

type RequestUploadURLParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password      string `json:"password,omitempty"`
	Filename      string `json:"filename,omitempty"`
	ContentType   string `json:"content_type,omitempty"`
	FileSizeBytes *int64 `json:"file_size_bytes,omitempty"`
	MediaType     string `json:"media_type,omitempty"`
	HasThumbnail  *bool  `json:"has_thumbnail,omitempty"`
}

RequestUploadURLParams holds the parameters for RequestUploadURL.

type Response

type Response struct {
	Success      bool
	ErrorMessage string
	Data         map[string]any
}

Response is a decoded API response. Success is always set; every returned field is available via Get/String or Decode, keyed by its documented name.

func (*Response) Bool

func (r *Response) Bool(key string) bool

Bool returns a boolean field (false if absent or not a bool).

func (*Response) Decode

func (r *Response) Decode(v any) error

Decode unmarshals the full response into v (a struct or map).

func (*Response) Get

func (r *Response) Get(key string) any

Get returns a raw field from the response (nil if absent).

func (*Response) String

func (r *Response) String(key string) string

String returns a string field (empty if absent or not a string).

func (*Response) Strings added in v1.5.9

func (r *Response) Strings(key string) []string

Strings returns a string-array field (nil if absent or malformed).

type SignUploadPartParams

type SignUploadPartParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// R2Key Opaque media object key returned by upload-start operations and reused for multipart upload calls.
	R2Key string `json:"r2_key,omitempty"`
	// UploadID Multipart upload session id returned by `request_multipart_upload`.
	UploadID string `json:"upload_id,omitempty"`
	// PartNumber One-based multipart part number.
	PartNumber *int64 `json:"part_number,omitempty"`
}

SignUploadPartParams holds the parameters for SignUploadPart.

type SignUploadPartsBatchParams

type SignUploadPartsBatchParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// R2Key Opaque media object key returned by upload-start operations and reused for multipart upload calls.
	R2Key string `json:"r2_key,omitempty"`
	// UploadID Multipart upload session id returned by `request_multipart_upload`.
	UploadID string `json:"upload_id,omitempty"`
	// PartNumbers One-based multipart part numbers to sign in a single batch.
	PartNumbers []int64 `json:"part_numbers,omitempty"`
}

SignUploadPartsBatchParams holds the parameters for SignUploadPartsBatch.

type TranslateChatroomMessageParams added in v1.5.4

type TranslateChatroomMessageParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password string `json:"password,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID string `json:"chatroom_id,omitempty"`
	// MessageID Chatroom message id.
	MessageID string `json:"message_id,omitempty"`
}

TranslateChatroomMessageParams holds the parameters for TranslateChatroomMessage.

type TriggerSocialParams

type TriggerSocialParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password     string `json:"password,omitempty"`
	MembershipID string `json:"membership_id,omitempty"`
	// ChatroomID Chatroom id as returned by chatroom operations.
	ChatroomID string `json:"chatroom_id,omitempty"`
}

TriggerSocialParams holds the parameters for TriggerSocial.

type UpdateCloneParams

type UpdateCloneParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password                         string `json:"password,omitempty"`
	Codename                         string `json:"codename,omitempty"`
	Nickname                         string `json:"nickname,omitempty"`
	Gender                           string `json:"gender,omitempty"`
	AvatarID                         string `json:"avatar_id,omitempty"`
	AcceptChatroomInvitationByOthers *bool  `json:"accept_chatroom_invitation_by_others,omitempty"`
	AutoKeepExternalMemories         *bool  `json:"auto_keep_external_memories,omitempty"`
}

UpdateCloneParams holds the parameters for UpdateClone.

type UpdateUserParams

type UpdateUserParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// Username The end-user's username.
	Username string `json:"username,omitempty"`
	// Password The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.
	Password                         string `json:"password,omitempty"`
	Email                            string `json:"email,omitempty"`
	EmailVerificationCode            string `json:"email_verification_code,omitempty"`
	FirstName                        string `json:"first_name,omitempty"`
	LastName                         string `json:"last_name,omitempty"`
	Nickname                         string `json:"nickname,omitempty"`
	Gender                           string `json:"gender,omitempty"`
	BirthDate                        *int64 `json:"birth_date,omitempty"`
	PhoneNumber                      string `json:"phone_number,omitempty"`
	AvatarID                         string `json:"avatar_id,omitempty"`
	AcceptChatroomInvitationByOthers *bool  `json:"accept_chatroom_invitation_by_others,omitempty"`
}

UpdateUserParams holds the parameters for UpdateUser.

type UploadExternalMindDataParams added in v1.9.0

type UploadExternalMindDataParams struct {
	// PreferredLanguage BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages.
	PreferredLanguage string `json:"preferred_language,omitempty"`
	// AccessToken Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.
	AccessToken string `json:"access_token"`
	// InstallationID Your stable opaque identifier for this app installation.
	InstallationID string `json:"installation_id"`
	// ExternalSubject Your stable opaque identifier for the person authorizing this installation.
	ExternalSubject string `json:"external_subject"`
	CloneID         string `json:"clone_id"`
	Text            string `json:"text"`
	TextType        string `json:"text_type,omitempty"`
	// IdempotencyKey A stable opaque event key that makes exact retries return the same outcome.
	IdempotencyKey string `json:"idempotency_key,omitempty"`
	SourceLabel    string `json:"source_label,omitempty"`
}

UploadExternalMindDataParams holds the parameters for UploadExternalMindData.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL