Skip to content

Latest commit

 

History

History
494 lines (372 loc) · 23.1 KB

README.md

File metadata and controls

494 lines (372 loc) · 23.1 KB

Room

(Room)

Overview

Operations related to rooms api

Available Operations

  • Create - Create a room ⚠️ Deprecated
  • Get - Retrieve a room ⚠️ Deprecated
  • Delete - Delete a room ⚠️ Deprecated
  • StartEgress - Start room RTMP egress ⚠️ Deprecated
  • StopEgress - Stop room RTMP egress ⚠️ Deprecated
  • CreateUser - Create a room user ⚠️ Deprecated
  • GetUser - Get user details ⚠️ Deprecated
  • UpdateUser - Update a room user ⚠️ Deprecated
  • DeleteUser - Remove a user from the room ⚠️ Deprecated

Create

Create a multiparticipant livestreaming room.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Room.Create(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.CreateRoomResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreateRoomResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

Get

Retrieve a room

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"
    ctx := context.Background()
    res, err := s.Room.Get(ctx, id)
    if err != nil {
        log.Fatal(err)
    }
    if res.Room != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.GetRoomResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

Delete

Delete a room

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"
    ctx := context.Background()
    res, err := s.Room.Delete(ctx, id)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.DeleteRoomResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

StartEgress

Create a livestream for your room. This allows you to leverage livestreaming features like recording and HLS output.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"github.com/livepeer/livepeer-go/models/components"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"

    roomEgressPayload := components.RoomEgressPayload{
        StreamID: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9",
    }
    ctx := context.Background()
    res, err := s.Room.StartEgress(ctx, id, roomEgressPayload)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
roomEgressPayload components.RoomEgressPayload ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.StartRoomEgressResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

StopEgress

Stop room RTMP egress

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"
    ctx := context.Background()
    res, err := s.Room.StopEgress(ctx, id)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.StopRoomEgressResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

CreateUser

Call this endpoint to add a user to a room, specifying a display name at a minimum. The response will contain a joining URL for Livepeer's default meeting app. Alternatively the joining token can be used with a custom app.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"github.com/livepeer/livepeer-go/models/components"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"

    roomUserPayload := components.RoomUserPayload{
        Name: "name",
        CanPublish: livepeergo.Bool(true),
        CanPublishData: livepeergo.Bool(true),
    }
    ctx := context.Background()
    res, err := s.Room.CreateUser(ctx, id, roomUserPayload)
    if err != nil {
        log.Fatal(err)
    }
    if res.RoomUserResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
roomUserPayload components.RoomUserPayload ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.CreateRoomUserResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

GetUser

Get user details

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"

    var userID string = "<value>"
    ctx := context.Background()
    res, err := s.Room.GetUser(ctx, id, userID)
    if err != nil {
        log.Fatal(err)
    }
    if res.GetRoomUserResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
userID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.GetRoomUserResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

UpdateUser

Update properties for a user.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"github.com/livepeer/livepeer-go/models/components"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"

    var userID string = "<value>"

    roomUserUpdatePayload := components.RoomUserUpdatePayload{
        CanPublish: livepeergo.Bool(true),
        CanPublishData: livepeergo.Bool(true),
    }
    ctx := context.Background()
    res, err := s.Room.UpdateUser(ctx, id, userID, roomUserUpdatePayload)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
userID string ✔️ N/A
roomUserUpdatePayload components.RoomUserUpdatePayload ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.UpdateRoomUserResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

DeleteUser

Remove a user from the room

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"context"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    var id string = "<value>"

    var userID string = "<value>"
    ctx := context.Background()
    res, err := s.Room.DeleteUser(ctx, id, userID)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A
userID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.DeleteRoomUserResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /