Skip to content

The-Egg-Corp/ThunderGo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ThunderGo

Go client for the Thunderstore API.
You can call it TSGO for short ;)

Currently, ThunderGo does not do any caching. Please implement this on your own end if required.

Warning

This project is a WIP and may not work correctly and/or have missing features.
It is not advised to use this in production until there is a stable release.

Installation

Enter the following line into your project's terminal.

go get github.com/the-egg-corp/thundergo/

Import

To correctly import TSGO, you must choose which version of Thunderstore to interact with.
Since you will likely be using V1 most of the time, you can just do the following:

import TSGO "github.com/the-egg-corp/thundergo/v1"

However, you may need to rely on both versions, in which case I recommend doing something like so:

import (
    TSGOV1 "github.com/the-egg-corp/thundergo/v1"
    TSGOExp "github.com/the-egg-corp/thundergo/experimental"
)

Basic Examples

Visit the wiki for the full documentation, or take a look at the tests.

V1

var comm = TSGOV1.Community{
    Identifier: "lethal-company",
}

func main() {
    mod := comm.GetPackage("Owen3H", "CSync")
    if err != nil {
        fmt.Println(err)
        return
    }

    latest := mod.LatestVersion()
    fmt.Println(latest.VersionNumber)
}

Experimental

func main() {
    mod, err := TSGO.GetPackage("Owen3H", "CSync")
    if err != nil {
        fmt.Println(err)
        return
    }

    changelog, _ := mod.Latest.Changelog()
    fmt.Println(changelog)
}

Contact

Feel free to join my discord for support or suggestions.