GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — plexgo/docs/sdks/users/README.md at main · LukasParke/plexgo

Expand file tree

/

README.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
1492 lines (1166 loc) · 71.3 KB
/

README.md

Copy path

File metadata and controls

1492 lines (1166 loc) · 71.3 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Users

Overview

Plex Users operations

Available Operations

  • GetLegacyResources - Get Legacy Resources
  • GetLegacyUsers - Get Legacy Users
  • GetFriends - Get Friends
  • GetHome - Get home hubs
  • GetHomeUsers - Get home hubs Users
  • CreateHomeUser - Create Home User
  • GetMyPlexAccount - Get MyPlex Account
  • GetUserServer - Get User Server Association
  • GetServerUserFeatures - Get Server User Features
  • ShareServer - Share Server
  • UpdateViewStateSync - Update View State Sync
  • GetUsers - Get list of all connected users
  • GetAccountXML - Get Account (XML)
  • GetAccountJSON - Get Account (JSON)
  • AcceptInvite - Accept an Invite
  • DeleteHomeUser - Delete Home User
  • UpdateHomeUser - Update Home User
  • UpdateRestrictedUser - Update Restricted User
  • GetServerDetails - Get Server Details
  • ShareServerLegacy - Share Server (Legacy v1)
  • RemoveShare - Remove Share
  • UpdateShare - Update Share
  • GetUserOptOuts - Get User Opt-Outs

GetLegacyResources

Get legacy published server connections (XML).

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetLegacyResources(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != 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.GetLegacyResourcesResponse, error

Errors

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

GetLegacyUsers

Get legacy friends list (XML).

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetLegacyUsers(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != 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.GetLegacyUsersResponse, error

Errors

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

GetFriends

Get the list of friends and shared users.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetFriends(ctx, operations.GetFriendsRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetFriendsResponse, error

Errors

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

GetHome

Get Plex Home user list.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetHome(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.MediaContainerWithHubs != 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.GetHomeResponse, error

Errors

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

GetHomeUsers

Get the list of Plex Home users.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetHomeUsers(ctx, operations.GetHomeUsersRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.MediaContainerWithDirectory != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetHomeUsersResponse, error

Errors

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

CreateHomeUser

Create a new Plex Home user.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.CreateHomeUser(ctx, operations.CreateHomeUserRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.CreateHomeUserResponse, error

Errors

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

GetMyPlexAccount

Get linked MyPlex account info on PMS.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetMyPlexAccount(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.UserPlexAccount != 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.GetMyPlexAccountResponse, error

Errors

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

GetUserServer

Get server association information for the logged-in user.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetUserServer(ctx, operations.GetUserServerRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ConnectionInfo != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetUserServerResponse, error

Errors

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

GetServerUserFeatures

Get features enabled per shared user for the server.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetServerUserFeatures(ctx, operations.GetServerUserFeaturesRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ServerUserFeaturesResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetServerUserFeaturesResponse, error

Errors

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

ShareServer

Share a server with a friend or managed user.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.ShareServer(ctx, operations.ShareServerRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ShareServerResponse, error

Errors

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

UpdateViewStateSync

Enable or disable watch-state sync consent for the logged-in user.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.UpdateViewStateSync(ctx, operations.UpdateViewStateSyncRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.UpdateViewStateSyncResponse, error

Errors

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

GetUsers

Get list of all users that are friends and have library access with the provided Plex authentication token

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetUsers(ctx, operations.GetUsersRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetUsersResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400 application/json
sdkerrors.Unauthorized 401 application/json
sdkerrors.SDKError 4XX, 5XX */*

GetAccountXML

Get the logged-in user's account details in XML format (legacy v1 endpoint).

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetAccountXML(ctx, operations.GetAccountXMLRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetAccountXMLResponse, error

Errors

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

GetAccountJSON

Get the logged-in user's account details in JSON format (legacy v1 endpoint).

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetAccountJSON(ctx, operations.GetAccountJSONRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.UserPlexAccount != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetAccountJSONResponse, error

Errors

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

AcceptInvite

Accept a pending Plex friend, home, or server invitation.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.AcceptInvite(ctx, operations.AcceptInviteRequest{
        InviteID: 530502,
        Friend: components.BoolIntTrue,
        Home: components.BoolIntTrue,
        Server: components.BoolIntTrue,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.AcceptInviteResponse, error

Errors

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

DeleteHomeUser

Remove a Plex Home user.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.DeleteHomeUser(ctx, operations.DeleteHomeUserRequest{
        UserID: 768153,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.DeleteHomeUserResponse, error

Errors

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

UpdateHomeUser

Update a Plex Home user.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.UpdateHomeUser(ctx, operations.UpdateHomeUserRequest{
        UserID: 187897,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.UpdateHomeUserResponse, error

Errors

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

UpdateRestrictedUser

Update restricted (managed) home user settings.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.UpdateRestrictedUser(ctx, operations.UpdateRestrictedUserRequest{
        UserID: 130660,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.UpdateRestrictedUserResponse, error

Errors

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

GetServerDetails

Get server details for sharing.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetServerDetails(ctx, operations.GetServerDetailsRequest{
        MachineID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ServerConfiguration != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetServerDetailsResponse, error

Errors

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

ShareServerLegacy

Share a library with a friend (legacy v1 XML endpoint).

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.ShareServerLegacy(ctx, operations.ShareServerLegacyRequest{
        MachineID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ShareServerLegacyResponse, error

Errors

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

RemoveShare

Remove a share / friend.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.RemoveShare(ctx, operations.RemoveShareRequest{
        UserID: 858924,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.RemoveShareResponse, error

Errors

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

UpdateShare

Update friend filters (allowSync, filterMovies, etc.).

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.UpdateShare(ctx, operations.UpdateShareRequest{
        UserID: 139113,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.SuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.UpdateShareResponse, error

Errors

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

GetUserOptOuts

Get online media source opt-out settings for a user.

Example Usage

package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Users.GetUserOptOuts(ctx, operations.GetUserOptOutsRequest{
        UUID: "17dd8bb4-eb45-4878-97c7-017f7d9a2384",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.UserOptOutsResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetUserOptOutsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 401 application/json
sdkerrors.SDKError 4XX, 5XX */*
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.