Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shellbear/go-blih
Epitech Blih client written in Go
https://github.com/shellbear/go-blih
api blih client epitech go golang
Last synced: 6 days ago
JSON representation
Epitech Blih client written in Go
- Host: GitHub
- URL: https://github.com/shellbear/go-blih
- Owner: shellbear
- License: mit
- Created: 2019-09-15T13:19:47.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-19T21:38:59.000Z (about 5 years ago)
- Last Synced: 2024-06-20T08:03:06.243Z (5 months ago)
- Topics: api, blih, client, epitech, go, golang
- Language: Go
- Size: 3.55 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
go get -u github.com/ShellBear/go-blih/blih
```## Examples
#### Generate new Service
```go
package mainimport (
"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)
}
``````bash
> go build -o go-blih .
> ./go-blih
I am YOUR_EPITECH_LOGIN
```#### Create repository
```go
package mainimport (
"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
```go
package mainimport (
"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](https://godoc.org/github.com/ShellBear/go-blih).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details