Files
sdk/api_domain.go

927 lines
33 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"
)
// DomainAPIService DomainAPI service
type DomainAPIService service
type DomainAPIGetDomainAvailabilityRequest struct {
ctx context.Context
ApiService *DomainAPIService
domain *string
}
// Domain is one name, or several comma-separated, to check in one call. Names are lowercased. It is required.
func (r DomainAPIGetDomainAvailabilityRequest) Domain(domain string) DomainAPIGetDomainAvailabilityRequest {
r.domain = &domain
return r
}
func (r DomainAPIGetDomainAvailabilityRequest) Execute() (*DomainQuoteList, *http.Response, error) {
return r.ApiService.GetDomainAvailabilityExecute(r)
}
/*
GetDomainAvailability Checks exact names rather than searching for them, and answers the same quote shape search does — purchasable, premium, first-term and renewal price in cents.
Checks exact names rather than searching for them, and answers the
same quote shape search does — purchasable, premium, first-term and renewal price
in cents.
It requires a validated principal; 401 without one. Nothing is charged and
nothing is held. A deployment with no registrar credentials answers 503.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return DomainAPIGetDomainAvailabilityRequest
*/
func (a *DomainAPIService) GetDomainAvailability(ctx context.Context) DomainAPIGetDomainAvailabilityRequest {
return DomainAPIGetDomainAvailabilityRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return DomainQuoteList
func (a *DomainAPIService) GetDomainAvailabilityExecute(r DomainAPIGetDomainAvailabilityRequest) (*DomainQuoteList, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *DomainQuoteList
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DomainAPIService.GetDomainAvailability")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/domain/availability"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.domain == nil {
return localVarReturnValue, nil, reportError("domain is required and must be specified")
}
parameterAddToHeaderOrQuery(localVarQueryParams, "domain", r.domain, "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 DomainAPIGetDomainDomainsRequest struct {
ctx context.Context
ApiService *DomainAPIService
}
func (r DomainAPIGetDomainDomainsRequest) Execute() (*DomainHoldings, *http.Response, error) {
return r.ApiService.GetDomainDomainsExecute(r)
}
/*
GetDomainDomains Is the domains your org has bought here, newest registration first, each carrying the name, when it was registered, when it expires, what the org paid, the registrar order id and the nameservers it points at.
Is the domains your org has bought here, newest registration first, each
carrying the name, when it was registered, when it expires, what the org paid,
the registrar order id and the nameservers it points at.
Scoped to the validated principal's org — 401 without one, and there is no
parameter that reaches another org's holdings.
This is the deployment's OWN ownership record, not a query to the registrar: it
lists what was bought THROUGH this surface, so a domain the org holds elsewhere
is not here. The default store is in-process, so a deployment that has not
swapped in a durable store answers from what this process registered.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return DomainAPIGetDomainDomainsRequest
*/
func (a *DomainAPIService) GetDomainDomains(ctx context.Context) DomainAPIGetDomainDomainsRequest {
return DomainAPIGetDomainDomainsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return DomainHoldings
func (a *DomainAPIService) GetDomainDomainsExecute(r DomainAPIGetDomainDomainsRequest) (*DomainHoldings, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *DomainHoldings
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DomainAPIService.GetDomainDomains")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/domain/domains"
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 DomainAPIGetDomainHealthRequest struct {
ctx context.Context
ApiService *DomainAPIService
}
func (r DomainAPIGetDomainHealthRequest) Execute() (*DomainReachability, *http.Response, error) {
return r.ApiService.GetDomainHealthExecute(r)
}
/*
GetDomainHealth Reports registrar reachability honestly: ok only when the wholesale credentials are present AND name.com accepted them on a live call made while you waited.
Reports registrar reachability honestly: ok only when the wholesale
credentials are present AND name.com accepted them on a live call made while you
waited.
Missing credentials or an unreachable registrar is 503 carrying configured,
reachable and the reason, so an operator reads the blocker instead of guessing at
it. It takes no principal, like every subsystem health probe.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return DomainAPIGetDomainHealthRequest
*/
func (a *DomainAPIService) GetDomainHealth(ctx context.Context) DomainAPIGetDomainHealthRequest {
return DomainAPIGetDomainHealthRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return DomainReachability
func (a *DomainAPIService) GetDomainHealthExecute(r DomainAPIGetDomainHealthRequest) (*DomainReachability, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *DomainReachability
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DomainAPIService.GetDomainHealth")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/domain/health"
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,
}
if localVarHTTPResponse.StatusCode == 503 {
var v DomainReachability
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
}
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 DomainAPIGetDomainSearchRequest struct {
ctx context.Context
ApiService *DomainAPIService
q *string
tld *string
}
// Q is the keyword to build names from. It is required.
func (r DomainAPIGetDomainSearchRequest) Q(q string) DomainAPIGetDomainSearchRequest {
r.q = &q
return r
}
// TLD narrows the search to a comma-separated set of top-level domains.
func (r DomainAPIGetDomainSearchRequest) Tld(tld string) DomainAPIGetDomainSearchRequest {
r.tld = &tld
return r
}
func (r DomainAPIGetDomainSearchRequest) Execute() (*DomainQuoteList, *http.Response, error) {
return r.ApiService.GetDomainSearchExecute(r)
}
/*
GetDomainSearch Finds names built from the keyword q, plus the registrar's alternate-TLD suggestions, and answers a quote for each: the name, whether it is purchasable, whether it is premium, the first-term and renewal price in cents, and the TLD.
Finds names built from the keyword q, plus the registrar's alternate-TLD
suggestions, and answers a quote for each: the name, whether it is purchasable,
whether it is premium, the first-term and renewal price in cents, and the TLD.
Prices are RETAIL — this deployment's markup is already applied and the wholesale
cost is never on the wire.
It requires a validated principal; 401 without one. Nothing is charged and
nothing is held — a quote is not a reservation, and the price is re-quoted at
purchase, so a name quoted here can be gone or dearer by the time you buy it. A
deployment with no registrar credentials answers 503.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return DomainAPIGetDomainSearchRequest
*/
func (a *DomainAPIService) GetDomainSearch(ctx context.Context) DomainAPIGetDomainSearchRequest {
return DomainAPIGetDomainSearchRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return DomainQuoteList
func (a *DomainAPIService) GetDomainSearchExecute(r DomainAPIGetDomainSearchRequest) (*DomainQuoteList, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *DomainQuoteList
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DomainAPIService.GetDomainSearch")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/domain/search"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.q == nil {
return localVarReturnValue, nil, reportError("q is required and must be specified")
}
parameterAddToHeaderOrQuery(localVarQueryParams, "q", r.q, "form", "")
if r.tld != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "tld", r.tld, "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 DomainAPIPostDomainRegisterRequest struct {
ctx context.Context
ApiService *DomainAPIService
domainOrder *DomainOrder
}
func (r DomainAPIPostDomainRegisterRequest) DomainOrder(domainOrder DomainOrder) DomainAPIPostDomainRegisterRequest {
r.domainOrder = &domainOrder
return r
}
func (r DomainAPIPostDomainRegisterRequest) Execute() (*DomainRegisterResult, *http.Response, error) {
return r.ApiService.PostDomainRegisterExecute(r)
}
/*
PostDomainRegister Buys a domain for your org and answers the ownership record together with the quote it was bought at.
Buys a domain for your org and answers the ownership record together
with the quote it was bought at.
The order of operations is the product guarantee: quote, refuse anything
unpurchasable or unpriced, AUTHORIZE the org's prepaid balance, provision the
authoritative zone in Hanzo DNS, register at the registrar already pointing at
Hanzo's nameservers, and only then CAPTURE the charge and record ownership. A
registrar failure therefore leaves the balance untouched — the org is never
billed for a domain it did not get.
It requires a validated principal; that principal's org owns the domain and is
the ledger the charge lands on. Re-buying a name the org already holds is 409,
not a second purchase.
Refusals are distinct on purpose: 402 when the prepaid balance cannot cover the
quoted price, 409 when the name is not available, 503 when the deployment has no
registrar credentials, and the registrar's own message with its own 4xx — or 502
for its 5xx — when it rejects the purchase. Zone provisioning is best-effort: if
the zone service is down the domain is still registered against Hanzo's
nameservers and the zone reconciles afterwards, rather than the purchase failing.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return DomainAPIPostDomainRegisterRequest
*/
func (a *DomainAPIService) PostDomainRegister(ctx context.Context) DomainAPIPostDomainRegisterRequest {
return DomainAPIPostDomainRegisterRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return DomainRegisterResult
func (a *DomainAPIService) PostDomainRegisterExecute(r DomainAPIPostDomainRegisterRequest) (*DomainRegisterResult, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *DomainRegisterResult
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DomainAPIService.PostDomainRegister")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/domain/register"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.domainOrder == nil {
return localVarReturnValue, nil, reportError("domainOrder 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.domainOrder
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 DomainAPIPostDomainRenewRequest struct {
ctx context.Context
ApiService *DomainAPIService
domainRenewReq *DomainRenewReq
}
func (r DomainAPIPostDomainRenewRequest) DomainRenewReq(domainRenewReq DomainRenewReq) DomainAPIPostDomainRenewRequest {
r.domainRenewReq = &domainRenewReq
return r
}
func (r DomainAPIPostDomainRenewRequest) Execute() (*DomainRenewResult, *http.Response, error) {
return r.ApiService.PostDomainRenewExecute(r)
}
/*
PostDomainRenew Extends a domain your org already owns and answers the updated record with its new expiry alongside what was paid.
Extends a domain your org already owns and answers the updated record with
its new expiry alongside what was paid.
Ownership is the gate: a name the caller's org does not hold is 404, so a renewal
can never reach another tenant's domain.
The price is re-quoted at the CURRENT renewal rate rather than the one paid at
purchase. If the registrar returns no renewal price the org's original price is
charged instead, so a renewal is never accidentally free. The balance is
authorized before the registrar is called and captured after it confirms — 402
when the prepaid balance cannot cover it, 503 when the deployment has no
registrar credentials. Requires a validated principal.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return DomainAPIPostDomainRenewRequest
*/
func (a *DomainAPIService) PostDomainRenew(ctx context.Context) DomainAPIPostDomainRenewRequest {
return DomainAPIPostDomainRenewRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return DomainRenewResult
func (a *DomainAPIService) PostDomainRenewExecute(r DomainAPIPostDomainRenewRequest) (*DomainRenewResult, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *DomainRenewResult
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DomainAPIService.PostDomainRenew")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/domain/renew"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.domainRenewReq == nil {
return localVarReturnValue, nil, reportError("domainRenewReq 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.domainRenewReq
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 DomainAPIPostDomainTransferRequest struct {
ctx context.Context
ApiService *DomainAPIService
domainTransferReq *DomainTransferReq
}
func (r DomainAPIPostDomainTransferRequest) DomainTransferReq(domainTransferReq DomainTransferReq) DomainAPIPostDomainTransferRequest {
r.domainTransferReq = &domainTransferReq
return r
}
func (r DomainAPIPostDomainTransferRequest) Execute() (*DomainRegisterResult, *http.Response, error) {
return r.ApiService.PostDomainTransferExecute(r)
}
/*
PostDomainTransfer Moves a domain you own at another registrar onto your org here, using its authCode, and answers the same record-plus-quote a purchase does.
Moves a domain you own at another registrar onto your org here, using
its authCode, and answers the same record-plus-quote a purchase does.
It is priced and charged exactly like a registration: authorize the org's prepaid
balance, ask the registrar for the transfer, capture only after the registrar
accepts. A name the registrar will not price is 409, an insufficient balance is
402, and a deployment with no registrar credentials is 503.
It requires a validated principal; the ownership record is written under that org
as soon as the registrar ACCEPTS the request, which is not the same instant the
transfer completes at the losing registrar. Unlike a registration this does not
provision a zone, so the record carries this deployment's configured nameservers.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return DomainAPIPostDomainTransferRequest
*/
func (a *DomainAPIService) PostDomainTransfer(ctx context.Context) DomainAPIPostDomainTransferRequest {
return DomainAPIPostDomainTransferRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return DomainRegisterResult
func (a *DomainAPIService) PostDomainTransferExecute(r DomainAPIPostDomainTransferRequest) (*DomainRegisterResult, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *DomainRegisterResult
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DomainAPIService.PostDomainTransfer")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/domain/transfer"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.domainTransferReq == nil {
return localVarReturnValue, nil, reportError("domainTransferReq 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.domainTransferReq
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
}