go-twitch/api/extensions/models.go

222 lines
9.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package extensions
import "time"
type ConfigurationSegment string
const (
ConfigurationSegmentBroadcaster ConfigurationSegment = "broadcaster"
ConfigurationSegmentDeveloper ConfigurationSegment = "developer"
ConfigurationSegmentGlobal ConfigurationSegment = "global"
)
type ExtensionSecrets struct {
// The version number that identifies this definition of the secrets data.
FormatVersion int `json:"format_version"`
// The list of secrets.
Secrets []ExtensionSecret `json:"secrets"`
}
type ExtensionSecret struct {
// The raw secret that you use with JWT encoding.
Content string `json:"content"`
// The UTC date and time (in RFC3339 format) that you may begin using this secret to sign a JWT.
ActiveAt time.Time `json:"active_at"`
// The UTC date and time (in RFC3339 format) that you must stop using this secret to decode a JWT.
ExpiresAt time.Time `json:"expires_at"`
}
type ConfigurationLocation string
const (
// The Extensions Configuration Service hosts the configuration.
ConfigurationLocationHosted ConfigurationLocation = "hosted"
// The Extension Backend Service (EBS) hosts the configuration.
ConfigurationLocationCustom ConfigurationLocation = "custom"
// The extension doesn't require configuration.
ConfigurationLocationNone ConfigurationLocation = "none"
)
type ExtensionState string
const (
ExtensionStateApproved ExtensionState = "Approved"
ExtensionStateAssetsUploaded ExtensionState = "AssetsUploaded"
ExtensionStateDeleted ExtensionState = "Deleted"
ExtensionStateDeprecated ExtensionState = "Deprecated"
ExtensionStateInReview ExtensionState = "InReview"
ExtensionStateInTest ExtensionState = "InTest"
ExtensionStatePendingAction ExtensionState = "PendingAction"
ExtensionStateRejected ExtensionState = "Rejected"
ExtensionStateReleased ExtensionState = "Released"
)
type Extension struct {
// The name of the user or organization that owns the extension
AuthorName string `json:"author_name"`
// A boolean value that determines whether the extension has features that use bits.
// Is true if the extension has features that use bits.
HasBits bool `json:"has_bits"`
// A boolean value that determines whether a user can install the extension on their channel.
// Is true if the user can install the extension on their channel.
CanInstall bool `json:"can_install"`
// The location of where the extensions configuration is stored.
ConfigurationLocation ConfigurationLocation `json:"configuration_location"`
// A longer description of the extension. It appears on the details page.
Description string `json:"description"`
// A URL to the extension's Terms of Service.
EulaTosUrl string `json:"eula_tos_url"`
// A boolean value that determines whether the extension can communicate with the installed channel's chat.
// Is true if the extension can communicate with the installed channel's chat room.
HasChatSupport bool `json:"has_chat_support"`
// A URL to the default icon that's displayed in the Extensions directory.
IconUrl string `json:"icon_url"`
// A dictionary that contains URLs to different sizes of the default icon.
// The dictionarys key identifies the icons size (for example, 24x24), and the dictionarys value contains the URL to the icon.
IconUrls map[string]string `json:"icon_urls"`
// The extensions ID.
ID string `json:"id"`
// The extensions state.
State ExtensionState `json:"state"`
// Indicates whether the extension can view the users subscription level on the channel that the extension is installed on.
// Possible values are:
//
// none — The extension can't view the users subscription level.
//
// optional — The extension can view the users subscription level.
SubscriptionsSupportLevel string `json:"subscriptions_support_level"`
// A short description of the extension that streamers see when hovering over the discovery splash screen in the Extensions manager.
Summary string `json:"summary"`
// The email address that users use to get support for the extension.
SupportEmail string `json:"support_email"`
// The extensions version number.
Version string `json:"version"`
// A brief description displayed on the channel to explain how the extension works.
ViewerSummary string `json:"viewer_summary"`
// Describes all views-related information such as how the extension is displayed on mobile devices.
Views struct {
// Describes how the extension is displayed on mobile devices.
Mobile struct {
// The HTML file that is shown to viewers on mobile devices. This page is presented to viewers as a panel behind the chat area of the mobile app.
ViewerUrl string `json:"viewer_url"`
} `json:"mobile"`
// Describes how the extension is rendered if the extension may be activated as a panel extension.
Panel struct {
// The HTML file that is shown to viewers when the extension is activated as a panel extension.
ViewerUrl string `json:"viewer_url"`
// The height, in pixels, of the panel component that the extension is rendered in.
Height int `json:"height"`
// A Boolean value that determines whether the extension can link to non-Twitch domains.
CanLinkExternalContent bool `json:"can_link_external_content"`
} `json:"panel"`
// Describes how the extension is rendered if the extension may be activated as a video-overlay extension.
VideoOverlay struct {
// The HTML file that is shown to viewers when the extension is activated as a video-overlay extension.
ViewerUrl string `json:"viewer_url"`
// A Boolean value that determines whether the extension can link to non-Twitch domains.
CanLinkExternalContent bool `json:"can_link_external_content"`
} `json:"video_overlay"`
// Describes how the extension is rendered if the extension may be activated as a video-component extension.
VideoComponent struct {
// The HTML file that is shown to viewers when the extension is activated as a video-component extension.
ViewerUrl string `json:"viewer_url"`
// The width value of the ratio (width : height) which determines the extensions width,
// and how the extensions iframe will resize in different video player environments.
AspectRatioX int `json:"aspect_ratio_x"`
// The height value of the ratio (width : height) which determines the extensions height,
// and how the extensions iframe will resize in different video player environments.
AspectRatioY int `json:"aspect_ratio_y"`
// A Boolean value that determines whether to apply CSS zoom.
// If true, a CSS zoom is applied such that the size of the extension is variable but the inner dimensions are fixed based on Scale Pixels.
// This allows your extension to render as if it is of fixed width and height.
// If false, the inner dimensions of the extension iframe are variable, meaning your extension must implement responsiveness.
Autoscale bool `json:"autoscale"`
// The base width, in pixels, of the extension to use when scaling (see autoscale). This value is ignored if autoscale is false.
ScalePixels int `json:"scale_pixels"`
// The height as a percent of the maximum height of a video component extension. Values are between 1% - 100%.
TargetHeight int `json:"target_height"`
// A boolean value that determines whether the extension can link to non-Twitch domains.
CanLinkExternalContent bool `json:"can_link_external_content"`
} `json:"video_component"`
// Describes the view that is shown to broadcasters while they are configuring your extension within the Extension Manager.
Config struct {
// The HTML file that is shown to broadcasters while they are configuring your extension within the Extension Manager.
ViewerUrl string `json:"viewer_url"`
// A Boolean value that determines whether the extension can link to non-Twitch domains.
CanLinkExternalContent bool `json:"can_link_external_content"`
} `json:"config"`
} `json:"views"`
// Allowlisted configuration URLs for displaying the extension
// (the allowlist is configured on Twitchs developer site under the Extensions -> Extension -> Version -> Capabilities).
AllowlistedConfigUrls []string `json:"allowlisted_config_urls"`
// Allowlisted panel URLs for displaying the extension
// (the allowlist is configured on Twitchs developer site under the Extensions -> Extension -> Version -> Capabilities).
AllowlistedPanelUrls []string `json:"allowlisted_panel_urls"`
}
type BitsProduct struct {
// The products SKU. The SKU is unique across an extensions products.
SKU string `json:"sku"`
// An object that contains the products cost information.
Cost struct {
// The products price.
Amount int `json:"amount"`
// The type of currency. Possible values are:
//
// bits
Type string `json:"type"`
} `json:"cost"`
// A Boolean value that indicates whether the product is in development. If true, the product is not available for public use.
InDevelopment bool `json:"in_development"`
// The products name as displayed in the extension.
DisplayName string `json:"display_name"`
// The date and time, in RFC3339 format, when the product expires.
Expiration time.Time `json:"expiration"`
// A Boolean value that determines whether Bits product purchase events are broadcast to all instances of an extension on a channel.
// The events are broadcast via the onTransactionComplete helper callback. Is true if the event is broadcast to all instances.
IsBroadcast bool `json:"is_broadcast"`
}