soundcloud

package
v0.0.0-...-27578c0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Token string `json:"access_token" validate:"nonzero"`
	Scope string `json:"scope"`
}

Auth is authentication data retrieved from the Soundcloud API

type Client

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

A Client is used to make requests to the Soundcloud API

func NewClient

func NewClient(cfg Config) *Client

NewClient creates a new client for the Soundcloud api

func (*Client) GetAuthToken

func (c *Client) GetAuthToken() error

GetAuthToken requests an oauth2 token from the api's /oauth2/token endpoint

func (*Client) UploadArtwork

func (c *Client) UploadArtwork(playlistID int, artwork []byte) error

UploadArtwork uploads the given artwork to the specified playlist

func (*Client) UploadPlaylist

func (c *Client) UploadPlaylist(playlist *Playlist) (*Playlist, error)

UploadPlaylist takes the given playlist and tries to upload it using the client credentials

type Config

type Config struct {
	// TODO: auth without password?
	Username string `yaml:"username" validate:"nonzero"`
	Password string `yaml:"password" validate:"nonzero"`
	Client   struct {
		ID     string `yaml:"id" validate:"nonzero"`
		Secret string `yaml:"secret" validate:"nonzero"`
	} `yaml:"client"`
}

Config is configuration data for the soundcloud API, retrieved from a yaml config file

type Playlist

type Playlist struct {
	ID           int     `json:"id,omitempty"`
	Title        string  `json:"title,omitempty"`
	Sharing      string  `json:"sharing,omitempty"`
	Tracks       []Track `json:"tracks,omitempty"`
	Created      string  `json:"created_at,omitempty"`
	ReleaseDay   int     `json:"release_day,omitempty"`
	ReleaseMonth int     `json:"release_month,omitempty"`
	ReleaseYear  int     `json:"release_year,omitempty"`
	ArtworkData  []byte  `json:"artwork_data,omitempty"`
	Type         string  `json:"playlist_type,omitempty"`
	Genre        string  `json:"genre,omitempty"`
	Description  string  `json:"description,omitempty"`
	Tags         string  `json:"tag_list,omitempty"`
}

A Playlist on Soundcloud

type Track

type Track struct {
	ID int `json:"id"`
}

A Track on Soundcloud

Jump to

Keyboard shortcuts

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