Files
sdk/api_author.go

669 lines
24 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
)
// AuthorAPIService AuthorAPI service
type AuthorAPIService service
type AuthorAPIGetAuthorRequest struct {
ctx context.Context
ApiService *AuthorAPIService
}
func (r AuthorAPIGetAuthorRequest) Execute() (map[string]interface{}, *http.Response, error) {
return r.ApiService.GetAuthorExecute(r)
}
/*
GetAuthor Returns the caller's author-program dashboard: enrolment status, linked forge login, verified repositories and owner-wide claims, recorded deploys, accrued / pending / paid royalty, and the payout history.
Returns the caller's author-program dashboard: enrolment status,
linked forge login, verified repositories and owner-wide claims, recorded deploys,
accrued / pending / paid royalty, and the payout history.
It answers ONE OF TWO SHAPES from this address. An org that has never connected
gets {"isAuthor": false, "defaultShareBps", "badgeBase"} — an honest "not enrolled"
rather than a 404, so the console can render the connect form. An enrolled org gets
the dashboard: isAuthor, id, status, githubLogin, verified, verifyCode, verifyFile,
verifySnippet, shareBps, badgeBase, repos, orgs, deploys, accruedCents,
pendingCents, paidCents, payouts and ledger.
For an APPROVED author this read ALSO runs the accrual sweep opportunistically, so
the dashboard is self-updating. That is why the royalty AUDIT lives at its own
address: an audit must not move the money it is auditing.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return AuthorAPIGetAuthorRequest
*/
func (a *AuthorAPIService) GetAuthor(ctx context.Context) AuthorAPIGetAuthorRequest {
return AuthorAPIGetAuthorRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return map[string]interface{}
func (a *AuthorAPIService) GetAuthorExecute(r AuthorAPIGetAuthorRequest) (map[string]interface{}, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue map[string]interface{}
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorAPIService.GetAuthor")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/author"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type AuthorAPIGetAuthorBasisRequest struct {
ctx context.Context
ApiService *AuthorAPIService
period *string
}
// Period is the UTC accrual month, YYYY-MM. Empty means every period; any other shape is refused with 400, because the period is echoed back and used as a SQL filter and is only ever accepted in the one form the accrual latch mints.
func (r AuthorAPIGetAuthorBasisRequest) Period(period string) AuthorAPIGetAuthorBasisRequest {
r.period = &period
return r
}
func (r AuthorAPIGetAuthorBasisRequest) Execute() (map[string]interface{}, *http.Response, error) {
return r.ApiService.GetAuthorBasisExecute(r)
}
/*
GetAuthorBasis Returns the AUDIT TRAIL behind the caller's own royalty: every ledger row with the spend it was computed from, the share applied at the time, the platform's matching half, whether each row satisfies the formula, and the attribution edges that already existed when the row was written.
Returns the AUDIT TRAIL behind the caller's own royalty: every
ledger row with the spend it was computed from, the share applied at the time, the
platform's matching half, whether each row satisfies the formula, and the
attribution edges that already existed when the row was written.
It answers ONE OF TWO SHAPES. An org that has never connected gets
{"isAuthor": false, "defaultShareBps"} — never a 404, which would answer "is this
org an author?" for anyone who asked. An enrolled org gets the basis: isAuthor, id,
status, asOf, shareBps, platformShareBps, defaultShareBps, shareSource, settlesTo,
method (the formula, the rate card and the sizing), ledger, reconciliation, window,
and period when one was requested.
This read NEVER sweeps, and that is the point of it being a separate address from
the dashboard: an audit must not move the money it is auditing, so calling it N
times leaves the balances and the ledger byte-identical.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return AuthorAPIGetAuthorBasisRequest
*/
func (a *AuthorAPIService) GetAuthorBasis(ctx context.Context) AuthorAPIGetAuthorBasisRequest {
return AuthorAPIGetAuthorBasisRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return map[string]interface{}
func (a *AuthorAPIService) GetAuthorBasisExecute(r AuthorAPIGetAuthorBasisRequest) (map[string]interface{}, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue map[string]interface{}
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorAPIService.GetAuthorBasis")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/author/basis"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.period != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "period", r.period, "form", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type AuthorAPIPostAuthorConnectRequest struct {
ctx context.Context
ApiService *AuthorAPIService
authorConnectRequest *AuthorConnectRequest
}
func (r AuthorAPIPostAuthorConnectRequest) AuthorConnectRequest(authorConnectRequest AuthorConnectRequest) AuthorAPIPostAuthorConnectRequest {
r.authorConnectRequest = &authorConnectRequest
return r
}
func (r AuthorAPIPostAuthorConnectRequest) Execute() (*AuthorEnrolment, *http.Response, error) {
return r.ApiService.PostAuthorConnectExecute(r)
}
/*
PostAuthorConnect Enrols the caller's org in the author program at status \"connected\" and returns its enrolment, including the verify code the file method needs.
Enrols the caller's org in the author program at status "connected"
and returns its enrolment, including the verify code the file method needs. It is
IDEMPOTENT: a second call returns the same enrolment rather than a conflict.
The forge login is taken from IAM's LINKED account for the provider when there is
one — that is identity proof, not a claim — and only otherwise from the login in
the body, which then has to be proven per repository. Connecting does not admit an
org to earning: a platform reviewer approves that separately.
Answers 201 when it enrolled the org and 200 when it found an existing enrolment.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return AuthorAPIPostAuthorConnectRequest
*/
func (a *AuthorAPIService) PostAuthorConnect(ctx context.Context) AuthorAPIPostAuthorConnectRequest {
return AuthorAPIPostAuthorConnectRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return AuthorEnrolment
func (a *AuthorAPIService) PostAuthorConnectExecute(r AuthorAPIPostAuthorConnectRequest) (*AuthorEnrolment, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *AuthorEnrolment
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorAPIService.PostAuthorConnect")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/author/connect"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.authorConnectRequest == nil {
return localVarReturnValue, nil, reportError("authorConnectRequest is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.authorConnectRequest
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type AuthorAPIPostAuthorDeploysRecordRequest struct {
ctx context.Context
ApiService *AuthorAPIService
authorDeployRequest *AuthorDeployRequest
}
func (r AuthorAPIPostAuthorDeploysRecordRequest) AuthorDeployRequest(authorDeployRequest AuthorDeployRequest) AuthorAPIPostAuthorDeploysRecordRequest {
r.authorDeployRequest = &authorDeployRequest
return r
}
func (r AuthorAPIPostAuthorDeploysRecordRequest) Execute() (*AuthorDeployRecord, *http.Response, error) {
return r.ApiService.PostAuthorDeploysRecordExecute(r)
}
/*
PostAuthorDeploysRecord Records that the caller's org deployed a project built from a source repository, which is the edge that makes an author's work earn royalty.
Records that the caller's org deployed a project built from a
source repository, which is the edge that makes an author's work earn royalty.
It is deliberately NOT an error for a deploy to attribute to nobody: a project
built from no repository, or from one no author has verified, answers
{"recorded": false, "reason"} so a deploy pipeline can fire this on every deploy
without branching. Attribution resolves per-repository first, then owner-wide, so a
repository with its own claim always earns for its own author.
A deploy of a Hanzo-maintained template attributes to the platform treasury, and a
self-deploy (the author's own org deploying its own repository) is recorded for
provenance but excluded from accrual. The edge is idempotent per
repository+project+org.
Answers 201 when it recorded a new edge and 200 otherwise.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return AuthorAPIPostAuthorDeploysRecordRequest
*/
func (a *AuthorAPIService) PostAuthorDeploysRecord(ctx context.Context) AuthorAPIPostAuthorDeploysRecordRequest {
return AuthorAPIPostAuthorDeploysRecordRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return AuthorDeployRecord
func (a *AuthorAPIService) PostAuthorDeploysRecordExecute(r AuthorAPIPostAuthorDeploysRecordRequest) (*AuthorDeployRecord, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *AuthorDeployRecord
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorAPIService.PostAuthorDeploysRecord")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/author/deploys/record"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.authorDeployRequest == nil {
return localVarReturnValue, nil, reportError("authorDeployRequest is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.authorDeployRequest
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type AuthorAPIPostAuthorReposVerifyRequest struct {
ctx context.Context
ApiService *AuthorAPIService
authorVerifyRequest *AuthorVerifyRequest
}
func (r AuthorAPIPostAuthorReposVerifyRequest) AuthorVerifyRequest(authorVerifyRequest AuthorVerifyRequest) AuthorAPIPostAuthorReposVerifyRequest {
r.authorVerifyRequest = &authorVerifyRequest
return r
}
func (r AuthorAPIPostAuthorReposVerifyRequest) Execute() (*AuthorClaim, *http.Response, error) {
return r.ApiService.PostAuthorReposVerifyExecute(r)
}
/*
PostAuthorReposVerify Proves that the caller owns a repository — or a whole OWNER — and records the claim, which is what makes deploys of that code earn royalty.
Proves that the caller owns a repository — or a whole OWNER — and
records the claim, which is what makes deploys of that code earn royalty.
Ownership is proven the SAME two ways in both cases, tried in order: an IAM-linked
forge token with admin or push permission, or a hanzo.json on the default branch
carrying the author's verify code. Claiming an OWNER proves it against that
owner's ".github" control repository, and is exactly as strong as a per-repository
claim — an owner the caller cannot prove is refused with 422, never assumed.
A per-repository claim wins over an owner-wide one, so a specifically-claimed
repository always earns for its own author. A repository another author has
already verified is a 409. The org must have connected first.
Answers 201 when it recorded a new claim and 200 when the claim already existed.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return AuthorAPIPostAuthorReposVerifyRequest
*/
func (a *AuthorAPIService) PostAuthorReposVerify(ctx context.Context) AuthorAPIPostAuthorReposVerifyRequest {
return AuthorAPIPostAuthorReposVerifyRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return AuthorClaim
func (a *AuthorAPIService) PostAuthorReposVerifyExecute(r AuthorAPIPostAuthorReposVerifyRequest) (*AuthorClaim, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *AuthorClaim
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorAPIService.PostAuthorReposVerify")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/author/repos/verify"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.authorVerifyRequest == nil {
return localVarReturnValue, nil, reportError("authorVerifyRequest is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.authorVerifyRequest
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}