Files
sdk/api_project.go

3853 lines
148 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"
"os"
"strings"
)
// ProjectAPIService ProjectAPI service
type ProjectAPIService service
type ProjectAPIDeleteProjectBySlugRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIDeleteProjectBySlugRequest) Execute() (*http.Response, error) {
return r.ApiService.DeleteProjectBySlugExecute(r)
}
/*
DeleteProjectBySlug Deletes a project and takes its site off the internet.
Deletes a project and takes its site off the internet.
The metadata delete is authoritative and everything after it is best-effort,
in this order: the public `<slug>` subdomain binding is released so the slug is
free to reclaim, the release rows are dropped so a reclaimed slug never
inherits the previous owner's rollback menu, the git source is retired on
every copy it has so a reclaimed slug never adopts a repository left behind
(visibility.go), the S3 origin is purged under BOTH `<org>/<slug>/` and the
site's sibling release space, and the edge cache-tag is flushed. A failure in
any of those is logged and the delete still answers 204 — resurrecting a
project because a purge missed would be worse than a leaked prefix.
Scope: a validated principal is required (401 without one) and the project is
resolved within that principal's org, so another tenant's slug is a 404 and
nothing of theirs is touched.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIDeleteProjectBySlugRequest
*/
func (a *ProjectAPIService) DeleteProjectBySlug(ctx context.Context, slug string) ProjectAPIDeleteProjectBySlugRequest {
return ProjectAPIDeleteProjectBySlugRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
func (a *ProjectAPIService) DeleteProjectBySlugExecute(r ProjectAPIDeleteProjectBySlugRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.DeleteProjectBySlug")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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/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 nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return 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 localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ProjectAPIDeleteProjectBySlugDomainsByHostRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
host string
}
func (r ProjectAPIDeleteProjectBySlugDomainsByHostRequest) Execute() (*http.Response, error) {
return r.ApiService.DeleteProjectBySlugDomainsByHostExecute(r)
}
/*
DeleteProjectBySlugDomainsByHost Gives a custom hostname back, so the name is free to reuse.
Gives a custom hostname back, so the name is free to reuse.
A claim is FIRST-COME and global, so ownership includes giving a name back: a
customer who mistyped a domain, or moved one elsewhere, releases it here and
the name is free for them or anyone else. The release is scoped to (host, org,
slug), so it can only ever drop THIS tenant's own claim, and it is IDEMPOTENT:
releasing a host we do not hold is a clean 204, never a 404 that would let a
caller probe which hosts other tenants hold. The edge cache-tag is flushed,
since the host stops routing here.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project the host is attached to, from the path.
@param host Host is the custom hostname, from the path. It is cleaned to its canonical form (lowercased, trailing dot dropped) before anything is looked up.
@return ProjectAPIDeleteProjectBySlugDomainsByHostRequest
*/
func (a *ProjectAPIService) DeleteProjectBySlugDomainsByHost(ctx context.Context, slug string, host string) ProjectAPIDeleteProjectBySlugDomainsByHostRequest {
return ProjectAPIDeleteProjectBySlugDomainsByHostRequest{
ApiService: a,
ctx: ctx,
slug: slug,
host: host,
}
}
// Execute executes the request
func (a *ProjectAPIService) DeleteProjectBySlugDomainsByHostExecute(r ProjectAPIDeleteProjectBySlugDomainsByHostRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.DeleteProjectBySlugDomainsByHost")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/domains/{host}"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"host"+"}", url.PathEscape(parameterValueToString(r.host, "host")), -1)
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/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 nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return 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 localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ProjectAPIDeleteProjectBySlugStarRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIDeleteProjectBySlugStarRequest) Execute() (*ProjectProjectsStar, *http.Response, error) {
return r.ApiService.DeleteProjectBySlugStarExecute(r)
}
/*
DeleteProjectBySlugStar Removes the caller's own bookmark from a project, and answers whether it is starred afterwards.
Removes the caller's own bookmark from a project, and answers whether
it is starred afterwards.
It removes only YOUR star — the same one star wrote — so a project other
people have starred stays on their lists. Unstarring one you had not starred
is not an error; it leaves it unstarred.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIDeleteProjectBySlugStarRequest
*/
func (a *ProjectAPIService) DeleteProjectBySlugStar(ctx context.Context, slug string) ProjectAPIDeleteProjectBySlugStarRequest {
return ProjectAPIDeleteProjectBySlugStarRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsStar
func (a *ProjectAPIService) DeleteProjectBySlugStarExecute(r ProjectAPIDeleteProjectBySlugStarRequest) (*ProjectProjectsStar, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsStar
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.DeleteProjectBySlugStar")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/star"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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 ProjectAPIGetProjectRequest struct {
ctx context.Context
ApiService *ProjectAPIService
}
func (r ProjectAPIGetProjectRequest) Execute() ([]ProjectProjectsProject, *http.Response, error) {
return r.ApiService.GetProjectExecute(r)
}
/*
GetProject Returns every project your org owns.
Returns every project your org owns.
Each row carries the slug, name, framework, visibility, status and live URL —
the same rows console and the builder render, because there is only one store
behind both. It requires a validated principal (401 without one) and is keyed
by that principal's org, so it never contains another tenant's project.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIGetProjectRequest
*/
func (a *ProjectAPIService) GetProject(ctx context.Context) ProjectAPIGetProjectRequest {
return ProjectAPIGetProjectRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return []ProjectProjectsProject
func (a *ProjectAPIService) GetProjectExecute(r ProjectAPIGetProjectRequest) ([]ProjectProjectsProject, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue []ProjectProjectsProject
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProject")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project"
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 ProjectAPIGetProjectBySlugRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIGetProjectBySlugRequest) Execute() (*ProjectProjectsProject, *http.Response, error) {
return r.ApiService.GetProjectBySlugExecute(r)
}
/*
GetProjectBySlug Returns one project of yours by slug — its settings, its live URL and the deployment currently serving it.
Returns one project of yours by slug — its settings, its live URL
and the deployment currently serving it.
Scope: a validated principal is required (401 without one) and the lookup is
keyed by (org, slug), so another tenant's slug is a 404 exactly like a
nonexistent one.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIGetProjectBySlugRequest
*/
func (a *ProjectAPIService) GetProjectBySlug(ctx context.Context, slug string) ProjectAPIGetProjectBySlugRequest {
return ProjectAPIGetProjectBySlugRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsProject
func (a *ProjectAPIService) GetProjectBySlugExecute(r ProjectAPIGetProjectBySlugRequest) (*ProjectProjectsProject, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsProject
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectBySlug")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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 ProjectAPIGetProjectBySlugDeploymentsRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIGetProjectBySlugDeploymentsRequest) Execute() ([]ProjectProjectsDeployment, *http.Response, error) {
return r.ApiService.GetProjectBySlugDeploymentsExecute(r)
}
/*
GetProjectBySlugDeployments Returns a project's deploy history, newest version first.
Returns a project's deploy history, newest version first.
Every deploy of the project is a row — uploads, generated sites, and git/CI
builds alike — carrying its version, status, source, commit, live URL, file
count and byte count. The short-lived upload grant a queued git deployment was
handed is NOT replayed here: it exists only on the 202 that minted it, so a
grant cannot outlive its build by being fetched again.
Scope: a validated principal is required (401 without one) and the project is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIGetProjectBySlugDeploymentsRequest
*/
func (a *ProjectAPIService) GetProjectBySlugDeployments(ctx context.Context, slug string) ProjectAPIGetProjectBySlugDeploymentsRequest {
return ProjectAPIGetProjectBySlugDeploymentsRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return []ProjectProjectsDeployment
func (a *ProjectAPIService) GetProjectBySlugDeploymentsExecute(r ProjectAPIGetProjectBySlugDeploymentsRequest) ([]ProjectProjectsDeployment, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue []ProjectProjectsDeployment
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectBySlugDeployments")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/deployments"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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 ProjectAPIGetProjectBySlugDeploymentsByIdRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
id string
}
func (r ProjectAPIGetProjectBySlugDeploymentsByIdRequest) Execute() (*ProjectProjectsDeployment, *http.Response, error) {
return r.ApiService.GetProjectBySlugDeploymentsByIdExecute(r)
}
/*
GetProjectBySlugDeploymentsById Returns one deployment of a project by id.
Returns one deployment of a project by id.
It is how a console follows a build: the status (`queued`, `uploading`,
`live`, `error`), the message a failure left, and the URL and prefix it went
live at. Like the history, it never replays the upload grant.
Scope: a validated principal is required (401 without one). Both the project
and the deployment are resolved within that principal's org, so a deployment
of another project — or of another tenant — is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project the deployment belongs to, from the path.
@param id ID is the deployment id, from the path. A deployment of another project — or of another tenant's project — is not found.
@return ProjectAPIGetProjectBySlugDeploymentsByIdRequest
*/
func (a *ProjectAPIService) GetProjectBySlugDeploymentsById(ctx context.Context, slug string, id string) ProjectAPIGetProjectBySlugDeploymentsByIdRequest {
return ProjectAPIGetProjectBySlugDeploymentsByIdRequest{
ApiService: a,
ctx: ctx,
slug: slug,
id: id,
}
}
// Execute executes the request
//
// @return ProjectProjectsDeployment
func (a *ProjectAPIService) GetProjectBySlugDeploymentsByIdExecute(r ProjectAPIGetProjectBySlugDeploymentsByIdRequest) (*ProjectProjectsDeployment, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsDeployment
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectBySlugDeploymentsById")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/deployments/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
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 ProjectAPIGetProjectBySlugDeploymentsByIdObjectsRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
id string
}
func (r ProjectAPIGetProjectBySlugDeploymentsByIdObjectsRequest) Execute() (*ProjectProjectsObjects, *http.Response, error) {
return r.ApiService.GetProjectBySlugDeploymentsByIdObjectsExecute(r)
}
/*
GetProjectBySlugDeploymentsByIdObjects Returns every object under a deployment's prefix as the object store itself records it: each key relative to the prefix, its size in bytes and its ETag.
Returns every object under a deployment's prefix as the object
store itself records it: each key relative to the prefix, its size in bytes
and its ETag.
It is what lets a publisher upload only what changed. The publisher diffs its
export against this listing — the store's own record, never a manifest kept
from an earlier run — and uploads the files that differ or are absent; an
object written in one part carries the MD5 of its bytes as its ETag, so a local
digest is the whole comparison. A file the diff wrongly skips is still caught:
the completion refuses a release while any key of its manifest is absent.
The listing is whole or refused. A store that is unconfigured or fails while
listing answers 503 naming the cause, never a partial list.
Scope: a validated principal is required (401 without one). Both the project
and the deployment are resolved within that principal's org, so a deployment
of another project — or of another tenant — is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project the deployment belongs to, from the path.
@param id ID is the deployment id, from the path. A deployment of another project — or of another tenant's project — is not found.
@return ProjectAPIGetProjectBySlugDeploymentsByIdObjectsRequest
*/
func (a *ProjectAPIService) GetProjectBySlugDeploymentsByIdObjects(ctx context.Context, slug string, id string) ProjectAPIGetProjectBySlugDeploymentsByIdObjectsRequest {
return ProjectAPIGetProjectBySlugDeploymentsByIdObjectsRequest{
ApiService: a,
ctx: ctx,
slug: slug,
id: id,
}
}
// Execute executes the request
//
// @return ProjectProjectsObjects
func (a *ProjectAPIService) GetProjectBySlugDeploymentsByIdObjectsExecute(r ProjectAPIGetProjectBySlugDeploymentsByIdObjectsRequest) (*ProjectProjectsObjects, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsObjects
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectBySlugDeploymentsByIdObjects")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/deployments/{id}/objects"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
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 ProjectAPIGetProjectBySlugDomainsRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIGetProjectBySlugDomainsRequest) Execute() (*ProjectProjectsDomains, *http.Response, error) {
return r.ApiService.GetProjectBySlugDomainsExecute(r)
}
/*
GetProjectBySlugDomains Returns every custom hostname this site holds: the live ones, plus any pending claim with the DNS records it still owes.
Returns every custom hostname this site holds: the live ones, plus
any pending claim with the DNS records it still owes.
`domains` is the routing answer — the hosts that are verified right now —
while `claims` is the full panel, one row per host, each saying whether it is
live or pending and, if pending, exactly what to publish.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIGetProjectBySlugDomainsRequest
*/
func (a *ProjectAPIService) GetProjectBySlugDomains(ctx context.Context, slug string) ProjectAPIGetProjectBySlugDomainsRequest {
return ProjectAPIGetProjectBySlugDomainsRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsDomains
func (a *ProjectAPIService) GetProjectBySlugDomainsExecute(r ProjectAPIGetProjectBySlugDomainsRequest) (*ProjectProjectsDomains, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsDomains
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectBySlugDomains")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/domains"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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 ProjectAPIGetProjectBySlugReleasesRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIGetProjectBySlugReleasesRequest) Execute() ([]ProjectProjectsRelease, *http.Response, error) {
return r.ApiService.GetProjectBySlugReleasesExecute(r)
}
/*
GetProjectBySlugReleases Returns a site's releases newest-first, marking the active one — the rollback menu.
Returns a site's releases newest-first, marking the active one —
the rollback menu.
Each row carries the release id to activate, the source it was promoted from,
its object and byte counts, and the URL if it is the one serving. Retention
bounds the list, so it is the set that can actually still be rolled back to,
not a full history.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIGetProjectBySlugReleasesRequest
*/
func (a *ProjectAPIService) GetProjectBySlugReleases(ctx context.Context, slug string) ProjectAPIGetProjectBySlugReleasesRequest {
return ProjectAPIGetProjectBySlugReleasesRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return []ProjectProjectsRelease
func (a *ProjectAPIService) GetProjectBySlugReleasesExecute(r ProjectAPIGetProjectBySlugReleasesRequest) ([]ProjectProjectsRelease, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue []ProjectProjectsRelease
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectBySlugReleases")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/releases"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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 ProjectAPIGetProjectBySlugShotRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIGetProjectBySlugShotRequest) Execute() (*http.Response, error) {
return r.ApiService.GetProjectBySlugShotExecute(r)
}
/*
GetProjectBySlugShot Get a PNG of the project's live site
Returns a screenshot of what this project currently serves, as image/png. The capture is keyed by the deployment, so a redeploy invalidates it by construction rather than by anyone remembering to clear a cache. A project with nothing deployed answers 404 — that is a 404 about the PICTURE and not about the project, which is still right there in the list. Scoped to the caller's org: a validated principal is required, and a slug belonging to another org is not found rather than forbidden.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug
@return ProjectAPIGetProjectBySlugShotRequest
*/
func (a *ProjectAPIService) GetProjectBySlugShot(ctx context.Context, slug string) ProjectAPIGetProjectBySlugShotRequest {
return ProjectAPIGetProjectBySlugShotRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
func (a *ProjectAPIService) GetProjectBySlugShotExecute(r ProjectAPIGetProjectBySlugShotRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectBySlugShot")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/shot"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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{}
// 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 nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ProjectAPIGetProjectEdgeRequest struct {
ctx context.Context
ApiService *ProjectAPIService
}
func (r ProjectAPIGetProjectEdgeRequest) Execute() (*ProjectEdgeState, *http.Response, error) {
return r.ApiService.GetProjectEdgeExecute(r)
}
/*
GetProjectEdge health reports whether a publish reaches readers, rather than whether it was accepted.
health reports whether a publish reaches readers, rather than whether it was
accepted. Those are different questions and only the second one was ever
visible.
It asks the edge and nothing else. There is no live call to the provider here:
Configured is a local fact, it is the fact that was missing, and a health check
that spends a third-party API call is one an operator learns not to run.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIGetProjectEdgeRequest
*/
func (a *ProjectAPIService) GetProjectEdge(ctx context.Context) ProjectAPIGetProjectEdgeRequest {
return ProjectAPIGetProjectEdgeRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return ProjectEdgeState
func (a *ProjectAPIService) GetProjectEdgeExecute(r ProjectAPIGetProjectEdgeRequest) (*ProjectEdgeState, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectEdgeState
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectEdge")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/edge"
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 ProjectEdgeState
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 ProjectAPIGetProjectSitesRequest struct {
ctx context.Context
ApiService *ProjectAPIService
}
func (r ProjectAPIGetProjectSitesRequest) Execute() ([]ProjectProjectsSite, *http.Response, error) {
return r.ApiService.GetProjectSitesExecute(r)
}
/*
GetProjectSites Returns the org's deployed sites at the pretty URLs they serve at.
Returns the org's deployed sites at the pretty URLs they serve at.
It reads the SAME org-scoped store as /v1/project and keeps only the projects
that are actually `live`, so a draft or a failed build is not advertised as a
site.
Scope: a validated principal is required (401 without one) and the list is
keyed by that principal's org.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIGetProjectSitesRequest
*/
func (a *ProjectAPIService) GetProjectSites(ctx context.Context) ProjectAPIGetProjectSitesRequest {
return ProjectAPIGetProjectSitesRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return []ProjectProjectsSite
func (a *ProjectAPIService) GetProjectSitesExecute(r ProjectAPIGetProjectSitesRequest) ([]ProjectProjectsSite, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue []ProjectProjectsSite
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectSites")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/sites"
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 ProjectAPIGetProjectSitesBySlugRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIGetProjectSitesBySlugRequest) Execute() (*ProjectProjectsSite, *http.Response, error) {
return r.ApiService.GetProjectSitesBySlugExecute(r)
}
/*
GetProjectSitesBySlug Returns one site — the same row ListSites carries, for one slug.
Returns one site — the same row ListSites carries, for one slug.
Every sub-resource under a site already answered: deployments, releases,
publish. The site itself did not, and a route that is never registered
answers 404 for a LIVE site exactly as it does for one that was never
created. So the one call a client makes to ask "is it there yet?" could only
ever say no, and a CI lane watching for its own publish would wait forever on
a success it had already achieved.
The org is the caller's, never a path segment. A slug is unique within an org
and two orgs may both own `tel`; taking the org from the validated principal
instead of the URL means a caller cannot read another org's site by editing a
path, and it is the same scope ListProjects and ListSites already use.
A site that exists but is not live is NOT found here, matching ListSites,
which keeps only `live` rows so a draft or a failed build is never advertised
as a site. One definition of "is a site", used by both.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIGetProjectSitesBySlugRequest
*/
func (a *ProjectAPIService) GetProjectSitesBySlug(ctx context.Context, slug string) ProjectAPIGetProjectSitesBySlugRequest {
return ProjectAPIGetProjectSitesBySlugRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsSite
func (a *ProjectAPIService) GetProjectSitesBySlugExecute(r ProjectAPIGetProjectSitesBySlugRequest) (*ProjectProjectsSite, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsSite
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectSitesBySlug")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/sites/{slug}"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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 ProjectAPIGetProjectTagsRequest struct {
ctx context.Context
ApiService *ProjectAPIService
}
func (r ProjectAPIGetProjectTagsRequest) Execute() (*TagConfig, *http.Response, error) {
return r.ApiService.GetProjectTagsExecute(r)
}
/*
GetProjectTags The site's browser tag set for the hosted tag — which pixels to inject, by publishable key
Returns the client-side pixels the SITE has connected (GA4, Google Ads, LinkedIn, Meta, Pinterest, Reddit, TikTok, X) with their NON-SECRET ids, so the hosted tag injects them first-party and stamps each browser event with the same event_id the server-side Conversions API uses — deduping the two. Resolved per site: by the publishable key on ?key= when it names a project, else by the request host, so hanzo.ai and hanzo.chat carry different tags under one org. WITHOUT a resolvable site it answers an empty set at 200 — a page never breaks on its tag config. `audience` says who is asking — `bot` (automation, a crawler, or a cloud provider's published address), `internal` (a member of the site's org, by the IAM bearer the page sends, or an address in the project's internal networks) or `person` — and the set answers for it: nothing for a bot, Google Analytics alone for the team. A site that reports to several Meta pixels names each (comma separated on the project's `meta`), and each is a tag of its own. `consent` is the visitor's rule for the third-party tags, decided per request from the country and US state Cloudflare attests: `eu` (the EU, the EEA, the UK and Switzerland, and any visitor no edge placed: before a choice Google Analytics runs cookieless under Consent Mode denied, Meta is held revoked, nothing else loads), `us_privacy` (a US state with a privacy law, or a US visitor with no attested state: everything runs, the visitor opts out of sale or sharing) or `global` (everywhere else: everything runs, with a notice); `defaults` is the categories granted before a choice, `refused` says the request carried Global Privacy Control or Do Not Track (no third party loads, in any region), and a choice's grants count when stored under a version from `floor` to `version`. The tag set is the same under every rule; the page gates it. The answer is per visitor and never cached by a shared cache. The site's own first-party stream is not governed by it.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIGetProjectTagsRequest
*/
func (a *ProjectAPIService) GetProjectTags(ctx context.Context) ProjectAPIGetProjectTagsRequest {
return ProjectAPIGetProjectTagsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return TagConfig
func (a *ProjectAPIService) GetProjectTagsExecute(r ProjectAPIGetProjectTagsRequest) (*TagConfig, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *TagConfig
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.GetProjectTags")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/tags"
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"}
// 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,
}
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 ProjectAPIPatchProjectBySlugRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
projectProjectsUpdate *ProjectProjectsUpdate
}
func (r ProjectAPIPatchProjectBySlugRequest) ProjectProjectsUpdate(projectProjectsUpdate ProjectProjectsUpdate) ProjectAPIPatchProjectBySlugRequest {
r.projectProjectsUpdate = &projectProjectsUpdate
return r
}
func (r ProjectAPIPatchProjectBySlugRequest) Execute() (*ProjectProjectsProject, *http.Response, error) {
return r.ApiService.PatchProjectBySlugExecute(r)
}
/*
PatchProjectBySlug Changes a project's settings, and only the settings you send.
Changes a project's settings, and only the settings you send.
Every field is optional and absent means "leave it": `name` may not be blanked,
`framework` must stay a known build hint, and `cacheControl` is capped at 256
characters with no newlines (it becomes a response header). `visibility` flips
public/private under the same rule as create — public is free, private needs a
funded org. `upstream` and `license` are free-text credit for third-party work,
and sending "" clears one. Changing anything reconciles the project's canonical
git repo, so a visibility change reaches the source and not just the listing.
Sending `repo` decides the site's `namespace` again: the repository's GitHub
org when this org holds that GitHub account, else the org. Linking a
repository in another account refuses (409) a move that is not safe: a site
with releases, a published site whose objects are not already copied to
`<namespace>/<slug>/`, a prefix something else already keeps objects at.
Sending the same repository moves the site only where that is safe, and
otherwise leaves it where it is. Nothing is copied here.
`hidden`/`hiddenReason` are platform MODERATION and are ignored unless the
caller is a platform admin; they remove a project from the public catalogue
without touching the publisher's own visibility choice, so un-hiding restores
exactly what they asked for.
Scope: a validated principal is required (401 without one) and the project is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to update, from the path. The URL is the addressing authority — a `slug` in the body cannot move the write to another project.
@return ProjectAPIPatchProjectBySlugRequest
*/
func (a *ProjectAPIService) PatchProjectBySlug(ctx context.Context, slug string) ProjectAPIPatchProjectBySlugRequest {
return ProjectAPIPatchProjectBySlugRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsProject
func (a *ProjectAPIService) PatchProjectBySlugExecute(r ProjectAPIPatchProjectBySlugRequest) (*ProjectProjectsProject, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPatch
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsProject
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PatchProjectBySlug")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsUpdate == nil {
return localVarReturnValue, nil, reportError("projectProjectsUpdate 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.projectProjectsUpdate
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 ProjectAPIPostProjectRequest struct {
ctx context.Context
ApiService *ProjectAPIService
projectProjectsCreate *ProjectProjectsCreate
}
func (r ProjectAPIPostProjectRequest) ProjectProjectsCreate(projectProjectsCreate ProjectProjectsCreate) ProjectAPIPostProjectRequest {
r.projectProjectsCreate = &projectProjectsCreate
return r
}
func (r ProjectAPIPostProjectRequest) Execute() (*ProjectProjectsProject, *http.Response, error) {
return r.ApiService.PostProjectExecute(r)
}
/*
PostProject Creates a project — the handle a site is deployed and served under — and answers 201 with it in `draft`.
Creates a project — the handle a site is deployed and served
under — and answers 201 with it in `draft`.
`name` is required; `slug` is derived from the name when omitted and is the
identifier that matters — it becomes the S3 key segment, the public host
`<slug>.hanzo.app`, and the handle every later call addresses, so it must
match `^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$` and may not be a reserved label
such as `api` or `admin`. `framework` is a build hint from a closed set,
defaulting to `static`; it never gates a deploy, it only tells CI how to build
a linked repo.
Two defaults are worth knowing: the analytics beacon is ON unless `analytics`
is explicitly false, and `visibility` is `public` unless asked otherwise.
Publishing publicly is free; PRIVATE is the paid feature, and an unfunded org
asking for it is refused rather than quietly published as public. Creation
also provisions the project's data space and a canonical git repo, both
best-effort — neither can fail the create.
Scope: a validated principal is required (401 without one) and the project is
created in THAT principal's org. The slug is unique per org, so a slug already
used in the caller's own org is a 409 while the same slug in another org is
irrelevant.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIPostProjectRequest
*/
func (a *ProjectAPIService) PostProject(ctx context.Context) ProjectAPIPostProjectRequest {
return ProjectAPIPostProjectRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return ProjectProjectsProject
func (a *ProjectAPIService) PostProjectExecute(r ProjectAPIPostProjectRequest) (*ProjectProjectsProject, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsProject
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProject")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsCreate == nil {
return localVarReturnValue, nil, reportError("projectProjectsCreate 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.projectProjectsCreate
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 ProjectAPIPostProjectBySlugDeployRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
body *os.File
}
func (r ProjectAPIPostProjectBySlugDeployRequest) Body(body *os.File) ProjectAPIPostProjectBySlugDeployRequest {
r.body = body
return r
}
func (r ProjectAPIPostProjectBySlugDeployRequest) Execute() (*ProjectsDeployment, *http.Response, error) {
return r.ApiService.PostProjectBySlugDeployExecute(r)
}
/*
PostProjectBySlugDeploy Upload a built site as one archive and serve it
Takes a built site live at `https://<slug>.hanzo.app` in one call. The body is the site itself — a `zip` or `tar.gz` holding `index.html` at its root (or a single wrapper directory that does), sent raw or as a multipart file part. It is unpacked to the site's own storage prefix and served immediately, answering the finished deployment.
It is bounded by the edge body limit (16 MiB by default), and that bound is the whole reason the other path exists: an oversized POST is refused by the server BEFORE any handler runs and surfaces as an opaque `400 Error when parsing request` that reads like a malformed payload rather than a size cap. A site too large for one archive opens a deployment with `POST /v1/project/{slug}/deployments` instead and writes its files straight to storage against the scoped grant that answers with — no body limit, and no bytes through this API at all.
Publishing is free: no deploy is charged, and an org with no balance can publish and republish. A site is billed for the storage its org holds past the free tier, metered hourly; an org already past the tier must be able to pay a month of that storage, or the upload is refused 402 (503 when commerce is unreachable) BEFORE anything is parsed or written. A failed upload never flips the live site, and a redeploy replaces the site's files and answers the SAME URL, because slug and apex are stable.
Scope: a validated principal is required (401 without one) and the site is resolved within that principal's org, so another tenant's slug is a 404. Object storage must be configured (503); an archive that does not walk is a 400 and one over the size cap is a 413.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug
@return ProjectAPIPostProjectBySlugDeployRequest
*/
func (a *ProjectAPIService) PostProjectBySlugDeploy(ctx context.Context, slug string) ProjectAPIPostProjectBySlugDeployRequest {
return ProjectAPIPostProjectBySlugDeployRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectsDeployment
func (a *ProjectAPIService) PostProjectBySlugDeployExecute(r ProjectAPIPostProjectBySlugDeployRequest) (*ProjectsDeployment, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectsDeployment
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugDeploy")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/deploy"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/octet-stream"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.body
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,
}
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 ProjectAPIPostProjectBySlugDeploymentsRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
projectProjectsDeployStart *ProjectProjectsDeployStart
}
func (r ProjectAPIPostProjectBySlugDeploymentsRequest) ProjectProjectsDeployStart(projectProjectsDeployStart ProjectProjectsDeployStart) ProjectAPIPostProjectBySlugDeploymentsRequest {
r.projectProjectsDeployStart = &projectProjectsDeployStart
return r
}
func (r ProjectAPIPostProjectBySlugDeploymentsRequest) Execute() (*ProjectProjectsDeployment, *http.Response, error) {
return r.ApiService.PostProjectBySlugDeploymentsExecute(r)
}
/*
PostProjectBySlugDeployments Opens a deployment and hands back a short-lived, prefix-scoped grant to write its bytes straight to object storage.
Opens a deployment and hands back a short-lived, prefix-scoped
grant to write its bytes straight to object storage. Answers 202.
This is the path for a site too large to send as one archive: a real export is
hundreds of megabytes against a 16 MiB body limit, so the bytes deliberately do
NOT pass through the API. The answer carries `bucket`, `prefix` and `upload` —
a presigned POST policy that S3 itself confines to this site's prefix
(starts-with `<org>/<slug>/`), expires in 30 minutes and bounds each object.
So a build writes its own files and holds no standing bucket credential; there
is nothing to rotate and nothing that leaks between tenants. Never guess the
prefix — it is server-derived, and a guessed one lands where nothing is served.
The deployment is `queued` until POST .../deployments/{id}/complete flips it
live (or error). That completion is also where DELETION happens: the grant
authorizes writes only, so a build cannot remove a file, and cloud reconciles
the prefix against the `keys` manifest the completion carries. A build that
dies before completing leaves the deployment queued rather than a half-live
site.
The grant is on the 202 and NOWHERE else — it is never stored and never
replayed on a later read, so it cannot outlive the build it was minted for. A
deployment whose grant could not be minted is still created and still
completable; it simply carries no `upload`, and a caller with no other way to
write should treat that as the failure it is.
Billing: the deployment is free. The one gate is storage, and it runs BEFORE
anything is created: an org past the free storage tier that cannot pay a month of
what it holds is 402, and 503 when commerce is unreachable. What the build uploads
is billed as storage from the hourly sweep that finds it, never as a deploy.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the site to deploy, from the path.
@return ProjectAPIPostProjectBySlugDeploymentsRequest
*/
func (a *ProjectAPIService) PostProjectBySlugDeployments(ctx context.Context, slug string) ProjectAPIPostProjectBySlugDeploymentsRequest {
return ProjectAPIPostProjectBySlugDeploymentsRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsDeployment
func (a *ProjectAPIService) PostProjectBySlugDeploymentsExecute(r ProjectAPIPostProjectBySlugDeploymentsRequest) (*ProjectProjectsDeployment, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsDeployment
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugDeployments")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/deployments"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsDeployStart == nil {
return localVarReturnValue, nil, reportError("projectProjectsDeployStart 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.projectProjectsDeployStart
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 ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
id string
projectProjectsComplete *ProjectProjectsComplete
}
func (r ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest) ProjectProjectsComplete(projectProjectsComplete ProjectProjectsComplete) ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest {
r.projectProjectsComplete = &projectProjectsComplete
return r
}
func (r ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest) Execute() (*ProjectProjectsDeployment, *http.Response, error) {
return r.ApiService.PostProjectBySlugDeploymentsByIdCompleteExecute(r)
}
/*
PostProjectBySlugDeploymentsByIdComplete CompleteDeployment is the CI completion hook that flips a queued git deployment to live (or error) once CI has synced the built site to S3.
CompleteDeployment is the CI completion hook that flips a queued git
deployment to live (or error) once CI has synced the built site to S3.
`status` must be `live` or `error`. On a LIVE completion the public host is
claimed FIRST, so the deployment reports the URL it actually OWNS — a
CI-supplied `liveUrl` is a hint that can refine that URL but can never assert
a subdomain another tenant holds. `keys` is the whole release, relative to the
deployment prefix: cloud reconciles the prefix against it so a page deleted
from the build actually stops serving. A fingerprinted asset the release drops
stays up to 36 hours, so a tab opened on the previous release can still load
its chunks. Omit `keys` and nothing is deleted — the prefix only grows.
Reconciliation runs only on a live completion (pruning against a failed
build's manifest would delete the site the last good build is still serving)
and is best-effort, so a stale leftover never turns a successful deploy into a
500. No completion is charged: the site is billed for the storage it holds,
and a live completion re-measures its org.
A live completion that names `keys` is not taken on trust. The objects `copy`
names are first copied from the `copyFrom` site's prefix, then the prefix is
listed, and while any key of the manifest is absent the answer is 409 naming
how many and the first of them. A store that cannot be listed is a 503, and a
copy that fails is a 502 naming the key. Each of those leaves the deployment
queued — a release that cannot be proven whole is never marked live — so the
publisher uploads what is missing and completes again.
Scope: a validated principal is required (401 without one). CI authenticates
with an org-scoped token through the gateway, so the deployment is resolved
within that principal's org and another tenant's slug or deployment id is a
404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project the deployment belongs to, from the path.
@param id ID is the queued deployment to complete, from the path.
@return ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest
*/
func (a *ProjectAPIService) PostProjectBySlugDeploymentsByIdComplete(ctx context.Context, slug string, id string) ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest {
return ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest{
ApiService: a,
ctx: ctx,
slug: slug,
id: id,
}
}
// Execute executes the request
//
// @return ProjectProjectsDeployment
func (a *ProjectAPIService) PostProjectBySlugDeploymentsByIdCompleteExecute(r ProjectAPIPostProjectBySlugDeploymentsByIdCompleteRequest) (*ProjectProjectsDeployment, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsDeployment
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugDeploymentsByIdComplete")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/deployments/{id}/complete"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsComplete == nil {
return localVarReturnValue, nil, reportError("projectProjectsComplete 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.projectProjectsComplete
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 ProjectAPIPostProjectBySlugDomainsRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
projectProjectsDomainsBind *ProjectProjectsDomainsBind
}
func (r ProjectAPIPostProjectBySlugDomainsRequest) ProjectProjectsDomainsBind(projectProjectsDomainsBind ProjectProjectsDomainsBind) ProjectAPIPostProjectBySlugDomainsRequest {
r.projectProjectsDomainsBind = &projectProjectsDomainsBind
return r
}
func (r ProjectAPIPostProjectBySlugDomainsRequest) Execute() (*ProjectProjectsBoundDomains, *http.Response, error) {
return r.ApiService.PostProjectBySlugDomainsExecute(r)
}
/*
PostProjectBySlugDomains Attaches one or more CUSTOM public hostnames to this org's site.
Attaches one or more CUSTOM public hostnames to this org's site.
Binding a host you do not own would let you shadow it at the edge, so which
outcome you get depends on whether ownership is already established: a SuperAdmin
vouches (the operator manages the customer's DNS, so its bind IS the proof) and
binds VERIFIED immediately; every other caller, INCLUDING an admin of the
deployment's own brand org, has the host CLAIMED as pending and gets the DNS
challenge back in `bound[].records`. A pending claim HOLDS the name so nobody
else can take it, but it does not route until POST .../domains/{host}/verify
proves control.
A hostname we operate is refused to a non-vouched caller (those are assigned
by the platform, never claimed), a host another site already holds is a 409,
and a name the platform holds is a 400 for EVERY caller — a vouch skips the
ownership proof, never the host table's own invariant. Claims and binds are
idempotent for the same
(org, slug), and re-claiming returns the SAME token rather than invalidating a
record the customer has already published. The edge cache-tag is flushed
afterwards so a newly-verified host serves the current build immediately.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the site the hosts attach to, from the path.
@return ProjectAPIPostProjectBySlugDomainsRequest
*/
func (a *ProjectAPIService) PostProjectBySlugDomains(ctx context.Context, slug string) ProjectAPIPostProjectBySlugDomainsRequest {
return ProjectAPIPostProjectBySlugDomainsRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsBoundDomains
func (a *ProjectAPIService) PostProjectBySlugDomainsExecute(r ProjectAPIPostProjectBySlugDomainsRequest) (*ProjectProjectsBoundDomains, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsBoundDomains
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugDomains")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/domains"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsDomainsBind == nil {
return localVarReturnValue, nil, reportError("projectProjectsDomainsBind 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.projectProjectsDomainsBind
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 ProjectAPIPostProjectBySlugDomainsByHostVerifyRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
host string
}
func (r ProjectAPIPostProjectBySlugDomainsByHostVerifyRequest) Execute() (*ProjectProjectsDomain, *http.Response, error) {
return r.ApiService.PostProjectBySlugDomainsByHostVerifyExecute(r)
}
/*
PostProjectBySlugDomainsByHostVerify Checks the DNS challenge for a pending custom hostname and, when it passes, promotes the host so it begins routing at the edge.
Checks the DNS challenge for a pending custom hostname and, when
it passes, promotes the host so it begins routing at the edge.
It answers 200 either way, with the host's honest current state: verified once
the TXT record is found, still pending — with the records to publish and the
resolver's own explanation in `detail` — when it is not. A not-yet is not an
error: the check ran, DNS simply has not propagated, and the customer retries.
An already-verified host is returned unchanged without re-resolving. On a
successful promotion the edge cache-tag is flushed, since the host routes as
of that moment.
Scope: a validated principal is required (401 without one). Both the site and
the claim are resolved within that principal's org, so a host claimed by
another tenant is "not claimed by this site".
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project the host is attached to, from the path.
@param host Host is the custom hostname, from the path. It is cleaned to its canonical form (lowercased, trailing dot dropped) before anything is looked up.
@return ProjectAPIPostProjectBySlugDomainsByHostVerifyRequest
*/
func (a *ProjectAPIService) PostProjectBySlugDomainsByHostVerify(ctx context.Context, slug string, host string) ProjectAPIPostProjectBySlugDomainsByHostVerifyRequest {
return ProjectAPIPostProjectBySlugDomainsByHostVerifyRequest{
ApiService: a,
ctx: ctx,
slug: slug,
host: host,
}
}
// Execute executes the request
//
// @return ProjectProjectsDomain
func (a *ProjectAPIService) PostProjectBySlugDomainsByHostVerifyExecute(r ProjectAPIPostProjectBySlugDomainsByHostVerifyRequest) (*ProjectProjectsDomain, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsDomain
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugDomainsByHostVerify")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/domains/{host}/verify"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"host"+"}", url.PathEscape(parameterValueToString(r.host, "host")), -1)
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 ProjectAPIPostProjectBySlugPublishRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
projectProjectsPublish *ProjectProjectsPublish
}
func (r ProjectAPIPostProjectBySlugPublishRequest) ProjectProjectsPublish(projectProjectsPublish ProjectProjectsPublish) ProjectAPIPostProjectBySlugPublishRequest {
r.projectProjectsPublish = &projectProjectsPublish
return r
}
func (r ProjectAPIPostProjectBySlugPublishRequest) Execute() (*ProjectProjectsRelease, *http.Response, error) {
return r.ApiService.PostProjectBySlugPublishExecute(r)
}
/*
PostProjectBySlugPublish Promotes a build output into a new release AND goes live with it — create+activate in one call, which is the 99% path.
Promotes a build output into a new release AND goes live with it —
create+activate in one call, which is the 99% path.
It is exactly the two halves in sequence with no extra semantics, so the
staged flow and the one-shot flow can never drift apart: `source` is promoted
under the same org-relative rule and the same guards CreateRelease applies,
then the site's pointer is flipped to it, the public host is claimed and the
edge is purged. Idempotent on unchanged bytes — same manifest, same release id,
no copy, and so nothing more stored. Free, behind the same storage gate.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the site to publish, from the path.
@return ProjectAPIPostProjectBySlugPublishRequest
*/
func (a *ProjectAPIService) PostProjectBySlugPublish(ctx context.Context, slug string) ProjectAPIPostProjectBySlugPublishRequest {
return ProjectAPIPostProjectBySlugPublishRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsRelease
func (a *ProjectAPIService) PostProjectBySlugPublishExecute(r ProjectAPIPostProjectBySlugPublishRequest) (*ProjectProjectsRelease, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsRelease
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugPublish")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/publish"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsPublish == nil {
return localVarReturnValue, nil, reportError("projectProjectsPublish 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.projectProjectsPublish
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 ProjectAPIPostProjectBySlugPurgeRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIPostProjectBySlugPurgeRequest) Execute() (*ProjectProjectsProject, *http.Response, error) {
return r.ApiService.PostProjectBySlugPurgeExecute(r)
}
/*
PostProjectBySlugPurge Flushes the site's edge cache without redeploying anything.
Flushes the site's edge cache without redeploying anything.
It invalidates the edge cache-tag `site-<namespace>-<slug>` and stamps `lastPurgeAt`
(unix seconds), and it NEVER writes or deletes the S3 origin — the live build
keeps serving; only stale copies held at the edge drop, so the next request
re-fetches the current artifact from origin. Idempotent, and an edge that is
unconfigured or failing is not fatal: `lastPurgeAt` is still stamped and the
answer is still the updated project.
Scope: a validated principal is required (401 without one) and the project is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIPostProjectBySlugPurgeRequest
*/
func (a *ProjectAPIService) PostProjectBySlugPurge(ctx context.Context, slug string) ProjectAPIPostProjectBySlugPurgeRequest {
return ProjectAPIPostProjectBySlugPurgeRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsProject
func (a *ProjectAPIService) PostProjectBySlugPurgeExecute(r ProjectAPIPostProjectBySlugPurgeRequest) (*ProjectProjectsProject, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsProject
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugPurge")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/purge"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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 ProjectAPIPostProjectBySlugReleasesRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
projectProjectsPublish *ProjectProjectsPublish
}
func (r ProjectAPIPostProjectBySlugReleasesRequest) ProjectProjectsPublish(projectProjectsPublish ProjectProjectsPublish) ProjectAPIPostProjectBySlugReleasesRequest {
r.projectProjectsPublish = &projectProjectsPublish
return r
}
func (r ProjectAPIPostProjectBySlugReleasesRequest) Execute() (*ProjectProjectsRelease, *http.Response, error) {
return r.ApiService.PostProjectBySlugReleasesExecute(r)
}
/*
PostProjectBySlugReleases Promotes a build output into a new immutable release WITHOUT serving it — the staged half of publishing, for when you want to check a release before it goes live.
Promotes a build output into a new immutable release WITHOUT
serving it — the staged half of publishing, for when you want to check a
release before it goes live. Answers 201.
`source` is a path RELATIVE to your org's own storage space: the org segment
is prepended server-side from the validated principal and the bucket is never
in the request at all, so a server-side copy can only ever reach bytes your
org already owns. The prefix is listed, content-addressed (SHA-256 over the
sorted manifest of key/size/etag), and copied into an immutable
`<org>/.releases/<slug>/<id>/` prefix; the row is written LAST, so a partial
copy is unreachable rather than merely unlikely. Re-publishing an unchanged
source is idempotent BY CONSTRUCTION — same bytes, same id, no copy at all.
The source must contain index.html at its root and stay under the same file
and byte caps an artifact deploy does (413 past them); a source that changes
mid-copy is a 409 and the release is abandoned. Each publish also reclaims
releases past the retention depth, so a site's release space stays bounded.
Creating a release is free. A retained release is stored bytes, so it counts
toward the org's storage until retention reclaims it; the storage gate runs
before any copy, refusing (402) an org past the free tier that cannot pay a
month of what it holds.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the site to publish, from the path.
@return ProjectAPIPostProjectBySlugReleasesRequest
*/
func (a *ProjectAPIService) PostProjectBySlugReleases(ctx context.Context, slug string) ProjectAPIPostProjectBySlugReleasesRequest {
return ProjectAPIPostProjectBySlugReleasesRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsRelease
func (a *ProjectAPIService) PostProjectBySlugReleasesExecute(r ProjectAPIPostProjectBySlugReleasesRequest) (*ProjectProjectsRelease, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsRelease
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugReleases")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/releases"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsPublish == nil {
return localVarReturnValue, nil, reportError("projectProjectsPublish 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.projectProjectsPublish
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 ProjectAPIPostProjectBySlugReleasesByReleaseActivateRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
release string
}
func (r ProjectAPIPostProjectBySlugReleasesByReleaseActivateRequest) Execute() (*ProjectProjectsRelease, *http.Response, error) {
return r.ApiService.PostProjectBySlugReleasesByReleaseActivateExecute(r)
}
/*
PostProjectBySlugReleasesByReleaseActivate Points the site at an existing release — the go-live, and equally the ROLLBACK.
Points the site at an existing release — the go-live, and
equally the ROLLBACK.
Aim it at an older release and the site serves that one again: releases are
immutable and retained to the retention depth, so nothing is rebuilt or
re-copied and the flip is one atomic statement. Before the flip, two
conditions run in the order that gives each its own honest answer — the ROW
says whether this release exists for this tenant at all (404, with no signal
about a foreign id), and only then do the BYTES say whether it can still serve
(410 GONE when retention has reclaimed them; that rollback target is not
coming back, so publish again). Going live also claims the public host and
purges the edge, so the release is reachable and no cached predecessor is
served. NOT billed: no new content is produced, only a pointer moved.
Scope: a validated principal is required (401 without one) and the site is
resolved within that principal's org, so another tenant's slug is a 404.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the site the release belongs to, from the path.
@param release Release is the content-addressed release id (\"rel_\" + 32 hex chars), from the path. Anything that is not that shape is not found, rather than being interpolated into a storage prefix.
@return ProjectAPIPostProjectBySlugReleasesByReleaseActivateRequest
*/
func (a *ProjectAPIService) PostProjectBySlugReleasesByReleaseActivate(ctx context.Context, slug string, release string) ProjectAPIPostProjectBySlugReleasesByReleaseActivateRequest {
return ProjectAPIPostProjectBySlugReleasesByReleaseActivateRequest{
ApiService: a,
ctx: ctx,
slug: slug,
release: release,
}
}
// Execute executes the request
//
// @return ProjectProjectsRelease
func (a *ProjectAPIService) PostProjectBySlugReleasesByReleaseActivateExecute(r ProjectAPIPostProjectBySlugReleasesByReleaseActivateRequest) (*ProjectProjectsRelease, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsRelease
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectBySlugReleasesByReleaseActivate")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/releases/{release}/activate"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"release"+"}", url.PathEscape(parameterValueToString(r.release, "release")), -1)
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 ProjectAPIPostProjectForkRequest struct {
ctx context.Context
ApiService *ProjectAPIService
projectProjectsFork *ProjectProjectsFork
}
func (r ProjectAPIPostProjectForkRequest) ProjectProjectsFork(projectProjectsFork ProjectProjectsFork) ProjectAPIPostProjectForkRequest {
r.projectProjectsFork = &projectProjectsFork
return r
}
func (r ProjectAPIPostProjectForkRequest) Execute() (*ProjectProjectsProject, *http.Response, error) {
return r.ApiService.PostProjectForkExecute(r)
}
/*
PostProjectFork Creates a project seeded from a PUBLISHED EXAMPLE — either a starter-kit template from the ONE embedded gallery catalog, or any live project on the platform (an example a seeded creator published, or another org's app serving at <slug>.hanzo.app).
Creates a project seeded from a PUBLISHED EXAMPLE — either a
starter-kit template from the ONE embedded gallery catalog, or any live
project on the platform (an example a seeded creator published, or another
org's app serving at <slug>.hanzo.app). Answers 201 with the new project.
`slug` names the PARENT to fork and is required. Templates resolve first, and
the caller org's own private templates ahead of the public gallery, so a
curated template slug keeps meaning the same thing even if someone later
publishes a live project under it; `variant` picks that template's
format/page/theme. If no template matches, the slug resolves to the UNIQUE
live project that owns it across all orgs — the same resolution the site edge
uses to serve <slug>.hanzo.app, so what you can browse is what you can fork.
`name` and `target` override the derived project name and slug; everything
else is inherited from the parent. A live parent contributes its REPO, so the
child builds from the same source — the parent's deployed bytes are never
copied, because releases are per-tenant by design and the fork publishes its
own. The parent it actually resolved is stamped on the child as `forkedFrom`,
so attribution is a fact recorded at fork time rather than a claim
reconstructed later.
A gallery template is COPIED instead: its source becomes a new private
repository in the org's own code workspace on the forge — made on this first
need if the org has none — and the project's `repo` is that copy, so what the
org changes is its own and never the template everybody forks. A copy that
cannot be made fails the fork with the forge's reason, and nothing is left
behind. The copy is then published: built from its repository in a sandbox
and served at the project's own address, answering `status: building` until
it is `live`. Unless `target` names the project, its slug is numbered past
any the org holds and any address another project serves at, so the copy has
an address of its own to publish to.
It funnels through the SAME create path POST /v1/project uses, so slug
validation, org scoping, ID minting and the 409 on a slug the caller's own org
already uses are identical.
Scope: a validated principal is required (401 without one) and the child is
created in THAT principal's org.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIPostProjectForkRequest
*/
func (a *ProjectAPIService) PostProjectFork(ctx context.Context) ProjectAPIPostProjectForkRequest {
return ProjectAPIPostProjectForkRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return ProjectProjectsProject
func (a *ProjectAPIService) PostProjectForkExecute(r ProjectAPIPostProjectForkRequest) (*ProjectProjectsProject, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsProject
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectFork")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/fork"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsFork == nil {
return localVarReturnValue, nil, reportError("projectProjectsFork 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.projectProjectsFork
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 ProjectAPIPostProjectSitesRequest struct {
ctx context.Context
ApiService *ProjectAPIService
projectProjectsBuildSite *ProjectProjectsBuildSite
}
func (r ProjectAPIPostProjectSitesRequest) ProjectProjectsBuildSite(projectProjectsBuildSite ProjectProjectsBuildSite) ProjectAPIPostProjectSitesRequest {
r.projectProjectsBuildSite = &projectProjectsBuildSite
return r
}
func (r ProjectAPIPostProjectSitesRequest) Execute() (*ProjectProjectsSiteDeploy, *http.Response, error) {
return r.ApiService.PostProjectSitesExecute(r)
}
/*
PostProjectSites Generates a self-contained, mobile-responsive static site from a natural-language brief and deploys it live in one call.
Generates a self-contained, mobile-responsive static site from a
natural-language brief and deploys it live in one call.
One inference call turns `brief` (capped at 8 KiB) into a file manifest, which
then runs through the SAME validation, guards and viewport guarantee as a
hand-supplied manifest: index.html required at the root, absolute and
traversal paths rejected, per-file and total size capped, and a mobile
viewport meta tag injected into every HTML document that lacks one. The
generated site is fully inline — no CDNs, no remote fonts or images — so it is
CSP-safe. `slug` and `name` are optional: the model's own title is preferred,
and a slug is derived or minted when none is given.
It writes into the SAME org-scoped store as /v1/project — it ensures a
project (framework `static`) for the resolved slug and records a deployment —
so this is a second entry point to one publish pipeline, not a second copy of
project state. Publishing is free; what is billed is the model's tokens, to the
caller's own ledger, and the storage the org holds past the free tier. The
storage gate runs BEFORE any inference or upload, so an org past the tier that
cannot pay a month of what it holds (402, or 503 when commerce is unreachable)
generates and uploads NOTHING.
Answers 503 when object storage or inference is unconfigured, and 400 when the
model's manifest cannot be parsed or fails the guards.
Scope: a validated principal is required (401 without one) and the site is
published into THAT principal's org.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIPostProjectSitesRequest
*/
func (a *ProjectAPIService) PostProjectSites(ctx context.Context) ProjectAPIPostProjectSitesRequest {
return ProjectAPIPostProjectSitesRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return ProjectProjectsSiteDeploy
func (a *ProjectAPIService) PostProjectSitesExecute(r ProjectAPIPostProjectSitesRequest) (*ProjectProjectsSiteDeploy, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsSiteDeploy
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectSites")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/sites"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsBuildSite == nil {
return localVarReturnValue, nil, reportError("projectProjectsBuildSite 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.projectProjectsBuildSite
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 ProjectAPIPostProjectSitesDeployRequest struct {
ctx context.Context
ApiService *ProjectAPIService
projectProjectsDeploySite *ProjectProjectsDeploySite
}
func (r ProjectAPIPostProjectSitesDeployRequest) ProjectProjectsDeploySite(projectProjectsDeploySite ProjectProjectsDeploySite) ProjectAPIPostProjectSitesDeployRequest {
r.projectProjectsDeploySite = &projectProjectsDeploySite
return r
}
func (r ProjectAPIPostProjectSitesDeployRequest) Execute() (*ProjectProjectsSiteDeploy, *http.Response, error) {
return r.ApiService.PostProjectSitesDeployExecute(r)
}
/*
PostProjectSitesDeploy Deploys a caller-supplied file manifest — the deploy_site capability an agent calls — and answers with where it went live.
Deploys a caller-supplied file manifest — the deploy_site
capability an agent calls — and answers with where it went live.
`files` is a list of {path, content} pairs, the same shape the brief build
emits, and it runs through the SAME guards: index.html required at the root,
absolute and traversal paths rejected, per-file and total size capped, and a
mobile viewport meta tag injected into every HTML document that lacks one — so
a hand-built site is exactly as safe and as responsive as a generated one.
`slug` and `name` are optional; a slug is derived from the name or minted.
It writes into the SAME org-scoped store as /v1/project, ensuring a project
(framework `static`) for the resolved slug and recording a deployment. It is
free: the site is billed for the storage its org holds past the free tier, and
the storage gate runs before the upload, refusing (402) an org past the tier
that cannot pay a month of what it holds. Answers 503 when object storage is
unconfigured.
Scope: a validated principal is required (401 without one) and the site is
published into THAT principal's org.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ProjectAPIPostProjectSitesDeployRequest
*/
func (a *ProjectAPIService) PostProjectSitesDeploy(ctx context.Context) ProjectAPIPostProjectSitesDeployRequest {
return ProjectAPIPostProjectSitesDeployRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return ProjectProjectsSiteDeploy
func (a *ProjectAPIService) PostProjectSitesDeployExecute(r ProjectAPIPostProjectSitesDeployRequest) (*ProjectProjectsSiteDeploy, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsSiteDeploy
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PostProjectSitesDeploy")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/sites/deploy"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.projectProjectsDeploySite == nil {
return localVarReturnValue, nil, reportError("projectProjectsDeploySite 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.projectProjectsDeploySite
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 ProjectAPIPutProjectBySlugStarRequest struct {
ctx context.Context
ApiService *ProjectAPIService
slug string
}
func (r ProjectAPIPutProjectBySlugStarRequest) Execute() (*ProjectProjectsStar, *http.Response, error) {
return r.ApiService.PutProjectBySlugStarExecute(r)
}
/*
PutProjectBySlugStar Bookmarks a project for the person calling, and answers whether it is starred afterwards.
Bookmarks a project for the person calling, and answers whether it is
starred afterwards.
The star is YOURS: it is keyed by you as well as by the project, so two people
see two answers for the same one and starring it says nothing about anybody
else's list. Starring a project you have already starred leaves it starred.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param slug Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.
@return ProjectAPIPutProjectBySlugStarRequest
*/
func (a *ProjectAPIService) PutProjectBySlugStar(ctx context.Context, slug string) ProjectAPIPutProjectBySlugStarRequest {
return ProjectAPIPutProjectBySlugStarRequest{
ApiService: a,
ctx: ctx,
slug: slug,
}
}
// Execute executes the request
//
// @return ProjectProjectsStar
func (a *ProjectAPIService) PutProjectBySlugStarExecute(r ProjectAPIPutProjectBySlugStarRequest) (*ProjectProjectsStar, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPut
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ProjectProjectsStar
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectAPIService.PutProjectBySlugStar")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/project/{slug}/star"
localVarPath = strings.Replace(localVarPath, "{"+"slug"+"}", url.PathEscape(parameterValueToString(r.slug, "slug")), -1)
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
}