Giter VIP home page Giter VIP logo

go-client's Introduction

BitBallon API Client in Go

See the netlify package on godoc for full library documentation.

Quick Start

First go get github.com/netlify/netlify-go then use in your go project.

import "github.com/netlify/netlify-go"

client := netlify.NewClient(&netlify.Config{AccessToken: AccessToken})

// Create a new site
site, resp, err := client.Sites.Create(&SiteAttributes{
  Name: "site-subdomain",
  CustomDomain: "www.example.com",
  Password: "secret",
  NotificationEmail: "[email protected]",
})

// Deploy a directory
deploy, resp, err := site.Deploys.Create("/path/to/directory")

// Wait for the deploy to process
err := deploy.WaitForReady(0)

// Get a single site
site, resp, err := client.Sites.Get("my-site-id")

// Set the domain of the site
site.CustomDomain = "www.example.com"

// Update the site
resp, err := site.Update()

// Deploy a new version of the site from a zip file
deploy, resp, err := site.Deploys.Create("/path/to/file.zip")
deploy.WaitForReady(0)

// Delete the site
resp, err := site.Destroy()

go-client's People

Contributors

biilmann avatar rybit avatar calavera avatar

Stargazers

Jamie Leviner avatar Felipe Monteiro avatar Christian Sakshaug avatar  avatar Robert Uao avatar Jerzerak avatar Rafael Jesus avatar Marcus André avatar Luca G. Soave avatar Damon Zhao avatar Brian Douglas avatar YoungTaek avatar Fredrik Forsmo avatar Zach Kelling avatar Henry Snopek avatar

Watchers

Phil Hawksworth avatar  avatar Esteban (Kito) Pastorino avatar Bret Comnes avatar David Wells avatar James Cloos avatar Eli Williamson avatar Todd Morey avatar Tim Erickson avatar Sarfaraz Rydhan avatar Bob McDonough avatar Lauren Sell avatar Rafa avatar OJ avatar Kaya W avatar Luna Yu avatar swyx.io avatar  avatar Amer Ali avatar James McNeil avatar Aaron (Yueh-Han) Huang avatar Dennis Padiernos avatar ingrid epure avatar Phenix Rizen avatar Emily Zhang avatar Perry avatar Cassandra Ferrara avatar  avatar

go-client's Issues

Add deploy locking and unlocking

Customer Robert contributed this code to do this.


// Restore an old deploy. Sets the deploy as the active deploy for a site

func (deploy *Deploy) Unlock() (*Response, error) {

return deploy.client.Request("POST", path.Join(deploy.apiPath(), "unlock"), nil, deploy)

}

// Restore an old deploy. Sets the deploy as the active deploy for a site

func (deploy *Deploy) Lock() (*Response, error) {

return deploy.client.Request("POST", path.Join(deploy.apiPath(), "lock"), nil, deploy)

}

POST unexpected EOF when using Create(zipOrDir)

I'm trying to create a new deploy for a site.

client := netlify.NewClient(&netlify.Config{AccessToken: "token"})
site, _, err := client.Sites.Get("site-id")
dep, resp, err := site.Deploys.Create("/path/to/dir")

site is correctly fetched and contains the relevant site info.
The call to Create, however, hangs then gives the error:

Post https://api.netlify.com/api/v1/sites/site-id/deploys: unexpected EOF 

The error happens l131 of deploys.go:

resp, err := s.client.Request("POST", s.apiPath(), options, deploy)

This happens whether I'm trying to a zip or dir as source, since this part is before the library even looks at the files.
Am I missing something? Thanks!

during deploy, some filenames are parsed, but shouldn't be

This build log shows the issue:

https://app.netlify.com/sites/scientist-cheetah-73554/deploys/57c5510866867428c137cf70

His build failed due specifically to this error:

2:28:15 AM: Error deploying site: parse images/50%-0: invalid URL escape "%-0"

He did indeed have files called 50%-0 and removing them "fixed" his deploy but we shouldn't be parsing filenames like this :)

(from https://app.intercom.io/a/apps/q245f50x/inbox/conversation/5782171140)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.