Go-openproject: Go Client Library for OpenProject

OpenProject Go Client Library

Go client library for OpenProject

Usage examples

Single work-package request

Basic work-package retrieval (Single work-package with ID 36353 from community.openproject.org) Please check examples folder for different use-cases.

import (
    "fmt"
    openproj "github.com/manuelbcd/go-openproject"
)

func main() {
    client, _ := openproj.NewClient(nil, "https://community.openproject.org/")
    wpResponse, _, err := client.WorkPackage.Get("36353", nil)
    if err != nil {
        panic(err)
    }

    // Output specific fields from response
    fmt.Printf("\n\nSubject: %s \nDescription: %s\n\n", wpResponse.Subject, wpResponse.Description.Raw)
}

Create a work package

Create a single work package

package main

import (
    "fmt"
    "strings"

    openproj "github.com/manuelbcd/go-openproject"
)

func main() {
    client, err := openproj.NewClient(nil, "https://youropenproject.url")
    if err != nil {
        fmt.Printf("\nerror: %v\n", err)
        return
    }

    i := openproj.WorkPackage{
        Subject: "This is my test work package",
        Description: &openproj.WPDescription{
            Format: "textile",
            Raw:    "This is just a demo workpackage description",
        },
    }

    wpResponse, _, err := client.WorkPackage.Create(&i, "demo-project")
    if err != nil {
        panic(err)
    }

    // Output specific fields from response
    fmt.Printf("\n\nSubject: %s \nDescription: %s\n\n", wpResponse.Subject, wpResponse.Description.Raw)
}

Supported objects

EndpointGET singleGET manyPOSTPUTDELETE
Attachments (Info):heavy_check_mark::heavy_check_mark:implementing-pending
Attachments (Download):heavy_check_mark:----
Categories:heavy_check_mark::heavy_check_mark:---
Documentsimplementing----
Projects:heavy_check_mark::heavy_check_mark::heavy_check_mark:pendingpending
Queries:heavy_check_mark::heavy_check_mark::heavy_check_mark:-:heavy_check_mark:
Schemaspending    
Statuses:heavy_check_mark::heavy_check_mark:pendingpendingpending
Users:heavy_check_mark::heavy_check_mark::heavy_check_mark: :heavy_check_mark:
Wiki Pages:heavy_check_mark:pendingpendingpendingpending
WorkPackages:heavy_check_mark::heavy_check_mark::heavy_check_mark: :heavy_check_mark:

API doc

https://docs.openproject.org/api

Thanks

Thanks Wieland, Oliver and OpenProject team for your support.

Thank you very much Andy Grunwald for the idea and your base code.

Inspired in Go Jira library

Author: Manuelbcd
Source Code: https://github.com/manuelbcd/go-openproject 
License: MIT license

#go #golang #open

What is GEEK

Buddha Community

Go-openproject: Go Client Library for OpenProject
Fannie  Zemlak

Fannie Zemlak

1599854400

What's new in the go 1.15

Go announced Go 1.15 version on 11 Aug 2020. Highlighted updates and features include Substantial improvements to the Go linker, Improved allocation for small objects at high core counts, X.509 CommonName deprecation, GOPROXY supports skipping proxies that return errors, New embedded tzdata package, Several Core Library improvements and more.

As Go promise for maintaining backward compatibility. After upgrading to the latest Go 1.15 version, almost all existing Golang applications or programs continue to compile and run as older Golang version.

#go #golang #go 1.15 #go features #go improvement #go package #go new features

Go(lang) Client Library for Cachet (open Source Status Page System)

cachet

Go(lang) client library for Cachet (open source status page system).

Features

  • Full API support
    • Components
    • Incidents
    • Metrics
    • Subscribers
  • Various authentication methods (Basic Auth and Token based)
  • Fully tested

Installation

It is go gettable

$ go get github.com/andygrunwald/cachet

(optional) to run unit / example tests:

$ cd $GOPATH/src/github.com/andygrunwald/cachet
$ go test -v ./...

Authentication

Cachet supports two different ways for authentication: BasicAuth and API Token. Both are supported by this library.

For BasicAuth you need to call the AuthenticationService and apply your email address and your password:

client.Authentication.SetBasicAuth("test@test.com", "test123")

To use the API Token way, you do nearly the same but use the SetTokenAuth function:

client.Authentication.SetTokenAuth("MY-SECRET-TOKEN")

Examples

Further a few examples how the API can be used. A few more examples are available in the GoDoc examples section.

Ping

Call the API test endpoint. Example without error handling. Full example available in the GoDoc examples section.

package main

import (
    "fmt"
    "github.com/andygrunwald/cachet"
)

