Giter Site home page Giter Site logo

pixela4go's People

Contributors

ebc-2in2crc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pixela4go's Issues

Enhancement: Support retries when an API call is rejected

Support retries when an API call is rejected.

This function is a measure for the specification added in Pixela v1.25.0.
ref: a-know/Pixela#29

  • Automatically retry API calls when the API returns an HTTP 503 ({"message":"Please retry this request〜).
  • Other than HTTP 503 ({"message":"Please retry this request〜), for example, network errors are not automatically retried.
  • Pixela4go users can turn this feature on and off.

Note that this function is experimental. The behavior may change or remove.

Support HTTP response status code

The pixela4go will be able to support HTTP response status codes.

When you call the Pixe.la API using pixela4go and the API fails, if you know the HTTP response status code, you can find out whether the error is caused by the client or the server.

Result struct will add StatusCode field.

client := pixela.New("YOUR_NAME", "YOUR_TOKEN")
uci := &pixela.UserCreateInput{
	AgreeTermsOfService: pixela.Bool(true),
	NotMinor:            pixela.Bool(true),
	ThanksCode:          pixela.String("thanks-code"),
}
result, err := client.User().CreateWithContext(context.Background(), uci)
if err != nil {
	log.Fatal(err)
}
if result.IsSuccess == false {
	log.Fatalf("message: %s, status code: %d\n", result.Message, result.StatusCode)

}

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.