GameClient - Go client
A friendly game of Capture the Flag
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://testdouble.com
Install the following dependencies:
go get -u github.com/danthompson/capture-the-flag-client-go
Put the package under your project folder and add the following in import:
import "github.com/danthompson/capture-the-flag-client-go/game_client"
package main
import (
"context"
"fmt"
game "github.com/danthompson/capture-the-flag-client-go"
)
func main() {
config := game.NewConfiguration()
config.Host = "THE_GAME_HOST"
auth := context.WithValue(
context.Background(),
game.ContextAccessToken, "YOUR_BEARER_TOKEN",
)
client := game.NewAPIClient(config)
lineResp, netResp, err := client.GameApi.GetPlayer(auth)
if err != nil {
panic(err)
}
fmt.Printf("%v", lineResp)
fmt.Printf("%v", netResp)
}
All URIs are relative to https://GAME-API-ENDPOINT/api
Class | Method | HTTP request | Description |
---|---|---|---|
GameApi | GetPlayer | Get /player | Get Player |
GameApi | PostMoves | Post /moves | Create Move |
Your bearer token is your email address.
- Type: Bearer authentication
Example
auth := context.WithValue(
context.Background(),
sw.ContextAccessToken, "YOUR_BEARER_TOKEN"
)
r, err := client.Service.Operation(auth, args)