func main() {
    client, _ := cachet.NewClient("https://demo.cachethq.io/", nil)
    pong, resp, _ := client.General.Ping()

    fmt.Printf("Result: %s\n", pong)
    fmt.Printf("Status: %s\n", resp.Status)

    // Output: Result: Pong!
    // Status: 200 OK
}

Create a new component

Calling /components. Example without error handling. Full example available in the GoDoc examples section.

package main

import (
    "fmt"
    "github.com/andygrunwald/cachet"
)

func main() {
    client, _ := cachet.NewClient("https://demo.cachethq.io/", nil)
    client.Authentication.SetBasicAuth("test@test.com", "test123")

    component := &cachet.Component{
        Name:        "Beer Fridge",
        Description: "Status of the beer fridge in the kitchen",
        Status:      cachet.ComponentStatusOperational,
    }
    newComponent, resp, _ := client.Components.Create(component)

    fmt.Printf("Result: %s\n", newComponent.Name)
    if newComponent.ID > 0 {
        fmt.Println("ID > 0!")
    }
    fmt.Printf("Status: %s\n", resp.Status)

    // Output: Beer Fridge
    // ID > 0!
    // Status: 200 OK
}

API

Please have a look at the GoDoc documentation for a detailed API description.

Supported versions

Tested with v1.2.1 of Cachet. It may works with older and / or newer versions. Newer versions will be supported. Older versions not.

Contribution and Contact

Contribution, in any kind of way, is highly welcome! It doesn't matter if you are not able to write code. Creating issues or holding talks and help other people to use cachet is contribution, too! A few examples:

  • Correct typos in the README / documentation
  • Reporting bugs
  • Implement a new feature or endpoint
  • Sharing the love if cachet and help people to get use to it

If you are new to pull requests, checkout Collaborating on projects using issues and pull requests / Creating a pull request. If you've found a bug, a typo, have a question or a want to request new feature, please report it as a GitHub issue.

For other queries, i'm available on Twitter (@andygrunwald).

Author: Andygrunwald
Source Code: https://github.com/andygrunwald/cachet 
License: MIT license

#go #golang #client #library 

Top 8 Machine Learning Libraries In Go Language One Must Know

Created by Google researchers, Go is a popular open-source programming language. The language includes many intuitive features, including a garbage collector, cross-platform, efficient concurrency, among others.

According to the Stack Overflow Developer Survey 2020, Go language is not only the fifth most loved programming language but also fetches the programmers the third-highest salary among other languages.

Below here, we list down the top machine learning libraries in Go language.

#opinions #go language #google ml tools #machine learning libraries #ml libraries #ml libraries in go

Go-openproject: Go Client Library for OpenProject

OpenProject Go Client Library

Go client library for OpenProject

Usage examples

Single work-package request

Basic work-package retrieval (Single work-package with ID 36353 from community.openproject.org) Please check examples folder for different use-cases.

import (
    "fmt"
    openproj "github.com/manuelbcd/go-openproject"
)

func main() {
    client, _ := openproj.NewClient(nil, "https://community.openproject.org/")
    wpResponse, _, err := client.WorkPackage.Get("36353", nil)
    if err != nil {
        panic(err)
    }

    // Output specific fields from response
    fmt.Printf("\n\nSubject: %s \nDescription: %s\n\n", wpResponse.Subject, wpResponse.Description.Raw)
}

Create a work package

Create a single work package

package main

import (
    "fmt"
    "strings"

    openproj "github.com/manuelbcd/go-openproject"
)

func main() {
    client, err := openproj.NewClient(nil, "https://youropenproject.url")
    if err != nil {
        fmt.Printf("\nerror: %v\n", err)
        return
    }

    i := openproj.WorkPackage{
        Subject: "This is my test work package",
        Description: &openproj.WPDescription{
            Format: "textile",
            Raw:    "This is just a demo workpackage description",
        },
    }

    wpResponse, _, err := client.WorkPackage.Create(&i, "demo-project")
    if err != nil {
        panic(err)
    }

    // Output specific fields from response
    fmt.Printf("\n\nSubject: %s \nDescription: %s\n\n", wpResponse.Subject, wpResponse.Description.Raw)
}

Supported objects

EndpointGET singleGET manyPOSTPUTDELETE
Attachments (Info):heavy_check_mark::heavy_check_mark:implementing-pending
Attachments (Download):heavy_check_mark:----
Categories:heavy_check_mark::heavy_check_mark:---
Documentsimplementing----
Projects:heavy_check_mark::heavy_check_mark::heavy_check_mark:pendingpending
Queries:heavy_check_mark::heavy_check_mark::heavy_check_mark:-:heavy_check_mark:
Schemaspending    
Statuses:heavy_check_mark::heavy_check_mark:pendingpendingpending
Users:heavy_check_mark::heavy_check_mark::heavy_check_mark: :heavy_check_mark:
Wiki Pages:heavy_check_mark:pendingpendingpendingpending
WorkPackages:heavy_check_mark::heavy_check_mark::heavy_check_mark: :heavy_check_mark:

