jwplatform

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyticsClient added in v1.0.0

type AnalyticsClient struct {
	// contains filtered or unexported fields
}

AnalyticsClient for interacting with V2 Analytics API.

func (*AnalyticsClient) Query added in v1.0.0

func (c *AnalyticsClient) Query(siteID string, queryParams *AnalyticsQueryParameters) (*AnalyticsResponse, error)

Query the Analytics API

type AnalyticsQueryParameters added in v1.0.0

type AnalyticsQueryParameters struct {
	Source string `url:"source"`
	Format string `url:"format"`
}

AnalyticsQueryParameters define the allowed parameters on the Query action.

type AnalyticsResponse added in v1.0.0

type AnalyticsResponse struct {
	Dimensions        []string       `json:"dimensions"`
	StartDate         string         `json:"start_date"`
	EndDate           string         `json:"end_date"`
	Filter            string         `json:"filter"`
	IncludeMetadata   bool           `json:"include_metadata"`
	Metrics           []reportMetric `json:"metrics"`
	Sort              []reportSort   `json:"sort"`
	Page              int            `json:"page"`
	PageLength        int            `json:"page_length"`
	RelativeTimeframe string         `json:"relative_timeframe"`
}

AnalyticsResponse is the structure returned via the Query action.

type BidSettingsMetadata added in v1.0.0

type BidSettingsMetadata struct {
	BidTimeout             int      `json:"bidTimeout"`
	FloorPriceCents        int      `json:"floorPriceCents"`
	MediationLayerAdServer string   `json:"mediationLayerAdServer"`
	Buckets                []Bucket `json:"buckets"`
}

BidSettingsMetadata represents the configuration for the player bidding plugin

type BiddersMetadata added in v1.0.0

type BiddersMetadata struct {
	Name         string            `json:"name"`
	ID           string            `json:"id"`
	PubID        string            `json:"pubid"`
	CustomParams map[string]string `json:"custom_params"`
}

BiddersMetadata describes a configured Player Bidding bidder

type BidsMetadata added in v1.0.0

type BidsMetadata struct {
	Settings BidSettingsMetadata `json:"settings"`
	Bidders  []BiddersMetadata   `json:"bidders"`
}

BidsMetadata represents the player bidding configuration as used by the JW Player

type Bucket added in v1.0.0

type Bucket struct {
	Min       float64 `json:"min"`
	Max       float64 `json:"max"`
	Increment float64 `json:"increment"`
}

Bucket represents a minimum, maximum value to which to apply an increment

type ChannelCreateMetadata added in v1.0.0

type ChannelCreateMetadata struct {
	CustomParams     map[string]string `json:"custom_params"`
	Dvr              string            `json:"dvr"`
	SimulcastTargets []simulcastTarget `json:"simulcast_targets"`
	Tags             []string          `json:"tags"`
	Title            string            `json:"title"`
	Latency          string            `json:"latency"`
	ReconnectWindow  int               `json:"reconnect_window"`
}

ChannelCreateMetadata describes the request structure used to create a Channel resource

type ChannelCreateRequest added in v1.0.0

type ChannelCreateRequest struct {
	Metadata ChannelCreateMetadata `json:"metadata"`
}

ChannelCreateRequest is the request structure required for Channel create calls.

type ChannelMetadata added in v1.0.0

type ChannelMetadata struct {
	CustomParams     map[string]string `json:"custom_params"`
	Dvr              string            `json:"dvr"`
	SimulcastTargets []simulcastTarget `json:"simulcast_targets"`
	Tags             []string          `json:"tags"`
	Title            string            `json:"title"`
}

ChannelMetadata describes a Channel resource

type ChannelResource added in v1.0.0

type ChannelResource struct {
	V2ResourceResponse

	Metadata        ChannelMetadata `json:"metadata"`
	Latency         string          `json:"latency"`
	RecentEvents    []recentEvent   `json:"recent_events"`
	ReconnectWindow int             `json:"reconnect_window"`
	Status          string          `json:"status"`
	StreamKey       string          `json:"stream_key"`
}

ChannelResource is the resource that is returned for all Channel resource requests

type ChannelResourcesResponse added in v1.0.0

type ChannelResourcesResponse struct {
	V2ResourcesResponse

	Channels []ChannelResource `json:"channels"`
}

