openapicli

package
v0.0.0-...-32b64ec Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	DefaultApi *DefaultApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Task List API v1.0.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerUrl

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type DefaultApiService

type DefaultApiService service

DefaultApiService DefaultApi service

func (*DefaultApiService) CancelTask

func (a *DefaultApiService) CancelTask(ctx _context.Context, taskId string) (*_nethttp.Response, error)

CancelTask Method for CancelTask

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param taskId

func (*DefaultApiService) CreateTask

func (a *DefaultApiService) CreateTask(ctx _context.Context, listId ListId, task Task) (RespTask, *_nethttp.Response, error)

CreateTask Method for CreateTask

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param listId
  • @param task task to add

@return RespTask

func (*DefaultApiService) CreateTaskList

func (a *DefaultApiService) CreateTaskList(ctx _context.Context, sprintOpts SprintOpts) (*_nethttp.Response, error)

CreateTaskList Method for CreateTaskList

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param sprintOpts

func (*DefaultApiService) DeleteTask

func (a *DefaultApiService) DeleteTask(ctx _context.Context, listId ListId, taskId string) (*_nethttp.Response, error)

DeleteTask Method for DeleteTask

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param listId
  • @param taskId

func (*DefaultApiService) DoneTask

func (a *DefaultApiService) DoneTask(ctx _context.Context, taskId string) (*_nethttp.Response, error)

DoneTask Method for DoneTask

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param taskId

func (*DefaultApiService) GetSprintTemplate

func (a *DefaultApiService) GetSprintTemplate(ctx _context.Context) (SprintTemplate, *_nethttp.Response, error)

GetSprintTemplate Method for GetSprintTemplate

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return SprintTemplate

func (*DefaultApiService) GetTaskList

func (a *DefaultApiService) GetTaskList(ctx _context.Context, listId ListId) (TaskList, *_nethttp.Response, error)

GetTaskList Method for GetTaskList

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param listId

@return TaskList

func (*DefaultApiService) TakeTask

func (a *DefaultApiService) TakeTask(ctx _context.Context, listId ListId, taskId string) (*_nethttp.Response, error)

TakeTask Method for TakeTask

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param listId
  • @param taskId

func (*DefaultApiService) UpdateTask

func (a *DefaultApiService) UpdateTask(ctx _context.Context, taskId string, updateOptions UpdateOptions) (*_nethttp.Response, error)

UpdateTask Method for UpdateTask

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param taskId
  • @param updateOptions task updates

type GenericOpenAPIError

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

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type ListId

type ListId string

ListId the model 'ListId'

const (
	SPRINT  ListId = "sprint"
	TODO    ListId = "todo"
	BACKLOG ListId = "backlog"
)

List of ListId

type RespTask

type RespTask struct {
	Id     string `json:"id"`
	Text   string `json:"text"`
	Points int32  `json:"points"`
	Burnt  int32  `json:"burnt"`
	State  string `json:"state"`
}

RespTask struct for RespTask

type ServerConfiguration

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

type SprintOpts

type SprintOpts struct {
	Title string `json:"title"`
}

SprintOpts struct for SprintOpts

type SprintTemplate

type SprintTemplate struct {
	Tasks []TaskTemplate `json:"tasks"`
}

SprintTemplate struct for SprintTemplate

type Task

type Task struct {
	Text   string `json:"text,omitempty"`
	Points int32  `json:"points,omitempty"`
	Burnt  int32  `json:"burnt,omitempty"`
	State  string `json:"state,omitempty"`
}

Task struct for Task

type TaskList

type TaskList struct {
	Title string     `json:"title"`
	Tasks []RespTask `json:"tasks"`
}

TaskList struct for TaskList

type TaskTemplate

type TaskTemplate struct {
	Id     string `json:"id"`
	Text   string `json:"text"`
	Points int32  `json:"points"`
}

TaskTemplate struct for TaskTemplate

type UpdateOptions

type UpdateOptions struct {
	Text   string `json:"text"`
	Burnt  int32  `json:"burnt"`
	Points int32  `json:"points"`
}

UpdateOptions struct for UpdateOptions

Jump to

Keyboard shortcuts

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