mirror of
https://github.com/zap-proto/gen.git
synced 2026-10-30 15:05:01 +00:00
Force-added past .gitignore's out/ as reproducible proof that one .zap
schema mechanically produces every surface:
- out/ts/tasks/tasks_zap.ts Tier-2 zero-copy View/Client/Server; tsc --noEmit
clean against @zap-proto/zap under strict (noUnusedLocals, verbatimModuleSyntax).
- out/{ts,go}/tasks/tasks.openapi.json OpenAPI 3.1.0; openapi-spec-validator OK;
4/4 methods as POST /tasks/<method>; 9 referenced structs in components.schemas.
- out/go/tasks oapi-codegen Tier-1 client + go.mod + offline request-forming
test: go vet/build/test all green (forms POST https://api.hanzo.ai/tasks/*).
- out/docs/{ts,go}/tasks.mdx generated SDK doc stubs.
Regenerate: bin/zapsdk ts schemas/tasks.zap ; bin/zapsdk go schemas/tasks.zap
747 lines
23 KiB
Go
747 lines
23 KiB
Go
// Code generated from a ZAP schema (zap-proto/gen) — DO NOT EDIT.
|
|
// Regenerate: bin/zapsdk go schemas/tasks.zap
|
|
|
|
// Package tasks provides primitives to interact with the openapi HTTP API.
|
|
//
|
|
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.
|
|
package tasks
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
// DescribeWorkflowRequest defines model for DescribeWorkflowRequest.
|
|
type DescribeWorkflowRequest struct {
|
|
Namespace string `json:"namespace"`
|
|
RunId string `json:"runId"`
|
|
WorkflowId string `json:"workflowId"`
|
|
}
|
|
|
|
// DescribeWorkflowResponse defines model for DescribeWorkflowResponse.
|
|
type DescribeWorkflowResponse struct {
|
|
Info WorkflowExecutionInfo `json:"info"`
|
|
}
|
|
|
|
// HealthResponse defines model for HealthResponse.
|
|
type HealthResponse struct {
|
|
Service string `json:"service"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
// SignalWorkflowRequest defines model for SignalWorkflowRequest.
|
|
type SignalWorkflowRequest struct {
|
|
Input []byte `json:"input"`
|
|
Namespace string `json:"namespace"`
|
|
RunId string `json:"runId"`
|
|
SignalName string `json:"signalName"`
|
|
WorkflowId string `json:"workflowId"`
|
|
}
|
|
|
|
// StartWorkflowRequest defines model for StartWorkflowRequest.
|
|
type StartWorkflowRequest struct {
|
|
Input []byte `json:"input"`
|
|
Namespace string `json:"namespace"`
|
|
TaskQueue string `json:"taskQueue"`
|
|
WorkflowId string `json:"workflowId"`
|
|
}
|
|
|
|
// StartWorkflowResponse defines model for StartWorkflowResponse.
|
|
type StartWorkflowResponse struct {
|
|
RunId string `json:"runId"`
|
|
}
|
|
|
|
// WorkflowExecution defines model for WorkflowExecution.
|
|
type WorkflowExecution struct {
|
|
RunId string `json:"runId"`
|
|
WorkflowId string `json:"workflowId"`
|
|
}
|
|
|
|
// WorkflowExecutionInfo defines model for WorkflowExecutionInfo.
|
|
type WorkflowExecutionInfo struct {
|
|
CloseTimeMs string `json:"closeTimeMs"`
|
|
Execution WorkflowExecution `json:"execution"`
|
|
HistoryLength string `json:"historyLength"`
|
|
StartTimeMs string `json:"startTimeMs"`
|
|
Status uint8 `json:"status"`
|
|
Type WorkflowType `json:"type"`
|
|
}
|
|
|
|
// WorkflowType defines model for WorkflowType.
|
|
type WorkflowType struct {
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// TasksDescribeWorkflowJSONRequestBody defines body for TasksDescribeWorkflow for application/json ContentType.
|
|
type TasksDescribeWorkflowJSONRequestBody = DescribeWorkflowRequest
|
|
|
|
// TasksSignalWorkflowJSONRequestBody defines body for TasksSignalWorkflow for application/json ContentType.
|
|
type TasksSignalWorkflowJSONRequestBody = SignalWorkflowRequest
|
|
|
|
// TasksStartWorkflowJSONRequestBody defines body for TasksStartWorkflow for application/json ContentType.
|
|
type TasksStartWorkflowJSONRequestBody = StartWorkflowRequest
|
|
|
|
// RequestEditorFn is the function signature for the RequestEditor callback function
|
|
type RequestEditorFn func(ctx context.Context, req *http.Request) error
|
|
|
|
// Doer performs HTTP requests.
|
|
//
|
|
// The standard http.Client implements this interface.
|
|
type HttpRequestDoer interface {
|
|
Do(req *http.Request) (*http.Response, error)
|
|
}
|
|
|
|
// Client which conforms to the OpenAPI3 specification for this service.
|
|
type Client struct {
|
|
// The endpoint of the server conforming to this interface, with scheme,
|
|
// https://api.deepmap.com for example. This can contain a path relative
|
|
// to the server, such as https://api.deepmap.com/dev-test, and all the
|
|
// paths in the swagger spec will be appended to the server.
|
|
Server string
|
|
|
|
// Doer for performing requests, typically a *http.Client with any
|
|
// customized settings, such as certificate chains.
|
|
Client HttpRequestDoer
|
|
|
|
// A list of callbacks for modifying requests which are generated before sending over
|
|
// the network.
|
|
RequestEditors []RequestEditorFn
|
|
}
|
|
|
|
// ClientOption allows setting custom parameters during construction
|
|
type ClientOption func(*Client) error
|
|
|
|
// Creates a new Client, with reasonable defaults
|
|
func NewClient(server string, opts ...ClientOption) (*Client, error) {
|
|
// create a client with sane default values
|
|
client := Client{
|
|
Server: server,
|
|
}
|
|
// mutate client and add all optional params
|
|
for _, o := range opts {
|
|
if err := o(&client); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
// ensure the server URL always has a trailing slash
|
|
if !strings.HasSuffix(client.Server, "/") {
|
|
client.Server += "/"
|
|
}
|
|
// create httpClient, if not already present
|
|
if client.Client == nil {
|
|
client.Client = &http.Client{}
|
|
}
|
|
return &client, nil
|
|
}
|
|
|
|
// WithHTTPClient allows overriding the default Doer, which is
|
|
// automatically created using http.Client. This is useful for tests.
|
|
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
|
|
return func(c *Client) error {
|
|
c.Client = doer
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithRequestEditorFn allows setting up a callback function, which will be
|
|
// called right before sending the request. This can be used to mutate the request.
|
|
func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
|
|
return func(c *Client) error {
|
|
c.RequestEditors = append(c.RequestEditors, fn)
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// The interface specification for the client above.
|
|
type ClientInterface interface {
|
|
// TasksDescribeWorkflowWithBody request with any body
|
|
TasksDescribeWorkflowWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
|
TasksDescribeWorkflow(ctx context.Context, body TasksDescribeWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
|
// TasksHealth request
|
|
TasksHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
|
// TasksSignalWorkflowWithBody request with any body
|
|
TasksSignalWorkflowWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
|
TasksSignalWorkflow(ctx context.Context, body TasksSignalWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
|
// TasksStartWorkflowWithBody request with any body
|
|
TasksStartWorkflowWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
|
TasksStartWorkflow(ctx context.Context, body TasksStartWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
}
|
|
|
|
func (c *Client) TasksDescribeWorkflowWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
req, err := NewTasksDescribeWorkflowRequestWithBody(c.Server, contentType, body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
req = req.WithContext(ctx)
|
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
return nil, err
|
|
}
|
|
return c.Client.Do(req)
|
|
}
|
|
|
|
func (c *Client) TasksDescribeWorkflow(ctx context.Context, body TasksDescribeWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
req, err := NewTasksDescribeWorkflowRequest(c.Server, body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
req = req.WithContext(ctx)
|
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
return nil, err
|
|
}
|
|
return c.Client.Do(req)
|
|
}
|
|
|
|
func (c *Client) TasksHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
req, err := NewTasksHealthRequest(c.Server)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
req = req.WithContext(ctx)
|
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
return nil, err
|
|
}
|
|
return c.Client.Do(req)
|
|
}
|
|
|
|
func (c *Client) TasksSignalWorkflowWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
req, err := NewTasksSignalWorkflowRequestWithBody(c.Server, contentType, body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
req = req.WithContext(ctx)
|
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
return nil, err
|
|
}
|
|
return c.Client.Do(req)
|
|
}
|
|
|
|
func (c *Client) TasksSignalWorkflow(ctx context.Context, body TasksSignalWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
req, err := NewTasksSignalWorkflowRequest(c.Server, body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
req = req.WithContext(ctx)
|
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
return nil, err
|
|
}
|
|
return c.Client.Do(req)
|
|
}
|
|
|
|
func (c *Client) TasksStartWorkflowWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
req, err := NewTasksStartWorkflowRequestWithBody(c.Server, contentType, body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
req = req.WithContext(ctx)
|
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
return nil, err
|
|
}
|
|
return c.Client.Do(req)
|
|
}
|
|
|
|
func (c *Client) TasksStartWorkflow(ctx context.Context, body TasksStartWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
req, err := NewTasksStartWorkflowRequest(c.Server, body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
req = req.WithContext(ctx)
|
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
return nil, err
|
|
}
|
|
return c.Client.Do(req)
|
|
}
|
|
|
|
// NewTasksDescribeWorkflowRequest calls the generic TasksDescribeWorkflow builder with application/json body
|
|
func NewTasksDescribeWorkflowRequest(server string, body TasksDescribeWorkflowJSONRequestBody) (*http.Request, error) {
|
|
var bodyReader io.Reader
|
|
buf, err := json.Marshal(body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
bodyReader = bytes.NewReader(buf)
|
|
return NewTasksDescribeWorkflowRequestWithBody(server, "application/json", bodyReader)
|
|
}
|
|
|
|
// NewTasksDescribeWorkflowRequestWithBody generates requests for TasksDescribeWorkflow with any type of body
|
|
func NewTasksDescribeWorkflowRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
|
|
var err error
|
|
|
|
serverURL, err := url.Parse(server)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
operationPath := fmt.Sprintf("/tasks/describe-workflow")
|
|
if operationPath[0] == '/' {
|
|
operationPath = "." + operationPath
|
|
}
|
|
|
|
queryURL, err := serverURL.Parse(operationPath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
req.Header.Add("Content-Type", contentType)
|
|
|
|
return req, nil
|
|
}
|
|
|
|
// NewTasksHealthRequest generates requests for TasksHealth
|
|
func NewTasksHealthRequest(server string) (*http.Request, error) {
|
|
var err error
|
|
|
|
serverURL, err := url.Parse(server)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
operationPath := fmt.Sprintf("/tasks/health")
|
|
if operationPath[0] == '/' {
|
|
operationPath = "." + operationPath
|
|
}
|
|
|
|
queryURL, err := serverURL.Parse(operationPath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return req, nil
|
|
}
|
|
|
|
// NewTasksSignalWorkflowRequest calls the generic TasksSignalWorkflow builder with application/json body
|
|
func NewTasksSignalWorkflowRequest(server string, body TasksSignalWorkflowJSONRequestBody) (*http.Request, error) {
|
|
var bodyReader io.Reader
|
|
buf, err := json.Marshal(body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
bodyReader = bytes.NewReader(buf)
|
|
return NewTasksSignalWorkflowRequestWithBody(server, "application/json", bodyReader)
|
|
}
|
|
|
|
// NewTasksSignalWorkflowRequestWithBody generates requests for TasksSignalWorkflow with any type of body
|
|
func NewTasksSignalWorkflowRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
|
|
var err error
|
|
|
|
serverURL, err := url.Parse(server)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
operationPath := fmt.Sprintf("/tasks/signal-workflow")
|
|
if operationPath[0] == '/' {
|
|
operationPath = "." + operationPath
|
|
}
|
|
|
|
queryURL, err := serverURL.Parse(operationPath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
req.Header.Add("Content-Type", contentType)
|
|
|
|
return req, nil
|
|
}
|
|
|
|
// NewTasksStartWorkflowRequest calls the generic TasksStartWorkflow builder with application/json body
|
|
func NewTasksStartWorkflowRequest(server string, body TasksStartWorkflowJSONRequestBody) (*http.Request, error) {
|
|
var bodyReader io.Reader
|
|
buf, err := json.Marshal(body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
bodyReader = bytes.NewReader(buf)
|
|
return NewTasksStartWorkflowRequestWithBody(server, "application/json", bodyReader)
|
|
}
|
|
|
|
// NewTasksStartWorkflowRequestWithBody generates requests for TasksStartWorkflow with any type of body
|
|
func NewTasksStartWorkflowRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
|
|
var err error
|
|
|
|
serverURL, err := url.Parse(server)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
operationPath := fmt.Sprintf("/tasks/start-workflow")
|
|
if operationPath[0] == '/' {
|
|
operationPath = "." + operationPath
|
|
}
|
|
|
|
queryURL, err := serverURL.Parse(operationPath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
req.Header.Add("Content-Type", contentType)
|
|
|
|
return req, nil
|
|
}
|
|
|
|
func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
|
|
for _, r := range c.RequestEditors {
|
|
if err := r(ctx, req); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
for _, r := range additionalEditors {
|
|
if err := r(ctx, req); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ClientWithResponses builds on ClientInterface to offer response payloads
|
|
type ClientWithResponses struct {
|
|
ClientInterface
|
|
}
|
|
|
|
// NewClientWithResponses creates a new ClientWithResponses, which wraps
|
|
// Client with return type handling
|
|
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
|
|
client, err := NewClient(server, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &ClientWithResponses{client}, nil
|
|
}
|
|
|
|
// WithBaseURL overrides the baseURL.
|
|
func WithBaseURL(baseURL string) ClientOption {
|
|
return func(c *Client) error {
|
|
newBaseURL, err := url.Parse(baseURL)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
c.Server = newBaseURL.String()
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// ClientWithResponsesInterface is the interface specification for the client with responses above.
|
|
type ClientWithResponsesInterface interface {
|
|
// TasksDescribeWorkflowWithBodyWithResponse request with any body
|
|
TasksDescribeWorkflowWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TasksDescribeWorkflowResponse, error)
|
|
|
|
TasksDescribeWorkflowWithResponse(ctx context.Context, body TasksDescribeWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*TasksDescribeWorkflowResponse, error)
|
|
|
|
// TasksHealthWithResponse request
|
|
TasksHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TasksHealthResponse, error)
|
|
|
|
// TasksSignalWorkflowWithBodyWithResponse request with any body
|
|
TasksSignalWorkflowWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TasksSignalWorkflowResponse, error)
|
|
|
|
TasksSignalWorkflowWithResponse(ctx context.Context, body TasksSignalWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*TasksSignalWorkflowResponse, error)
|
|
|
|
// TasksStartWorkflowWithBodyWithResponse request with any body
|
|
TasksStartWorkflowWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TasksStartWorkflowResponse, error)
|
|
|
|
TasksStartWorkflowWithResponse(ctx context.Context, body TasksStartWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*TasksStartWorkflowResponse, error)
|
|
}
|
|
|
|
type TasksDescribeWorkflowResponse struct {
|
|
Body []byte
|
|
HTTPResponse *http.Response
|
|
JSON200 *DescribeWorkflowResponse
|
|
}
|
|
|
|
// Status returns HTTPResponse.Status
|
|
func (r TasksDescribeWorkflowResponse) Status() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Status
|
|
}
|
|
return http.StatusText(0)
|
|
}
|
|
|
|
// StatusCode returns HTTPResponse.StatusCode
|
|
func (r TasksDescribeWorkflowResponse) StatusCode() int {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.StatusCode
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
|
|
func (r TasksDescribeWorkflowResponse) ContentType() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Header.Get("Content-Type")
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type TasksHealthResponse struct {
|
|
Body []byte
|
|
HTTPResponse *http.Response
|
|
JSON200 *HealthResponse
|
|
}
|
|
|
|
// Status returns HTTPResponse.Status
|
|
func (r TasksHealthResponse) Status() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Status
|
|
}
|
|
return http.StatusText(0)
|
|
}
|
|
|
|
// StatusCode returns HTTPResponse.StatusCode
|
|
func (r TasksHealthResponse) StatusCode() int {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.StatusCode
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
|
|
func (r TasksHealthResponse) ContentType() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Header.Get("Content-Type")
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type TasksSignalWorkflowResponse struct {
|
|
Body []byte
|
|
HTTPResponse *http.Response
|
|
}
|
|
|
|
// Status returns HTTPResponse.Status
|
|
func (r TasksSignalWorkflowResponse) Status() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Status
|
|
}
|
|
return http.StatusText(0)
|
|
}
|
|
|
|
// StatusCode returns HTTPResponse.StatusCode
|
|
func (r TasksSignalWorkflowResponse) StatusCode() int {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.StatusCode
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
|
|
func (r TasksSignalWorkflowResponse) ContentType() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Header.Get("Content-Type")
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type TasksStartWorkflowResponse struct {
|
|
Body []byte
|
|
HTTPResponse *http.Response
|
|
JSON200 *StartWorkflowResponse
|
|
}
|
|
|
|
// Status returns HTTPResponse.Status
|
|
func (r TasksStartWorkflowResponse) Status() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Status
|
|
}
|
|
return http.StatusText(0)
|
|
}
|
|
|
|
// StatusCode returns HTTPResponse.StatusCode
|
|
func (r TasksStartWorkflowResponse) StatusCode() int {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.StatusCode
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
|
|
func (r TasksStartWorkflowResponse) ContentType() string {
|
|
if r.HTTPResponse != nil {
|
|
return r.HTTPResponse.Header.Get("Content-Type")
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// TasksDescribeWorkflowWithBodyWithResponse request with arbitrary body returning *TasksDescribeWorkflowResponse
|
|
func (c *ClientWithResponses) TasksDescribeWorkflowWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TasksDescribeWorkflowResponse, error) {
|
|
rsp, err := c.TasksDescribeWorkflowWithBody(ctx, contentType, body, reqEditors...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ParseTasksDescribeWorkflowResponse(rsp)
|
|
}
|
|
|
|
func (c *ClientWithResponses) TasksDescribeWorkflowWithResponse(ctx context.Context, body TasksDescribeWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*TasksDescribeWorkflowResponse, error) {
|
|
rsp, err := c.TasksDescribeWorkflow(ctx, body, reqEditors...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ParseTasksDescribeWorkflowResponse(rsp)
|
|
}
|
|
|
|
// TasksHealthWithResponse request returning *TasksHealthResponse
|
|
func (c *ClientWithResponses) TasksHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TasksHealthResponse, error) {
|
|
rsp, err := c.TasksHealth(ctx, reqEditors...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ParseTasksHealthResponse(rsp)
|
|
}
|
|
|
|
// TasksSignalWorkflowWithBodyWithResponse request with arbitrary body returning *TasksSignalWorkflowResponse
|
|
func (c *ClientWithResponses) TasksSignalWorkflowWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TasksSignalWorkflowResponse, error) {
|
|
rsp, err := c.TasksSignalWorkflowWithBody(ctx, contentType, body, reqEditors...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ParseTasksSignalWorkflowResponse(rsp)
|
|
}
|
|
|
|
func (c *ClientWithResponses) TasksSignalWorkflowWithResponse(ctx context.Context, body TasksSignalWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*TasksSignalWorkflowResponse, error) {
|
|
rsp, err := c.TasksSignalWorkflow(ctx, body, reqEditors...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ParseTasksSignalWorkflowResponse(rsp)
|
|
}
|
|
|
|
// TasksStartWorkflowWithBodyWithResponse request with arbitrary body returning *TasksStartWorkflowResponse
|
|
func (c *ClientWithResponses) TasksStartWorkflowWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TasksStartWorkflowResponse, error) {
|
|
rsp, err := c.TasksStartWorkflowWithBody(ctx, contentType, body, reqEditors...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ParseTasksStartWorkflowResponse(rsp)
|
|
}
|
|
|
|
func (c *ClientWithResponses) TasksStartWorkflowWithResponse(ctx context.Context, body TasksStartWorkflowJSONRequestBody, reqEditors ...RequestEditorFn) (*TasksStartWorkflowResponse, error) {
|
|
rsp, err := c.TasksStartWorkflow(ctx, body, reqEditors...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ParseTasksStartWorkflowResponse(rsp)
|
|
}
|
|
|
|
// ParseTasksDescribeWorkflowResponse parses an HTTP response from a TasksDescribeWorkflowWithResponse call
|
|
func ParseTasksDescribeWorkflowResponse(rsp *http.Response) (*TasksDescribeWorkflowResponse, error) {
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
|
defer func() { _ = rsp.Body.Close() }()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
response := &TasksDescribeWorkflowResponse{
|
|
Body: bodyBytes,
|
|
HTTPResponse: rsp,
|
|
}
|
|
|
|
switch {
|
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
var dest DescribeWorkflowResponse
|
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
return nil, err
|
|
}
|
|
response.JSON200 = &dest
|
|
|
|
}
|
|
|
|
return response, nil
|
|
}
|
|
|
|
// ParseTasksHealthResponse parses an HTTP response from a TasksHealthWithResponse call
|
|
func ParseTasksHealthResponse(rsp *http.Response) (*TasksHealthResponse, error) {
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
|
defer func() { _ = rsp.Body.Close() }()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
response := &TasksHealthResponse{
|
|
Body: bodyBytes,
|
|
HTTPResponse: rsp,
|
|
}
|
|
|
|
switch {
|
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
var dest HealthResponse
|
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
return nil, err
|
|
}
|
|
response.JSON200 = &dest
|
|
|
|
}
|
|
|
|
return response, nil
|
|
}
|
|
|
|
// ParseTasksSignalWorkflowResponse parses an HTTP response from a TasksSignalWorkflowWithResponse call
|
|
func ParseTasksSignalWorkflowResponse(rsp *http.Response) (*TasksSignalWorkflowResponse, error) {
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
|
defer func() { _ = rsp.Body.Close() }()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
response := &TasksSignalWorkflowResponse{
|
|
Body: bodyBytes,
|
|
HTTPResponse: rsp,
|
|
}
|
|
|
|
return response, nil
|
|
}
|
|
|
|
// ParseTasksStartWorkflowResponse parses an HTTP response from a TasksStartWorkflowWithResponse call
|
|
func ParseTasksStartWorkflowResponse(rsp *http.Response) (*TasksStartWorkflowResponse, error) {
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
|
defer func() { _ = rsp.Body.Close() }()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
response := &TasksStartWorkflowResponse{
|
|
Body: bodyBytes,
|
|
HTTPResponse: rsp,
|
|
}
|
|
|
|
switch {
|
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
var dest StartWorkflowResponse
|
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
return nil, err
|
|
}
|
|
response.JSON200 = &dest
|
|
|
|
}
|
|
|
|
return response, nil
|
|
}
|