ChannelResourcesResponse is the response structure for Channel list calls.

type ChannelUpdateRequest added in v1.0.0

type ChannelUpdateRequest struct {
	Metadata ChannelMetadata `json:"metadata"`
}

ChannelUpdateRequest is the request structure required for Channel update calls.

type ChannelsClient added in v1.0.0

type ChannelsClient struct {
	Events *EventsClient
	// contains filtered or unexported fields
}

ChannelsClient for interacting with V2 Channels and Channel Events API.

func NewChannelsClient added in v1.0.0

func NewChannelsClient(v2Client *V2Client) *ChannelsClient

NewChannelsClient returns a new Channels Client

func (*ChannelsClient) Create added in v1.0.0

func (c *ChannelsClient) Create(siteID string, ChannelCreateMetadata *ChannelCreateMetadata) (*ChannelResource, error)

Create a Channel resource.

func (*ChannelsClient) Delete added in v1.0.0

func (c *ChannelsClient) Delete(siteID, channelID string) error

Delete a Channel resource by ID.

func (*ChannelsClient) Get added in v1.0.0

func (c *ChannelsClient) Get(siteID, channelID string) (*ChannelResource, error)

Get a single Channel resource by ID.

func (*ChannelsClient) List added in v1.0.0

func (c *ChannelsClient) List(siteID string, queryParams *QueryParams) (*ChannelResourcesResponse, error)

List all Channel resources associated with a given Site ID.

func (*ChannelsClient) Update added in v1.0.0

func (c *ChannelsClient) Update(siteID, channelID string, channelMetadata *ChannelMetadata) (*ChannelResource, error)

Update a Channel resource by ID.

type CreateMediaRequest added in v1.0.0

type CreateMediaRequest struct {
	Metadata MediaMetadata `json:"metadata,omitempty"`
	Upload   Upload        `json:"upload,omitempty"`
}

CreateMediaRequest is the request structure required for Media create calls. By default, the 'direct' upload method is used.

type CreateMediaResponse added in v1.0.0

type CreateMediaResponse struct {
	V2ResourceResponse
	MediaResource
	UploadLink  string `json:"upload_link,omitempty"`
	UploadToken string `json:"upload_token,omitempty"`
	UploadID    string `json:"upload_id,omitempty"`
}

CreateMediaResponse is the response structure for Media create calls. If "direct" or "multipart" were selected as the upload method, the response includes additional data required to complete your upload.

For direct uploads, the UploadLink will return a pre-signed S3 Upload Link.

For multipart uploads, the UploadToken and UploadID will be returned, to be used in subsequent requests to the V2 Upload API.

type CreateWebhookResponse added in v1.0.0

type CreateWebhookResponse struct {
	V2ResourceResponse
	Metadata WebhookMetadata `json:"metadata"`
	Secret   string          `json:"secret"`
}

CreateWebhookResponse is the response structure for Webhook create calls.

The Secret is returned only on Create calls and can be used to authenticate incoming webhooks Please see the documentation for additional details: https://developer.jwplayer.com/jwplayer/docs/learn-about-webhooks#section-verify-the-authenticity-of-a-webhook

type DRMPoliciesClient added in v1.0.0

type DRMPoliciesClient struct {
	// contains filtered or unexported fields
}

DRMPoliciesClient for interacting with V2 DRM Policies API.

func (*DRMPoliciesClient) Create added in v1.0.0

func (c *DRMPoliciesClient) Create(siteID string, DRMPolicyMetadata *DRMPolicyMetadata) (*DRMPolicyResource, error)

Create a DRMPolicy resource.

func (*DRMPoliciesClient) Delete added in v1.0.0

func (c *DRMPoliciesClient) Delete(siteID, drmPolicyID string) error

Delete a DRMPolicy resource by ID.

func (*DRMPoliciesClient) Get added in v1.0.0

func (c *DRMPoliciesClient) Get(siteID, drmPolicyID string) (*DRMPolicyResource, error)

Get a single DRMPolicy resource by ID.

func (*DRMPoliciesClient) List added in v1.0.0

func (c *DRMPoliciesClient) List(siteID string, queryParams *QueryParams) (*DRMPolicyResourcesResponse, error)

List all DRMPolicy resources.

