Skip to content

Latest commit

 

History

History
508 lines (367 loc) · 22.8 KB

README.md

File metadata and controls

508 lines (367 loc) · 22.8 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

Errors

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>"),
    )

    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

Errors

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>"),
    )

    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

Errors

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"
	"context"
	"github.com/livepeer/livepeer-go/models/components"
	"log"
)

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

    ctx := context.Background()
    res, err := s.Room.StartEgress(ctx, "<id>", components.RoomEgressPayload{
        StreamID: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9",
    })
    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

Errors

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>"),
    )

    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

Errors

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"
	"context"
	"github.com/livepeer/livepeer-go/models/components"
	"log"
)

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

    ctx := context.Background()
    res, err := s.Room.CreateUser(ctx, "<id>", components.RoomUserPayload{
        Name: "name",
        CanPublish: livepeergo.Bool(true),
        CanPublishData: livepeergo.Bool(true),
    })
    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

Errors

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>"),
    )

    ctx := context.Background()
    res, err := s.Room.GetUser(ctx, "<id>", "<value>")
    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

Errors

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"
	"context"
	"github.com/livepeer/livepeer-go/models/components"
	"log"
)

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

    ctx := context.Background()
    res, err := s.Room.UpdateUser(ctx, "<id>", "<value>", components.RoomUserUpdatePayload{
        CanPublish: livepeergo.Bool(true),
        CanPublishData: livepeergo.Bool(true),
    })
    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

Errors

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>"),
    )

    ctx := context.Background()
    res, err := s.Room.DeleteUser(ctx, "<id>", "<value>")
    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

Errors

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