1 // Package invokermanagementapi provides primitives to interact with the openapi HTTP API.
3 // Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT.
4 package invokermanagementapi
17 "github.com/deepmap/oapi-codegen/pkg/runtime"
20 // RequestEditorFn is the function signature for the RequestEditor callback function
21 type RequestEditorFn func(ctx context.Context, req *http.Request) error
23 // Doer performs HTTP requests.
25 // The standard http.Client implements this interface.
26 type HttpRequestDoer interface {
27 Do(req *http.Request) (*http.Response, error)
30 // Client which conforms to the OpenAPI3 specification for this service.
32 // The endpoint of the server conforming to this interface, with scheme,
33 // https://api.deepmap.com for example. This can contain a path relative
34 // to the server, such as https://api.deepmap.com/dev-test, and all the
35 // paths in the swagger spec will be appended to the server.
38 // Doer for performing requests, typically a *http.Client with any
39 // customized settings, such as certificate chains.
40 Client HttpRequestDoer
42 // A list of callbacks for modifying requests which are generated before sending over
44 RequestEditors []RequestEditorFn
47 // ClientOption allows setting custom parameters during construction
48 type ClientOption func(*Client) error
50 // Creates a new Client, with reasonable defaults
51 func NewClient(server string, opts ...ClientOption) (*Client, error) {
52 // create a client with sane default values
56 // mutate client and add all optional params
57 for _, o := range opts {
58 if err := o(&client); err != nil {
62 // ensure the server URL always has a trailing slash
63 if !strings.HasSuffix(client.Server, "/") {
66 // create httpClient, if not already present
67 if client.Client == nil {
68 client.Client = &http.Client{}
73 // WithHTTPClient allows overriding the default Doer, which is
74 // automatically created using http.Client. This is useful for tests.
75 func WithHTTPClient(doer HttpRequestDoer) ClientOption {
76 return func(c *Client) error {
82 // WithRequestEditorFn allows setting up a callback function, which will be
83 // called right before sending the request. This can be used to mutate the request.
84 func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
85 return func(c *Client) error {
86 c.RequestEditors = append(c.RequestEditors, fn)
91 // The interface specification for the client above.
92 type ClientInterface interface {
93 // PostOnboardedInvokers request with any body
94 PostOnboardedInvokersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
96 PostOnboardedInvokers(ctx context.Context, body PostOnboardedInvokersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
98 // DeleteOnboardedInvokersOnboardingId request
99 DeleteOnboardedInvokersOnboardingId(ctx context.Context, onboardingId string, reqEditors ...RequestEditorFn) (*http.Response, error)
101 // ModifyIndApiInvokeEnrolment request with any body
102 ModifyIndApiInvokeEnrolmentWithBody(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
104 // PutOnboardedInvokersOnboardingId request with any body
105 PutOnboardedInvokersOnboardingIdWithBody(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
107 PutOnboardedInvokersOnboardingId(ctx context.Context, onboardingId string, body PutOnboardedInvokersOnboardingIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
110 func (c *Client) PostOnboardedInvokersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
111 req, err := NewPostOnboardedInvokersRequestWithBody(c.Server, contentType, body)
115 req = req.WithContext(ctx)
116 if err := c.applyEditors(ctx, req, reqEditors); err != nil {
119 return c.Client.Do(req)
122 func (c *Client) PostOnboardedInvokers(ctx context.Context, body PostOnboardedInvokersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
123 req, err := NewPostOnboardedInvokersRequest(c.Server, body)
127 req = req.WithContext(ctx)
128 if err := c.applyEditors(ctx, req, reqEditors); err != nil {
131 return c.Client.Do(req)
134 func (c *Client) DeleteOnboardedInvokersOnboardingId(ctx context.Context, onboardingId string, reqEditors ...RequestEditorFn) (*http.Response, error) {
135 req, err := NewDeleteOnboardedInvokersOnboardingIdRequest(c.Server, onboardingId)
139 req = req.WithContext(ctx)
140 if err := c.applyEditors(ctx, req, reqEditors); err != nil {
143 return c.Client.Do(req)
146 func (c *Client) ModifyIndApiInvokeEnrolmentWithBody(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
147 req, err := NewModifyIndApiInvokeEnrolmentRequestWithBody(c.Server, onboardingId, contentType, body)
151 req = req.WithContext(ctx)
152 if err := c.applyEditors(ctx, req, reqEditors); err != nil {
155 return c.Client.Do(req)
158 func (c *Client) PutOnboardedInvokersOnboardingIdWithBody(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
159 req, err := NewPutOnboardedInvokersOnboardingIdRequestWithBody(c.Server, onboardingId, contentType, body)
163 req = req.WithContext(ctx)
164 if err := c.applyEditors(ctx, req, reqEditors); err != nil {
167 return c.Client.Do(req)
170 func (c *Client) PutOnboardedInvokersOnboardingId(ctx context.Context, onboardingId string, body PutOnboardedInvokersOnboardingIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
171 req, err := NewPutOnboardedInvokersOnboardingIdRequest(c.Server, onboardingId, body)
175 req = req.WithContext(ctx)
176 if err := c.applyEditors(ctx, req, reqEditors); err != nil {
179 return c.Client.Do(req)
182 // NewPostOnboardedInvokersRequest calls the generic PostOnboardedInvokers builder with application/json body
183 func NewPostOnboardedInvokersRequest(server string, body PostOnboardedInvokersJSONRequestBody) (*http.Request, error) {
184 var bodyReader io.Reader
185 buf, err := json.Marshal(body)
189 bodyReader = bytes.NewReader(buf)
190 return NewPostOnboardedInvokersRequestWithBody(server, "application/json", bodyReader)
193 // NewPostOnboardedInvokersRequestWithBody generates requests for PostOnboardedInvokers with any type of body
194 func NewPostOnboardedInvokersRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
197 serverURL, err := url.Parse(server)
202 operationPath := fmt.Sprintf("/onboardedInvokers")
203 if operationPath[0] == '/' {
204 operationPath = "." + operationPath
207 queryURL, err := serverURL.Parse(operationPath)
212 req, err := http.NewRequest("POST", queryURL.String(), body)
217 req.Header.Add("Content-Type", contentType)
222 // NewDeleteOnboardedInvokersOnboardingIdRequest generates requests for DeleteOnboardedInvokersOnboardingId
223 func NewDeleteOnboardedInvokersOnboardingIdRequest(server string, onboardingId string) (*http.Request, error) {
226 var pathParam0 string
228 pathParam0, err = runtime.StyleParamWithLocation("simple", false, "onboardingId", runtime.ParamLocationPath, onboardingId)
233 serverURL, err := url.Parse(server)
238 operationPath := fmt.Sprintf("/onboardedInvokers/%s", pathParam0)
239 if operationPath[0] == '/' {
240 operationPath = "." + operationPath
243 queryURL, err := serverURL.Parse(operationPath)
248 req, err := http.NewRequest("DELETE", queryURL.String(), nil)
256 // NewModifyIndApiInvokeEnrolmentRequestWithBody generates requests for ModifyIndApiInvokeEnrolment with any type of body
257 func NewModifyIndApiInvokeEnrolmentRequestWithBody(server string, onboardingId string, contentType string, body io.Reader) (*http.Request, error) {
260 var pathParam0 string
262 pathParam0, err = runtime.StyleParamWithLocation("simple", false, "onboardingId", runtime.ParamLocationPath, onboardingId)
267 serverURL, err := url.Parse(server)
272 operationPath := fmt.Sprintf("/onboardedInvokers/%s", pathParam0)
273 if operationPath[0] == '/' {
274 operationPath = "." + operationPath
277 queryURL, err := serverURL.Parse(operationPath)
282 req, err := http.NewRequest("PATCH", queryURL.String(), body)
287 req.Header.Add("Content-Type", contentType)
292 // NewPutOnboardedInvokersOnboardingIdRequest calls the generic PutOnboardedInvokersOnboardingId builder with application/json body
293 func NewPutOnboardedInvokersOnboardingIdRequest(server string, onboardingId string, body PutOnboardedInvokersOnboardingIdJSONRequestBody) (*http.Request, error) {
294 var bodyReader io.Reader
295 buf, err := json.Marshal(body)
299 bodyReader = bytes.NewReader(buf)
300 return NewPutOnboardedInvokersOnboardingIdRequestWithBody(server, onboardingId, "application/json", bodyReader)
303 // NewPutOnboardedInvokersOnboardingIdRequestWithBody generates requests for PutOnboardedInvokersOnboardingId with any type of body
304 func NewPutOnboardedInvokersOnboardingIdRequestWithBody(server string, onboardingId string, contentType string, body io.Reader) (*http.Request, error) {
307 var pathParam0 string
309 pathParam0, err = runtime.StyleParamWithLocation("simple", false, "onboardingId", runtime.ParamLocationPath, onboardingId)
314 serverURL, err := url.Parse(server)
319 operationPath := fmt.Sprintf("/onboardedInvokers/%s", pathParam0)
320 if operationPath[0] == '/' {
321 operationPath = "." + operationPath
324 queryURL, err := serverURL.Parse(operationPath)
329 req, err := http.NewRequest("PUT", queryURL.String(), body)
334 req.Header.Add("Content-Type", contentType)
339 func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
340 for _, r := range c.RequestEditors {
341 if err := r(ctx, req); err != nil {
345 for _, r := range additionalEditors {
346 if err := r(ctx, req); err != nil {
353 // ClientWithResponses builds on ClientInterface to offer response payloads
354 type ClientWithResponses struct {
358 // NewClientWithResponses creates a new ClientWithResponses, which wraps
359 // Client with return type handling
360 func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
361 client, err := NewClient(server, opts...)
365 return &ClientWithResponses{client}, nil
368 // WithBaseURL overrides the baseURL.
369 func WithBaseURL(baseURL string) ClientOption {
370 return func(c *Client) error {
371 newBaseURL, err := url.Parse(baseURL)
375 c.Server = newBaseURL.String()
380 // ClientWithResponsesInterface is the interface specification for the client with responses above.
381 type ClientWithResponsesInterface interface {
382 // PostOnboardedInvokers request with any body
383 PostOnboardedInvokersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostOnboardedInvokersResponse, error)
385 PostOnboardedInvokersWithResponse(ctx context.Context, body PostOnboardedInvokersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostOnboardedInvokersResponse, error)
387 // DeleteOnboardedInvokersOnboardingId request
388 DeleteOnboardedInvokersOnboardingIdWithResponse(ctx context.Context, onboardingId string, reqEditors ...RequestEditorFn) (*DeleteOnboardedInvokersOnboardingIdResponse, error)
390 // ModifyIndApiInvokeEnrolment request with any body
391 ModifyIndApiInvokeEnrolmentWithBodyWithResponse(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ModifyIndApiInvokeEnrolmentResponse, error)
393 // PutOnboardedInvokersOnboardingId request with any body
394 PutOnboardedInvokersOnboardingIdWithBodyWithResponse(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutOnboardedInvokersOnboardingIdResponse, error)
396 PutOnboardedInvokersOnboardingIdWithResponse(ctx context.Context, onboardingId string, body PutOnboardedInvokersOnboardingIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutOnboardedInvokersOnboardingIdResponse, error)
399 type PostOnboardedInvokersResponse struct {
401 HTTPResponse *http.Response
402 JSON201 *APIInvokerEnrolmentDetails
405 // Status returns HTTPResponse.Status
406 func (r PostOnboardedInvokersResponse) Status() string {
407 if r.HTTPResponse != nil {
408 return r.HTTPResponse.Status
410 return http.StatusText(0)
413 // StatusCode returns HTTPResponse.StatusCode
414 func (r PostOnboardedInvokersResponse) StatusCode() int {
415 if r.HTTPResponse != nil {
416 return r.HTTPResponse.StatusCode
421 type DeleteOnboardedInvokersOnboardingIdResponse struct {
423 HTTPResponse *http.Response
426 // Status returns HTTPResponse.Status
427 func (r DeleteOnboardedInvokersOnboardingIdResponse) Status() string {
428 if r.HTTPResponse != nil {
429 return r.HTTPResponse.Status
431 return http.StatusText(0)
434 // StatusCode returns HTTPResponse.StatusCode
435 func (r DeleteOnboardedInvokersOnboardingIdResponse) StatusCode() int {
436 if r.HTTPResponse != nil {
437 return r.HTTPResponse.StatusCode
442 type ModifyIndApiInvokeEnrolmentResponse struct {
444 HTTPResponse *http.Response
445 JSON200 *APIInvokerEnrolmentDetails
448 // Status returns HTTPResponse.Status
449 func (r ModifyIndApiInvokeEnrolmentResponse) Status() string {
450 if r.HTTPResponse != nil {
451 return r.HTTPResponse.Status
453 return http.StatusText(0)
456 // StatusCode returns HTTPResponse.StatusCode
457 func (r ModifyIndApiInvokeEnrolmentResponse) StatusCode() int {
458 if r.HTTPResponse != nil {
459 return r.HTTPResponse.StatusCode
464 type PutOnboardedInvokersOnboardingIdResponse struct {
466 HTTPResponse *http.Response
467 JSON200 *APIInvokerEnrolmentDetails
470 // Status returns HTTPResponse.Status
471 func (r PutOnboardedInvokersOnboardingIdResponse) Status() string {
472 if r.HTTPResponse != nil {
473 return r.HTTPResponse.Status
475 return http.StatusText(0)
478 // StatusCode returns HTTPResponse.StatusCode
479 func (r PutOnboardedInvokersOnboardingIdResponse) StatusCode() int {
480 if r.HTTPResponse != nil {
481 return r.HTTPResponse.StatusCode
486 // PostOnboardedInvokersWithBodyWithResponse request with arbitrary body returning *PostOnboardedInvokersResponse
487 func (c *ClientWithResponses) PostOnboardedInvokersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostOnboardedInvokersResponse, error) {
488 rsp, err := c.PostOnboardedInvokersWithBody(ctx, contentType, body, reqEditors...)
492 return ParsePostOnboardedInvokersResponse(rsp)
495 func (c *ClientWithResponses) PostOnboardedInvokersWithResponse(ctx context.Context, body PostOnboardedInvokersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostOnboardedInvokersResponse, error) {
496 rsp, err := c.PostOnboardedInvokers(ctx, body, reqEditors...)
500 return ParsePostOnboardedInvokersResponse(rsp)
503 // DeleteOnboardedInvokersOnboardingIdWithResponse request returning *DeleteOnboardedInvokersOnboardingIdResponse
504 func (c *ClientWithResponses) DeleteOnboardedInvokersOnboardingIdWithResponse(ctx context.Context, onboardingId string, reqEditors ...RequestEditorFn) (*DeleteOnboardedInvokersOnboardingIdResponse, error) {
505 rsp, err := c.DeleteOnboardedInvokersOnboardingId(ctx, onboardingId, reqEditors...)
509 return ParseDeleteOnboardedInvokersOnboardingIdResponse(rsp)
512 // ModifyIndApiInvokeEnrolmentWithBodyWithResponse request with arbitrary body returning *ModifyIndApiInvokeEnrolmentResponse
513 func (c *ClientWithResponses) ModifyIndApiInvokeEnrolmentWithBodyWithResponse(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ModifyIndApiInvokeEnrolmentResponse, error) {
514 rsp, err := c.ModifyIndApiInvokeEnrolmentWithBody(ctx, onboardingId, contentType, body, reqEditors...)
518 return ParseModifyIndApiInvokeEnrolmentResponse(rsp)
521 // PutOnboardedInvokersOnboardingIdWithBodyWithResponse request with arbitrary body returning *PutOnboardedInvokersOnboardingIdResponse
522 func (c *ClientWithResponses) PutOnboardedInvokersOnboardingIdWithBodyWithResponse(ctx context.Context, onboardingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutOnboardedInvokersOnboardingIdResponse, error) {
523 rsp, err := c.PutOnboardedInvokersOnboardingIdWithBody(ctx, onboardingId, contentType, body, reqEditors...)
527 return ParsePutOnboardedInvokersOnboardingIdResponse(rsp)
530 func (c *ClientWithResponses) PutOnboardedInvokersOnboardingIdWithResponse(ctx context.Context, onboardingId string, body PutOnboardedInvokersOnboardingIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutOnboardedInvokersOnboardingIdResponse, error) {
531 rsp, err := c.PutOnboardedInvokersOnboardingId(ctx, onboardingId, body, reqEditors...)
535 return ParsePutOnboardedInvokersOnboardingIdResponse(rsp)
538 // ParsePostOnboardedInvokersResponse parses an HTTP response from a PostOnboardedInvokersWithResponse call
539 func ParsePostOnboardedInvokersResponse(rsp *http.Response) (*PostOnboardedInvokersResponse, error) {
540 bodyBytes, err := ioutil.ReadAll(rsp.Body)
541 defer func() { _ = rsp.Body.Close() }()
546 response := &PostOnboardedInvokersResponse{
552 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201:
553 var dest APIInvokerEnrolmentDetails
554 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
557 response.JSON201 = &dest
564 // ParseDeleteOnboardedInvokersOnboardingIdResponse parses an HTTP response from a DeleteOnboardedInvokersOnboardingIdWithResponse call
565 func ParseDeleteOnboardedInvokersOnboardingIdResponse(rsp *http.Response) (*DeleteOnboardedInvokersOnboardingIdResponse, error) {
566 bodyBytes, err := ioutil.ReadAll(rsp.Body)
567 defer func() { _ = rsp.Body.Close() }()
572 response := &DeleteOnboardedInvokersOnboardingIdResponse{
580 // ParseModifyIndApiInvokeEnrolmentResponse parses an HTTP response from a ModifyIndApiInvokeEnrolmentWithResponse call
581 func ParseModifyIndApiInvokeEnrolmentResponse(rsp *http.Response) (*ModifyIndApiInvokeEnrolmentResponse, error) {
582 bodyBytes, err := ioutil.ReadAll(rsp.Body)
583 defer func() { _ = rsp.Body.Close() }()
588 response := &ModifyIndApiInvokeEnrolmentResponse{
594 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
595 var dest APIInvokerEnrolmentDetails
596 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
599 response.JSON200 = &dest
606 // ParsePutOnboardedInvokersOnboardingIdResponse parses an HTTP response from a PutOnboardedInvokersOnboardingIdWithResponse call
607 func ParsePutOnboardedInvokersOnboardingIdResponse(rsp *http.Response) (*PutOnboardedInvokersOnboardingIdResponse, error) {
608 bodyBytes, err := ioutil.ReadAll(rsp.Body)
609 defer func() { _ = rsp.Body.Close() }()
614 response := &PutOnboardedInvokersOnboardingIdResponse{
620 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
621 var dest APIInvokerEnrolmentDetails
622 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
625 response.JSON200 = &dest