mixcloud

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertSearchString

func ConvertSearchString(s string) string

Types

type Client

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

Client is a client used to interact with the Mixcloud API

func NewClient

func NewClient(term string, filter *Filter) *Client

NewClient instantiates a new Client using the search term

func (*Client) FilterResults

func (c *Client) FilterResults(r Result) Result

func (*Client) GetAsync

func (c *Client) GetAsync(wg *sync.WaitGroup, q chan queueItem)

func (*Client) GetMixItems

func (c *Client) GetMixItems() []string

GetMixItems returns a slice of strings which are the keys of the mix data

func (*Client) GetOffsetURL

func (c *Client) GetOffsetURL(offset int32) string

GetOffsetURL returns a mixcloud search URL from the offset passed in.

func (*Client) PrintResults

func (c *Client) PrintResults()

PrintResults prints results to stdout should be replaced by a func that returns string

func (*Client) SearchAsync

func (c *Client) SearchAsync(max int32, workers int32)

SearchAsync runs up to 5 workers asynchronously to search mixcloud using a search term and a range of offsets

type Filter

type Filter struct {
	Excludes *regexp.Regexp
	Includes *regexp.Regexp
}

Filter is a client side filter for the results

func NewFilter

func NewFilter(excludes []string, includes []string) *Filter

type Item

type Item struct {
	Key string `json:"key"` // Key is the mix key field of the item
}

Item is a search result for a single mix

type Result

type Result struct {
	Paging struct {
		Next string `json:"next"`
	} `json:"paging"`
	Data []Item `json:"data"`
}

Result is the response back from the API

type ResultSet

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

ResultSet holds a slice of Results including a mutex for thread safe updates.

Jump to

Keyboard shortcuts

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