Skip to content

shellbear/go-blih

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-blih

go-blih is a Go client library for Blih (the Epitech bocal API).

Installation

You can use go get to install the latest version of the library. This command will install the the library and its dependencies:

go get -u github.com/ShellBear/go-blih/blih

Examples

Generate new Service

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/ShellBear/go-blih/blih"
)

func main() {
	svc := blih.New("EPITECH_LOGIN", "EPITECH_PASSWORD", context.Background())

	response, err := svc.Utils.WhoAmI()
	if err != nil {
		fmt.Println("An error ocurred. Err:", err)
		os.Exit(1)
	}

	fmt.Printf("I am %s\n", response.Message)

}
> go build -o go-blih .
> ./go-blih
I am YOUR_EPITECH_LOGIN

Create repository

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/ShellBear/go-blih/blih"
)

func main() {
	svc := blih.New("EPITECH_LOGIN", "EPITECH_PASSWORD", context.Background())

	repo := &blih.Repository{Name: "example"}

	response, err := svc.Repository.Create(repo)
	if err != nil {
		fmt.Println("An error ocurred. Err:", err)
		os.Exit(1)
	}

	fmt.Println(response.Message)
}

List repositories

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/ShellBear/go-blih/blih"
)

func main() {
	svc := blih.New("EPITECH_LOGIN", "EPITECH_PASSWORD", context.Background())

	response, err := svc.Repository.List()
	if err != nil {
		fmt.Println("An error ocurred. Err:", err)
		os.Exit(1)
	}

	for repoName, repo := range response.Repositories {
		fmt.Printf("%s (%s)\n", repoName, repo.URL)
	}
}

Documentation

A generated documentation is available on GoDoc.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Epitech Blih client written in Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages