Documentation
¶
Index ¶
- Constants
- Variables
- type AddPetIn
- type AddPetOut
- type AddPetResponse
- type ApiResponse
- type Category
- type Client
- func (_c Client) AddPet(ctx context.Context, httpRequestBody *Pet) (httpResponseBody *Pet, httpStatusCode int, err error)
- func (_c Client) ForHost(host string) Client
- func (_c Client) GetPetById(ctx context.Context, petId int64) (httpResponseBody *Pet, httpStatusCode int, err error)
- func (_c Client) UploadFile(ctx context.Context, relativeURL string, body any) (res *http.Response, err error)
- func (_c Client) WithOptions(opts ...pub.Option) Client
- type Def
- type Executor
- func (_c Executor) ForHost(host string) Executor
- func (_c Executor) WithFlowOptions(flowOptions *workflow.FlowOptions) Executor
- func (_c Executor) WithInputFlow(flow *workflow.Flow) Executor
- func (_c Executor) WithOptions(opts ...pub.Option) Executor
- func (_c Executor) WithOutputFlow(flow *workflow.Flow) Executor
- func (_c Executor) WithWorkflowRunner(runner WorkflowRunner) Executor
- type GetPetByIdIn
- type GetPetByIdOut
- type GetPetByIdResponse
- type Hook
- type MulticastClient
- func (_c MulticastClient) AddPet(ctx context.Context, httpRequestBody *Pet) iter.Seq[*AddPetResponse]
- func (_c MulticastClient) ForHost(host string) MulticastClient
- func (_c MulticastClient) GetPetById(ctx context.Context, petId int64) iter.Seq[*GetPetByIdResponse]
- func (_c MulticastClient) UploadFile(ctx context.Context, relativeURL string, body any) iter.Seq[*pub.Response]
- func (_c MulticastClient) WithOptions(opts ...pub.Option) MulticastClient
- type MulticastTrigger
- type Pet
- type Tag
- type WorkflowRunner
Constants ¶
const Hostname = "petstore.example"
Hostname is the default hostname of the microservice.
Variables ¶
var ( // HINT: Insert endpoint definitions here AddPet = Def{Method: "POST", Route: "/pet"} // MARKER: AddPet GetPetById = Def{Method: "GET", Route: "/pet/{petId}"} // MARKER: GetPetById UploadFile = Def{Method: "POST", Route: "/pet/{petId}/uploadImage"} // MARKER: UploadFile )
Functions ¶
This section is empty.
Types ¶
type AddPetIn ¶
type AddPetIn struct {
HTTPRequestBody *Pet `json:"-"`
}
AddPetIn are the input arguments of AddPet.
type AddPetResponse ¶
type AddPetResponse multicastResponse // MARKER: AddPet
AddPetResponse packs the response of AddPet.
type ApiResponse ¶
type ApiResponse struct {
Code int32 `json:"code,omitzero" jsonschema:"description=Code is the response code"`
Type string `json:"type,omitzero" jsonschema:"description=Type is the response type"`
Message string `json:"message,omitzero" jsonschema:"description=Message is the response message"`
}
ApiResponse is a generic response from the Swagger Petstore API. Imported from the Swagger Petstore API.
type Category ¶
type Category struct {
ID int64 `json:"id,omitzero" jsonschema:"description=ID is the category identifier"`
Name string `json:"name,omitzero" jsonschema:"description=Name is the category name"`
}
Category is a pet category. Imported from the Swagger Petstore API.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a lightweight proxy for making unicast calls to the microservice.
func (Client) AddPet ¶
func (_c Client) AddPet(ctx context.Context, httpRequestBody *Pet) (httpResponseBody *Pet, httpStatusCode int, err error)
AddPet adds a new pet to the store.
Input:
- httpRequestBody: httpRequestBody is the pet to add
Output:
- httpResponseBody: httpResponseBody is the created pet
- httpStatusCode: httpStatusCode is the remote HTTP status code
func (Client) ForHost ¶
ForHost returns a copy of the client with a different hostname to be applied to requests.
func (Client) GetPetById ¶
func (_c Client) GetPetById(ctx context.Context, petId int64) (httpResponseBody *Pet, httpStatusCode int, err error)
GetPetById returns a single pet.
Input:
- petId: petId is the ID of the pet to return
Output:
- httpResponseBody: httpResponseBody is the requested pet
- httpStatusCode: httpStatusCode is the remote HTTP status code
func (Client) UploadFile ¶
func (_c Client) UploadFile(ctx context.Context, relativeURL string, body any) (res *http.Response, err error)
UploadFile uploads an image of the pet.
If a URL is provided, it is resolved relative to the URL of the endpoint. If the body is of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor runs tasks and workflows synchronously, blocking until termination. It is primarily intended for integration tests.
func NewExecutor ¶
NewExecutor creates a new executor proxy to the microservice.
func (Executor) ForHost ¶
ForHost returns a copy of the executor with a different hostname to be applied to requests.
func (Executor) WithFlowOptions ¶
func (_c Executor) WithFlowOptions(flowOptions *workflow.FlowOptions) Executor
WithFlowOptions returns a copy of the executor that creates workflows with the given flow options (priority, fairness key and weight). It has no effect on task execution.
func (Executor) WithInputFlow ¶
WithInputFlow returns a copy of the executor with an input flow to use for task execution. The input flow's state is available to the task in addition to the typed input arguments.
func (Executor) WithOptions ¶
WithOptions returns a copy of the executor with options to be applied to requests.
func (Executor) WithOutputFlow ¶
WithOutputFlow returns a copy of the executor with an output flow to populate after task execution. The output flow captures the full flow state including control signals (Goto, Retry, Interrupt, Sleep).
func (Executor) WithWorkflowRunner ¶
func (_c Executor) WithWorkflowRunner(runner WorkflowRunner) Executor
WithWorkflowRunner returns a copy of the executor with a workflow runner for executing workflows. foremanapi.NewClient(svc) satisfies the WorkflowRunner interface.
type GetPetByIdIn ¶
type GetPetByIdIn struct {
PetId int64 `json:"petId,omitzero"`
}
GetPetByIdIn are the input arguments of GetPetById.
type GetPetByIdOut ¶
GetPetByIdOut are the output arguments of GetPetById.
type GetPetByIdResponse ¶
type GetPetByIdResponse multicastResponse // MARKER: GetPetById
GetPetByIdResponse packs the response of GetPetById.
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook assists in the subscription to the events of the microservice.
func NewHook ¶
func NewHook(listener service.Subscriber) Hook
NewHook creates a new hook to the events of the microservice.
type MulticastClient ¶
type MulticastClient struct {
// contains filtered or unexported fields
}
MulticastClient is a lightweight proxy for making multicast calls to the microservice.
func NewMulticastClient ¶
func NewMulticastClient(caller service.Publisher) MulticastClient
NewMulticastClient creates a new multicast client proxy to the microservice.
func (MulticastClient) AddPet ¶
func (_c MulticastClient) AddPet(ctx context.Context, httpRequestBody *Pet) iter.Seq[*AddPetResponse]
AddPet adds a new pet to the store.
Input:
- httpRequestBody: httpRequestBody is the pet to add
Output:
- httpResponseBody: httpResponseBody is the created pet
- httpStatusCode: httpStatusCode is the remote HTTP status code
func (MulticastClient) ForHost ¶
func (_c MulticastClient) ForHost(host string) MulticastClient
ForHost returns a copy of the client with a different hostname to be applied to requests.
func (MulticastClient) GetPetById ¶
func (_c MulticastClient) GetPetById(ctx context.Context, petId int64) iter.Seq[*GetPetByIdResponse]
GetPetById returns a single pet.
Input:
- petId: petId is the ID of the pet to return
Output:
- httpResponseBody: httpResponseBody is the requested pet
- httpStatusCode: httpStatusCode is the remote HTTP status code
func (MulticastClient) UploadFile ¶
func (_c MulticastClient) UploadFile(ctx context.Context, relativeURL string, body any) iter.Seq[*pub.Response]
UploadFile uploads an image of the pet.
If a URL is provided, it is resolved relative to the URL of the endpoint. If the body is of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON.
func (MulticastClient) WithOptions ¶
func (_c MulticastClient) WithOptions(opts ...pub.Option) MulticastClient
WithOptions returns a copy of the client with options to be applied to requests.
type MulticastTrigger ¶
type MulticastTrigger struct {
// contains filtered or unexported fields
}
MulticastTrigger is a lightweight proxy for triggering the events of the microservice.
func NewMulticastTrigger ¶
func NewMulticastTrigger(caller service.Publisher) MulticastTrigger
NewMulticastTrigger creates a new multicast trigger of events of the microservice.
func (MulticastTrigger) ForHost ¶
func (_c MulticastTrigger) ForHost(host string) MulticastTrigger
ForHost returns a copy of the trigger with a different hostname to be applied to requests.
func (MulticastTrigger) WithOptions ¶
func (_c MulticastTrigger) WithOptions(opts ...pub.Option) MulticastTrigger
WithOptions returns a copy of the trigger with options to be applied to requests.
type Pet ¶
type Pet struct {
ID int64 `json:"id,omitzero" jsonschema:"description=ID is the pet identifier"`
Name string `json:"name,omitzero" jsonschema:"description=Name is the pet name"`
Category *Category `json:"category,omitzero" jsonschema:"description=Category is the pet category"`
PhotoURLs []string `json:"photoUrls,omitzero" jsonschema:"description=PhotoURLs are the URLs of the pet photos"`
Tags []Tag `json:"tags,omitzero" jsonschema:"description=Tags are the pet tags"`
Status string `json:"status,omitzero" jsonschema:"description=Status is the pet status in the store"`
}
Pet is a pet in the store. Imported from the Swagger Petstore API.
type Tag ¶
type Tag struct {
ID int64 `json:"id,omitzero" jsonschema:"description=ID is the tag identifier"`
Name string `json:"name,omitzero" jsonschema:"description=Name is the tag name"`
}
Tag is a pet tag. Imported from the Swagger Petstore API.
type WorkflowRunner ¶
type WorkflowRunner interface {
Run(ctx context.Context, workflowName string, initialState any, opts *workflow.FlowOptions) (status string, state map[string]any, err error)
}
WorkflowRunner executes a workflow by name with initial state, blocking until termination. foremanapi.Client satisfies this interface.