netlify

package
v1.49.13 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken(ctx context.Context, orgName string) string

Get access token

Types

type Client

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

func New

func New(ctx context.Context, accessToken string) *Client

func NewFromNamespace

func NewFromNamespace(ctx context.Context, orgName string) *Client

Get a client for netlify

func (*Client) AccessToken

func (c *Client) AccessToken(userId, email string) (User, error)

func (*Client) CreateDeploy

func (c *Client) CreateDeploy(ste *Site, digest *Digest, draft bool) (*Deploy, error)

func (*Client) CreateSite

func (c *Client) CreateSite(s *Site) (*Site, error)

func (*Client) DeleteSite

func (c *Client) DeleteSite(s *Site) error

func (*Client) GetSite

func (c *Client) GetSite(s *Site) (*Site, error)

func (*Client) UpdateSite

func (c *Client) UpdateSite(s *Site) (*Site, error)

type Deploy

type Deploy struct {
	Id     string `json:"id"`
	SiteId string `json:"siteId"`
	UserId string `json:"-"`

	// State of the deploy (uploading/uploaded/processing/ready/error)
	State string `json:"state"`

	// Cause of error if State is "error"
	ErrorMessage string `json:"errorMessage,omitempty"`

	// Shas of files that needs to be uploaded before the deploy is ready
	Required []string `json:"required"`

	DeployUrl     string `json:"deployUrl"`
	SiteUrl       string `json:"url"`
	ScreenshotUrl string `json:"screenshotUrl,omitempty"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Represents a Netlify deploy

type Digest

type Digest struct {
	Files map[string]string `json:"files"`
}

{"files": {"/index.html": "907d14fb3af2b0d4f18c2d46abe8aedce17367bd"}}

type OauthTransport

type OauthTransport struct {
	http.RoundTripper
	AccessToken string
}

func (*OauthTransport) RoundTrip

func (t *OauthTransport) RoundTrip(req *http.Request) (res *http.Response, err error)

type Site

type Site struct {
	Id     string `json:"id"`
	UserId string `json:"userId"`

	// These fields can be updated through the API
	Name              string `json:"name"`
	Domain            string `json:"domain"`
	Password          string `json:"password"`
	NotificationEmail string `json:"notificationEmail"`

	State   string `json:"state"`
	Premium bool   `json:"premium"`
	Claimed bool   `json:"claimed"`

	Url           string `json:"url"`
	AdminUrl      string `json:"adminUrl"`
	DeployUrl     string `json:"deployUrl"`
	ScreenshotUrl string `json:"screenshotUrl"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Represents a Netlify site

type TokenReq

type TokenReq struct {
	User User `json:"user"`
}

type User

type User struct {
	Email       string    `json:"email"`             // Our users's email (typically fake email)
	Id          string    `json:"id,omitempy"`       // Netlify's id for access token
	Uid         string    `json:"uid,omitempty"`     // Netlify's copy of our supplied id (typically organization name)
	UserId      string    `json:"user_id,omitempty"` // Netlify's user_id for our org
	CreatedAt   time.Time `json:"created_at,omitempy"`
	AccessToken string    `json:"access_token,omitempy"`
}

This is really a token response, but for our purposes acts as a copy of netlify's representation of our user.

Jump to

Keyboard shortcuts

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