restapi

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Keys for dataset endpoints
	CreateDatasetEndPoint  = "CREATE_DATASET"
	GetDatasetEndPoint     = "GET_DATASET"
	GetDatasetsEndPoint    = "GET_DATASETS"
	GetAllDatasetsEndPoint = "GET_ALL_DATASETS"

	// Keys for design endpoints
	CreateDesignEndPoint = "CREATE_DESIGN"
	GetDesignsEndPoint   = "GET_DESIGNS"
	GetDesignEndPoint    = "GET_DESIGN"

	// Keys for design schema endpoints
	CreateDesignSchemaEndPoint = "CREATE_DESIGN_SCHEMA"
	GetDesignSchemaEndPoint    = "GET_DESIGN_SCHEMA"
	GetDesignSchemasEndPoint   = "GET_DESIGN_SCHEMAS"
	UpdateDesignSchemaEndPoint = "UPDATE_DESIGN_SCHEMA"

	// Keys for design code endpoints
	CreateDesignCodeEndPoint = "CREATE_DESIGN_CODE"
	GetDesignCodeEndPoint    = "GET_DESIGN_CODE"
	UpdateDesignCodeEndPoint = "UPDATE_DESIGN_CODE"

	// Keys for job endpoints
	CreateJobEndpoint       = "CREATE_JOB"
	GetJobEndPoint          = "GET_JOB"
	GetJobsEndPoint         = "GET_JOBS"
	GetTasksInfoEndpoint    = "GET_TASKS_INFO"
	DeleteJobEndPoint       = "DELETE_JOB"
	UpdateJobEndPoint       = "UPDATE_JOB"
	ChangeJobSchemaEndPoint = "CHANGE_SCHEMA_JOB"
	UpdateJobStatusEndPoint = "UPDATE_JOB_STATUS"

	// Keys for task
	GetTaskEndpoint          = "GET_TASK"
	UpdateTaskStatusEndPoint = "UPDATE_TASK_STATUS"
)

Variables

View Source
var URI = map[string]string{

	CreateDatasetEndPoint:  "/{{.user}}/datasets",
	GetDatasetEndPoint:     "/{{.user}}/datasets/{{.datasetId}}",
	GetDatasetsEndPoint:    "/{{.user}}/datasets/?limit={{.limit}}",
	GetAllDatasetsEndPoint: "/datasets/?limit={{.limit}}",

	CreateDesignEndPoint: "/{{.user}}/designs",
	GetDesignEndPoint:    "/{{.user}}/designs/{{.designId}}",
	GetDesignsEndPoint:   "/{{.user}}/designs/?limit={{.limit}}",

	CreateDesignSchemaEndPoint: "/{{.user}}/designs/{{.designId}}/schemas",
	GetDesignSchemaEndPoint:    "/{{.user}}/designs/{{.designId}}/schemas/{{.version}}",
	GetDesignSchemasEndPoint:   "/{{.user}}/designs/{{.designId}}/schemas",
	UpdateDesignSchemaEndPoint: "/{{.user}}/designs/{{.designId}}/schemas/{{.version}}",

	CreateDesignCodeEndPoint: "/{{.user}}/designs/{{.designId}}/codes",
	GetDesignCodeEndPoint:    "/{{.user}}/designs/{{.designId}}/codes/{{.version}}",
	UpdateDesignCodeEndPoint: "/{{.user}}/designs/{{.designId}}/codes/{{.version}}",

	CreateJobEndpoint:       "/{{.user}}/jobs",
	GetJobEndPoint:          "/{{.user}}/jobs/{{.jobId}}",
	GetJobsEndPoint:         "/{{.user}}/jobs/?limit={{.limit}}",
	GetTasksInfoEndpoint:    "/{{.user}}/jobs/{{.jobId}}/tasks/?limit={{.limit}}",
	UpdateJobEndPoint:       "/{{.user}}/jobs/{{.jobId}}",
	DeleteJobEndPoint:       "/{{.user}}/jobs/{{.jobId}}",
	ChangeJobSchemaEndPoint: "/{{.user}}/jobs/{{.jobId}}/schema/{{.schemaId}}/design/{{.designId}}",
	UpdateJobStatusEndPoint: "/{{.user}}/jobs/{{.jobId}}/status",

	GetTaskEndpoint:          "/jobs/{{.jobId}}/{{.agentId}}/task/?key={{.key}}",
	UpdateTaskStatusEndPoint: "/jobs/{{.jobId}}/{{.agentId}}/task/status",
}

Functions

func CheckStatusCode

func CheckStatusCode(code int) error

func CreateMultipartFormData

func CreateMultipartFormData(kv map[string]io.Reader) (*bytes.Buffer, *multipart.Writer, error)

func CreateURL

func CreateURL(hostEndpoint string, endPoint string, inputMap map[string]string) string

func ErrorNilCheck

func ErrorNilCheck(method string, err error) error

ErrorNilCheck logger function to avoid re-writing the checks

func FromTemplate

func FromTemplate(skeleton string, inputMap map[string]string) (string, error)

func GetFunctionName

func GetFunctionName(i interface{}) string

func HTTPGet

func HTTPGet(url string) (int, []byte, error)

func HTTPGetMultipart

func HTTPGetMultipart(url string) (int, map[string][]byte, error)

func HTTPPost

func HTTPPost(url string, msg interface{}, contentType string) (int, []byte, error)

func HTTPPut

func HTTPPut(url string, msg interface{}, contentType string) (int, []byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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