Categorygithub.com/brittonhayes/dnd
modulepackage
0.3.1
Repository: https://github.com/brittonhayes/dnd.git
Documentation: pkg.go.dev

# README

DnD

Go Reference GitHub tag (latest SemVer) Go Report Card Test codecov

A Go Client for the Dungeons and Dragons 5e SRD REST API

Installation

Install with the go get command

go get github.com/brittonhayes/dnd

Documentation

View the full docs on pkg.go.dev

View the API here https://www.dnd5eapi.co/

Usage

Using the package is as easy as create client, pick the endpoint, and run the method. This applies across every data type, so it is consistent across the board. Here's a simple example of how to fetch a rule from the DnD 5e ruleset.

func main() {
    // Create a dnd client
    c := dnd.NewClient()
    
    // Fetch DnD rules about adventuring
    r, _ := c.Rules.Find("adventuring")
    
    // Print out the rule's name
    fmt.Println("Name", r.Name)
}

Examples

For example uses of the package, check out the example directory

Development

If you'd like to contribute to DnD, make sure you have mage installed: https://magefile.org

# Download dependencies and run tests
go run main.go download
go test ./...

Social image by Ashley Mcnamara https://twitter.com/ashleymcnamara 💖

# Packages

No description provided by the author
models defines data types available in the dnd package.

# Functions

NewClient creates a new instance of the DnD REST API client.
NewCustomClient creates a new instance of the DnD REST API client.
NewEquipmentService creates a custom instance of the Equipment service.
NewMonstersService creates a custom instance of the Monsters service.
NewRacesService creates a custom instance of the Races service.
NewRulesService creates a custom instance of the Rules service.
NewSpellsService creates a custom instance of the Spells service.
NewEquipmentService creates a new instance of the Equipment service.
NewMonstersService creates a new instance of the Monsters service.
NewRacesService creates a new instance of the Races service.
NewRulesService creates a new instance of the Rules service.
NewSpellsService creates a new instance of the Spells service.

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

Equipment interface covers the methods available for the EquipmentService.
Monsters interface covers the methods available for the MonstersService.
Races interface covers the methods available for the RacesService.
Rules interface covers the methods available for the RulesService.
Spells interface covers the methods available for the SpellsService.