Files
sdk/api_standing.go

149 lines
4.9 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"
)
// StandingAPIService StandingAPI service
type StandingAPIService service
type StandingAPIPostStandingUpkeepRequest struct {
ctx context.Context
ApiService *StandingAPIService
standingUpkeepIn *StandingUpkeepIn
}
func (r StandingAPIPostStandingUpkeepRequest) StandingUpkeepIn(standingUpkeepIn StandingUpkeepIn) StandingAPIPostStandingUpkeepRequest {
r.standingUpkeepIn = &standingUpkeepIn
return r
}
func (r StandingAPIPostStandingUpkeepRequest) Execute() (*StandingUpkeep, *http.Response, error) {
return r.ApiService.PostStandingUpkeepExecute(r)
}
/*
PostStandingUpkeep Reports what keeping this entity costs every year, itemised.
Reports what keeping this entity costs every year, itemised.
This is the figure that decides where to incorporate, and the one a formation
price cannot show: Delaware is cheaper to form than Wyoming for a corporation
and dearer to keep, so a founder shown only the formation fee is shown the half
that reverses. Each state line carries the authority that publishes it and the
date it was checked, and a franchise tax that scales is marked a minimum rather
than quoted as final.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return StandingAPIPostStandingUpkeepRequest
*/
func (a *StandingAPIService) PostStandingUpkeep(ctx context.Context) StandingAPIPostStandingUpkeepRequest {
return StandingAPIPostStandingUpkeepRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return StandingUpkeep
func (a *StandingAPIService) PostStandingUpkeepExecute(r StandingAPIPostStandingUpkeepRequest) (*StandingUpkeep, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *StandingUpkeep
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StandingAPIService.PostStandingUpkeep")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/standing/upkeep"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.standingUpkeepIn == nil {
return localVarReturnValue, nil, reportError("standingUpkeepIn 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.standingUpkeepIn
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
}