upload

package
v0.0.0-...-6553c09 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeployFileUploadParams

type DeployFileUploadParams struct {
	DeployID string
	Path     string
	File     io.ReadCloser
}

DeployFileUploadParams contains the information necessary to upload a new file to a deploy.

type DeployWithFilesParams

type DeployWithFilesParams struct {
	ID     string
	Title  string
	Branch string
	Files  map[string]string
}

DeployWithFilesParams contains all of the necessary parameters to initiate a new deployment.

func NewDeployWithExistingFiles

func NewDeployWithExistingFiles(id, branch string, assets []*models.File) (params *DeployWithFilesParams)

NewDeployWithExistingFiles creates a DeployWithFilesParams object from a site ID, branch name, and a list of existing site files.

func (*DeployWithFilesParams) RegisterFile

func (d *DeployWithFilesParams) RegisterFile(path string, content io.ReadSeeker) (err error)

RegisterFile adds a file path name and its hash to the file list.

type Handler

type Handler struct {
	Token string
}

Handler provides high level functions to upload files to Netlify through their SDK.

func (Handler) CreateDeployWithFiles

func (h Handler) CreateDeployWithFiles(ctx context.Context, deployParams *DeployWithFilesParams) (deploy *models.Deploy, err error)

CreateDeployWithFiles creates a new site deployment.

func (Handler) DestroyDeploy

func (h Handler) DestroyDeploy(ctx context.Context, id string) (err error)

DestroyDeploy cancels and then deletes the deploy with the given ID.

func (Handler) GetLatestDeploy

func (h Handler) GetLatestDeploy(ctx context.Context, id, branch string) (deploy *models.Deploy, err error)

GetLatestDeploy returns the most recent deploy for the given site if one exists.

func (Handler) GetSite

func (h Handler) GetSite(ctx context.Context, name string) (site *models.Site, err error)

GetSite returns a model of the site using the given name if one exists.

func (Handler) GetSiteFiles

func (h Handler) GetSiteFiles(ctx context.Context, id string) (files []*models.File, err error)

GetSiteFiles returns the list of files for a specific site.

func (Handler) UploadFilesToDeploy

func (h Handler) UploadFilesToDeploy(ctx context.Context, deployFiles ...DeployFileUploadParams) (files []*models.File, err error)

UploadFilesToDeploy uploads a slice of files to an open deploy on Netlify.

func (Handler) WaitForDeploy

func (h Handler) WaitForDeploy(ctx context.Context, deploy *models.Deploy) (err error)

WaitForDeploy waits until the deploy is ready.

Jump to

Keyboard shortcuts

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