swassistantbackend

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 14 Imported by: 0

README

swassistant-backend

Custom backend for SWAssistant. Extension of stupid-backend

APIs

Profiles

Character, vehicles, and minion profiles.

POST: /profile/upload?key={api_key}?type={character|vehicle|minion}

Upload a profile.

Request Body:

{
    // profile data
}

Note: Only allows up to 5MB of data. If over 5MB returns 413. Further limits might be imposed in the future.

Response:

{
    "id": "profile ID",
    "expiration": 0 // Unix time (Seconds) of expiration
}

GET: /profile/{profile id}?key={api_key}

Get an uploaded profile.

Response:

{
    "type": "character|vehicle|minion",
    // profile data minus uid
}
Rooms

GET: /rooms/list?key={api_key}&token={jwt_token}

Get a list of rooms your currently a part of.

Response:

[
    {
        "id": "room ID",
        "name": "room name",
        "owner": "username"
    }
]

POST: /rooms/new?key={api_key}&token={jwt_token}?name={room name}

Create a new room

Response:

{
    "id": "room ID",
    "name": "room name"
}

GET: /rooms/{room id}?key={api_key}&token={jwt_token}

Get info about a room.

{
    "id": "room ID",
    "name": "room name",
    "owner": "username",
    "users": [
        "username"
    ],
    "profiles": [
        "profile uuids"
    ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Room

type Room struct {
	ID       string   `json:"id" bson:"_id"`
	Name     string   `json:"name" bson:"name"`
	Owner    string   `json:"owner" bson:"owner"`
	Users    []string `json:"users" bson:"users"`
	Profiles []string `json:"profiles" bson:"profiles"`
}

type SWBackend

type SWBackend struct {
	// contains filtered or unexported fields
}

func NewSWBackend

func NewSWBackend(client *mongo.Client) *SWBackend

func (*SWBackend) AcceptCrash added in v0.2.0

func (s *SWBackend) AcceptCrash(cr crash.Individual) bool

func (*SWBackend) Crashes

func (s *SWBackend) Crashes() db.CrashTable

func (*SWBackend) CurrentVersions

func (s *SWBackend) CurrentVersions() (out []string)

func (*SWBackend) Extension added in v0.1.2

func (s *SWBackend) Extension(req *stupid.Request) bool

func (*SWBackend) GetProfile

func (s *SWBackend) GetProfile(req *stupid.Request) bool

func (*SWBackend) GetRoom

func (s *SWBackend) GetRoom(req *stupid.Request) bool

func (*SWBackend) HandleProfiles

func (s *SWBackend) HandleProfiles(req *stupid.Request) bool

func (*SWBackend) HandleRooms

func (s *SWBackend) HandleRooms(req *stupid.Request) bool

func (*SWBackend) ListRooms

func (s *SWBackend) ListRooms(req *stupid.Request) bool

func (*SWBackend) Logs added in v0.1.3

func (s *SWBackend) Logs() db.LogTable

func (*SWBackend) NewRoom

func (s *SWBackend) NewRoom(req *stupid.Request) bool

func (*SWBackend) UploadProfile

func (s *SWBackend) UploadProfile(req *stupid.Request) bool

type UploadedProf added in v0.1.6

type UploadedProf struct {
	Profile    map[string]any `json:"profile" bson:"profile"`
	ID         string         `json:"id" bson:"_id"`
	Type       string         `json:"type" bson:"type"`
	Expiration int64          `json:"expiration" bson:"expiration"`
}

Jump to

Keyboard shortcuts

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