sdk

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CTJSON string = "application/json"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ManagerURL      string
	TLSVerification bool
}

type PageMetadata

type PageMetadata struct {
	Offset uint64 `json:"offset"`
	Limit  uint64 `json:"limit"`
}

type SDK

type SDK interface {
	// CreateTask creates a new task.
	//
	// example:
	//  task := sdk.Task{
	//    Name:	 "John Doe"
	//  }
	//  task, _ := sdk.CreateTask(task)
	//  fmt.Println(task)
	CreateTask(task Task) (Task, error)

	// GetTask gets a task by id.
	//
	// example:
	//  task, _ := sdk.GetTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
	//  fmt.Println(task)
	GetTask(id string) (Task, error)

	// ListTasks lists tasks.
	//
	// example:
	//  taskPage, _ := sdk.ListTasks(0, 10)
	//  fmt.Println(taskPage)
	ListTasks(offset uint64, limit uint64) (TaskPage, error)

	// UpdateTask updates a task.
	//
	// example:
	//  task := sdk.Task{
	//    Name:	 "John Doe"
	//  }
	//  task, _ := sdk.UpdateTask(task)
	//  fmt.Println(task)
	UpdateTask(task Task) (Task, error)

	// DeleteTask deletes a task.
	//
	// example:
	//  task, _ := sdk.DeleteTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
	//  fmt.Println(task)
	DeleteTask(id string) error

	// StartTask starts a task.
	//
	// example:
	//  task, _ := sdk.StartTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
	//  fmt.Println(task)
	StartTask(id string) error

	// StopTask stops a task.
	//
	// example:
	//  task, _ := sdk.StopTask("b1d10738-c5d7-4ff1-8f4d-b9328ce6f040")
	//  fmt.Println(task)
	StopTask(id string) error
}

func NewSDK

func NewSDK(cfg Config) SDK

type Task

type Task struct {
	ID         string    `json:"id,omitempty"`
	Name       string    `json:"name"`
	State      uint8     `json:"state,omitempty"`
	StartTime  time.Time `json:"start_time"`
	FinishTime time.Time `json:"finish_time"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

type TaskPage

type TaskPage struct {
	Offset uint64 `json:"offset"`
	Limit  uint64 `json:"limit"`
	Total  uint64 `json:"total"`
	Tasks  []Task `json:"tasks"`
}

Jump to

Keyboard shortcuts

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