api

package
v0.0.0-...-aba7d2c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeEndpointOfDeleteFlow

func MakeEndpointOfDeleteFlow(s Service) endpoint.Endpoint

MakeEndpointOfDeleteFlow creates the endpoint for s.DeleteFlow.

func MakeEndpointOfDeleteTool

func MakeEndpointOfDeleteTool(s Service) endpoint.Endpoint

MakeEndpointOfDeleteTool creates the endpoint for s.DeleteTool.

func MakeEndpointOfGetFlow

func MakeEndpointOfGetFlow(s Service) endpoint.Endpoint

MakeEndpointOfGetFlow creates the endpoint for s.GetFlow.

func MakeEndpointOfGetSchemas

func MakeEndpointOfGetSchemas(s Service) endpoint.Endpoint

MakeEndpointOfGetSchemas creates the endpoint for s.GetSchemas.

func MakeEndpointOfGetTools

func MakeEndpointOfGetTools(s Service) endpoint.Endpoint

MakeEndpointOfGetTools creates the endpoint for s.GetTools.

func MakeEndpointOfResumeActor

func MakeEndpointOfResumeActor(s Service) endpoint.Endpoint

MakeEndpointOfResumeActor creates the endpoint for s.ResumeActor.

func MakeEndpointOfRunFlow

func MakeEndpointOfRunFlow(s Service) endpoint.Endpoint

MakeEndpointOfRunFlow creates the endpoint for s.RunFlow.

func MakeEndpointOfTestFlow

func MakeEndpointOfTestFlow(s Service) endpoint.Endpoint

MakeEndpointOfTestFlow creates the endpoint for s.TestFlow.

func MakeEndpointOfUpsertFlow

func MakeEndpointOfUpsertFlow(s Service) endpoint.Endpoint

MakeEndpointOfUpsertFlow creates the endpoint for s.UpsertFlow.

func MakeEndpointOfUpsertTool

func MakeEndpointOfUpsertTool(s Service) endpoint.Endpoint

MakeEndpointOfUpsertTool creates the endpoint for s.UpsertTool.

func NewHTTPRouter

func NewHTTPRouter(svc Service, codecs httpcodec.Codecs, opts ...httpoption.Option) chi.Router

func OASv2APIDoc

func OASv2APIDoc(schema oas2.Schema) string

func ValidateDeleteFlowRequest

func ValidateDeleteFlowRequest(newSchema func(*DeleteFlowRequest) validating.Schema) httpoption.Validator

ValidateDeleteFlowRequest creates a validator for DeleteFlowRequest.

func ValidateDeleteToolRequest

func ValidateDeleteToolRequest(newSchema func(*DeleteToolRequest) validating.Schema) httpoption.Validator

ValidateDeleteToolRequest creates a validator for DeleteToolRequest.

func ValidateGetFlowRequest

func ValidateGetFlowRequest(newSchema func(*GetFlowRequest) validating.Schema) httpoption.Validator

ValidateGetFlowRequest creates a validator for GetFlowRequest.

func ValidateResumeActorRequest

func ValidateResumeActorRequest(newSchema func(*ResumeActorRequest) validating.Schema) httpoption.Validator

ValidateResumeActorRequest creates a validator for ResumeActorRequest.

func ValidateRunFlowRequest

func ValidateRunFlowRequest(newSchema func(*RunFlowRequest) validating.Schema) httpoption.Validator

ValidateRunFlowRequest creates a validator for RunFlowRequest.

func ValidateTestFlowRequest

func ValidateTestFlowRequest(newSchema func(*TestFlowRequest) validating.Schema) httpoption.Validator

ValidateTestFlowRequest creates a validator for TestFlowRequest.

func ValidateUpsertFlowRequest

func ValidateUpsertFlowRequest(newSchema func(*UpsertFlowRequest) validating.Schema) httpoption.Validator

ValidateUpsertFlowRequest creates a validator for UpsertFlowRequest.

func ValidateUpsertToolRequest

func ValidateUpsertToolRequest(newSchema func(*UpsertToolRequest) validating.Schema) httpoption.Validator

ValidateUpsertToolRequest creates a validator for UpsertToolRequest.

Types

type DeleteFlowRequest

type DeleteFlowRequest struct {
	Name string `json:"-"`
}

type DeleteFlowResponse

type DeleteFlowResponse struct {
	Err error `json:"-"`
}

func (*DeleteFlowResponse) Body

func (r *DeleteFlowResponse) Body() interface{}

func (*DeleteFlowResponse) Failed

func (r *DeleteFlowResponse) Failed() error

Failed implements endpoint.Failer.

type DeleteToolRequest

type DeleteToolRequest struct {
	Group string `json:"-"`
	Typ   string `json:"typ"`
}

type DeleteToolResponse

type DeleteToolResponse struct {
	Err error `json:"-"`
}

func (*DeleteToolResponse) Body

func (r *DeleteToolResponse) Body() interface{}

func (*DeleteToolResponse) Failed

func (r *DeleteToolResponse) Failed() error

Failed implements endpoint.Failer.

type EventStream

type EventStream struct {
	httpcodec.JSON
}

func (*EventStream) EncodeSuccessResponse

func (es *EventStream) EncodeSuccessResponse(w http.ResponseWriter, statusCode int, body interface{}) error

type GetFlowRequest

type GetFlowRequest struct {
	Name string `json:"-"`
}

type GetFlowResponse

type GetFlowResponse struct {
	Definition map[string]any `json:"definition"`
	Err        error          `json:"-"`
}

func (*GetFlowResponse) Body

func (r *GetFlowResponse) Body() interface{}

func (*GetFlowResponse) Failed

func (r *GetFlowResponse) Failed() error

Failed implements endpoint.Failer.

type GetSchemasResponse

type GetSchemasResponse struct {
	Schemas map[string]any `json:"schemas"`
	Err     error          `json:"-"`
}

func (*GetSchemasResponse) Body

func (r *GetSchemasResponse) Body() interface{}

func (*GetSchemasResponse) Failed

func (r *GetSchemasResponse) Failed() error

Failed implements endpoint.Failer.

type GetToolsResponse

type GetToolsResponse struct {
	Groups []string          `json:"groups"`
	Tools  map[string][]Tool `json:"tools"`
	Err    error             `json:"-"`
}

func (*GetToolsResponse) Body

func (r *GetToolsResponse) Body() interface{}

func (*GetToolsResponse) Failed

func (r *GetToolsResponse) Failed() error

Failed implements endpoint.Failer.

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(codecs httpcodec.Codecs, httpClient *http.Client, baseURL string) (*HTTPClient, error)

func (*HTTPClient) DeleteFlow

func (c *HTTPClient) DeleteFlow(ctx context.Context, name string) (err error)

func (*HTTPClient) DeleteTool

func (c *HTTPClient) DeleteTool(ctx context.Context, group string, typ string) (err error)

func (*HTTPClient) GetFlow

func (c *HTTPClient) GetFlow(ctx context.Context, name string) (definition map[string]any, err error)

func (*HTTPClient) GetSchemas

func (c *HTTPClient) GetSchemas(ctx context.Context) (schemas map[string]any, err error)

func (*HTTPClient) GetTools

func (c *HTTPClient) GetTools(ctx context.Context) (groups []string, tools map[string][]Tool, err error)

func (*HTTPClient) ResumeActor

func (c *HTTPClient) ResumeActor(ctx context.Context, id string, input map[string]any) (output map[string]any, err error)

func (*HTTPClient) RunFlow

func (c *HTTPClient) RunFlow(ctx context.Context, name string, input map[string]any) (output map[string]any, err error)

func (*HTTPClient) TestFlow

func (c *HTTPClient) TestFlow(ctx context.Context, name string, input map[string]any) (event orchestrator.Event, err error)

func (*HTTPClient) UpsertFlow

func (c *HTTPClient) UpsertFlow(ctx context.Context, name string, definition map[string]any) (err error)

func (*HTTPClient) UpsertTool

func (c *HTTPClient) UpsertTool(ctx context.Context, group string, typ string, tool Tool) (err error)

type JSONOrYAML

type JSONOrYAML struct {
	httpcodec.JSON
}

func (*JSONOrYAML) DecodeRequestBody

func (jy *JSONOrYAML) DecodeRequestBody(r *http.Request, out interface{}) error

type ResumeActorRequest

type ResumeActorRequest struct {
	Id    string         `json:"-"`
	Input map[string]any `json:"input"`
}

type ResumeActorResponse

type ResumeActorResponse struct {
	Output map[string]any `json:"output"`
	Err    error          `json:"-"`
}

func (*ResumeActorResponse) Body

func (r *ResumeActorResponse) Body() interface{}

