X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=servicemanager%2Finternal%2Fpublishserviceapi%2Fpublishserviceapi-client.gen.go;fp=servicemanager%2Finternal%2Fpublishserviceapi%2Fpublishserviceapi-client.gen.go;h=363fbf46cc8f68b009634235bd2d4135d2743d8b;hb=cbac30ac2136aebbc76a69f197a782ab94d083e8;hp=0000000000000000000000000000000000000000;hpb=8ff4d0377ccd9b3c10bc9fb247b7136bba3eb6d7;p=nonrtric%2Fplt%2Fsme.git diff --git a/servicemanager/internal/publishserviceapi/publishserviceapi-client.gen.go b/servicemanager/internal/publishserviceapi/publishserviceapi-client.gen.go new file mode 100644 index 0000000..363fbf4 --- /dev/null +++ b/servicemanager/internal/publishserviceapi/publishserviceapi-client.gen.go @@ -0,0 +1,883 @@ +// Package publishserviceapi provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT. +package publishserviceapi + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/deepmap/oapi-codegen/pkg/runtime" +) + +// 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 { + // GetApfIdServiceApis request + GetApfIdServiceApis(ctx context.Context, apfId string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostApfIdServiceApis request with any body + PostApfIdServiceApisWithBody(ctx context.Context, apfId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PostApfIdServiceApis(ctx context.Context, apfId string, body PostApfIdServiceApisJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteApfIdServiceApisServiceApiId request + DeleteApfIdServiceApisServiceApiId(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetApfIdServiceApisServiceApiId request + GetApfIdServiceApisServiceApiId(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ModifyIndAPFPubAPI request with any body + ModifyIndAPFPubAPIWithBody(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PutApfIdServiceApisServiceApiId request with any body + PutApfIdServiceApisServiceApiIdWithBody(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PutApfIdServiceApisServiceApiId(ctx context.Context, apfId string, serviceApiId string, body PutApfIdServiceApisServiceApiIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) +} + +func (c *Client) GetApfIdServiceApis(ctx context.Context, apfId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetApfIdServiceApisRequest(c.Server, apfId) + 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) PostApfIdServiceApisWithBody(ctx context.Context, apfId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostApfIdServiceApisRequestWithBody(c.Server, apfId, 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) PostApfIdServiceApis(ctx context.Context, apfId string, body PostApfIdServiceApisJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostApfIdServiceApisRequest(c.Server, apfId, 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) DeleteApfIdServiceApisServiceApiId(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteApfIdServiceApisServiceApiIdRequest(c.Server, apfId, serviceApiId) + 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) GetApfIdServiceApisServiceApiId(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetApfIdServiceApisServiceApiIdRequest(c.Server, apfId, serviceApiId) + 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) ModifyIndAPFPubAPIWithBody(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewModifyIndAPFPubAPIRequestWithBody(c.Server, apfId, serviceApiId, 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) PutApfIdServiceApisServiceApiIdWithBody(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutApfIdServiceApisServiceApiIdRequestWithBody(c.Server, apfId, serviceApiId, 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) PutApfIdServiceApisServiceApiId(ctx context.Context, apfId string, serviceApiId string, body PutApfIdServiceApisServiceApiIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutApfIdServiceApisServiceApiIdRequest(c.Server, apfId, serviceApiId, 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) +} + +// NewGetApfIdServiceApisRequest generates requests for GetApfIdServiceApis +func NewGetApfIdServiceApisRequest(server string, apfId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "apfId", runtime.ParamLocationPath, apfId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/%s/service-apis", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostApfIdServiceApisRequest calls the generic PostApfIdServiceApis builder with application/json body +func NewPostApfIdServiceApisRequest(server string, apfId string, body PostApfIdServiceApisJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPostApfIdServiceApisRequestWithBody(server, apfId, "application/json", bodyReader) +} + +// NewPostApfIdServiceApisRequestWithBody generates requests for PostApfIdServiceApis with any type of body +func NewPostApfIdServiceApisRequestWithBody(server string, apfId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "apfId", runtime.ParamLocationPath, apfId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/%s/service-apis", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewDeleteApfIdServiceApisServiceApiIdRequest generates requests for DeleteApfIdServiceApisServiceApiId +func NewDeleteApfIdServiceApisServiceApiIdRequest(server string, apfId string, serviceApiId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "apfId", runtime.ParamLocationPath, apfId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, serviceApiId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/%s/service-apis/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetApfIdServiceApisServiceApiIdRequest generates requests for GetApfIdServiceApisServiceApiId +func NewGetApfIdServiceApisServiceApiIdRequest(server string, apfId string, serviceApiId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "apfId", runtime.ParamLocationPath, apfId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, serviceApiId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/%s/service-apis/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewModifyIndAPFPubAPIRequestWithBody generates requests for ModifyIndAPFPubAPI with any type of body +func NewModifyIndAPFPubAPIRequestWithBody(server string, apfId string, serviceApiId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "apfId", runtime.ParamLocationPath, apfId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, serviceApiId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/%s/service-apis/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PATCH", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewPutApfIdServiceApisServiceApiIdRequest calls the generic PutApfIdServiceApisServiceApiId builder with application/json body +func NewPutApfIdServiceApisServiceApiIdRequest(server string, apfId string, serviceApiId string, body PutApfIdServiceApisServiceApiIdJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPutApfIdServiceApisServiceApiIdRequestWithBody(server, apfId, serviceApiId, "application/json", bodyReader) +} + +// NewPutApfIdServiceApisServiceApiIdRequestWithBody generates requests for PutApfIdServiceApisServiceApiId with any type of body +func NewPutApfIdServiceApisServiceApiIdRequestWithBody(server string, apfId string, serviceApiId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "apfId", runtime.ParamLocationPath, apfId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, serviceApiId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/%s/service-apis/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PUT", 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 { + // GetApfIdServiceApis request + GetApfIdServiceApisWithResponse(ctx context.Context, apfId string, reqEditors ...RequestEditorFn) (*GetApfIdServiceApisResponse, error) + + // PostApfIdServiceApis request with any body + PostApfIdServiceApisWithBodyWithResponse(ctx context.Context, apfId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApfIdServiceApisResponse, error) + + PostApfIdServiceApisWithResponse(ctx context.Context, apfId string, body PostApfIdServiceApisJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApfIdServiceApisResponse, error) + + // DeleteApfIdServiceApisServiceApiId request + DeleteApfIdServiceApisServiceApiIdWithResponse(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*DeleteApfIdServiceApisServiceApiIdResponse, error) + + // GetApfIdServiceApisServiceApiId request + GetApfIdServiceApisServiceApiIdWithResponse(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*GetApfIdServiceApisServiceApiIdResponse, error) + + // ModifyIndAPFPubAPI request with any body + ModifyIndAPFPubAPIWithBodyWithResponse(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ModifyIndAPFPubAPIResponse, error) + + // PutApfIdServiceApisServiceApiId request with any body + PutApfIdServiceApisServiceApiIdWithBodyWithResponse(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApfIdServiceApisServiceApiIdResponse, error) + + PutApfIdServiceApisServiceApiIdWithResponse(ctx context.Context, apfId string, serviceApiId string, body PutApfIdServiceApisServiceApiIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApfIdServiceApisServiceApiIdResponse, error) +} + +type GetApfIdServiceApisResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *[]ServiceAPIDescription +} + +// Status returns HTTPResponse.Status +func (r GetApfIdServiceApisResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApfIdServiceApisResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostApfIdServiceApisResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *ServiceAPIDescription +} + +// Status returns HTTPResponse.Status +func (r PostApfIdServiceApisResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostApfIdServiceApisResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteApfIdServiceApisServiceApiIdResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r DeleteApfIdServiceApisServiceApiIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteApfIdServiceApisServiceApiIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetApfIdServiceApisServiceApiIdResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ServiceAPIDescription +} + +// Status returns HTTPResponse.Status +func (r GetApfIdServiceApisServiceApiIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetApfIdServiceApisServiceApiIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type ModifyIndAPFPubAPIResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ServiceAPIDescription +} + +// Status returns HTTPResponse.Status +func (r ModifyIndAPFPubAPIResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ModifyIndAPFPubAPIResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PutApfIdServiceApisServiceApiIdResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ServiceAPIDescription +} + +// Status returns HTTPResponse.Status +func (r PutApfIdServiceApisServiceApiIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PutApfIdServiceApisServiceApiIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// GetApfIdServiceApisWithResponse request returning *GetApfIdServiceApisResponse +func (c *ClientWithResponses) GetApfIdServiceApisWithResponse(ctx context.Context, apfId string, reqEditors ...RequestEditorFn) (*GetApfIdServiceApisResponse, error) { + rsp, err := c.GetApfIdServiceApis(ctx, apfId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApfIdServiceApisResponse(rsp) +} + +// PostApfIdServiceApisWithBodyWithResponse request with arbitrary body returning *PostApfIdServiceApisResponse +func (c *ClientWithResponses) PostApfIdServiceApisWithBodyWithResponse(ctx context.Context, apfId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApfIdServiceApisResponse, error) { + rsp, err := c.PostApfIdServiceApisWithBody(ctx, apfId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApfIdServiceApisResponse(rsp) +} + +func (c *ClientWithResponses) PostApfIdServiceApisWithResponse(ctx context.Context, apfId string, body PostApfIdServiceApisJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApfIdServiceApisResponse, error) { + rsp, err := c.PostApfIdServiceApis(ctx, apfId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostApfIdServiceApisResponse(rsp) +} + +// DeleteApfIdServiceApisServiceApiIdWithResponse request returning *DeleteApfIdServiceApisServiceApiIdResponse +func (c *ClientWithResponses) DeleteApfIdServiceApisServiceApiIdWithResponse(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*DeleteApfIdServiceApisServiceApiIdResponse, error) { + rsp, err := c.DeleteApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteApfIdServiceApisServiceApiIdResponse(rsp) +} + +// GetApfIdServiceApisServiceApiIdWithResponse request returning *GetApfIdServiceApisServiceApiIdResponse +func (c *ClientWithResponses) GetApfIdServiceApisServiceApiIdWithResponse(ctx context.Context, apfId string, serviceApiId string, reqEditors ...RequestEditorFn) (*GetApfIdServiceApisServiceApiIdResponse, error) { + rsp, err := c.GetApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetApfIdServiceApisServiceApiIdResponse(rsp) +} + +// ModifyIndAPFPubAPIWithBodyWithResponse request with arbitrary body returning *ModifyIndAPFPubAPIResponse +func (c *ClientWithResponses) ModifyIndAPFPubAPIWithBodyWithResponse(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ModifyIndAPFPubAPIResponse, error) { + rsp, err := c.ModifyIndAPFPubAPIWithBody(ctx, apfId, serviceApiId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseModifyIndAPFPubAPIResponse(rsp) +} + +// PutApfIdServiceApisServiceApiIdWithBodyWithResponse request with arbitrary body returning *PutApfIdServiceApisServiceApiIdResponse +func (c *ClientWithResponses) PutApfIdServiceApisServiceApiIdWithBodyWithResponse(ctx context.Context, apfId string, serviceApiId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApfIdServiceApisServiceApiIdResponse, error) { + rsp, err := c.PutApfIdServiceApisServiceApiIdWithBody(ctx, apfId, serviceApiId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutApfIdServiceApisServiceApiIdResponse(rsp) +} + +func (c *ClientWithResponses) PutApfIdServiceApisServiceApiIdWithResponse(ctx context.Context, apfId string, serviceApiId string, body PutApfIdServiceApisServiceApiIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApfIdServiceApisServiceApiIdResponse, error) { + rsp, err := c.PutApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePutApfIdServiceApisServiceApiIdResponse(rsp) +} + +// ParseGetApfIdServiceApisResponse parses an HTTP response from a GetApfIdServiceApisWithResponse call +func ParseGetApfIdServiceApisResponse(rsp *http.Response) (*GetApfIdServiceApisResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetApfIdServiceApisResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []ServiceAPIDescription + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParsePostApfIdServiceApisResponse parses an HTTP response from a PostApfIdServiceApisWithResponse call +func ParsePostApfIdServiceApisResponse(rsp *http.Response) (*PostApfIdServiceApisResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostApfIdServiceApisResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest ServiceAPIDescription + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + } + + return response, nil +} + +// ParseDeleteApfIdServiceApisServiceApiIdResponse parses an HTTP response from a DeleteApfIdServiceApisServiceApiIdWithResponse call +func ParseDeleteApfIdServiceApisServiceApiIdResponse(rsp *http.Response) (*DeleteApfIdServiceApisServiceApiIdResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeleteApfIdServiceApisServiceApiIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseGetApfIdServiceApisServiceApiIdResponse parses an HTTP response from a GetApfIdServiceApisServiceApiIdWithResponse call +func ParseGetApfIdServiceApisServiceApiIdResponse(rsp *http.Response) (*GetApfIdServiceApisServiceApiIdResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetApfIdServiceApisServiceApiIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ServiceAPIDescription + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseModifyIndAPFPubAPIResponse parses an HTTP response from a ModifyIndAPFPubAPIWithResponse call +func ParseModifyIndAPFPubAPIResponse(rsp *http.Response) (*ModifyIndAPFPubAPIResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ModifyIndAPFPubAPIResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ServiceAPIDescription + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParsePutApfIdServiceApisServiceApiIdResponse parses an HTTP response from a PutApfIdServiceApisServiceApiIdWithResponse call +func ParsePutApfIdServiceApisServiceApiIdResponse(rsp *http.Response) (*PutApfIdServiceApisServiceApiIdResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PutApfIdServiceApisServiceApiIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ServiceAPIDescription + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +}