wharf-api-client-go

module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT

README

Go-lang RPC client for Wharf

Codacy Badge Go Reference

A library to talk to Wharf via Wharf's main API written in Go.

Uses net/http to send HTTP requests and encoding/json to serialize/deserialize each message back and forth.

This project is for example used inside the providers to create projects into the database when importing from GitLab, GitHub, or Azure DevOps.

Usage

package main

import (
	"fmt"
	"github.com/iver-wharf/wharf-api-client-go/pkg/wharfapi"
)

func main() {
	client := wharfapi.Client{
		APIURL:     "https://example.wharf.com",
		AuthHeader: "Bearer some-auth-token",
	}

	project,err := client.GetProjectByID(125)

	if err != nil {
		fmt.Printf("Unable to find project\n")
	} else {
		fmt.Printf("Project #%d: %s\n", project.ProjectID, project.Name)
	}
}
Sample output
GET | PROJECT | 125
Project #125: MyProject

Linting Golang

go get -u github.com/mgechev/revive
npm run lint-go

Linting markdown

npm install

npm run lint-md

# Some errors can be fixed automatically. Keep in mind that this updates the
# files in place.
npm run lint-md-fix

Linting

You can lint all of the above at the same time by running:

npm run lint

# Some errors can be fixed automatically. Keep in mind that this updates the
# files in place.
npm run lint-fix

Maintained by Iver. Licensed under the MIT license.

Directories

Path Synopsis
pkg
wharfapi
Package wharfapi has a list of type-safe functions used to access Wharf's main API (wharf-api).
Package wharfapi has a list of type-safe functions used to access Wharf's main API (wharf-api).

Jump to

Keyboard shortcuts

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