Giter VIP home page Giter VIP logo

client-go's Introduction

NewReleases API v1 Go client

Go GoDoc NewReleases

Package newreleases is a Go client library for accessing the NewReleases v1 API.

You can view the client API docs here: https://godoc.org/newreleases.io/newreleases

You can view NewReleases API docs here: https://newreleases.io/api/v1

Installation

Run go get newreleases.io/newreleases from command line.

Usage

import "newreleases.io/newreleases"

Create a new Client, then use the exposed services to access different parts of the API.

Authentication

Currently, API keys is the only method of authenticating with the API. You can manage your keys at the NewReleases API keys settings page.

You can then use your token to create a new Client.

Features

This client implements all NewReleases API features.

  • List projects
  • Search projects
  • Get project
  • Add project
  • Update project
  • Delete project
  • List projects releases
  • Get project release
  • Get latest non-excluded project release
  • Get project release note
  • Get tracked providers
  • Get added Slack Channels
  • Get added Telegram Chats
  • Get added Dissord Channels
  • Get added Hangouts Chat webhooks
  • Get added Microsoft Teams webhooks
  • Get added Mattermost webhooks
  • Get added Rocket.Chat webhooks
  • Get added Matrix Rooms
  • Get added custom Webhooks
  • List tags
  • Get tag
  • Add tag
  • Update tag
  • Delete tag
  • Get auth keys

Examples

To add a new project:

package main

import (
    "context"
    "log"

    "newreleases.io/newreleases"
)

var key = "myapikey"

func main() {
    client := newreleases.NewClient(key, nil)
    p, err := client.Projects.Add(
        context.Background(),
        "github",
        "golang/go",
        newreleases.ProjectOptions{
            EmailNotification: &newreleases.EmailNotificationHourly,
        }
    )
    if err != nil {
        log.Fatal(err)
    }
    log.Print(p.ID)
}

List projects with pagination:

func AllProjects(ctx context.Context, client *newreleases.Client) (pp []newreleases.Project, err error) {
    o := &newreleases.ProjectListOptions{
        Page: 1,
    }
    for {
        projects, lastPage, err := client.Projects.List(ctx, o)
        if err != nil {
            return nil, err
        }

        pp = append(pp, projects...)

        if o.Page >= lastPage {
            break
        }
        o.Page++
    }

    return pp, nil
}

Versioning

Each version of the client is tagged and the version is updated accordingly.

This package uses Go modules.

To see the list of past versions, run git tag.

Contributing

We love pull requests! Please see the contribution guidelines.

License

This library is distributed under the BSD-style license found in the LICENSE file.

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.