(LobbiesV3)
- CreateLobby - CreateLobby
- ListActivePublicLobbies - ListActivePublicLobbies
- GetLobbyInfoByRoomID - GetLobbyInfoByRoomId
- GetLobbyInfoByShortCode - GetLobbyInfoByShortCode
Create a new lobby for an application. A lobby object is a wrapper around a room object. With a lobby, you get additional functionality like configuring the visibility of the room, managing the state of a match, and retrieving a list of public lobbies to display to players.
package main
import(
"context"
"hathoracloud"
"hathoracloud/models/components"
"hathoracloud/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := hathoracloud.New(
hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
)
res, err := s.LobbiesV3.CreateLobby(ctx, operations.CreateLobbySecurity{
PlayerAuth: "<YOUR_BEARER_TOKEN_HERE>",
}, components.CreateLobbyV3Params{
Visibility: components.LobbyVisibilityPrivate,
RoomConfig: hathoracloud.String("{\"name\":\"my-room\"}"),
Region: components.RegionSeattle,
}, hathoracloud.String("app-af469a92-5b45-4565-b3c4-b79878de67d2"), hathoracloud.String("LFG4"), hathoracloud.String("2swovpy1fnunu"))
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
security |
operations.CreateLobbySecurity | ✔️ | The security requirements to use for the request. | |
createLobbyV3Params |
components.CreateLobbyV3Params | ✔️ | N/A | |
appID |
*string | ➖ | N/A | app-af469a92-5b45-4565-b3c4-b79878de67d2 |
shortCode |
*string | ➖ | N/A | LFG4 |
roomID |
*string | ➖ | N/A | 2swovpy1fnunu |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.LobbyV3, error
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 400, 401, 402, 404, 422, 429, 500 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Get all active lobbies for a given application. Filter the array by optionally passing in a region
. Use this endpoint to display all public lobbies that a player can join in the game client.
package main
import(
"context"
"hathoracloud"
"log"
)
func main() {
ctx := context.Background()
s := hathoracloud.New(
hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
)
res, err := s.LobbiesV3.ListActivePublicLobbies(ctx, hathoracloud.String("app-af469a92-5b45-4565-b3c4-b79878de67d2"), nil)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
appID |
*string | ➖ | N/A | app-af469a92-5b45-4565-b3c4-b79878de67d2 |
region |
*components.Region | ➖ | If omitted, active public lobbies in all regions will be returned. | |
opts |
[]operations.Option | ➖ | The options for this request. |
[]components.LobbyV3, error
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 401, 429 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Get details for a lobby.
package main
import(
"context"
"hathoracloud"
"log"
)
func main() {
ctx := context.Background()
s := hathoracloud.New(
hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
)
res, err := s.LobbiesV3.GetLobbyInfoByRoomID(ctx, "2swovpy1fnunu", hathoracloud.String("app-af469a92-5b45-4565-b3c4-b79878de67d2"))
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
roomID |
string | ✔️ | N/A | 2swovpy1fnunu |
appID |
*string | ➖ | N/A | app-af469a92-5b45-4565-b3c4-b79878de67d2 |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.LobbyV3, error
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 404, 422, 429 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Get details for a lobby. If 2 or more lobbies have the same shortCode
, then the most recently created lobby will be returned.
package main
import(
"context"
"hathoracloud"
"log"
)
func main() {
ctx := context.Background()
s := hathoracloud.New(
hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
)
res, err := s.LobbiesV3.GetLobbyInfoByShortCode(ctx, "LFG4", hathoracloud.String("app-af469a92-5b45-4565-b3c4-b79878de67d2"))
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
shortCode |
string | ✔️ | N/A | LFG4 |
appID |
*string | ➖ | N/A | app-af469a92-5b45-4565-b3c4-b79878de67d2 |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.LobbyV3, error
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 404, 429 | application/json |
errors.SDKError | 4XX, 5XX | */* |