client

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFound added in v0.6.0

func NotFound(err error) bool

NotFound detects if an error returned by the Vercel API was the result of an entity not existing.

Types

type APIError

type APIError struct {
	Code       string `json:"code"`
	Message    string `json:"message"`
	StatusCode int
	RawMessage []byte
	// contains filtered or unexported fields
}

APIError is an error type that exposes additional information about why an API request failed.

func (APIError) Error

func (e APIError) Error() string

Error provides a user friendly error message.

type AliasResponse added in v0.6.0

type AliasResponse struct {
	UID          string `json:"uid"`
	Alias        string `json:"alias"`
	DeploymentID string `json:"deploymentId"`
	TeamID       string `json:"-"`
}

AliasResponse defines the response the Vercel API returns for an alias.

type AttackChallengeMode added in v1.10.0

type AttackChallengeMode struct {
	ProjectID string `json:"projectId"`
	TeamID    string `json:"-"`
	Enabled   bool   `json:"attackModeEnabled"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an API wrapper, providing a high-level interface to the Vercel API.

func New

func New(token string) *Client

New creates a new instace of Client for a given API token.

func (*Client) CreateAlias added in v0.6.0

func (c *Client) CreateAlias(ctx context.Context, request CreateAliasRequest, deploymentID string, teamID string) (r AliasResponse, err error)

CreateAlias creates an alias within Vercel.

func (*Client) CreateDNSRecord added in v0.5.0

func (c *Client) CreateDNSRecord(ctx context.Context, teamID string, request CreateDNSRecordRequest) (r DNSRecord, err error)

CreateDNSRecord creates a DNS record for a specified domain name within Vercel.

func (*Client) CreateDeployHook added in v1.9.0

func (c *Client) CreateDeployHook(ctx context.Context, request CreateDeployHookRequest) (h DeployHook, err error)

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(ctx context.Context, request CreateDeploymentRequest, teamID string) (r DeploymentResponse, err error)

CreateDeployment creates a deployment within Vercel.

func (*Client) CreateEdgeConfig added in v1.5.0

func (c *Client) CreateEdgeConfig(ctx context.Context, request CreateEdgeConfigRequest) (e EdgeConfig, err error)

func (*Client) CreateEdgeConfigToken added in v1.5.0

func (c *Client) CreateEdgeConfigToken(ctx context.Context, request CreateEdgeConfigTokenRequest) (e EdgeConfigToken, err error)

func (*Client) CreateEnvironmentVariable added in v0.8.0

func (c *Client) CreateEnvironmentVariable(ctx context.Context, request CreateEnvironmentVariableRequest) (e EnvironmentVariable, err error)

CreateEnvironmentVariable will create a brand new environment variable if one does not exist.

func (*Client) CreateEnvironmentVariables added in v0.11.2

func (c *Client) CreateEnvironmentVariables(ctx context.Context, request CreateEnvironmentVariablesRequest) error

func (*Client) CreateFile

func (c *Client) CreateFile(ctx context.Context, request CreateFileRequest) error

CreateFile will upload a file to Vercel so that it can be later used for a Deployment.

func (*Client) CreateLogDrain added in v1.7.0

func (c *Client) CreateLogDrain(ctx context.Context, request CreateLogDrainRequest) (l LogDrain, err error)

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, teamID string, request CreateProjectRequest) (r ProjectResponse, err error)

CreateProject will create a project within Vercel.

func (*Client) CreateProjectDomain

func (c *Client) CreateProjectDomain(ctx context.Context, projectID, teamID string, request CreateProjectDomainRequest) (r ProjectDomainResponse, err error)

CreateProjectDomain creates a project domain within Vercel.

func (*Client) CreateSharedEnvironmentVariable added in v0.12.0

func (c *Client) CreateSharedEnvironmentVariable(ctx context.Context, request CreateSharedEnvironmentVariableRequest) (e SharedEnvironmentVariableResponse, err error)

CreateSharedEnvironmentVariable will create a brand new shared environment variable if one does not exist.

func (*Client) CreateTeam

func (c *Client) CreateTeam(ctx context.Context, request TeamCreateRequest) (r Team, err error)

CreateTeam creates a team within vercel.

func (*Client) CreateWebhook added in v1.6.0

func (c *Client) CreateWebhook(ctx context.Context, request CreateWebhookRequest) (w Webhook, err error)

func (*Client) DeleteAlias added in v0.6.0

func (c *Client) DeleteAlias(ctx context.Context, aliasUID string, teamID string) (r DeleteAliasResponse, err error)

DeleteAlias deletes an alias within Vercel.

func (*Client) DeleteDNSRecord added in v0.5.0

func (c *Client) DeleteDNSRecord(ctx context.Context, domain, recordID, teamID string) error

DeleteDNSRecord removes a DNS domain from Vercel.

func (*Client) DeleteDeployHook added in v1.9.0

func (c *Client) DeleteDeployHook(ctx context.Context, request DeleteDeployHookRequest) error

func (*Client) DeleteDeployment added in v0.3.0

func (c *Client) DeleteDeployment(ctx context.Context, deploymentID string, teamID string) (r DeleteDeploymentResponse, err error)

DeleteDeployment deletes a deployment within Vercel.

func (*Client) DeleteEdgeConfig added in v1.5.0

func (c *Client) DeleteEdgeConfig(ctx context.Context, id, teamID string) error

func (*Client) DeleteEdgeConfigSchema added in v1.5.0

func (c *Client) DeleteEdgeConfigSchema(ctx context.Context, id, teamID string) error

func (*Client) DeleteEdgeConfigToken added in v1.5.0

func (c *Client) DeleteEdgeConfigToken(ctx context.Context, request EdgeConfigTokenRequest) error

func (*Client) DeleteEnvironmentVariable

func (c *Client) DeleteEnvironmentVariable(ctx context.Context, projectID, teamID, variableID string) error

DeleteEnvironmentVariable will remove an environment variable from Vercel.

func (*Client) DeleteLogDrain added in v1.7.0

func (c *Client) DeleteLogDrain(ctx context.Context, id, teamID string) error

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, projectID, teamID string) error

DeleteProject deletes a project within Vercel. Note that there is no need to explicitly remove every environment variable, as these cease to exist when a project is removed.

func (*Client) DeleteProjectDomain

func (c *Client) DeleteProjectDomain(ctx context.Context, projectID, domain, teamID string) error

DeleteProjectDomain removes any association of a domain name with a Vercel project.

func (*Client) DeleteSharedEnvironmentVariable added in v0.12.0

func (c *Client) DeleteSharedEnvironmentVariable(ctx context.Context, teamID, variableID string) error

DeleteSharedEnvironmentVariable will remove a shared environment variable from Vercel.

func (*Client) DeleteTeam

func (c *Client) DeleteTeam(ctx context.Context, teamID string) error

DeleteTeam deletes an existing team within vercel.

func (*Client) DeleteWebhook added in v1.6.0

func (c *Client) DeleteWebhook(ctx context.Context, id, teamID string) error

func (*Client) GetAlias added in v0.6.0

func (c *Client) GetAlias(ctx context.Context, alias, teamID string) (r AliasResponse, err error)

GetAlias retrieves information about an existing alias from vercel.

func (*Client) GetAttackChallengeMode added in v1.10.0

func (c *Client) GetAttackChallengeMode(ctx context.Context, projectID, teamID string) (a AttackChallengeMode, err error)

func (*Client) GetDNSRecord added in v0.5.0

func (c *Client) GetDNSRecord(ctx context.Context, recordID, teamID string) (r DNSRecord, err error)

GetDNSRecord retrieves information about a DNS domain from Vercel.

func (*Client) GetDeployment

func (c *Client) GetDeployment(ctx context.Context, deploymentID, teamID string) (r DeploymentResponse, err error)

GetDeployment retrieves information from Vercel about an existing Deployment.

func (*Client) GetEdgeConfig added in v1.5.0

func (c *Client) GetEdgeConfig(ctx context.Context, id, teamID string) (e EdgeConfig, err error)

func (*Client) GetEdgeConfigSchema added in v1.5.0

func (c *Client) GetEdgeConfigSchema(ctx context.Context, id, teamID string) (e EdgeConfigSchema, err error)

func (*Client) GetEdgeConfigToken added in v1.5.0

func (c *Client) GetEdgeConfigToken(ctx context.Context, request EdgeConfigTokenRequest) (e EdgeConfigToken, err error)

func (*Client) GetEndpointVerificationCode added in v1.7.0

func (c *Client) GetEndpointVerificationCode(ctx context.Context, teamID string) (code string, err error)

func (*Client) GetEnvironmentVariable added in v0.8.0

func (c *Client) GetEnvironmentVariable(ctx context.Context, projectID, teamID, envID string) (e EnvironmentVariable, err error)

GetEnvironmentVariable gets a singluar environment variable from Vercel based on its ID.

func (*Client) GetEnvironmentVariables added in v1.9.0

func (c *Client) GetEnvironmentVariables(ctx context.Context, projectID, teamID string) ([]EnvironmentVariable, error)

func (*Client) GetLogDrain added in v1.7.0

func (c *Client) GetLogDrain(ctx context.Context, id, teamID string) (l LogDrain, err error)

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, projectID, teamID string) (r ProjectResponse, err error)

GetProject retrieves information about an existing project from Vercel.

func (*Client) GetProjectDomain

func (c *Client) GetProjectDomain(ctx context.Context, projectID, domain, teamID string) (r ProjectDomainResponse, err error)

GetProjectDomain retrieves information about a project domain from Vercel.

func (*Client) GetProjectFunctionCPU added in v1.10.0

func (c *Client) GetProjectFunctionCPU(ctx context.Context, projectID, teamID string) (p ProjectFunctionCPU, err error)

func (*Client) GetSharedEnvironmentVariable added in v0.12.0

func (c *Client) GetSharedEnvironmentVariable(ctx context.Context, teamID, envID string) (e SharedEnvironmentVariableResponse, err error)

func (*Client) GetTeam

func (c *Client) GetTeam(ctx context.Context, idOrSlug string) (r Team, err error)

GetTeam returns information about an existing team within vercel.

func (*Client) GetWebhook added in v1.6.0

func (c *Client) GetWebhook(ctx context.Context, id, teamID string) (w Webhook, err error)

func (*Client) LinkGitRepoToProject added in v1.8.0

func (c *Client) LinkGitRepoToProject(ctx context.Context, request LinkGitRepoToProjectRequest) (r ProjectResponse, err error)

func (*Client) ListDNSRecords added in v0.5.0

func (c *Client) ListDNSRecords(ctx context.Context, domain, teamID string) (r []DNSRecord, err error)

ListDNSRecords is a test helper for listing DNS records that exist for a given domain. We limit this to 100, as this is the largest limit allowed by the API. This is only used by the sweeper script, so this is safe to do so, but converting into a production ready function would require some refactoring.

func (*Client) ListEdgeConfigs added in v1.5.0

func (c *Client) ListEdgeConfigs(ctx context.Context, teamID string) (e []EdgeConfig, err error)

func (*Client) ListProjects added in v0.2.0

func (c *Client) ListProjects(ctx context.Context, teamID string) (r []ProjectResponse, err error)

ListProjects lists the top 100 projects (no pagination) from within Vercel.

func (*Client) ListSharedEnvironmentVariables added in v1.1.0

func (c *Client) ListSharedEnvironmentVariables(ctx context.Context, teamID string) ([]SharedEnvironmentVariableResponse, error)

func (*Client) Team added in v1.10.1

func (c *Client) Team(ctx context.Context, teamID string) (Team, error)

func (*Client) UnlinkGitRepoFromProject added in v1.8.0

func (c *Client) UnlinkGitRepoFromProject(ctx context.Context, projectID, teamID string) (r ProjectResponse, err error)

func (*Client) UpdateAttackChallengeMode added in v1.10.0

func (c *Client) UpdateAttackChallengeMode(ctx context.Context, request AttackChallengeMode) (a AttackChallengeMode, err error)

func (*Client) UpdateDNSRecord added in v0.5.0

func (c *Client) UpdateDNSRecord(ctx context.Context, teamID, recordID string, request UpdateDNSRecordRequest) (r DNSRecord, err error)

UpdateDNSRecord updates a DNS record for a specified domain name within Vercel.

func (*Client) UpdateEdgeConfig added in v1.5.0

func (c *Client) UpdateEdgeConfig(ctx context.Context, request UpdateEdgeConfigRequest) (e EdgeConfig, err error)

func (*Client) UpdateEnvironmentVariable added in v0.8.0

func (c *Client) UpdateEnvironmentVariable(ctx context.Context, request UpdateEnvironmentVariableRequest) (e EnvironmentVariable, err error)

UpdateEnvironmentVariable will update an existing environment variable to the latest information.

func (*Client) UpdateProductionBranch added in v0.11.0

func (c *Client) UpdateProductionBranch(ctx context.Context, request UpdateProductionBranchRequest) (r ProjectResponse, err error)

func (*Client) UpdateProject

func (c *Client) UpdateProject(ctx context.Context, projectID, teamID string, request UpdateProjectRequest) (r ProjectResponse, err error)

UpdateProject updates an existing projects configuration within Vercel.

func (*Client) UpdateProjectDomain

func (c *Client) UpdateProjectDomain(ctx context.Context, projectID, domain, teamID string, request UpdateProjectDomainRequest) (r ProjectDomainResponse, err error)

UpdateProjectDomain updates an existing project domain within Vercel.

func (*Client) UpdateProjectFunctionCPU added in v1.10.0

func (c *Client) UpdateProjectFunctionCPU(ctx context.Context, request ProjectFunctionCPURequest) (p ProjectFunctionCPU, err error)

func (*Client) UpdateProtectionBypassForAutomation added in v0.15.0

func (c *Client) UpdateProtectionBypassForAutomation(ctx context.Context, request UpdateProtectionBypassForAutomationRequest) (s string, err error)

func (*Client) UpdateSharedEnvironmentVariable added in v0.12.0

func (c *Client) UpdateSharedEnvironmentVariable(ctx context.Context, request UpdateSharedEnvironmentVariableRequest) (e SharedEnvironmentVariableResponse, err error)

func (*Client) UpsertEdgeConfigSchema added in v1.5.0

func (c *Client) UpsertEdgeConfigSchema(ctx context.Context, request EdgeConfigSchema) (e EdgeConfigSchema, err error)

func (*Client) WithTeam added in v1.10.1

func (c *Client) WithTeam(team Team) *Client

type CreateAliasRequest added in v0.6.0

type CreateAliasRequest struct {
	Alias string `json:"alias"`
}

CreateAliasRequest defines the request the Vercel API expects in order to create an alias.

type CreateDNSRecordRequest added in v0.5.0

type CreateDNSRecordRequest struct {
	Domain     string `json:"-"`
	MXPriority int64  `json:"mxPriority,omitempty"`
	Name       string `json:"name"`
	SRV        *SRV   `json:"srv,omitempty"`
	TTL        int64  `json:"ttl,omitempty"`
	Type       string `json:"type"`
	Value      string `json:"value,omitempty"`
	Comment    string `json:"comment"`
}

CreateDNSRecordRequest defines the information necessary to create a DNS record within Vercel.

type CreateDeployHookRequest added in v1.9.0

type CreateDeployHookRequest struct {
	ProjectID string `json:"-"`
	TeamID    string `json:"-"`
	Name      string `json:"name"`
	Ref       string `json:"ref"`
}

type CreateDeploymentRequest

type CreateDeploymentRequest struct {
	Files       []DeploymentFile       `json:"files,omitempty"`
	Functions   map[string]interface{} `json:"functions,omitempty"`
	Environment map[string]string      `json:"env,omitempty"`
	Build       struct {
		Environment map[string]string `json:"env,omitempty"`
	} `json:"build,omitempty"`
	ProjectID       string                 `json:"project,omitempty"`
	ProjectSettings map[string]interface{} `json:"projectSettings"`
	Name            string                 `json:"name"`
	Regions         []string               `json:"regions,omitempty"`
	Routes          []interface{}          `json:"routes,omitempty"`
	Target          string                 `json:"target,omitempty"`
	GitSource       *gitSource             `json:"gitSource,omitempty"`
	Ref             string                 `json:"-"`
}

CreateDeploymentRequest defines the request the Vercel API expects in order to create a deployment.

type CreateEdgeConfigRequest added in v1.5.0

type CreateEdgeConfigRequest struct {
	Name   string `json:"slug"`
	TeamID string `json:"-"`
}

type CreateEdgeConfigTokenRequest added in v1.5.0

type CreateEdgeConfigTokenRequest struct {
	Label        string `json:"label"`
	TeamID       string `json:"-"`
	EdgeConfigID string `json:"-"`
}

type CreateEnvironmentVariableRequest added in v0.8.0

type CreateEnvironmentVariableRequest struct {
	EnvironmentVariable EnvironmentVariableRequest
	ProjectID           string
	TeamID              string
}

type CreateEnvironmentVariablesRequest added in v0.11.2

type CreateEnvironmentVariablesRequest struct {
	EnvironmentVariables []EnvironmentVariableRequest
	ProjectID            string
	TeamID               string
}

type CreateFileRequest added in v0.5.1

type CreateFileRequest struct {
	Filename string
	SHA      string
	Content  string
	TeamID   string
}

CreateFileRequest defines the information needed to upload a file to Vercel.

type CreateLogDrainRequest added in v1.7.0

type CreateLogDrainRequest struct {
	TeamID         string            `json:"-"`
	DeliveryFormat string            `json:"deliveryFormat"`
	Environments   []string          `json:"environments"`
	Headers        map[string]string `json:"headers,omitempty"`
	ProjectIDs     []string          `json:"projectIds,omitempty"`
	SamplingRate   float64           `json:"samplingRate,omitempty"`
	Secret         string            `json:"secret,omitempty"`
	Sources        []string          `json:"sources"`
	Endpoint       string            `json:"url"`
}

type CreateProjectDomainRequest

type CreateProjectDomainRequest struct {
	Name               string `json:"name"`
	GitBranch          string `json:"gitBranch,omitempty"`
	Redirect           string `json:"redirect,omitempty"`
	RedirectStatusCode int64  `json:"redirectStatusCode,omitempty"`
}

CreateProjectDomainRequest defines the information necessary to create a project domain. A project domain is an association of a specific domain name to a project. These are typically used to assign a domain name to any production deployments, but can also be used to configure redirects, or to give specific git branches a domain name.

type CreateProjectRequest

type CreateProjectRequest struct {
	BuildCommand                *string               `json:"buildCommand"`
	CommandForIgnoringBuildStep *string               `json:"commandForIgnoringBuildStep,omitempty"`
	DevCommand                  *string               `json:"devCommand"`
	EnvironmentVariables        []EnvironmentVariable `json:"environmentVariables"`
	Framework                   *string               `json:"framework"`
	GitRepository               *GitRepository        `json:"gitRepository,omitempty"`
	InstallCommand              *string               `json:"installCommand"`
	Name                        string                `json:"name"`
	OutputDirectory             *string               `json:"outputDirectory"`
	PublicSource                *bool                 `json:"publicSource"`
	RootDirectory               *string               `json:"rootDirectory"`
	ServerlessFunctionRegion    string                `json:"serverlessFunctionRegion,omitempty"`
}

CreateProjectRequest defines the information necessary to create a project.

type CreateSharedEnvironmentVariableRequest added in v0.12.0

type CreateSharedEnvironmentVariableRequest struct {
	EnvironmentVariable SharedEnvironmentVariableRequest
	TeamID              string
}

type CreateWebhookRequest added in v1.6.0

type CreateWebhookRequest struct {
	TeamID     string   `json:"-"`
	Events     []string `json:"events"`
	Endpoint   string   `json:"url"`
	ProjectIDs []string `json:"projectIds,omitempty"`
}

type DNSRecord added in v0.5.0

type DNSRecord struct {
	Creator    string `json:"creator"`
	Domain     string `json:"domain"`
	ID         string `json:"id"`
	TeamID     string `json:"-"`
	Name       string `json:"name"`
	TTL        int64  `json:"ttl"`
	Value      string `json:"value"`
	RecordType string `json:"recordType"`
	Priority   int64  `json:"priority"`
	Comment    string `json:"comment"`
}

DNSRecord is the information Vercel surfaces about a DNS record associated with a particular domain.

type DeleteAliasResponse added in v0.6.0

type DeleteAliasResponse struct {
	Status string `json:"status"`
}

DeleteAliasResponse defines the response the Vercel API returns when an alias is deleted.

type DeleteDeployHookRequest added in v1.9.0

type DeleteDeployHookRequest struct {
	ProjectID string
	TeamID    string
	ID        string
}

type DeleteDeploymentResponse added in v0.3.0

type DeleteDeploymentResponse struct {
	State string `json:"state"`
	UID   string `json:"uid"`
}

DeleteDeploymentResponse defines the response the Vercel API returns when a deployment is deleted.

type DeployHook added in v1.9.0

type DeployHook struct {
	Name string `json:"name"`
	Ref  string `json:"ref"`
	URL  string `json:"url"`
	ID   string `json:"id"`
}

type DeploymentFile

type DeploymentFile struct {
	File string `json:"file"`
	Sha  string `json:"sha"`
	Size int    `json:"size"`
}

DeploymentFile is a struct defining the required information about a singular file that should be used within a deployment.

type DeploymentResponse

type DeploymentResponse struct {
	Aliases    []string `json:"alias"`
	AliasError *struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"aliasError"`
	AliasWarning *struct {
		Code    string `json:"code"`
		Message string `json:"message"`
		Link    string `json:"link"`
		Action  string `json:"action"`
	} `json:"aliasWarning"`
	Creator struct {
		Username string `json:"username"`
	} `json:"creator"`
	Team *struct {
		Slug string `json:"slug"`
	} `json:"team"`
	Build struct {
		Environment []string `json:"env"`
	} `json:"build"`
	AliasAssigned    bool      `json:"aliasAssigned"`
	ChecksConclusion string    `json:"checksConclusion"`
	ErrorCode        string    `json:"errorCode"`
	ErrorMessage     string    `json:"errorMessage"`
	ID               string    `json:"id"`
	ProjectID        string    `json:"projectId"`
	TeamID           string    `json:"-"`
	ReadyState       string    `json:"readyState"`
	Target           *string   `json:"target"`
	URL              string    `json:"url"`
	GitSource        gitSource `json:"gitSource"`
}

