Files
plexgo/models/operations/uploadplaylist.go

122 lines
3.5 KiB
Go

// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package operations
import (
"encoding/json"
"fmt"
"github.com/LukeHagar/plexgo/internal/utils"
"net/http"
)
// QueryParamForce - Force overwriting of duplicate playlists.
// By default, a playlist file uploaded with the same path will overwrite the existing playlist.
// The `force` argument is used to disable overwriting.
// If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
type QueryParamForce int64
const (
QueryParamForceZero QueryParamForce = 0
QueryParamForceOne QueryParamForce = 1
)
func (e QueryParamForce) ToPointer() *QueryParamForce {
return &e
}
func (e *QueryParamForce) UnmarshalJSON(data []byte) error {
var v int64
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 0:
fallthrough
case 1:
*e = QueryParamForce(v)
return nil
default:
return fmt.Errorf("invalid value for QueryParamForce: %v", v)
}
}
type UploadPlaylistRequest struct {
// absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server.
// If the `path` argument is a directory, that path will be scanned for playlist files to be processed.
// Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it.
// The GUID of each playlist is based on the filename.
// If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it.
// The GUID of each playlist is based on the filename.
//
Path string `queryParam:"style=form,explode=true,name=path"`
// Force overwriting of duplicate playlists.
// By default, a playlist file uploaded with the same path will overwrite the existing playlist.
// The `force` argument is used to disable overwriting.
// If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
//
Force QueryParamForce `queryParam:"style=form,explode=true,name=force"`
// Possibly the section ID to upload the playlist to, we are not certain.
SectionID int64 `default:"1" queryParam:"style=form,explode=true,name=sectionID"`
}
func (u UploadPlaylistRequest) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(u, "", false)
}
func (u *UploadPlaylistRequest) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil {
return err
}
return nil
}
func (o *UploadPlaylistRequest) GetPath() string {
if o == nil {
return ""
}
return o.Path
}
func (o *UploadPlaylistRequest) GetForce() QueryParamForce {
if o == nil {
return QueryParamForce(0)
}
return o.Force
}
func (o *UploadPlaylistRequest) GetSectionID() int64 {
if o == nil {
return 0
}
return o.SectionID
}
type UploadPlaylistResponse struct {
// HTTP response content type for this operation
ContentType string
// HTTP response status code for this operation
StatusCode int
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response
}
func (o *UploadPlaylistResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *UploadPlaylistResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *UploadPlaylistResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}