Skip to content

This is a Go client library for gathering PUBG API reference data

License

Notifications You must be signed in to change notification settings

NovikovRoman/pubg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PUBG

Go Reference Build Status Go Report Card

This is a Go client library for gathering PUBG API reference data

Relevant for V22.1.0

Table of Contents

Getting Started

Download the PUBG library:

go get github.com/NovikovRoman/pubg

Usage Example

pubgClient := pubg.NewClient(apikey, nil)

if !pubgClient.Status() {
 log.Fatalln("PUBG API not working.")
}

tournaments, err := pubgClient.Tournaments()
if err != nil {
 if e, ok := err.(*pubg.ErrBadRequest); ok {
  log.Fatalln("Bad request", e, e.GetDetail())

 } else if e, ok := err.(*pubg.ErrUnauthorized); ok {
  log.Fatalln("Unauthorized", e, e.GetDetail())

 } else if e, ok := err.(*pubg.ErrNotFound); ok {
  log.Fatalln("Not found", e, e.GetDetail())

 } else if e, ok := err.(*pubg.ErrUnsupportedMediaType); ok {
  log.Fatalln("Unsupported media type", e, e.GetDetail())

 } else if e, ok := err.(*pubg.ErrTooManyRequest); ok {
  log.Fatalln("Too many request", e, e.GetDetail())
 }

 log.Fatalln(err)
}

for _, t := range tournaments.Data {
 fmt.Println(t.ID, t.Attributes.CreatedAt)
}

See the example of using telemetry in the telemetry_test.go.

Tests

PAUSE=true [PROXY=…] APIKEY=… go test

Documentation

See the PUBG API reference.

About

This is a Go client library for gathering PUBG API reference data

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages