bsubio

package module
v0.0.0-...-9fe6739 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: BSD-2-Clause Imports: 14 Imported by: 0

README

Go SDK for bsub.io (BETA)

[we're early project; anything here can change withtout a warning until we push v1]

Official Golang SDK for the BSUB.IO API.

You can use it to build Golang apps for data processing.

Features

  • Simple API: Easy-to-use client with helper methods for common workflows
  • Type-safe: Generated from OpenAPI spec with full type safety
  • Complete: Access to all BSUB.IO API endpoints
  • Flexible: Use high-level helpers or low-level API methods

Installation

    go get github.com/bsubio/bsubio-go

Quick Start

Getting an API Key

Our CLI will create you ~/.config/bsubio/config.json automatically. Visit https://www.bsub.io and follow the installation steps to get bsubio to work for you. Then bsubio register should give you new account with API key created.

Simple Example
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/bsubio/bsubio-go"
)

func main() {
    // Load configuration (reads from ~/.config/bsubio/config.json or BSUBIO_API_KEY env var)
    config := bsubio.LoadConfig()

    // Create client
    client, err := bsubio.NewBsubClient(config)
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    // Process a file (one-liner)
    result, err := client.ProcessFile(ctx, "pandoc_md", "document.pdf")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Job completed: %s\n", *result.Job.Id)
    fmt.Printf("Output: %s\n", string(result.Output))
}

For more examples, see examples/ directory:

You should be able to build them all by:

make ex

Binaries will be in bin/.

Development

You must have Go 1.24+ installed. Most Linux/macOS distributions have this. Go to https://go.dev/doc/install to learn more. You need OpenAPI compiler: https://github.com/oapi-codegen/oapi-codegen

Then:

make
make test

This SDK is based on bsubio.io OpenAPI specification available at:

https://app.bsub.io/static/openapi.yaml

License

MIT

Support

Documentation

Overview

Package bsubio provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func NewCancelJobRequest

func NewCancelJobRequest(server string, jobId JobId) (*http.Request, error)

NewCancelJobRequest generates requests for CancelJob

func NewCreateJobRequest

func NewCreateJobRequest(server string, body CreateJobJSONRequestBody) (*http.Request, error)

NewCreateJobRequest calls the generic CreateJob builder with application/json body

func NewCreateJobRequestWithBody

func NewCreateJobRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreateJobRequestWithBody generates requests for CreateJob with any type of body

func NewDeleteJobRequest

func NewDeleteJobRequest(server string, jobId JobId) (*http.Request, error)

NewDeleteJobRequest generates requests for DeleteJob

func NewGetJobLogsRequest

func NewGetJobLogsRequest(server string, jobId JobId) (*http.Request, error)

NewGetJobLogsRequest generates requests for GetJobLogs

func NewGetJobOutputRequest

func NewGetJobOutputRequest(server string, jobId JobId) (*http.Request, error)

NewGetJobOutputRequest generates requests for GetJobOutput

func NewGetJobRequest

func NewGetJobRequest(server string, jobId JobId) (*http.Request, error)

NewGetJobRequest generates requests for GetJob

func NewGetTypesRequest

func NewGetTypesRequest(server string) (*http.Request, error)

NewGetTypesRequest generates requests for GetTypes

func NewGetVersionRequest

func NewGetVersionRequest(server string) (*http.Request, error)

NewGetVersionRequest generates requests for GetVersion

func NewListJobsRequest

func NewListJobsRequest(server string, params *ListJobsParams) (*http.Request, error)

NewListJobsRequest generates requests for ListJobs

func NewSubmitJobRequest

func NewSubmitJobRequest(server string, jobId JobId) (*http.Request, error)

NewSubmitJobRequest generates requests for SubmitJob

func NewUploadJobDataRequestWithBody

func NewUploadJobDataRequestWithBody(server string, jobId openapi_types.UUID, params *UploadJobDataParams, contentType string, body io.Reader) (*http.Request, error)

NewUploadJobDataRequestWithBody generates requests for UploadJobData with any type of body