func (*DRMPoliciesClient) Update added in v1.0.0

func (c *DRMPoliciesClient) Update(siteID, drmPolicyID string, DRMPolicyMetadata *DRMPolicyMetadata) (*DRMPolicyResource, error)

Update a DRMPolicy resource by ID.

type DRMPolicyMetadata added in v1.0.0

type DRMPolicyMetadata struct {
	Name                    string `json:"name"`
	MaxWidth                int    `json:"max_width"`
	WidevineSecurity        string `json:"widevine_security"`
	PlayreadySecurity       int    `json:"playready_security"`
	AllowOfflinePersistence bool   `json:"allow_offline_persistence"`
	DigitalOutputProtection string `json:"digital_output_protection"`
	LicenseDuration         int    `json:"license_duration"`
	PlaybackDuration        int    `json:"playback_duration"`
}

DRMPolicyMetadata describes a DRMPolicy resource

type DRMPolicyResource added in v1.0.0

type DRMPolicyResource struct {
	V2ResourceResponse
	Metadata DRMPolicyMetadata `json:"metadata"`
}

DRMPolicyResource is the resource that is returned for all DRM Policy resource requests

type DRMPolicyResourcesResponse added in v1.0.0

type DRMPolicyResourcesResponse struct {
	V2ResourcesResponse

	DRMPolicies []DRMPolicyResource `json:"drm_policies"`
}

DRMPolicyResourcesResponse is the response structure for DRMPolicy list calls.

type DRMPolicyWriteRequest added in v1.0.0

type DRMPolicyWriteRequest struct {
	Metadata DRMPolicyMetadata `json:"metadata"`
}

DRMPolicyWriteRequest is the request structure required for DRMPolicy create and update calls.

type EventResource added in v1.0.0

type EventResource struct {
	V2ResourceResponse
	MasterAccess masterAccess `json:"master_access"`
	MediaID      string       `json:"media_id"`
	Status       string       `json:"status"`
}

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.

type EventResourcesResponse added in v1.0.0

type EventResourcesResponse struct {
	V2ResourcesResponse
	Events []EventResource `json:"events"`
}

EventResourcesResponse is the response structure for Event list calls.

type EventsClient added in v1.0.0

type EventsClient struct {
	// contains filtered or unexported fields
}

EventsClient for interacting with V2 Events API.

func (*EventsClient) Get added in v1.0.0

func (c *EventsClient) Get(siteID, channelID, eventID string) (*EventResource, error)

Get a single Event resource by Channel and Event ID.

func (*EventsClient) List added in v1.0.0

func (c *EventsClient) List(siteID, channelID string, queryParams *QueryParams) (*EventResourcesResponse, error)

List all Event resources associated with a given Site and Channel ID.

func (*EventsClient) RequestMaster added in v1.0.0

func (c *EventsClient) RequestMaster(siteID, channelID, eventID string) error

RequestMaster reqyests the master asset resources associated with a given Site ID.

type ImportMetadata added in v1.0.0

type ImportMetadata struct {
	URL            string         `json:"url"`
	HostOnImport   bool           `json:"host_on_import"`
	Title          string         `json:"title,omitempty"`
	State          string         `json:"state"`
	Type           string         `json:"type"`
	Username       string         `json:"username,omitempty"`
	Tags           []string       `json:"tags"`
	IngestMetadata IngestMetadata `json:"ingest_metadata"`
	IngestTags     []string       `json:"ingest_tags"`
}

ImportMetadata describes the metadata for an Import resource

type ImportReadMetadata added in v1.0.0

type ImportReadMetadata struct {
	ImportMetadata
	Password string `json:"password"`
}

ImportReadMetadata describes the read structure of an Import resource metadata. This extends the base metadata, including an additional field, Password, which cannot be updated on a write call (update/create)

type ImportResource added in v1.0.0

type ImportResource struct {
	V2ResourceResponse

	Metadata           ImportReadMetadata `json:"metadata"`
	TotalItemsIngested int                `json:"total_items_ingested"`
	LastImport         string             `json:"last_import"`
}

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.

type ImportResourcesResponse added in v1.0.0

type ImportResourcesResponse struct {
	V2ResourcesResponse
	Imports []ImportResource `json:"imports"`
}

ImportResourcesResponse is the response structure for Import list calls.

type ImportWriteRequest added in v1.0.0

type ImportWriteRequest struct {
	Metadata ImportMetadata `json:"metadata"`
}

ImportWriteRequest is the request structure required for Import create calls.

type ImportsClient added in v1.0.0

type ImportsClient struct {
	// contains filtered or unexported fields
}

ImportsClient for interacting with V2 Imports API.

func (*ImportsClient) Create added in v1.0.0

func (c *ImportsClient) Create(siteID string, importMetadata *ImportMetadata) (*ImportResource, error)

Create a Import resource.

func (*ImportsClient) Delete added in v1.0.0

func (c *ImportsClient) Delete(siteID, importID string) error

Delete a Import resource by ID.

func (*ImportsClient) Get added in v1.0.0

func (c *ImportsClient) Get(siteID, importID string) (*ImportResource, error)

Get a single Import resource by ID.

func (*ImportsClient) List added in v1.0.0

func (c *ImportsClient) List(siteID string, queryParams *QueryParams) (*ImportResourcesResponse, error)

List all Import resources associated with a given Site ID.

func (*ImportsClient) Update added in v1.0.0

func (c *ImportsClient) Update(siteID, importID string, importMetadata *ImportMetadata) (*ImportResource, error)

Update a Import resource by ID.

type IngestMetadata added in v1.0.0

type IngestMetadata struct {
	Captions    bool `json:"captions"`
	Categories  bool `json:"categories"`
	Credits     bool `json:"credits"`
	Description bool `json:"description"`
	Keywords    bool `json:"keywords"`
	PublishDate bool `json:"publish_date"`
	Tags        bool `json:"tags"`
	Thumbnails  bool `json:"thumbnails"`
}

IngestMetadata describes which data will be captured in the import from the MRSS feed.

type JWError added in v1.0.0

type JWError struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

JWError represents a single error from the V2 Platform API.

type JWErrorResponse added in v1.0.0

type JWErrorResponse struct {
	Errors     []JWError `json:"errors"`
	StatusCode int
}

JWErrorResponse represents a V2 Platform error response.

func (*JWErrorResponse) Error added in v1.0.0

func (e *JWErrorResponse) Error() string

Error serializes the error object to JSON and returns it as a string.

type JWPlatform added in v1.0.0

type JWPlatform struct {
	Version       string
	Analytics     *AnalyticsClient
	Channels      *ChannelsClient
	DRMPolicies   *DRMPoliciesClient
	Imports       *ImportsClient
	Media         *MediaClient
	PlayerBidding *PlayerBiddingClient
	Webhooks      *WebhooksClient
}

JWPlatform client for interacting with JW Player V2 Platform APIs.

func New added in v1.0.0

func New(apiSecret string) *JWPlatform

New generates an authenticated client for interacting with JW Player V2 Platform APIs.

type MediaClient added in v1.0.0

type MediaClient struct {
	// contains filtered or unexported fields
}

MediaClient for interacting with V2 Media API.

func (*MediaClient) Create added in v1.0.0

func (c *MediaClient) Create(siteID string, mediaMetadata *MediaMetadata) (*CreateMediaResponse, error)

Create a Media resource.

func (*MediaClient) Delete added in v1.0.0

func (c *MediaClient) Delete(siteID, mediaID string) error

Delete a Media resource by ID.

func (*MediaClient) Get added in v1.0.0

func (c *MediaClient) Get(siteID, mediaID string) (*MediaResource, error)

Get a single Media resource by ID.

func (*MediaClient) List added in v1.0.0

func (c *MediaClient) List(siteID string, queryParams *QueryParams) (*MediaResourcesResponse, error)

List all Media resources associated with a given Site ID.

func (*MediaClient) Reupload added in v1.0.0

func (c *MediaClient) Reupload(siteID, mediaID string, upload *Upload) (*CreateMediaResponse, error)

Reupload a Media resource by ID.

func (*MediaClient) Update added in v1.0.0

func (c *MediaClient) Update(siteID, mediaID string, mediaMetadata *MediaMetadata) (*MediaResource, error)

Update a Media resource by ID.

type MediaMetadata added in v1.0.0