API doc

https://docs.openproject.org/api

Thanks

Thanks Wieland, Oliver and OpenProject team for your support.

Thank you very much Andy Grunwald for the idea and your base code.

Inspired in Go Jira library

Author: Manuelbcd
Source Code: https://github.com/manuelbcd/go-openproject 
License: MIT license

#go #golang #open

Aerospike-client-go: Aerospike Client Go

Aerospike Go Client 

IMPORTANT NOTE

This is an old version the Aerospike Go Client, which is v4.x.x. The newest version v6 has migrated to go modules, which required us to put it in the v6 branch here. All the latest changes to the library are applied in that branch, documented in the CHANGELOG.


Official Aerospike Client library for Go.

This library is compatible with Go 1.9+ and supports the following operating systems: Linux, Mac OS X (Windows builds are possible, but untested).

Up-to-date documentation is available in the Godoc.

You can refer to the test files for idiomatic use cases.

Please refer to CHANGELOG.md for release notes, or if you encounter breaking changes.

Usage

The following is a very simple example of CRUD operations in an Aerospike database.

package main

import (
  "fmt"

  aero "github.com/aerospike/aerospike-client-go"
)

// This is only for this example.
// Please handle errors properly.
func panicOnError(err error) {
  if err != nil {
    panic(err)
  }
}

func main() {
  // define a client to connect to
  client, err := aero.NewClient("127.0.0.1", 3000)
  panicOnError(err)

  key, err := aero.NewKey("test", "aerospike", "key")
  panicOnError(err)

  // define some bins with data
  bins := aero.BinMap{
    "bin1": 42,
    "bin2": "An elephant is a mouse with an operating system",
    "bin3": []interface{}{"Go", 2009},
  }

  // write the bins
  err = client.Put(nil, key, bins)
  panicOnError(err)

  // read it back!
  rec, err := client.Get(nil, key)
  panicOnError(err)

  // delete the key, and check if key exists
  existed, err := client.Delete(nil, key)
  panicOnError(err)
  fmt.Printf("Record existed before delete? %v\n", existed)
}

More examples illustrating the use of the API are located in the examples directory.

Details about the API are available in the docs directory.

Prerequisites

Go version v1.12+ is required.

To install the latest stable version of Go, visit http://golang.org/dl/

Aerospike Go client implements the wire protocol, and does not depend on the C client. It is goroutine friendly, and works asynchronously.

Supported operating systems:

  • Major Linux distributions (Ubuntu, Debian, Red Hat)
  • Mac OS X
  • Windows (untested)

Installation

  1. Install Go 1.9+ and setup your environment as Documented here.
  2. Get the client in your GOPATH : go get github.com/aerospike/aerospike-client-go
  • To update the client library: go get -u github.com/aerospike/aerospike-client-go

Using gopkg.in is also supported: go get -u gopkg.in/aerospike/aerospike-client-go.v1

Some Hints:

  • To run a go program directly: go run <filename.go>
  • to build: go build -o <output> <filename.go>
  • example: go build -o benchmark tools/benchmark/benchmark.go

 

Performance Tweaking

We are bending all efforts to improve the client's performance. In our reference benchmarks, Go client performs almost as good as the C client.

To read about performance variables, please refer to docs/performance.md

Tests

This library is packaged with a number of tests. Tests require Ginkgo and Gomega library.

Before running the tests, you need to update the dependencies:

$ go get .

To run all the test cases with race detection:

$ ginkgo -r -race

Examples

A variety of example applications are provided in the examples directory.

Tools

A variety of clones of original tools are provided in the tools directory. They show how to use more advanced features of the library to re-implement the same functionality in a more concise way.

Benchmarks

Benchmark utility is provided in the tools/benchmark directory. See the tools/benchmark/README.md for details.

API Documentation

A simple API documentation is available in the docs directory. The latest up-to-date docs can be found in Godoc.

Google App Engine

To build the library for App Engine, build it with the build tag app_engine. Aggregation functionality is not available in this build.

Reflection, and Object API

To make the library both flexible and fast, we had to integrate the reflection API (methods with [Get/Put/...]Object names) tightly in the library. In case you wanted to avoid mixing those API in your app inadvertently, you can use the build tag as_performance to remove those APIs from the build.

Download Details:

Author: Aerospike
Source Code: https://github.com/aerospike/aerospike-client-go 
License: Apache-2.0 license

#go #golang #client