func (*ResumeActorResponse) Failed

func (r *ResumeActorResponse) Failed() error

Failed implements endpoint.Failer.

type RunFlowRequest

type RunFlowRequest struct {
	Name  string         `json:"-"`
	Input map[string]any `json:"input"`
}

type RunFlowResponse

type RunFlowResponse struct {
	Output map[string]any `json:"output"`
	Err    error          `json:"-"`
}

func (*RunFlowResponse) Body

func (r *RunFlowResponse) Body() interface{}

func (*RunFlowResponse) Failed

func (r *RunFlowResponse) Failed() error

Failed implements endpoint.Failer.

type Service

type Service interface {
	//kun:op GET /tools
	//kun:param __ in=header name=Authorization required=true
	GetTools(ctx context.Context) (groups []string, tools map[string][]Tool, err error)

	//kun:op PUT /tools/{group}
	//kun:param __ in=header name=Authorization required=true
	UpsertTool(ctx context.Context, group, typ string, tool Tool) (err error)

	//kun:op DELETE /tools/{group}
	//kun:param __ in=header name=Authorization required=true
	DeleteTool(ctx context.Context, group, typ string) (err error)

	//kun:op PUT /flows/{name}
	//kun:param __ in=header name=Authorization required=true
	//kun:body definition
	UpsertFlow(ctx context.Context, name string, definition map[string]any) (err error)

	//kun:op DELETE /flows/{name}
	//kun:param __ in=header name=Authorization required=true
	DeleteFlow(ctx context.Context, name string) (err error)

	//kun:op GET /flows/{name}
	//kun:param __ in=header name=Authorization required=true
	GetFlow(ctx context.Context, name string) (definition map[string]any, err error)

	//kun:op GET /schemas
	//kun:param __ in=header name=Authorization required=true
	GetSchemas(ctx context.Context) (schemas map[string]any, err error)

	//kun:op POST /flows/{name}:run
	//kun:param __ in=header name=Authorization required=true
	//kun:body input
	//kun:success body=output
	RunFlow(ctx context.Context, name string, input map[string]any) (output map[string]any, err error)

	//kun:op POST /flows/{name}:test
	//kun:param __ in=header name=Authorization required=true
	//kun:body input
	//kun:success body=event
	TestFlow(ctx context.Context, name string, input map[string]any) (event orchestrator.Event, err error)

	//kun:op POST /actors/{id}:resume
	//kun:param __ in=header name=Authorization required=true
	//kun:body input
	//kun:success body=output
	ResumeActor(ctx context.Context, id string, input map[string]any) (output map[string]any, err error)

	//kun:op POST /actors/{id}:stop
	//kun:param __ in=header name=Authorization required=true
	//kun:body input
	//kun:success statusCode=204 body=output
	StopActor(ctx context.Context, id string, input map[string]any) (output map[string]any, err error)
}

type TestFlowRequest

type TestFlowRequest struct {
	Name  string         `json:"-"`
	Input map[string]any `json:"input"`
}

type TestFlowResponse

type TestFlowResponse struct {
	Event orchestrator.Event `json:"event"`
	Err   error              `json:"-"`
}

func (*TestFlowResponse) Body

func (r *TestFlowResponse) Body() interface{}

func (*TestFlowResponse) Failed

func (r *TestFlowResponse) Failed() error

Failed implements endpoint.Failer.

type Tool

type Tool struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

type UpsertFlowRequest

type UpsertFlowRequest struct {
	Name       string         `json:"-"`
	Definition map[string]any `json:"definition"`
}

type UpsertFlowResponse

type UpsertFlowResponse struct {
	Err error `json:"-"`
}

func (*UpsertFlowResponse) Body

func (r *UpsertFlowResponse) Body() interface{}

func (*UpsertFlowResponse) Failed

func (r *UpsertFlowResponse) Failed() error

Failed implements endpoint.Failer.

type UpsertToolRequest

type UpsertToolRequest struct {
	Group string `json:"-"`
	Typ   string `json:"typ"`
	Tool  Tool   `json:"tool"`
}

type UpsertToolResponse

type UpsertToolResponse struct {
	Err error `json:"-"`
}

func (*UpsertToolResponse) Body

func (r *UpsertToolResponse) Body() interface{}

func (*UpsertToolResponse) Failed

func (r *UpsertToolResponse) Failed() error

Failed implements endpoint.Failer.

Jump to

Keyboard shortcuts

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