DeploymentResponse defines the response the Vercel API returns when a deployment is created or updated.

func (*DeploymentResponse) CheckForError

func (dr *DeploymentResponse) CheckForError(projectID string) error

CheckForError checks through the various failure modes of a deployment to see if any were hit.

func (*DeploymentResponse) DeploymentLogsURL

func (dr *DeploymentResponse) DeploymentLogsURL(projectID string) string

DeploymentLogsURL provides a user friendly URL that links directly to the vercel UI for a particular deployment.

func (*DeploymentResponse) IsComplete

func (dr *DeploymentResponse) IsComplete() bool

IsComplete is used to determine whether a deployment is still processing, or whether it is fully done.

type EdgeConfig added in v1.5.0

type EdgeConfig struct {
	Slug   string `json:"slug"`
	ID     string `json:"id"`
	TeamID string `json:"ownerId"`
}

type EdgeConfigSchema added in v1.5.0

type EdgeConfigSchema struct {
	ID         string `json:"-"`
	Definition any    `json:"definition"`
	TeamID     string `json:"-"`
}

type EdgeConfigToken added in v1.5.0

type EdgeConfigToken struct {
	TeamID       string
	Token        string `json:"token"`
	Label        string `json:"label"`
	ID           string `json:"id"`
	EdgeConfigID string `json:"edgeConfigId"`
}

func (EdgeConfigToken) ConnectionString added in v1.5.0

func (e EdgeConfigToken) ConnectionString() string

type EdgeConfigTokenRequest added in v1.5.0

type EdgeConfigTokenRequest struct {
	TeamID       string
	EdgeConfigID string
	Token        string
}

type EnvironmentVariable

type EnvironmentVariable struct {
	Key       string   `json:"key"`
	Value     string   `json:"value"`
	Target    []string `json:"target"`
	GitBranch *string  `json:"gitBranch,omitempty"`
	Type      string   `json:"type"`
	ID        string   `json:"id,omitempty"`
	TeamID    string   `json:"-"`
}

EnvironmentVariable defines the information Vercel requires and surfaces about an environment variable that is associated with a project.

type EnvironmentVariableRequest added in v0.11.2

type EnvironmentVariableRequest struct {
	Key       string   `json:"key"`
	Value     string   `json:"value"`
	Target    []string `json:"target"`
	GitBranch *string  `json:"gitBranch,omitempty"`
	Type      string   `json:"type"`
}

CreateEnvironmentVariableRequest defines the information that needs to be passed to Vercel in order to create an environment variable.

type GitComments added in v1.9.0

type GitComments struct {
	OnCommit      bool `json:"onCommit"`
	OnPullRequest bool `json:"onPullRequest"`
}

type GitRepository

type GitRepository struct {
	Type string `json:"type"`
	Repo string `json:"repo"`
}

GitRepository is the information Vercel requires and surfaces about which git provider and repository a project is linked with.

type LinkGitRepoToProjectRequest added in v1.8.0

type LinkGitRepoToProjectRequest struct {
	ProjectID string `json:"-"`
	TeamID    string `json:"-"`
	Type      string `json:"type"`
	Repo      string `json:"repo"`
}

type LogDrain added in v1.7.0

type LogDrain struct {
	ID             string            `json:"id"`
	TeamID         string            `json:"ownerId"`
	DeliveryFormat string            `json:"deliveryFormat"`
	Environments   []string          `json:"environments"`
	Headers        map[string]string `json:"headers"`
	ProjectIDs     []string          `json:"projectIds"`
	SamplingRate   *float64          `json:"samplingRate"`
	Secret         string            `json:"secret"`
	Sources        []string          `json:"sources"`
	Endpoint       string            `json:"url"`
}

type MissingFilesError

type MissingFilesError struct {
	Code    string   `json:"code"`
	Message string   `json:"message"`
	Missing []string `json:"missing"`
}

MissingFilesError is a sentinel error that indicates a deployment could not be created because additional files need to be uploaded first.

func (MissingFilesError) Error

func (e MissingFilesError) Error() string

Error gives the MissingFilesError a user friendly error message.

type OptionsAllowlist added in v1.11.0

type OptionsAllowlist struct {
	Paths []OptionsAllowlistPath `json:"paths"`
}

type OptionsAllowlistPath added in v1.11.0

type OptionsAllowlistPath struct {
	Value string `json:"value"`
}

type PasswordProtection added in v1.0.0

type PasswordProtection struct {
	DeploymentType string `json:"deploymentType"`
}

type PasswordProtectionWithPassword added in v1.0.0

type PasswordProtectionWithPassword struct {
	DeploymentType string `json:"deploymentType"`
	Password       string `json:"password"`
}

type ProjectDomainResponse

type ProjectDomainResponse struct {
	Name               string  `json:"name"`
	ProjectID          string  `json:"projectId"`
	TeamID             string  `json:"-"`
	Redirect           *string `json:"redirect"`
	RedirectStatusCode *int64  `json:"redirectStatusCode"`
	GitBranch          *string `json:"gitBranch"`
}

ProjectDomainResponse defines the information that Vercel exposes about a domain that is associated with a vercel project.

type ProjectFunctionCPU added in v1.10.0

type ProjectFunctionCPU struct {
	ProjectID string
	TeamID    string
	CPU       *string
}

type ProjectFunctionCPURequest added in v1.10.0

type ProjectFunctionCPURequest struct {
	ProjectID string
	TeamID    string
	CPU       string
}

type ProjectResponse

type ProjectResponse struct {
	BuildCommand                *string `json:"buildCommand"`
	CommandForIgnoringBuildStep *string `json:"commandForIgnoringBuildStep"`
	DevCommand                  *string `json:"devCommand"`
	Framework                   *string `json:"framework"`
	ID                          string  `json:"id"`
	TeamID                      string  `json:"-"`
	InstallCommand              *string `json:"installCommand"`
	Link                        *struct {
		Type string `json:"type"`
		// github
		Org  string `json:"org"`
		Repo string `json:"repo"`
		// bitbucket
		Owner string `json:"owner"`
		Slug  string `json:"slug"`
		// gitlab
		ProjectNamespace string `json:"projectNamespace"`
		ProjectURL       string `json:"projectUrl"`
		ProjectID        int64  `json:"projectId,string"`
		// production branch
		ProductionBranch *string      `json:"productionBranch"`
		DeployHooks      []DeployHook `json:"deployHooks"`
	} `json:"link"`
	Name                                 string                      `json:"name"`
	OutputDirectory                      *string                     `json:"outputDirectory"`
	PublicSource                         *bool                       `json:"publicSource"`
	RootDirectory                        *string                     `json:"rootDirectory"`
	ServerlessFunctionRegion             *string                     `json:"serverlessFunctionRegion"`
	VercelAuthentication                 *VercelAuthentication       `json:"ssoProtection"`
	PasswordProtection                   *PasswordProtection         `json:"passwordProtection"`
	TrustedIps                           *TrustedIps                 `json:"trustedIps"`
	OptionsAllowlist                     *OptionsAllowlist           `json:"optionsAllowlist"`
	ProtectionBypass                     map[string]ProtectionBypass `json:"protectionBypass"`
	AutoExposeSystemEnvVars              *bool                       `json:"autoExposeSystemEnvs"`
	EnablePreviewFeedback                *bool                       `json:"enablePreviewFeedback"`
	AutoAssignCustomDomains              bool                        `json:"autoAssignCustomDomains"`
	GitLFS                               bool                        `json:"gitLFS"`
	ServerlessFunctionZeroConfigFailover bool                        `json:"serverlessFunctionZeroConfigFailover"`
	CustomerSupportCodeVisibility        bool                        `json:"customerSupportCodeVisibility"`
	GitForkProtection                    bool                        `json:"gitForkProtection"`
	ProductionDeploymentsFastLane        bool                        `json:"productionDeploymentsFastLane"`
	DirectoryListing                     bool                        `json:"directoryListing"`
	SkewProtectionMaxAge                 int                         `json:"skewProtectionMaxAge"`
	GitComments                          *GitComments                `json:"gitComments"`
	Security                             *Security                   `json:"security"`
}

ProjectResponse defines the information Vercel returns about a project.

func (*ProjectResponse) Repository

func (r *ProjectResponse) Repository() *Repository

Repository is a helper method to convert the ProjectResponse Repository information into a more digestible format.

type ProtectionBypass added in v0.15.0

type ProtectionBypass struct {
	Scope string `json:"scope"`
}

type Repository

type Repository struct {
	Type             string
	Repo             string
	ProductionBranch *string
	DeployHooks      []DeployHook
}

Repository defines the information about a projects git connection.

type SRV added in v0.5.0

type SRV struct {
	Port     int64  `json:"port"`
	Priority int64  `json:"priority"`
	Target   string `json:"target"`
	Weight   int64  `json:"weight"`
}

SRV defines the metata required for creating an SRV type DNS Record.

type SRVUpdate added in v0.5.0

type SRVUpdate struct {
	Port     *int64  `json:"port"`
	Priority *int64  `json:"priority"`
	Target   *string `json:"target"`
	Weight   *int64  `json:"weight"`
}

SRVUpdate defines the updatable fields within an SRV block of a DNS record.

type Security added in v1.10.0

type Security struct {
	AttackModeEnabled bool `json:"attackModeEnabled"`
}

type SharedEnvVarRequest added in v0.12.0

type SharedEnvVarRequest struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type SharedEnvironmentVariableRequest added in v0.12.0

type SharedEnvironmentVariableRequest struct {
	Type                 string                `json:"type"`
	ProjectIDs           []string              `json:"projectId"`
	Target               []string              `json:"target"`
	EnvironmentVariables []SharedEnvVarRequest `json:"evs"`
}

type SharedEnvironmentVariableResponse added in v0.12.0

type SharedEnvironmentVariableResponse struct {
	Key        string   `json:"key"`
	TeamID     string   `json:"ownerId"`
	ID         string   `json:"id,omitempty"`
	Value      string   `json:"value"`
	Type       string   `json:"type"`
	Target     []string `json:"target"`
	ProjectIDs []string `json:"projectId"`
}

type Team added in v1.10.1

type Team struct {
	ID                                 string  `json:"id"`
	SensitiveEnvironmentVariablePolicy *string `json:"sensitiveEnvironmentVariablePolicy"`
}

Team is the information returned by the vercel api when a team is created.

type TeamCreateRequest

type TeamCreateRequest struct {
	Slug string `json:"slug"`
	Name string `json:"name"`
}

TeamCreateRequest defines the information needed to create a team within vercel.

type TrustedIpAddress added in v1.0.0

type TrustedIpAddress struct {
	Value string `json:"value"`
	Note  string `json:"note"`
}

type TrustedIps added in v1.0.0

type TrustedIps struct {
	DeploymentType string             `json:"deploymentType"`
	Addresses      []TrustedIpAddress `json:"addresses"`
	ProtectionMode string             `json:"protectionMode"`
}

type UpdateDNSRecordRequest added in v0.5.0

type UpdateDNSRecordRequest struct {
	MXPriority *int64     `json:"mxPriority,omitempty"`
	Name       *string    `json:"name,omitempty"`
	SRV        *SRVUpdate `json:"srv,omitempty"`
	TTL        *int64     `json:"ttl,omitempty"`
	Value      *string    `json:"value,omitempty"`
	Comment    string     `json:"comment"`
}

UpdateDNSRecordRequest defines the structure of the request body for updating a DNS record.

type UpdateEdgeConfigRequest added in v1.5.0

type UpdateEdgeConfigRequest struct {
	Slug   string `json:"slug"`
	TeamID string `json:"-"`
	ID     string `json:"-"`
}

type UpdateEnvironmentVariableRequest added in v0.8.0

type UpdateEnvironmentVariableRequest struct {
	Value     string   `json:"value"`
	Target    []string `json:"target"`
	GitBranch *string  `json:"gitBranch,omitempty"`
	Type      string   `json:"type"`
	ProjectID string   `json:"-"`
	TeamID    string   `json:"-"`
	EnvID     string   `json:"-"`
}

UpdateEnvironmentVariableRequest defines the information that needs to be passed to Vercel in order to update an environment variable.

type UpdateProductionBranchRequest added in v0.11.0

type UpdateProductionBranchRequest struct {
	TeamID    string `json:"-"`
	ProjectID string `json:"-"`
	Branch    string `json:"branch"`
}

type UpdateProjectDomainRequest

type UpdateProjectDomainRequest struct {
	GitBranch          *string `json:"gitBranch"`
	Redirect           *string `json:"redirect"`
	RedirectStatusCode *int64  `json:"redirectStatusCode"`
}

UpdateProjectDomainRequest defines the information necessary to update a project domain.

type UpdateProjectRequest

type UpdateProjectRequest struct {
	BuildCommand                         *string                         `json:"buildCommand"`
	CommandForIgnoringBuildStep          *string                         `json:"commandForIgnoringBuildStep"`
	DevCommand                           *string                         `json:"devCommand"`
	Framework                            *string                         `json:"framework"`
	InstallCommand                       *string                         `json:"installCommand"`
	Name                                 *string                         `json:"name,omitempty"`
	OutputDirectory                      *string                         `json:"outputDirectory"`
	PublicSource                         *bool                           `json:"publicSource"`
	RootDirectory                        *string                         `json:"rootDirectory"`
	ServerlessFunctionRegion             string                          `json:"serverlessFunctionRegion,omitempty"`
	VercelAuthentication                 *VercelAuthentication           `json:"ssoProtection"`
	PasswordProtection                   *PasswordProtectionWithPassword `json:"passwordProtection"`
	TrustedIps                           *TrustedIps                     `json:"trustedIps"`
	OptionsAllowlist                     *OptionsAllowlist               `json:"optionsAllowlist"`
	AutoExposeSystemEnvVars              bool                            `json:"autoExposeSystemEnvs"`
	EnablePreviewFeedback                *bool                           `json:"enablePreviewFeedback"`
	AutoAssignCustomDomains              bool                            `json:"autoAssignCustomDomains"`
	GitLFS                               bool                            `json:"gitLFS"`
	ServerlessFunctionZeroConfigFailover bool                            `json:"serverlessFunctionZeroConfigFailover"`
	CustomerSupportCodeVisibility        bool                            `json:"customerSupportCodeVisibility"`
	GitForkProtection                    bool                            `json:"gitForkProtection"`
	ProductionDeploymentsFastLane        bool                            `json:"productionDeploymentsFastLane"`
	DirectoryListing                     bool                            `json:"directoryListing"`
	SkewProtectionMaxAge                 int                             `json:"skewProtectionMaxAge"`
	GitComments                          *GitComments                    `json:"gitComments"`
}

UpdateProjectRequest defines the possible fields that can be updated within a vercel project. note that the values are all pointers, with many containing `omitempty` for serialisation. This is because the Vercel API behaves in the following manner: - a provided field will be updated - setting the field to an empty value (e.g. "") will remove the setting for that field. - omitting the value entirely from the request will _not_ update the field.

type UpdateProtectionBypassForAutomationRequest added in v0.15.0

type UpdateProtectionBypassForAutomationRequest struct {
	TeamID    string
	ProjectID string
	NewValue  bool
	Secret    string
}

type UpdateSharedEnvironmentVariableRequest added in v0.12.0

type UpdateSharedEnvironmentVariableRequest struct {
	Value      string   `json:"value"`
	Type       string   `json:"type"`
	ProjectIDs []string `json:"projectId"`
	Target     []string `json:"target"`
	TeamID     string   `json:"-"`
	EnvID      string   `json:"-"`
}

type VercelAuthentication added in v1.0.0

type VercelAuthentication struct {
	DeploymentType string `json:"deploymentType"`
}

func (*VercelAuthentication) MarshalJSON added in v1.0.0

func (v *VercelAuthentication) MarshalJSON() ([]byte, error)

type Webhook added in v1.6.0

type Webhook struct {
	Events     []string `json:"events"`
	ID         string   `json:"id"`
	Endpoint   string   `json:"url"`
	TeamID     string   `json:"ownerId"`
	ProjectIDs []string `json:"projectIds"`
	Secret     string   `json:"secret"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL