42 lines
878 B
Go
42 lines
878 B
Go
package pluralkit
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
// System is a plural system.
|
|
type System struct {
|
|
ID string `json:"id"`
|
|
Name *string `json:"name"`
|
|
Description *string `json:"description"`
|
|
Tag *string `json:"tag"`
|
|
AvatarURL *string `json:"avatar_url"`
|
|
Tz *string `json:"tz"`
|
|
Created time.Time `json:"created"`
|
|
}
|
|
|
|
// System gets the currently authenticated system.
|
|
func (c Client) System() (System, error) {
|
|
var result System
|
|
|
|
err := c.Do(http.MethodGet, "s", http.StatusOK, nil, &result)
|
|
if err != nil {
|
|
return result, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// SystemByID gets information on a system by its ID.
|
|
func (c Client) SystemByID(id string) (System, error) {
|
|
var result System
|
|
|
|
err := c.Do(http.MethodGet, "s/"+id, http.StatusOK, nil, &result)
|
|
if err != nil {
|
|
return result, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|