Types

type BadRequest

type BadRequest = Error

BadRequest defines model for BadRequest.

type BsubClient

type BsubClient struct {
	*ClientWithResponses
	// contains filtered or unexported fields
}

BsubClient wraps the generated API client with helper methods

func NewBsubClient

func NewBsubClient(config Config) (*BsubClient, error)

NewBsubClient creates a new BSUB.IO API client

func (*BsubClient) CreateAndSubmitJob

func (c *BsubClient) CreateAndSubmitJob(ctx context.Context, jobType string, data io.Reader) (*Job, error)

CreateAndSubmitJob is a helper that creates a job, uploads data, and submits it for processing

func (*BsubClient) CreateAndSubmitJobFromFile

func (c *BsubClient) CreateAndSubmitJobFromFile(ctx context.Context, jobType string, filePath string) (*Job, error)

CreateAndSubmitJobFromFile is a helper that creates a job, uploads a file, and submits it for processing

func (*BsubClient) GetJobResult

func (c *BsubClient) GetJobResult(ctx context.Context, jobID JobId) (*JobResult, error)

GetJobResult retrieves the complete result of a finished job including output and logs

func (*BsubClient) Process

func (c *BsubClient) Process(ctx context.Context, jobType string, data io.Reader) (*JobResult, error)

Process is a complete helper that creates, uploads, submits, waits, and retrieves results from a reader

func (*BsubClient) ProcessFile

func (c *BsubClient) ProcessFile(ctx context.Context, jobType string, filePath string) (*JobResult, error)

ProcessFile is a complete helper that creates, uploads, submits, waits, and retrieves results

func (*BsubClient) WaitForJob

func (c *BsubClient) WaitForJob(ctx context.Context, jobID JobId) (*Job, error)

WaitForJob polls the job status until it's finished or failed

type CancelJobResponse

type CancelJobResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Message *string `json:"message,omitempty"`
		Success *bool   `json:"success,omitempty"`
	}
	JSON400 *Error
	JSON401 *Unauthorized
	JSON404 *NotFound
}

func ParseCancelJobResponse

func ParseCancelJobResponse(rsp *http.Response) (*CancelJobResponse, error)

ParseCancelJobResponse parses an HTTP response from a CancelJobWithResponse call

func (CancelJobResponse) Status

func (r CancelJobResponse) Status() string

Status returns HTTPResponse.Status

func (CancelJobResponse) StatusCode

func (r CancelJobResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CancelJob

func (c *Client) CancelJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateJob

func (c *Client) CreateJob(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateJobWithBody

func (c *Client) CreateJobWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) DeleteJob

func (c *Client) DeleteJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetJob

func (c *Client) GetJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetJobLogs

func (c *Client) GetJobLogs(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetJobOutput

func (c *Client) GetJobOutput(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetTypes

func (c *Client) GetTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListJobs

func (c *Client) ListJobs(ctx context.Context, params *ListJobsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitJob

func (c *Client) SubmitJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UploadJobDataWithBody

func (c *Client) UploadJobDataWithBody(ctx context.Context, jobId openapi_types.UUID, params *UploadJobDataParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// ListJobs request
	ListJobs(ctx context.Context, params *ListJobsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateJobWithBody request with any body
	CreateJobWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreateJob(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteJob request
	DeleteJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetJob request
	GetJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CancelJob request
	CancelJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetJobLogs request
	GetJobLogs(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetJobOutput request
	GetJobOutput(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SubmitJob request
	SubmitJob(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetTypes request
	GetTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UploadJobDataWithBody request with any body
	UploadJobDataWithBody(ctx context.Context, jobId openapi_types.UUID, params *UploadJobDataParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetVersion request
	GetVersion(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) CancelJobWithResponse

func (c *ClientWithResponses) CancelJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*CancelJobResponse, error)

CancelJobWithResponse request returning *CancelJobResponse

func (*ClientWithResponses) CreateJobWithBodyWithResponse

func (c *ClientWithResponses) CreateJobWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateJobResponse, error)

CreateJobWithBodyWithResponse request with arbitrary body returning *CreateJobResponse

func (*ClientWithResponses) CreateJobWithResponse

func (c *ClientWithResponses) CreateJobWithResponse(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateJobResponse, error)

func (*ClientWithResponses) DeleteJobWithResponse

func (c *ClientWithResponses) DeleteJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*DeleteJobResponse, error)

DeleteJobWithResponse request returning *DeleteJobResponse

func (*ClientWithResponses) GetJobLogsWithResponse

func (c *ClientWithResponses) GetJobLogsWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*GetJobLogsResponse, error)

GetJobLogsWithResponse request returning *GetJobLogsResponse

func (*ClientWithResponses) GetJobOutputWithResponse

func (c *ClientWithResponses) GetJobOutputWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*GetJobOutputResponse, error)

GetJobOutputWithResponse request returning *GetJobOutputResponse

func (*ClientWithResponses) GetJobWithResponse

func (c *ClientWithResponses) GetJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*GetJobResponse, error)

GetJobWithResponse request returning *GetJobResponse

func (*ClientWithResponses) GetTypesWithResponse

func (c *ClientWithResponses) GetTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetTypesResponse, error)

GetTypesWithResponse request returning *GetTypesResponse

func (*ClientWithResponses) GetVersionWithResponse

func (c *ClientWithResponses) GetVersionWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetVersionResponse, error)

GetVersionWithResponse request returning *GetVersionResponse

func (*ClientWithResponses) ListJobsWithResponse

func (c *ClientWithResponses) ListJobsWithResponse(ctx context.Context, params *ListJobsParams, reqEditors ...RequestEditorFn) (*ListJobsResponse, error)

ListJobsWithResponse request returning *ListJobsResponse

func (*ClientWithResponses) SubmitJobWithResponse

func (c *ClientWithResponses) SubmitJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*SubmitJobResponse, error)

SubmitJobWithResponse request returning *SubmitJobResponse

func (*ClientWithResponses) UploadJobDataWithBodyWithResponse

func (c *ClientWithResponses) UploadJobDataWithBodyWithResponse(ctx context.Context, jobId openapi_types.UUID, params *UploadJobDataParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadJobDataResponse, error)

UploadJobDataWithBodyWithResponse request with arbitrary body returning *UploadJobDataResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListJobsWithResponse request
	ListJobsWithResponse(ctx context.Context, params *ListJobsParams, reqEditors ...RequestEditorFn) (*ListJobsResponse, error)

	// CreateJobWithBodyWithResponse request with any body
	CreateJobWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateJobResponse, error)

	CreateJobWithResponse(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateJobResponse, error)

	// DeleteJobWithResponse request
	DeleteJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*DeleteJobResponse, error)

	// GetJobWithResponse request
	GetJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*GetJobResponse, error)

	// CancelJobWithResponse request
	CancelJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*CancelJobResponse, error)

	// GetJobLogsWithResponse request
	GetJobLogsWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*GetJobLogsResponse, error)

	// GetJobOutputWithResponse request
	GetJobOutputWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*GetJobOutputResponse, error)

	// SubmitJobWithResponse request
	SubmitJobWithResponse(ctx context.Context, jobId JobId, reqEditors ...RequestEditorFn) (*SubmitJobResponse, error)

	// GetTypesWithResponse request
	GetTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetTypesResponse, error)

	// UploadJobDataWithBodyWithResponse request with any body
	UploadJobDataWithBodyWithResponse(ctx context.Context, jobId openapi_types.UUID, params *UploadJobDataParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadJobDataResponse, error)

	// GetVersionWithResponse request
	GetVersionWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetVersionResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Config

type Config struct {
	// APIKey is your BSUB.IO API key
	APIKey string
	// BaseURL is the API server URL (defaults to production)
	BaseURL string
	// HTTPClient is optional custom HTTP client
	HTTPClient *http.Client
}

Config holds configuration for the BSUB.IO client

func LoadConfig

func LoadConfig() Config

LoadConfig loads configuration from ~/.config/bsubio/config.json or BSUBIO_API_KEY env var Returns an empty Config{} if neither is found (no error)

type CreateJobJSONBody

type CreateJobJSONBody struct {
	// Type Processing type (see /v1/types for available types)
	Type string `json:"type"`
}

CreateJobJSONBody defines parameters for CreateJob.

type CreateJobJSONRequestBody

type CreateJobJSONRequestBody CreateJobJSONBody

CreateJobJSONRequestBody defines body for CreateJob for application/json ContentType.

type CreateJobResponse

type CreateJobResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *struct {
		Data    *Job  `json:"data,omitempty"`
		Success *bool `json:"success,omitempty"`
	}
	JSON400 *BadRequest
	JSON401 *Unauthorized
}

func ParseCreateJobResponse

func ParseCreateJobResponse(rsp *http.Response) (*CreateJobResponse, error)

ParseCreateJobResponse parses an HTTP response from a CreateJobWithResponse call

func (CreateJobResponse) Status

func (r CreateJobResponse) Status() string

Status returns HTTPResponse.Status

func (CreateJobResponse) StatusCode

func (r CreateJobResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type DeleteJobResponse

type DeleteJobResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Unauthorized
	JSON404      *NotFound
	JSON409      *Error
}

func ParseDeleteJobResponse

func ParseDeleteJobResponse(rsp *http.Response) (*DeleteJobResponse, error)

ParseDeleteJobResponse parses an HTTP response from a DeleteJobWithResponse call

func (DeleteJobResponse) Status

func (r DeleteJobResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteJobResponse) StatusCode

func (r DeleteJobResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Error

type Error struct {
	// Error Error message
	Error   *string `json:"error,omitempty"`
	Success *bool   `json:"success,omitempty"`
}

Error defines model for Error.

type GetJobLogsResponse

type GetJobLogsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Unauthorized
	JSON404      *NotFound
}

func ParseGetJobLogsResponse

func ParseGetJobLogsResponse(rsp *http.Response) (*GetJobLogsResponse, error)

ParseGetJobLogsResponse parses an HTTP response from a GetJobLogsWithResponse call

func (GetJobLogsResponse) Status

func (r GetJobLogsResponse) Status() string

Status returns HTTPResponse.Status

func (GetJobLogsResponse) StatusCode

func (r GetJobLogsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetJobOutputResponse

type GetJobOutputResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Unauthorized
	JSON404      *NotFound
	JSON409      *Error
}

func ParseGetJobOutputResponse

func ParseGetJobOutputResponse(rsp *http.Response) (*GetJobOutputResponse, error)

ParseGetJobOutputResponse parses an HTTP response from a GetJobOutputWithResponse call

func (GetJobOutputResponse) Status

func (r GetJobOutputResponse) Status() string

Status returns HTTPResponse.Status

func (GetJobOutputResponse) StatusCode

func (r GetJobOutputResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetJobResponse

type GetJobResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Data    *Job  `json:"data,omitempty"`
		Success *bool `json:"success,omitempty"`
	}
	JSON401 *Unauthorized
	JSON404 *NotFound
}

func ParseGetJobResponse

func ParseGetJobResponse(rsp *http.Response) (*GetJobResponse, error)

ParseGetJobResponse parses an HTTP response from a GetJobWithResponse call

func (GetJobResponse) Status

func (r GetJobResponse) Status() string

Status returns HTTPResponse.Status

func (GetJobResponse) StatusCode

func (r GetJobResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTypesResponse

type GetTypesResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Types *[]ProcessingType `json:"types,omitempty"`
	}
}

func ParseGetTypesResponse

func ParseGetTypesResponse(rsp *http.Response) (*GetTypesResponse, error)

ParseGetTypesResponse parses an HTTP response from a GetTypesWithResponse call

func (GetTypesResponse) Status

func (r GetTypesResponse) Status() string

Status returns HTTPResponse.Status

func (GetTypesResponse) StatusCode

func (r GetTypesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetVersionResponse

type GetVersionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Build   *string `json:"build,omitempty"`
		Server  *string `json:"server,omitempty"`
		Version *string `json:"version,omitempty"`
	}
}

func ParseGetVersionResponse

func ParseGetVersionResponse(rsp *http.Response) (*GetVersionResponse, error)

ParseGetVersionResponse parses an HTTP response from a GetVersionWithResponse call

func (GetVersionResponse) Status

func (r GetVersionResponse) Status() string

Status returns HTTPResponse.Status

func (GetVersionResponse) StatusCode

func (r GetVersionResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Job

type Job struct {
	// ClaimedAt When job was claimed by worker
	ClaimedAt *time.Time `json:"claimed_at"`

	// ClaimedBy Worker ID that claimed the job
	ClaimedBy *string `json:"claimed_by"`

	// CreatedAt Job creation timestamp
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// DataSize Size of uploaded data in bytes
	DataSize *int64 `json:"data_size,omitempty"`

	// ErrorCode Error code if job failed
	ErrorCode *string `json:"error_code"`

	// ErrorMessage Error message if job failed
	ErrorMessage *string `json:"error_message"`

	// FinishedAt When job finished (success or failure)
	FinishedAt *time.Time `json:"finished_at"`

	// Id Unique job identifier
	Id *openapi_types.UUID `json:"id,omitempty"`

	// Status Current job status
	Status *JobStatus `json:"status,omitempty"`

	// Type Processing type
	Type *string `json:"type,omitempty"`

	// UpdatedAt Last update timestamp
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	// UploadToken Token for uploading data (only present in `created` state)
	UploadToken *string `json:"upload_token,omitempty"`

	// UserId User who created the job
	UserId *string `json:"user_id,omitempty"`
}

Job defines model for Job.

type JobId

type JobId = openapi_types.UUID

JobId defines model for JobId.

type JobResult

type JobResult struct {
	Job    *Job
	Output []byte
	Logs   string
}

JobResult represents the result of a completed job

type JobStatus

type JobStatus string

JobStatus Current job status

const (
	JobStatusClaimed    JobStatus = "claimed"
	JobStatusCreated    JobStatus = "created"
	JobStatusFailed     JobStatus = "failed"
	JobStatusFinished   JobStatus = "finished"
	JobStatusLoaded     JobStatus = "loaded"
	JobStatusPending    JobStatus = "pending"
	JobStatusPreparing  JobStatus = "preparing"
	JobStatusProcessing JobStatus = "processing"
)

Defines values for JobStatus.

type ListJobsParams

type ListJobsParams struct {
	// Status Filter by job status
	Status *ListJobsParamsStatus `form:"status,omitempty" json:"status,omitempty"`

	// Limit Maximum number of jobs to return
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

ListJobsParams defines parameters for ListJobs.

type ListJobsParamsStatus

type ListJobsParamsStatus string

ListJobsParamsStatus defines parameters for ListJobs.

const (
	ListJobsParamsStatusClaimed    ListJobsParamsStatus = "claimed"
	ListJobsParamsStatusCreated    ListJobsParamsStatus = "created"
	ListJobsParamsStatusFailed     ListJobsParamsStatus = "failed"
	ListJobsParamsStatusFinished   ListJobsParamsStatus = "finished"
	ListJobsParamsStatusLoaded     ListJobsParamsStatus = "loaded"
	ListJobsParamsStatusPending    ListJobsParamsStatus = "pending"
	ListJobsParamsStatusPreparing  ListJobsParamsStatus = "preparing"
	ListJobsParamsStatusProcessing ListJobsParamsStatus = "processing"
)

Defines values for ListJobsParamsStatus.

type ListJobsResponse

type ListJobsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Data *struct {
			Jobs *[]Job `json:"jobs,omitempty"`

			// Total Total number of jobs (before pagination)
			Total *int `json:"total,omitempty"`
		} `json:"data,omitempty"`
		Success *bool `json:"success,omitempty"`
	}
	JSON401 *Unauthorized
}

