unleash-server-api-go

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 7 Imported by: 0

README

Client documentation

Client docs

Requirements

  • Go > 1.20

OpenAPI generator used

Instalation instructions: https://openapi-generator.tech/docs/installation#bash-launcher-script

Version used:

openapi-generator-cli 6.6.0
  commit : 7f8b853
  built  : -999999999-01-01T00:00:00+18:00
  source : https://github.com/openapitools/openapi-generator
  docs   : https://openapi-generator.tech/

Generating the client:

(optional) Update the openapi.json spec:

  1. docker compose up
  2. curl -s http://localhost:4242/docs/openapi.json | jq > openapi.json

Generate client from opeanpi.json

./generate.sh

After generating the code you can use main.go to test it works (before running the command below start Unleash server with docker compose up)

go run main.go -unleash-api http://localhost:4242 -authorization *:*.unleash-insecure-admin-api-token

Testing

Testing relies on a running environment. You can use docker-compose.yml file to spin up an environment with a clean state and predictable admin API token

A basic test is automatically generated by the tool (find them under client/test), but they don't have a default configuration and doesn't have payloads required for some of the endpoints. This is the reason why the tools marks all of them as Skip. Still they're a good starting point.

We recommend copying specific tests from client/test into test and adapting them accordingly. We've done that already for api_users_test and some of its methods

Running the tests

  1. (optional but recommended) docker compose rm --force
  2. docker compose up
  3. go test ./test/...

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
client module

Jump to

Keyboard shortcuts

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