XU XUv0.16.0

#github.com/xulang-org/packages/openai

import: openai #github.com/xulang-org/packages/openai

counts: 27 functions, 25 methods, 22 types, 1 constants, 0 method sets

External package `openai #github.com/xulang-org/packages/openai`, provided by github.com/xulang-org/packages.

github.com/xulang-org/packages · 1.17.2 · Install and use

const DEFAULT_TIMEOUT_NS

XuAPI
pub const DEFAULT_TIMEOUT_NS = 60000000000

Purpose

Constant DEFAULT_TIMEOUT_NS, defining protocol or algorithm parameters.

struct Client

XuAPI
pub struct Client {
    pub base_url string
    pub api_key string
    pub timeout_ns int
    pub max_retries int
    pub extra_headers []string
}

Purpose

Openai Client session maintaining connection and operations.

Public fields

base_url string
field (string)
api_key string
field (string)
timeout_ns int
timeout in nanoseconds
max_retries int
field (int)
extra_headers []string
field ([]string)

struct ToolCall

XuAPI
pub struct ToolCall {
    pub id string
    pub kind string
    pub name string
    pub arguments string
}

Purpose

Structure encapsulating id, kind, name, arguments.

Public fields

id string
field (string)
kind string
kind tag
name string
name
arguments string
field (string)

struct ContentPart

XuAPI
pub struct ContentPart {
    pub kind string
    pub text string
    pub image_url string
    pub detail string
}

Purpose

Structure encapsulating kind, text, image_url, detail.

Public fields

kind string
kind tag
text string
text
image_url string
field (string)
detail string
field (string)

struct Message

XuAPI
pub struct Message {
    pub role string
    pub content string
    pub parts []ContentPart
    pub tool_call_id string
    pub tool_calls []ToolCall
}

Purpose

Structure encapsulating role, content, parts, tool_call_id, tool_calls.

Public fields

role string
field (string)
content string
field (string)
parts []ContentPart
parts
tool_call_id string
field (string)
tool_calls []ToolCall
field ([]ToolCall)

struct ToolDef

XuAPI
pub struct ToolDef {
    pub name string
    pub description string
    pub parameters_json string
}

Purpose

Structure encapsulating name, description, parameters_json.

Public fields

name string
name
description string
field (string)
parameters_json string
field (string)

struct ChatRequest

XuAPI
pub struct ChatRequest {
    pub model string
    pub messages []Message
    pub tools []ToolDef
    pub temperature f64
    pub has_temperature bool
    pub top_p f64
    pub has_top_p bool
    pub presence_penalty f64
    pub has_presence_penalty bool
    pub frequency_penalty f64
    pub has_frequency_penalty bool
    pub max_tokens int
    pub max_completion_tokens int
    pub seed int
    pub has_seed bool
    pub stop []string
    pub tool_choice string
    pub response_format_json string
    pub extra_body_json string
    pub include_usage bool
}

Purpose

Structure encapsulating model, messages, tools, temperature, has_temperature.

Public fields

model string
field (string)
messages []Message
field ([]Message)
tools []ToolDef
field ([]ToolDef)
temperature f64
field (f64)
has_temperature bool
field (bool)
top_p f64
field (f64)
has_top_p bool
field (bool)
presence_penalty f64
field (f64)
has_presence_penalty bool
field (bool)
frequency_penalty f64
field (f64)
has_frequency_penalty bool
field (bool)
max_tokens int
field (int)
max_completion_tokens int
field (int)
seed int
random seed
has_seed bool
field (bool)
stop []string
field ([]string)
tool_choice string
field (string)
response_format_json string
field (string)
extra_body_json string
field (string)
include_usage bool
field (bool)

struct CompletionRequest

XuAPI
pub struct CompletionRequest {
    pub model string
    pub prompt string
    pub temperature f64
    pub has_temperature bool
    pub top_p f64
    pub has_top_p bool
    pub max_tokens int
    pub seed int
    pub has_seed bool
    pub stop []string
    pub echo bool
    pub extra_body_json string
}

Purpose

Structure encapsulating model, prompt, temperature, has_temperature, top_p.

Public fields

model string
field (string)
prompt string
field (string)
temperature f64
field (f64)
has_temperature bool
field (bool)
top_p f64
field (f64)
has_top_p bool
field (bool)
max_tokens int
field (int)
seed int
random seed
has_seed bool
field (bool)
stop []string
field ([]string)
echo bool
field (bool)
extra_body_json string
field (string)

struct CompletionResponse

XuAPI
pub struct CompletionResponse {
    pub id string
    pub model string
    pub text string
    pub finish_reason string
    pub usage Usage
}

Purpose

Openai Server response payload containing status, headers, and body.

Public fields

id string
field (string)
model string
field (string)
text string
text
finish_reason string
field (string)
usage Usage
usage text

struct Usage

XuAPI
pub struct Usage {
    pub prompt_tokens int
    pub completion_tokens int
    pub total_tokens int
}

Purpose

Structure encapsulating prompt_tokens, completion_tokens, total_tokens.

Public fields

prompt_tokens int
field (int)
completion_tokens int
field (int)
total_tokens int
field (int)

struct ChatResponse

XuAPI
pub struct ChatResponse {
    pub id string
    pub model string
    pub content string
    pub reasoning_content string
    pub finish_reason string
    pub tool_calls []ToolCall
    pub usage Usage
}

Purpose

Openai Server response payload containing status, headers, and body.

Public fields

id string
field (string)
model string
field (string)
content string
field (string)
reasoning_content string
field (string)
finish_reason string
field (string)
tool_calls []ToolCall
field ([]ToolCall)
usage Usage
usage text

struct StreamDelta

XuAPI
pub struct StreamDelta {
    pub content string
    pub reasoning_content string
    pub finish_reason string
    pub tool_calls []ToolCall
    pub has_usage bool
    pub usage Usage
    pub done bool
}

Purpose

Structure encapsulating content, reasoning_content, finish_reason, tool_calls, has_usage.

Public fields

content string
field (string)
reasoning_content string
field (string)
finish_reason string
field (string)
tool_calls []ToolCall
field ([]ToolCall)
has_usage bool
field (bool)
usage Usage
usage text
done bool
field (bool)

struct EmbedRequest

XuAPI
pub struct EmbedRequest {
    pub model string
    pub inputs []string
}

Purpose

Structure encapsulating model, inputs.

Public fields

model string
field (string)
inputs []string
field ([]string)

struct EmbedResponse

XuAPI
pub struct EmbedResponse {
    pub model string
    pub embeddings [][]f64
    pub usage Usage
}

Purpose

Openai Server response payload containing status, headers, and body.

Public fields

model string
field (string)
embeddings [][]f64
field ([][]f64)
usage Usage
usage text

struct ModelInfo

XuAPI
pub struct ModelInfo {
    pub id string
    pub object string
}

Purpose

Structure encapsulating id, object.

Public fields

id string
field (string)
object string
field (string)

struct ResponsesToolCall

XuAPI
pub struct ResponsesToolCall {
    pub id string
    pub call_id string
    pub name string
    pub arguments string
}

Purpose

Structure encapsulating id, call_id, name, arguments.

Public fields

id string
field (string)
call_id string
field (string)
name string
name
arguments string
field (string)

struct ResponsesRequest

XuAPI
pub struct ResponsesRequest {
    pub model string
    pub input string
    pub input_json string
    pub instructions string
    pub previous_response_id string
    pub tools []ToolDef
    pub temperature f64
    pub has_temperature bool
    pub top_p f64
    pub has_top_p bool
    pub max_output_tokens int
    pub tool_choice string
    pub extra_body_json string
}

Purpose

Structure encapsulating model, input, input_json, instructions, previous_response_id.

Public fields

model string
field (string)
input string
field (string)
input_json string
field (string)
instructions string
field (string)
previous_response_id string
field (string)
tools []ToolDef
field ([]ToolDef)
temperature f64
field (f64)
has_temperature bool
field (bool)
top_p f64
field (f64)
has_top_p bool
field (bool)
max_output_tokens int
field (int)
tool_choice string
field (string)
extra_body_json string
field (string)

struct ResponsesResponse

XuAPI
pub struct ResponsesResponse {
    pub id string
    pub model string
    pub status string
    pub output_text string
    pub tool_calls []ResponsesToolCall
    pub usage Usage
}

Purpose

Openai Server response payload containing status, headers, and body.

Public fields

id string
field (string)
model string
field (string)
status string
field (string)
output_text string
field (string)
tool_calls []ResponsesToolCall
field ([]ResponsesToolCall)
usage Usage
usage text

struct ResponsesStreamEvent

XuAPI
pub struct ResponsesStreamEvent {
    pub event_type string
    pub text_delta string
    pub response_id string
    pub status string
    pub tool_calls []ResponsesToolCall
    pub has_usage bool
    pub usage Usage
    pub done bool
}

Purpose

Structure encapsulating event_type, text_delta, response_id, status, tool_calls.

Public fields

event_type string
field (string)
text_delta string
field (string)
response_id string
field (string)
status string
field (string)
tool_calls []ResponsesToolCall
field ([]ResponsesToolCall)
has_usage bool
field (bool)
usage Usage
usage text
done bool
field (bool)

struct ImageGenResult

XuAPI
pub struct ImageGenResult {
    pub url string
    pub b64_json string
    pub revised_prompt string
}

Purpose

Structure encapsulating url, b64_json, revised_prompt.

Public fields

url string
field (string)
b64_json string
field (string)
revised_prompt string
field (string)

struct RerankResult

XuAPI
pub struct RerankResult {
    pub index int
    pub relevance_score f64
    pub document string
}

Purpose

Structure encapsulating index, relevance_score, document.

Public fields

index int
field (int)
relevance_score f64
field (f64)
document string
field (string)

struct FileObject

XuAPI
pub struct FileObject {
    pub id string
    pub object string
    pub bytes int
    pub created_at int
    pub filename string
    pub purpose string
    pub status string
}

Purpose

Structure encapsulating id, object, bytes, created_at, filename.

Public fields

id string
field (string)
object string
field (string)
bytes int
field (int)
created_at int
field (int)
filename string
field (string)
purpose string
field (string)
status string
field (string)

struct BatchObject

XuAPI
pub struct BatchObject {
    pub id string
    pub object string
    pub endpoint string
    pub input_file_id string
    pub output_file_id string
    pub error_file_id string
    pub completion_window string
    pub status string
    pub created_at int
    pub request_total int
    pub request_completed int
    pub request_failed int
}

Purpose

Structure encapsulating id, object, endpoint, input_file_id, output_file_id.

Public fields

id string
field (string)
object string
field (string)
endpoint string
field (string)
input_file_id string
field (string)
output_file_id string
field (string)
error_file_id string
field (string)
completion_window string
field (string)
status string
field (string)
created_at int
field (int)
request_total int
field (int)
request_completed int
field (int)
request_failed int
field (int)

new_client

XuAPI
pub fn new_client(base_url string, api_key string) Client

Purpose

Construct client.

Parameters

base_url string
base_url (string)
api_key string
api_key (string)

Returns

Client — a value of this type

new_deepseek_client

XuAPI
pub fn new_deepseek_client(api_key string) Client

Purpose

Construct deepseek client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_openrouter_client

XuAPI
pub fn new_openrouter_client(api_key string) Client

Purpose

Construct openrouter client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_groq_client

XuAPI
pub fn new_groq_client(api_key string) Client

Purpose

Construct groq client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_xai_client

XuAPI
pub fn new_xai_client(api_key string) Client

Purpose

Construct xai client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_together_client

XuAPI
pub fn new_together_client(api_key string) Client

Purpose

Construct together client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_fireworks_client

XuAPI
pub fn new_fireworks_client(api_key string) Client

Purpose

Construct fireworks client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_ollama_client

XuAPI
pub fn new_ollama_client(base_url string) Client

Purpose

Construct ollama client.

Parameters

base_url string
base_url (string)

Returns

Client — a value of this type

new_cohere_client

XuAPI
pub fn new_cohere_client(api_key string) Client

Purpose

Construct cohere client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_qwen_client

XuAPI
pub fn new_qwen_client(api_key string) Client

Purpose

Construct qwen client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_mistral_client

XuAPI
pub fn new_mistral_client(api_key string) Client

Purpose

Construct mistral client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

new_minimax_client

XuAPI
pub fn new_minimax_client(api_key string) Client

Purpose

Construct minimax client.

Parameters

api_key string
api_key (string)

Returns

Client — a value of this type

($&Client) set_max_retries

XuAPI
pub fn (c $&Client) set_max_retries(n int)

Purpose

Operation on $&Client: set max retries.

Parameters

c $&Client
The Client instance used by this call (exclusive borrow).
n int
count, length, or limit (int)

Returns

This call does not return a value.

($&Client) add_header

XuAPI
pub fn (c $&Client) add_header(name string, value string)

Purpose

Operation on $&Client: add header.

Parameters

c $&Client
The Client instance used by this call (exclusive borrow).
name string
name (string)
value string
value (string)

Returns

This call does not return a value.

(&Client) clone_client

XuAPI
pub fn (c &Client) clone_client() Client

Purpose

Operation on &Client: clone client.

Parameters

c &Client
The Client instance used by this call (borrow).

Returns

Client — a value of this type

responses_input_text_item

XuAPI
pub fn responses_input_text_item(role string, text string) string

Purpose

Responses input text item.

Parameters

role string
role (string)
text string
text (string)

Returns

string — result string

responses_function_call_output_item

XuAPI
pub fn responses_function_call_output_item(call_id string, output string) string

Purpose

Responses function call output item.

Parameters

call_id string
call_id (string)
output string
output (string)

Returns

string — result string

responses_input_array

XuAPI
pub fn responses_input_array(items &[]string) string

Purpose

Responses input array.

Parameters

items &[]string
items (read-only borrow; caller keeps the original; type &[]string)

Returns

string — result string

text_part

XuAPI
pub fn text_part(text string) ContentPart

Purpose

Text part.

Parameters

text string
text (string)

Returns

ContentPart — a value of this type

image_url_part

XuAPI
pub fn image_url_part(url string, detail string) ContentPart

Purpose

Image url part.

Parameters

url string
url (string)
detail string
detail (string)

Returns

ContentPart — a value of this type

image_base64_part

XuAPI
pub fn image_base64_part(mime_type string, b64_data string, detail string) ContentPart

Purpose

Image base64 part.

Parameters

mime_type string
mime_type (string)
b64_data string
b64_data (string)
detail string
detail (string)

Returns

ContentPart — a value of this type

message

XuAPI
pub fn message(role string, content string) Message

Purpose

Execute message.

Parameters

role string
role (string)
content string
content (string)

Returns

Message — a value of this type

message_parts

XuAPI
pub fn message_parts(role string, parts []ContentPart) Message

Purpose

Message parts.

Parameters

role string
role (string)
parts []ContentPart
parts ([]ContentPart)

Returns

Message — a value of this type

tool_message

XuAPI
pub fn tool_message(tool_call_id string, content string) Message

Purpose

Tool message.

Parameters

tool_call_id string
tool_call_id (string)
content string
content (string)

Returns

Message — a value of this type

json_schema_format

XuAPI
pub fn json_schema_format(name string, schema_json string, strict bool) string

Purpose

Json schema format.

Parameters

name string
name (string)
schema_json string
schema_json (string)
strict bool
strict (bool)

Returns

string — result string

tool

XuAPI
pub fn tool(name string, description string, parameters_json string) ToolDef

Purpose

Execute tool.

Parameters

name string
name (string)
description string
description (string)
parameters_json string
parameters_json (string)

Returns

ToolDef — a value of this type

chat_request

XuAPI
pub fn chat_request(model string, messages []Message) ChatRequest

Purpose

Chat request.

Parameters

model string
model (string)
messages []Message
messages ([]Message)

Returns

ChatRequest — a value of this type

new_completion_request

XuAPI
pub fn new_completion_request(model string, prompt string) CompletionRequest

Purpose

Construct completion request.

Parameters

model string
model (string)
prompt string
prompt (string)

Returns

CompletionRequest — a value of this type

embed_request

XuAPI
pub fn embed_request(model string, inputs []string) EmbedRequest

Purpose

Embed request.

Parameters

model string
model (string)
inputs []string
inputs ([]string)

Returns

EmbedRequest — a value of this type

new_responses_request

XuAPI
pub fn new_responses_request(model string, input string) ResponsesRequest

Purpose

Construct responses request.

Parameters

model string
model (string)
input string
input (string)

Returns

ResponsesRequest — a value of this type

(&Client) list_models

XuAPI
pub fn (c &Client) list_models() []ModelInfo

Purpose

Operation on &Client: list models. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).

Returns

[]ModelInfo — slice result

(&Client) chat

XuAPI
pub fn (c &Client) chat(req &ChatRequest) ChatResponse

Purpose

Execute chat on &Client. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &ChatRequest
req (read-only borrow; caller keeps the original; type &ChatRequest)

Returns

ChatResponse — a value of this type

(&Client) chat_stream

XuAPI
pub fn (c &Client) chat_stream(req &ChatRequest, on_delta fn(StreamDelta) bool) ChatResponse

Purpose

Operation on &Client: chat stream. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &ChatRequest
req (read-only borrow; caller keeps the original; type &ChatRequest)
on_delta fn(StreamDelta) bool
on_delta (function value; type fn(StreamDelta) bool)

Returns

ChatResponse — a value of this type

(&Client) chat_stream_chan

XuAPI
pub fn (c &Client) chat_stream_chan(req &ChatRequest, delta_ch chan StreamDelta) ChatResponse

Purpose

Operation on &Client: chat stream chan. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &ChatRequest
req (read-only borrow; caller keeps the original; type &ChatRequest)
delta_ch chan StreamDelta
delta_ch (channel; type chan StreamDelta)

Returns

ChatResponse — a value of this type

(&Client) audio_transcriptions

XuAPI
pub fn (c &Client) audio_transcriptions(model string, filename string, audio_bytes &string, language string, prompt string) string

Purpose

Operation on &Client: audio transcriptions. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
model string
model (string)
filename string
filename (string)
audio_bytes &string
audio_bytes (read-only borrow; caller keeps the original; type &string)
language string
language (string)
prompt string
prompt (string)

Returns

string — result string

(&Client) audio_speech

XuAPI
pub fn (c &Client) audio_speech(model string, voice string, input string, response_format string) string

Purpose

Operation on &Client: audio speech. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
model string
model (string)
voice string
voice (string)
input string
input (string)
response_format string
response_format (string)

Returns

string — result string

(&Client) images_generate

XuAPI
pub fn (c &Client) images_generate(model string, prompt string, size string, n int) []ImageGenResult

Purpose

Operation on &Client: images generate. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
model string
model (string)
prompt string
prompt (string)
size string
size (string)
n int
count, length, or limit (int)

Returns

[]ImageGenResult — slice result

(&Client) rerank

XuAPI
pub fn (c &Client) rerank(model string, query string, documents &[]string, top_n int) []RerankResult

Purpose

Execute rerank on &Client. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
model string
model (string)
query string
query (string)
documents &[]string
documents (read-only borrow; caller keeps the original; type &[]string)
top_n int
top_n (int)

Returns

[]RerankResult — slice result

(&Client) embeddings

XuAPI
pub fn (c &Client) embeddings(req &EmbedRequest) EmbedResponse

Purpose

Execute embeddings on &Client. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &EmbedRequest
req (read-only borrow; caller keeps the original; type &EmbedRequest)

Returns

EmbedResponse — a value of this type

(&Client) completions

XuAPI
pub fn (c &Client) completions(req &CompletionRequest) CompletionResponse

Purpose

Execute completions on &Client. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &CompletionRequest
req (read-only borrow; caller keeps the original; type &CompletionRequest)

Returns

CompletionResponse — a value of this type

(&Client) responses

XuAPI
pub fn (c &Client) responses(req &ResponsesRequest) ResponsesResponse

Purpose

Execute responses on &Client. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &ResponsesRequest
req (read-only borrow; caller keeps the original; type &ResponsesRequest)

Returns

ResponsesResponse — a value of this type

(&Client) responses_stream

XuAPI
pub fn (c &Client) responses_stream(req &ResponsesRequest, on_event fn(ResponsesStreamEvent) bool) ResponsesResponse

Purpose

Operation on &Client: responses stream. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &ResponsesRequest
req (read-only borrow; caller keeps the original; type &ResponsesRequest)
on_event fn(ResponsesStreamEvent) bool
on_event (function value; type fn(ResponsesStreamEvent) bool)

Returns

ResponsesResponse — a value of this type

(&Client) responses_stream_chan

XuAPI
pub fn (c &Client) responses_stream_chan(req &ResponsesRequest, ch chan ResponsesStreamEvent) ResponsesResponse

Purpose

Operation on &Client: responses stream chan. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
req &ResponsesRequest
req (read-only borrow; caller keeps the original; type &ResponsesRequest)
ch chan ResponsesStreamEvent
character code (channel; type chan ResponsesStreamEvent)

Returns

ResponsesResponse — a value of this type

(&Client) upload_file

XuAPI
pub fn (c &Client) upload_file(filename string, purpose string, content &string) FileObject

Purpose

Operation on &Client: upload file. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
filename string
filename (string)
purpose string
purpose (string)
content &string
content (read-only borrow; caller keeps the original; type &string)

Returns

FileObject — a value of this type

(&Client) get_file

XuAPI
pub fn (c &Client) get_file(file_id string) FileObject

Purpose

Operation on &Client: read file. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
file_id string
file_id (string)

Returns

FileObject — a value of this type

(&Client) list_files

XuAPI
pub fn (c &Client) list_files(purpose string) []FileObject

Purpose

Operation on &Client: list files. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
purpose string
purpose (string)

Returns

[]FileObject — slice result

(&Client) delete_file

XuAPI
pub fn (c &Client) delete_file(file_id string) bool

Purpose

Operation on &Client: delete file. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
file_id string
file_id (string)

Returns

bool — true or false

(&Client) get_file_content

XuAPI
pub fn (c &Client) get_file_content(file_id string) string

Purpose

Operation on &Client: read file content. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
file_id string
file_id (string)

Returns

string — result string

(&Client) create_batch

XuAPI
pub fn (c &Client) create_batch(input_file_id string, endpoint string, completion_window string, metadata_json string) BatchObject

Purpose

Operation on &Client: create batch. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
input_file_id string
input_file_id (string)
endpoint string
endpoint (string)
completion_window string
completion_window (string)
metadata_json string
metadata_json (string)

Returns

BatchObject — a value of this type

(&Client) get_batch

XuAPI
pub fn (c &Client) get_batch(batch_id string) BatchObject

Purpose

Operation on &Client: read batch. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
batch_id string
batch_id (string)

Returns

BatchObject — a value of this type

(&Client) cancel_batch

XuAPI
pub fn (c &Client) cancel_batch(batch_id string) BatchObject

Purpose

Operation on &Client: cancel batch. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
batch_id string
batch_id (string)

Returns

BatchObject — a value of this type

(&Client) list_batches

XuAPI
pub fn (c &Client) list_batches(limit int) []BatchObject

Purpose

Operation on &Client: list batches. Throws on failure; handle the error or propagate it to the caller.

Parameters

c &Client
The Client instance used by this call (borrow).
limit int
limit (int)

Returns

[]BatchObject — slice result