Categorygithub.com/jwplayer/jwplatform-go
modulepackage
1.0.0
Repository: https://github.com/jwplayer/jwplatform-go.git
Documentation: pkg.go.dev

# README

Go JW Platform

GoDoc Build Status

The official Go client library for accessing the JW Platform API.

Requirements

Go 1.15+

Usage

import (
  "github.com/jwplayer/jwplatform-go"
  "github.com/jwplayer/jwplatform-go/media"
)

jwplatform := jwplatform.New("API_SECRET")
siteID := "9kzNUpe4"
mediaID := "LaJFzc9d"

// Get a Resource
media, err := jwplatform.Media.Get(siteID, mediaID)

// Create a Resource
mediaToCreate := &jwplatform.MediaMetadata(Title: "My new video")
media, err := jwplatform.Media.Create(siteID, mediaToCreate)

// List a Resource
mediaResources, err := jwplatform.Media.List(siteID, nil)
// Optionally include query parameters, including page, page length, sort, and filters.
params := jwplatform.QueryParams{Page: 2, PageLength: 5}
mediaResources, err := jwplatform.Media.List(siteID, params)

// Update a Resource
updateMetadata := &jwplatform.MediaMetadata{Title: "Updated video title"}
updatedMedia, err := jwplatform.Media.Update(siteID, mediaID, updateMetadata)

// Delete a Resource
_ := jwplatform.Media.Delete(siteID, mediaID)

Supported operations

All API methods documentated on the API are available in this client. Please refer to our api documentation.

Test

Before running the tests, make sure to grab all of the package's dependencies:

go get -t -v

Run all tests:

make test

For any requests, bug or comments, please [open an issue][issues] or [submit a pull request][pulls].

V1 Client

The V1 Client remains available for use, but is deprecated. We strongly recommend using the V2 Client. For documentation on the V1 Client, please refer to the v1 submodule.

# Functions

New generates an authenticated client for interacting with JW Player V2 Platform APIs.
NewChannelsClient returns a new Channels Client.
NewV2Client creates an authenticated V2 Client.

# Structs

AnalyticsClient for interacting with V2 Analytics API.
AnalyticsQueryParameters define the allowed parameters on the Query action.
AnalyticsResponse is the structure returned via the Query action.
BiddersMetadata describes a configured Player Bidding bidder.
BidSettingsMetadata represents the configuration for the player bidding plugin.
BidsMetadata represents the player bidding configuration as used by the JW Player.
Bucket represents a minimum, maximum value to which to apply an increment.
ChannelCreateMetadata describes the request structure used to create a Channel resource.
ChannelCreateRequest is the request structure required for Channel create calls.
ChannelMetadata describes a Channel resource.
ChannelResource is the resource that is returned for all Channel resource requests.
ChannelResourcesResponse is the response structure for Channel list calls.
ChannelsClient for interacting with V2 Channels and Channel Events API.
ChannelUpdateRequest is the request structure required for Channel update calls.
CreateMediaRequest is the request structure required for Media create calls.
CreateMediaResponse is the response structure for Media create calls.
CreateWebhookResponse is the response structure for Webhook create calls.
DRMPoliciesClient for interacting with V2 DRM Policies API.
DRMPolicyMetadata describes a DRMPolicy resource.
DRMPolicyResource is the resource that is returned for all DRM Policy resource requests.
DRMPolicyResourcesResponse is the response structure for DRMPolicy list calls.
DRMPolicyWriteRequest is the request structure required for DRMPolicy create and update calls.
EventResource is the resource that is returned for all Event resource requests, with the exception of the Create action, which extends this struct with upload-related data.
EventResourcesResponse is the response structure for Event list calls.
EventsClient for interacting with V2 Events API.
ImportMetadata describes the metadata for an Import resource.
ImportReadMetadata describes the read structure of an Import resource metadata.
ImportResource is the resource that is returned for all Import resource requests, with the exception of the Create action, which extends this struct with upload-related data.
ImportResourcesResponse is the response structure for Import list calls.
ImportsClient for interacting with V2 Imports API.
ImportWriteRequest is the request structure required for Import create calls.
IngestMetadata describes which data will be captured in the import from the MRSS feed.
JWError represents a single error from the V2 Platform API.
JWErrorResponse represents a V2 Platform error response.
JWPlatform client for interacting with JW Player V2 Platform APIs.
MediaClient for interacting with V2 Media API.
MediaMetadata describes a Media resource.
MediaResource is the resource that is returned for all Media resource requests, with the exception of the Create action, which extends this struct with upload-related data.
MediaResourcesResponse is the response structure for Media list calls.
PlayerBiddingClient for interacting with V2 Player Bidding Configurations API.
PlayerBiddingConfigurationMetadata describes the metadata for an Player Bidding Configuration resource.
PlayerBiddingConfigurationResource is the resource that is returned for all Player Bidding Configuration resource requests, with the exception of the Create action, which extends this struct with upload-related data.
PlayerBiddingConfigurationResourcesResponse is the response structure for Player Bidding Configuration list calls.
PlayerBiddingWriteRequest is the request structure required for Player Bidding Configuration create and update calls.
QueryParams that can be specified on all resource list calls.
ReuploadRequest is the request structure required for Media reupload calls.
UpdateMediaRequest is the request structure required for Media update calls.
Upload contains the data used to describe the upload.
V2Client is a light wrapper around the http.defaultClient for interacting with JW Player V2 Platform APIs.
V2ResourceResponse describes the response structure for resource calls.
V2ResourcesResponse describes the response structure for list calls.
WebhookMetadata describes a Webhook resource.
WebhookResource is the resource that is returned for all Webhook resource requests, with the exception of the Create action, which extends this struct with upload-related data.
WebhookResourcesResponse is the response structure for Webhook list calls.
WebhooksClient for interacting with V2 Webhooks API.
WebhookWriteRequest is the request structure required for Webhook create and update calls.