func ParseListJobsResponse

func ParseListJobsResponse(rsp *http.Response) (*ListJobsResponse, error)

ParseListJobsResponse parses an HTTP response from a ListJobsWithResponse call

func (ListJobsResponse) Status

func (r ListJobsResponse) Status() string

Status returns HTTPResponse.Status

func (ListJobsResponse) StatusCode

func (r ListJobsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type NotFound

type NotFound = Error

NotFound defines model for NotFound.

type ProcessingType

type ProcessingType struct {
	// Description Human-readable description
	Description *string `json:"description,omitempty"`

	// Example Example usage information
	Example *struct {
		// Cmd Example command
		Cmd *string `json:"cmd,omitempty"`

		// Desc Example description
		Desc *string `json:"desc,omitempty"`
	} `json:"example,omitempty"`

	// Input Input format information
	Input *struct {
		// MimeIn Accepted input MIME types
		MimeIn *[]string `json:"mime_in,omitempty"`
	} `json:"input,omitempty"`

	// Name Human-readable name
	Name *string `json:"name,omitempty"`

	// Output Output format information
	Output *struct {
		// Display Display format hint
		Display *string `json:"display,omitempty"`

		// Ext Output file extension
		Ext *string `json:"ext,omitempty"`

		// MimeOut Output MIME types
		MimeOut *[]string `json:"mime_out,omitempty"`
	} `json:"output,omitempty"`

	// Type Type identifier used when creating jobs
	Type *string `json:"type,omitempty"`
}

ProcessingType defines model for ProcessingType.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type SubmitJobResponse

type SubmitJobResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Message *string `json:"message,omitempty"`
		Success *bool   `json:"success,omitempty"`
	}
	JSON400 *BadRequest
	JSON401 *Unauthorized
	JSON404 *NotFound
}

func ParseSubmitJobResponse

func ParseSubmitJobResponse(rsp *http.Response) (*SubmitJobResponse, error)

ParseSubmitJobResponse parses an HTTP response from a SubmitJobWithResponse call

func (SubmitJobResponse) Status

func (r SubmitJobResponse) Status() string

Status returns HTTPResponse.Status

func (SubmitJobResponse) StatusCode

func (r SubmitJobResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Unauthorized

type Unauthorized = Error

Unauthorized defines model for Unauthorized.

type UploadJobDataMultipartBody

type UploadJobDataMultipartBody struct {
	// File File to process
	File openapi_types.File `json:"file"`
}

UploadJobDataMultipartBody defines parameters for UploadJobData.

type UploadJobDataMultipartRequestBody

type UploadJobDataMultipartRequestBody UploadJobDataMultipartBody

UploadJobDataMultipartRequestBody defines body for UploadJobData for multipart/form-data ContentType.

type UploadJobDataParams

type UploadJobDataParams struct {
	// Token Upload token from job creation
	Token string `form:"token" json:"token"`
}

UploadJobDataParams defines parameters for UploadJobData.

type UploadJobDataResponse

type UploadJobDataResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		// DataSize Size of uploaded file in bytes
		DataSize *int    `json:"data_size,omitempty"`
		Message  *string `json:"message,omitempty"`
		Success  *bool   `json:"success,omitempty"`
	}
	JSON400 *BadRequest
	JSON401 *Error
	JSON404 *NotFound
	JSON413 *Error
}

func ParseUploadJobDataResponse

func ParseUploadJobDataResponse(rsp *http.Response) (*UploadJobDataResponse, error)

ParseUploadJobDataResponse parses an HTTP response from a UploadJobDataWithResponse call

func (UploadJobDataResponse) Status

func (r UploadJobDataResponse) Status() string

Status returns HTTPResponse.Status

func (UploadJobDataResponse) StatusCode

func (r UploadJobDataResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Directories

Path Synopsis
examples
basic command
batch command
comprehensive command
custom-workflow command

Jump to

Keyboard shortcuts

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