type MediaMetadata struct {
	Title            string            `json:"title,omitempty"`
	Description      string            `json:"description,omitempty"`
	Author           string            `json:"author,omitempty"`
	Permalink        string            `json:"permalink,omitempty"`
	Category         string            `json:"category,omitempty"`
	PublishStartDate string            `json:"publish_start_date,omitempty"`
	PublishEndDate   string            `json:"publish_end_date,omitempty"`
	Tags             []string          `json:"tags,omitempty"`
	CustomParams     map[string]string `json:"custom_params,omitempty"`
	ExternalID       string            `json:"external_id,omitempty"`
}

MediaMetadata describes a Media resource

type MediaResource added in v1.0.0

type MediaResource struct {
	V2ResourceResponse

	Duration     float64 `json:"duration"`
	ExternalID   string  `json:"external_id"`
	TrimInPoint  string  `json:"trim_in_point"`
	TrimOutPoint string  `json:"trim_out_point"`
	Status       string  `json:"status"`
	ErrorMessage string  `json:"error_message"`
	MimeType     string  `json:"mime_type"`
	MediaType    string  `json:"media_type"`
	HostingType  string  `json:"hosting_type"`
	SourceURL    string  `json:"source_url"`

	Metadata MediaMetadata `json:"metadata"`
}

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.

type MediaResourcesResponse added in v1.0.0

type MediaResourcesResponse struct {
	V2ResourcesResponse
	Media []MediaResource `json:"media"`
}

MediaResourcesResponse is the response structure for Media list calls.

type PlayerBiddingClient added in v1.0.0

type PlayerBiddingClient struct {
	// contains filtered or unexported fields
}

PlayerBiddingClient for interacting with V2 Player Bidding Configurations API.

func (*PlayerBiddingClient) Create added in v1.0.0

func (c *PlayerBiddingClient) Create(siteID string, PlayerBiddingConfigurationMetadata *PlayerBiddingConfigurationMetadata) (*PlayerBiddingConfigurationResource, error)

Create a Player Bidding Configuration resource.

func (*PlayerBiddingClient) Delete added in v1.0.0

func (c *PlayerBiddingClient) Delete(siteID, importID string) error

Delete a Player Bidding Configuration resource by ID.

func (*PlayerBiddingClient) Get added in v1.0.0

Get a single Player Bidding Configuration resource by ID.

func (*PlayerBiddingClient) List added in v1.0.0

List all Player Bidding Configuration resources associated with a given Site ID.

func (*PlayerBiddingClient) Update added in v1.0.0

func (c *PlayerBiddingClient) Update(siteID, importID string, PlayerBiddingConfigurationMetadata *PlayerBiddingConfigurationMetadata) (*PlayerBiddingConfigurationResource, error)

Update a Player Bidding Configuration resource by ID.

type PlayerBiddingConfigurationMetadata added in v1.0.0

type PlayerBiddingConfigurationMetadata struct {
	Bids BidsMetadata `json:"bids"`
}

PlayerBiddingConfigurationMetadata describes the metadata for an Player Bidding Configuration resource

type PlayerBiddingConfigurationResource added in v1.0.0

type PlayerBiddingConfigurationResource struct {
	V2ResourceResponse
	Metadata PlayerBiddingConfigurationMetadata `json:"metadata"`
}

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.

type PlayerBiddingConfigurationResourcesResponse added in v1.0.0

type PlayerBiddingConfigurationResourcesResponse struct {
	V2ResourcesResponse
	PlayerBiddingConfigs []PlayerBiddingConfigurationResource `json:"vpb_configs"`
}

PlayerBiddingConfigurationResourcesResponse is the response structure for Player Bidding Configuration list calls.

type PlayerBiddingWriteRequest added in v1.0.0

type PlayerBiddingWriteRequest struct {
	Metadata PlayerBiddingConfigurationMetadata `json:"metadata"`
}

PlayerBiddingWriteRequest is the request structure required for Player Bidding Configuration create and update calls.

type QueryParams added in v1.0.0

type QueryParams struct {
	PageLength int    `url:"page_length"`
	Page       int    `url:"page"`
	Query      string `url:"q"`
	Sort       string `url:"sort"`
}

QueryParams that can be specified on all resource list calls.

type ReuploadRequest added in v1.0.0

type ReuploadRequest struct {
	Upload Upload `json:"upload"`
}

ReuploadRequest is the request structure required for Media reupload calls.

type UpdateMediaRequest added in v1.0.0

type UpdateMediaRequest struct {
	Metadata MediaMetadata `json:"metadata"`
}

UpdateMediaRequest is the request structure required for Media update calls.

type Upload added in v1.0.0

type Upload struct {
	Method       string `json:"method,omitempty"`
	MimeType     string `json:"mime_type,omitempty"`
	SourceURL    string `json:"source_url,omitempty"`
	TrimInPoint  string `json:"trim_in_point,omitempty"`
	TrimOutPoint string `json:"trim_out_point,omitempty"`
}

Upload contains the data used to describe the upload. Available upload method's include "direct" (default), "multipart", "external", and "fetch".

Direct uploads can be used for assets up to 5GB.

MimeType and SourceURL are required only for "direct" and "fetch", respectively.

TrimInPoint and TrimOutPoint cannot be specified for "external".

type V2Client added in v1.0.0

type V2Client struct {
	Version string
	// contains filtered or unexported fields
}

V2Client is a light wrapper around the http.defaultClient for interacting with JW Player V2 Platform APIs

func NewV2Client added in v1.0.0

func NewV2Client(authToken string) *V2Client

NewV2Client creates an authenticated V2 Client.

func (*V2Client) Do added in v1.0.0

func (c *V2Client) Do(req *http.Request, v interface{}) error

Do executes the request and parses V2 Platform API errors.

func (*V2Client) Request added in v1.0.0

func (c *V2Client) Request(method, path string, response interface{}, data interface{}, queryParams url.Values) error

Request performs an authenticated HTTP request to the V2 Platform API.

type V2ResourceResponse added in v1.0.0

type V2ResourceResponse struct {
	ID            string                 `json:"id"`
	Created       string                 `json:"created"`
	LastModified  string                 `json:"last_modified"`
	Type          string                 `json:"type"`
	Relationships map[string]interface{} `json:"relationships"`
}

V2ResourceResponse describes the response structure for resource calls

type V2ResourcesResponse added in v1.0.0

type V2ResourcesResponse struct {
	Total      int `json:"total"`
	Page       int `json:"page"`
	PageLength int `json:"page_length"`
}

V2ResourcesResponse describes the response structure for list calls

type WebhookMetadata added in v1.0.0

type WebhookMetadata struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Events      []string `json:"events"`
	Sites       []string `json:"site_ids"`
	WebhookURL  string   `json:"webhook_url"`
}

WebhookMetadata describes a Webhook resource

type WebhookResource added in v1.0.0

type WebhookResource struct {
	V2ResourceResponse
	Metadata WebhookMetadata `json:"metadata"`
}

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.

type WebhookResourcesResponse added in v1.0.0

type WebhookResourcesResponse struct {
	V2ResourcesResponse
	Webhooks []WebhookResource `json:"webhooks"`
}

WebhookResourcesResponse is the response structure for Webhook list calls.

type WebhookWriteRequest added in v1.0.0

type WebhookWriteRequest struct {
	Metadata WebhookMetadata `json:"metadata"`
}

WebhookWriteRequest is the request structure required for Webhook create and update calls.

type WebhooksClient added in v1.0.0

type WebhooksClient struct {
	// contains filtered or unexported fields
}

WebhooksClient for interacting with V2 Webhooks API.

func (*WebhooksClient) Create added in v1.0.0

func (c *WebhooksClient) Create(webhookMetadata *WebhookMetadata) (*CreateWebhookResponse, error)

Create a Webhook resource.

func (*WebhooksClient) Delete added in v1.0.0

func (c *WebhooksClient) Delete(webhookID string) error

Delete a Webhook resource by ID.

func (*WebhooksClient) Get added in v1.0.0

func (c *WebhooksClient) Get(webhookID string) (*WebhookResource, error)

Get a single Webhook resource by ID.

func (*WebhooksClient) List added in v1.0.0

func (c *WebhooksClient) List(queryParams *QueryParams) (*WebhookResourcesResponse, error)

List all Webhook resources.

func (*WebhooksClient) Update added in v1.0.0

func (c *WebhooksClient) Update(webhookID string, webhookMetadata *WebhookMetadata) (*WebhookResource, error)

Update a Webhook resource by ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL