Skip to content

Latest commit

 

History

History
234 lines (175 loc) · 14.5 KB

README.md

File metadata and controls

234 lines (175 loc) · 14.5 KB

LobbiesV3

(LobbiesV3)

Overview

Available Operations

CreateLobby

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.

Example Usage

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
    }
}

Parameters

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.

Response

*components.LobbyV3, error

Errors

Error Type Status Code Content Type
errors.APIError 400, 401, 402, 404, 422, 429, 500 application/json
errors.SDKError 4XX, 5XX */*

ListActivePublicLobbies

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.

Example Usage

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
    }
}

Parameters

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.

Response

[]components.LobbyV3, error

Errors

Error Type Status Code Content Type
errors.APIError 401, 429 application/json
errors.SDKError 4XX, 5XX */*

GetLobbyInfoByRoomID

Get details for a lobby.

Example Usage

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
    }
}

Parameters

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.

Response

*components.LobbyV3, error

Errors

Error Type Status Code Content Type
errors.APIError 404, 422, 429 application/json
errors.SDKError 4XX, 5XX */*

GetLobbyInfoByShortCode

Get details for a lobby. If 2 or more lobbies have the same shortCode, then the most recently created lobby will be returned.

Example Usage

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
    }
}

Parameters

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.

Response

*components.LobbyV3, error

Errors

Error Type Status Code Content Type
errors.APIError 404, 429 application/json
errors.SDKError 4XX, 5XX */*