mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
927 lines
31 KiB
Go
927 lines
31 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"
|
|
)
|
|
|
|
// SeoAPIService SeoAPI service
|
|
type SeoAPIService service
|
|
|
|
type SeoAPISeoAuditRequest struct {
|
|
ctx context.Context
|
|
ApiService *SeoAPIService
|
|
seoSeoAuditIn *SeoSeoAuditIn
|
|
}
|
|
|
|
func (r SeoAPISeoAuditRequest) SeoSeoAuditIn(seoSeoAuditIn SeoSeoAuditIn) SeoAPISeoAuditRequest {
|
|
r.seoSeoAuditIn = &seoSeoAuditIn
|
|
return r
|
|
}
|
|
|
|
func (r SeoAPISeoAuditRequest) Execute() (*SeoSeoAuditOut, *http.Response, error) {
|
|
return r.ApiService.SeoAuditExecute(r)
|
|
}
|
|
|
|
/*
|
|
SeoAudit Fetch one page and report what it gets wrong
|
|
|
|
Fetches one page and reports what it gets wrong.
|
|
|
|
It returns the page's on-page score, its title and description, how much readable
|
|
text it carries, and the full set of named checks — is it https, does it have one
|
|
h1, is the title duplicated, is it slow, is it a redirect, is anything on it
|
|
broken. It is the technical half of search visibility, and it is the half a
|
|
developer can act on this afternoon.
|
|
|
|
ONE PAGE, LIVE, IN THIS REQUEST. It is deliberately not a site crawl: a crawl is
|
|
a job with a lifecycle, and this answers the same questions about the page
|
|
somebody is actually looking at, now, with no task id to poll. Point it at the
|
|
pages that matter one at a time.
|
|
|
|
It is priced per page fetched, which is one.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return SeoAPISeoAuditRequest
|
|
*/
|
|
func (a *SeoAPIService) SeoAudit(ctx context.Context) SeoAPISeoAuditRequest {
|
|
return SeoAPISeoAuditRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return SeoSeoAuditOut
|
|
func (a *SeoAPIService) SeoAuditExecute(r SeoAPISeoAuditRequest) (*SeoSeoAuditOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *SeoSeoAuditOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeoAPIService.SeoAudit")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/seo/audit"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.seoSeoAuditIn == nil {
|
|
return localVarReturnValue, nil, reportError("seoSeoAuditIn 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.seoSeoAuditIn
|
|
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 SeoAPISeoBacklinkRequest struct {
|
|
ctx context.Context
|
|
ApiService *SeoAPIService
|
|
seoSeoBacklinkIn *SeoSeoBacklinkIn
|
|
}
|
|
|
|
func (r SeoAPISeoBacklinkRequest) SeoSeoBacklinkIn(seoSeoBacklinkIn SeoSeoBacklinkIn) SeoAPISeoBacklinkRequest {
|
|
r.seoSeoBacklinkIn = &seoSeoBacklinkIn
|
|
return r
|
|
}
|
|
|
|
func (r SeoAPISeoBacklinkRequest) Execute() (*SeoSeoBacklinkOut, *http.Response, error) {
|
|
return r.ApiService.SeoBacklinkExecute(r)
|
|
}
|
|
|
|
/*
|
|
SeoBacklink Who links to a target, and how much of it is broken or spam
|
|
|
|
Summarises who links to a target.
|
|
|
|
It returns the authority score, how many links point at it and from how many
|
|
distinct sites, how many of those are broken, and how much of the profile reads
|
|
as spam. Distinct sites is the number to read: a thousand links from one domain
|
|
is one endorsement, and a profile that grew fast in links and not in domains is
|
|
usually a profile somebody bought.
|
|
|
|
The target can be a whole domain, a subdomain, or one page URL — the summary is
|
|
scoped to whatever is named. It is priced per request, so a domain with ten
|
|
million links costs the same as one with ten.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return SeoAPISeoBacklinkRequest
|
|
*/
|
|
func (a *SeoAPIService) SeoBacklink(ctx context.Context) SeoAPISeoBacklinkRequest {
|
|
return SeoAPISeoBacklinkRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return SeoSeoBacklinkOut
|
|
func (a *SeoAPIService) SeoBacklinkExecute(r SeoAPISeoBacklinkRequest) (*SeoSeoBacklinkOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *SeoSeoBacklinkOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeoAPIService.SeoBacklink")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/seo/backlinks"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.seoSeoBacklinkIn == nil {
|
|
return localVarReturnValue, nil, reportError("seoSeoBacklinkIn 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.seoSeoBacklinkIn
|
|
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 SeoAPISeoCompetitorRequest struct {
|
|
ctx context.Context
|
|
ApiService *SeoAPIService
|
|
seoSeoCompetitorIn *SeoSeoCompetitorIn
|
|
}
|
|
|
|
func (r SeoAPISeoCompetitorRequest) SeoSeoCompetitorIn(seoSeoCompetitorIn SeoSeoCompetitorIn) SeoAPISeoCompetitorRequest {
|
|
r.seoSeoCompetitorIn = &seoSeoCompetitorIn
|
|
return r
|
|
}
|
|
|
|
func (r SeoAPISeoCompetitorRequest) Execute() (*SeoSeoCompetitorOut, *http.Response, error) {
|
|
return r.ApiService.SeoCompetitorExecute(r)
|
|
}
|
|
|
|
/*
|
|
SeoCompetitor The domains that place for the same phrases
|
|
|
|
Names the domains that place for the same phrases.
|
|
|
|
Given a set of phrases it returns the sites that appear across them, with each
|
|
one's average position, how many of the phrases it places for, its share of the
|
|
available attention and the visits that earns. It answers "who am I actually up
|
|
against here", which is a different question from "who do I think my competitors
|
|
are" and frequently a different answer.
|
|
|
|
Pair it with seoRank: this says who is in the race, seoRank says where any one of
|
|
them finishes. It is priced per row, so Limit decides the cost.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return SeoAPISeoCompetitorRequest
|
|
*/
|
|
func (a *SeoAPIService) SeoCompetitor(ctx context.Context) SeoAPISeoCompetitorRequest {
|
|
return SeoAPISeoCompetitorRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return SeoSeoCompetitorOut
|
|
func (a *SeoAPIService) SeoCompetitorExecute(r SeoAPISeoCompetitorRequest) (*SeoSeoCompetitorOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *SeoSeoCompetitorOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeoAPIService.SeoCompetitor")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/seo/competitors"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.seoSeoCompetitorIn == nil {
|
|
return localVarReturnValue, nil, reportError("seoSeoCompetitorIn 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.seoSeoCompetitorIn
|
|
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 SeoAPISeoIdeaRequest struct {
|
|
ctx context.Context
|
|
ApiService *SeoAPIService
|
|
seoSeoIdeaIn *SeoSeoIdeaIn
|
|
}
|
|
|
|
func (r SeoAPISeoIdeaRequest) SeoSeoIdeaIn(seoSeoIdeaIn SeoSeoIdeaIn) SeoAPISeoIdeaRequest {
|
|
r.seoSeoIdeaIn = &seoSeoIdeaIn
|
|
return r
|
|
}
|
|
|
|
func (r SeoAPISeoIdeaRequest) Execute() (*SeoSeoIdeaOut, *http.Response, error) {
|
|
return r.ApiService.SeoIdeaExecute(r)
|
|
}
|
|
|
|
/*
|
|
SeoIdea Grow a seed phrase into the phrases nobody named yet
|
|
|
|
Grows a seed phrase into the phrases nobody named yet.
|
|
|
|
It takes phrases you have and returns phrases in the same category that you do
|
|
not — relevant rather than merely containing the seed — each with its search
|
|
volume, click cost, competition and how hard its first page is to reach. This is
|
|
where a keyword list comes FROM; seoKeyword is where a list you already have gets
|
|
measured.
|
|
|
|
It is priced per row, so Limit is the knob that decides what the call costs.
|
|
Total says how many more there were.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return SeoAPISeoIdeaRequest
|
|
*/
|
|
func (a *SeoAPIService) SeoIdea(ctx context.Context) SeoAPISeoIdeaRequest {
|
|
return SeoAPISeoIdeaRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return SeoSeoIdeaOut
|
|
func (a *SeoAPIService) SeoIdeaExecute(r SeoAPISeoIdeaRequest) (*SeoSeoIdeaOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *SeoSeoIdeaOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeoAPIService.SeoIdea")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/seo/ideas"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.seoSeoIdeaIn == nil {
|
|
return localVarReturnValue, nil, reportError("seoSeoIdeaIn 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.seoSeoIdeaIn
|
|
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 SeoAPISeoKeywordRequest struct {
|
|
ctx context.Context
|
|
ApiService *SeoAPIService
|
|
seoSeoKeywordIn *SeoSeoKeywordIn
|
|
}
|
|
|
|
func (r SeoAPISeoKeywordRequest) SeoSeoKeywordIn(seoSeoKeywordIn SeoSeoKeywordIn) SeoAPISeoKeywordRequest {
|
|
r.seoSeoKeywordIn = &seoSeoKeywordIn
|
|
return r
|
|
}
|
|
|
|
func (r SeoAPISeoKeywordRequest) Execute() (*SeoSeoKeywordOut, *http.Response, error) {
|
|
return r.ApiService.SeoKeywordExecute(r)
|
|
}
|
|
|
|
/*
|
|
SeoKeyword How often named phrases are searched, and what a click costs
|
|
|
|
Measures phrases the caller already has.
|
|
|
|
It answers, for each phrase named, how many people search it in a month, what an
|
|
advertising click on it costs, and how contested that advertising is. This is the
|
|
ground fact of search: everything else on this surface is a question about
|
|
phrases, and this is the one that says whether a phrase is worth having.
|
|
|
|
Give it phrases you already suspect. To find phrases you have not thought of,
|
|
use seoIdea; to find the ones a site already places for, use seoRank.
|
|
|
|
The market defaults to the United States in English. It is priced per request
|
|
rather than per phrase, so asking about fifty phrases costs what asking about
|
|
one does.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return SeoAPISeoKeywordRequest
|
|
*/
|
|
func (a *SeoAPIService) SeoKeyword(ctx context.Context) SeoAPISeoKeywordRequest {
|
|
return SeoAPISeoKeywordRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return SeoSeoKeywordOut
|
|
func (a *SeoAPIService) SeoKeywordExecute(r SeoAPISeoKeywordRequest) (*SeoSeoKeywordOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *SeoSeoKeywordOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeoAPIService.SeoKeyword")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/seo/keywords"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.seoSeoKeywordIn == nil {
|
|
return localVarReturnValue, nil, reportError("seoSeoKeywordIn 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.seoSeoKeywordIn
|
|
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 SeoAPISeoRankRequest struct {
|
|
ctx context.Context
|
|
ApiService *SeoAPIService
|
|
seoSeoRankIn *SeoSeoRankIn
|
|
}
|
|
|
|
func (r SeoAPISeoRankRequest) SeoSeoRankIn(seoSeoRankIn SeoSeoRankIn) SeoAPISeoRankRequest {
|
|
r.seoSeoRankIn = &seoSeoRankIn
|
|
return r
|
|
}
|
|
|
|
func (r SeoAPISeoRankRequest) Execute() (*SeoSeoRankOut, *http.Response, error) {
|
|
return r.ApiService.SeoRankExecute(r)
|
|
}
|
|
|
|
/*
|
|
SeoRank Every phrase a domain already places for, with its position
|
|
|
|
Reports every phrase a domain already places for.
|
|
|
|
For each one it gives the phrase, the position on the results page, the page of
|
|
the site that placed, that result's headline, the phrase's monthly searches and
|
|
the visits the placement is estimated to earn. It is the single most direct
|
|
question about a site's search visibility — yours or a competitor's, since it
|
|
takes any domain.
|
|
|
|
Position is the ABSOLUTE rank, counting every element on the page — the ads, the
|
|
answer boxes, the map — because that is what a person scrolling actually passes.
|
|
An organic-only rank flatters a result that sits below half a screen of other
|
|
things.
|
|
|
|
It is priced per row, so Limit decides what the call costs, and Total says how
|
|
many more there were.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return SeoAPISeoRankRequest
|
|
*/
|
|
func (a *SeoAPIService) SeoRank(ctx context.Context) SeoAPISeoRankRequest {
|
|
return SeoAPISeoRankRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return SeoSeoRankOut
|
|
func (a *SeoAPIService) SeoRankExecute(r SeoAPISeoRankRequest) (*SeoSeoRankOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *SeoSeoRankOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeoAPIService.SeoRank")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/seo/rankings"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.seoSeoRankIn == nil {
|
|
return localVarReturnValue, nil, reportError("seoSeoRankIn 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.seoSeoRankIn
|
|
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 SeoAPISeoRateRequest struct {
|
|
ctx context.Context
|
|
ApiService *SeoAPIService
|
|
}
|
|
|
|
func (r SeoAPISeoRateRequest) Execute() (*SeoSeoRateOut, *http.Response, error) {
|
|
return r.ApiService.SeoRateExecute(r)
|
|
}
|
|
|
|
/*
|
|
SeoRate What each call on this surface costs, from the vendor's own list
|
|
|
|
Publishes what every call on this surface costs.
|
|
|
|
The numbers are read from the upstream's own published price list, not from a
|
|
table kept here, so a price change on their side moves this card within the hour
|
|
and moves what is debited with it. That is the whole of the pricing model: this
|
|
surface resells at cost, and the cost is theirs to state.
|
|
|
|
A row has two numbers because a call has two costs: a flat charge for asking, and
|
|
a charge per row returned. An op priced per request reports zero for the second,
|
|
and for one priced per row the total is `request + result x limit` — which is the
|
|
amount your balance is authorized against before the call, and roughly what you
|
|
will be debited after it.
|
|
|
|
It is a read and it is free: asking what something costs must not require the
|
|
balance that would pay for it. If the upstream cannot be reached the card comes
|
|
back empty rather than stale — a price nobody can confirm is not a price.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return SeoAPISeoRateRequest
|
|
*/
|
|
func (a *SeoAPIService) SeoRate(ctx context.Context) SeoAPISeoRateRequest {
|
|
return SeoAPISeoRateRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return SeoSeoRateOut
|
|
func (a *SeoAPIService) SeoRateExecute(r SeoAPISeoRateRequest) (*SeoSeoRateOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *SeoSeoRateOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeoAPIService.SeoRate")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/seo/rates"
|
|
|
|
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
|
|
}
|