Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/idebeijer/satisfactory-client-go

🚧 WIP A Golang client for the Satisfactory dedicated server HTTP API.
https://github.com/idebeijer/satisfactory-client-go

client-go golang satisfactory satisfactory-api satisfactory-community

Last synced: about 1 month ago
JSON representation

🚧 WIP A Golang client for the Satisfactory dedicated server HTTP API.

Awesome Lists containing this project

README

        

# Satisfactory Client Go

This Go client library provides an interface to interact with the Satisfactory dedicated server HTTP API.

## Installation

To install the library, use go get:
```bash
go get github.com/idebeijer/satisfactory-client-go/satisfactory
```

## Usage

Create the client and login with the password. The password is the same as the one you use to login to the server.
```go
package main

import (
"context"
"fmt"
"os"

"github.com/idebeijer/satisfactory-client-go/satisfactory"
)

func main() {
ctx := context.Background()
client := satisfactory.NewClient("https://localhost:7777", nil, true)

password := os.Getenv("SF_PASSWD") // Replace with your password
if _, err := client.PasswordLogin(ctx, "Administrator", password); err != nil {
fmt.Println(err)
return
}
}
```

## Examples
### Run a health check
```go
package main

import (
"context"
"fmt"

"github.com/idebeijer/satisfactory-client-go/satisfactory"
)

func main() {
ctx := context.Background()
client := satisfactory.NewClient("https://localhost:7777", nil, true)

healthcheck, _, err := client.HealthCheck(ctx, "Custom data from client")
if err != nil {
return
}
if healthcheck.Health != "healthy" {
fmt.Println("Healthcheck failed")
return
}
}
```