_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q9000
ArrayOfFunction
train
func ArrayOfFunction(env *Zlisp, name string, args []Sexp) (Sexp, error) { if len(args) != 2 { return SexpNull, fmt.Errorf("insufficient arguments to ([size] regtype) array constructor. use: " + "([size...] a-regtype)\n") } sz := 0 Q("args = %#v in ArrayOfFunction", args) switch ar := args[1].(type) { case...
go
{ "resource": "" }
q9001
compareUint64
train
func compareUint64(i *SexpUint64, expr Sexp) (int, error) { switch e := expr.(type) { case *SexpUint64: return signumUint64(i.Val - e.Val), nil } errmsg := fmt.Sprintf("err 101: cannot compare %T to %T", i, expr) return 0, errors.New(errmsg) }
go
{ "resource": "" }
q9002
parseExpression
train
func (parser *Parser) parseExpression(depth int) (res Sexp, err error) { //getAnother: tok, err := parser.lexer.getNextToken() if err != nil { return SexpEnd, err } switch tok.typ { case TokenLParen: exp, err := parser.parseList(depth + 1) return exp, err case TokenLSquare: exp, err := parser.parseArra...
go
{ "resource": "" }
q9003
TruncateToSize
train
func (stack *Stack) TruncateToSize(newsize int) { el := make([]StackElem, newsize) copy(el, stack.elements) stack.elements = el stack.tos = newsize - 1 }
go
{ "resource": "" }
q9004
nestedPathGetSet
train
func (s *Stack) nestedPathGetSet(env *Zlisp, dotpaths []string, setVal *Sexp) (Sexp, error) { if len(dotpaths) == 0 { return SexpNull, fmt.Errorf("internal error: in nestedPathGetSet() dotpaths" + " had zero length") } curStack := s var ret Sexp = SexpNull var err error var scop *Scope lenpath := len(dot...
go
{ "resource": "" }
q9005
FieldError
train
func FieldError(fieldName string, err error) error { if fErr, ok := err.(*fieldError); ok { fErr.fieldStack = append([]string{fieldName}, fErr.fieldStack...) return err } return &fieldError{ fieldStack: []string{fieldName}, nestedErr: err, } }
go
{ "resource": "" }
q9006
newApp
train
func newApp() *iris.Application { app := iris.New() yaag.Init(&yaag.Config{ // <- IMPORTANT, init the middleware. On: true, DocTitle: "Iris", DocPath: "apidoc.html", BaseUrls: map[string]string{"Production": "", "Staging": ""}, }) app.Use(irisyaag.New()) // <- IMPORTANT, register the middleware. ...
go
{ "resource": "" }
q9007
New
train
func New() context.Handler { return func(ctx context.Context) { if !yaag.IsOn() { // execute the main handler and exit if yaag is off. ctx.Next() return } // prepare the middleware. apiCall := &models.ApiCall{} middleware.Before(apiCall, ctx.Request()) // start the recorder instead of raw respon...
go
{ "resource": "" }
q9008
New
train
func New(amount int64, code string) *Money { return &Money{ amount: &Amount{val: amount}, currency: newCurrency(code).get(), } }
go
{ "resource": "" }
q9009
SameCurrency
train
func (m *Money) SameCurrency(om *Money) bool { return m.currency.equals(om.currency) }
go
{ "resource": "" }
q9010
Equals
train
func (m *Money) Equals(om *Money) (bool, error) { if err := m.assertSameCurrency(om); err != nil { return false, err } return m.compare(om) == 0, nil }
go
{ "resource": "" }
q9011
Absolute
train
func (m *Money) Absolute() *Money { return &Money{amount: mutate.calc.absolute(m.amount), currency: m.currency} }
go
{ "resource": "" }
q9012
Negative
train
func (m *Money) Negative() *Money { return &Money{amount: mutate.calc.negative(m.amount), currency: m.currency} }
go
{ "resource": "" }
q9013
Add
train
func (m *Money) Add(om *Money) (*Money, error) { if err := m.assertSameCurrency(om); err != nil { return nil, err } return &Money{amount: mutate.calc.add(m.amount, om.amount), currency: m.currency}, nil }
go
{ "resource": "" }
q9014
Subtract
train
func (m *Money) Subtract(om *Money) (*Money, error) { if err := m.assertSameCurrency(om); err != nil { return nil, err } return &Money{amount: mutate.calc.subtract(m.amount, om.amount), currency: m.currency}, nil }
go
{ "resource": "" }
q9015
Multiply
train
func (m *Money) Multiply(mul int64) *Money { return &Money{amount: mutate.calc.multiply(m.amount, mul), currency: m.currency} }
go
{ "resource": "" }
q9016
Divide
train
func (m *Money) Divide(div int64) *Money { return &Money{amount: mutate.calc.divide(m.amount, div), currency: m.currency} }
go
{ "resource": "" }
q9017
Round
train
func (m *Money) Round() *Money { return &Money{amount: mutate.calc.round(m.amount, m.currency.Fraction), currency: m.currency} }
go
{ "resource": "" }
q9018
Split
train
func (m *Money) Split(n int) ([]*Money, error) { if n <= 0 { return nil, errors.New("split must be higher than zero") } a := mutate.calc.divide(m.amount, int64(n)) ms := make([]*Money, n) for i := 0; i < n; i++ { ms[i] = &Money{amount: a, currency: m.currency} } l := mutate.calc.modulus(m.amount, int64(n)...
go
{ "resource": "" }
q9019
Allocate
train
func (m *Money) Allocate(rs ...int) ([]*Money, error) { if len(rs) == 0 { return nil, errors.New("no ratios specified") } // Calculate sum of ratios. var sum int for _, r := range rs { sum += r } var total int64 var ms []*Money for _, r := range rs { party := &Money{ amount: mutate.calc.allocate(m...
go
{ "resource": "" }
q9020
Display
train
func (m *Money) Display() string { c := m.currency.get() return c.Formatter().Format(m.amount.val) }
go
{ "resource": "" }
q9021
AddCurrency
train
func AddCurrency(Code, Grapheme, Template, Decimal, Thousand string, Fraction int) *Currency { currencies[Code] = &Currency{ Code: Code, Grapheme: Grapheme, Template: Template, Decimal: Decimal, Thousand: Thousand, Fraction: Fraction, } return currencies[Code] }
go
{ "resource": "" }
q9022
Formatter
train
func (c *Currency) Formatter() *Formatter { return &Formatter{ Fraction: c.Fraction, Decimal: c.Decimal, Thousand: c.Thousand, Grapheme: c.Grapheme, Template: c.Template, } }
go
{ "resource": "" }
q9023
getDefault
train
func (c *Currency) getDefault() *Currency { return &Currency{Decimal: ".", Thousand: ",", Code: c.Code, Fraction: 2, Grapheme: c.Code, Template: "1$"} }
go
{ "resource": "" }
q9024
get
train
func (c *Currency) get() *Currency { if curr, ok := currencies[c.Code]; ok { return curr } return c.getDefault() }
go
{ "resource": "" }
q9025
NewFormatter
train
func NewFormatter(fraction int, decimal, thousand, grapheme, template string) *Formatter { return &Formatter{ Fraction: fraction, Decimal: decimal, Thousand: thousand, Grapheme: grapheme, Template: template, } }
go
{ "resource": "" }
q9026
Format
train
func (f *Formatter) Format(amount int64) string { // Work with absolute amount value sa := strconv.FormatInt(f.abs(amount), 10) if len(sa) <= f.Fraction { sa = strings.Repeat("0", f.Fraction-len(sa)+1) + sa } if f.Thousand != "" { for i := len(sa) - f.Fraction - 3; i > 0; i -= 3 { sa = sa[:i] + f.Thousand...
go
{ "resource": "" }
q9027
New
train
func New(m uint, k uint) *BloomFilter { return &BloomFilter{max(1, m), max(1, k), bitset.New(m)} }
go
{ "resource": "" }
q9028
baseHashes
train
func baseHashes(data []byte) [4]uint64 { a1 := []byte{1} // to grab another bit of data hasher := murmur3.New128() hasher.Write(data) // #nosec v1, v2 := hasher.Sum128() hasher.Write(a1) // #nosec v3, v4 := hasher.Sum128() return [4]uint64{ v1, v2, v3, v4, } }
go
{ "resource": "" }
q9029
NewWithEstimates
train
func NewWithEstimates(n uint, fp float64) *BloomFilter { m, k := EstimateParameters(n, fp) return New(m, k) }
go
{ "resource": "" }
q9030
Merge
train
func (f *BloomFilter) Merge(g *BloomFilter) error { // Make sure the m's and k's are the same, otherwise merging has no real use. if f.m != g.m { return fmt.Errorf("m's don't match: %d != %d", f.m, g.m) } if f.k != g.k { return fmt.Errorf("k's don't match: %d != %d", f.m, g.m) } f.b.InPlaceUnion(g.b) retur...
go
{ "resource": "" }
q9031
Copy
train
func (f *BloomFilter) Copy() *BloomFilter { fc := New(f.m, f.k) fc.Merge(f) // #nosec return fc }
go
{ "resource": "" }
q9032
EstimateFalsePositiveRate
train
func (f *BloomFilter) EstimateFalsePositiveRate(n uint) (fpRate float64) { rounds := uint32(100000) f.ClearAll() n1 := make([]byte, 4) for i := uint32(0); i < uint32(n); i++ { binary.BigEndian.PutUint32(n1, i) f.Add(n1) } fp := 0 // test for number of rounds for i := uint32(0); i < rounds; i++ { binary.Bi...
go
{ "resource": "" }
q9033
Equal
train
func (f *BloomFilter) Equal(g *BloomFilter) bool { return f.m == g.m && f.k == g.k && f.b.Equal(g.b) }
go
{ "resource": "" }
q9034
Locations
train
func Locations(data []byte, k uint) []uint64 { locs := make([]uint64, k) // calculate locations h := baseHashes(data) for i := uint(0); i < k; i++ { locs[i] = location(h, i) } return locs }
go
{ "resource": "" }
q9035
New
train
func New(value interface{}) *StateMachine { return &StateMachine{ states: map[string]*State{}, events: map[string]*Event{}, } }
go
{ "resource": "" }
q9036
Initial
train
func (sm *StateMachine) Initial(name string) *StateMachine { sm.initialState = name return sm }
go
{ "resource": "" }
q9037
State
train
func (sm *StateMachine) State(name string) *State { state := &State{Name: name} sm.states[name] = state return state }
go
{ "resource": "" }
q9038
Event
train
func (sm *StateMachine) Event(name string) *Event { event := &Event{Name: name} sm.events[name] = event return event }
go
{ "resource": "" }
q9039
Trigger
train
func (sm *StateMachine) Trigger(name string, value Stater, tx *gorm.DB, notes ...string) error { var ( newTx *gorm.DB stateWas = value.GetState() ) if tx != nil { newTx = tx.New() } if stateWas == "" { stateWas = sm.initialState value.SetState(sm.initialState) } if event := sm.events[name]; event...
go
{ "resource": "" }
q9040
Enter
train
func (state *State) Enter(fc func(value interface{}, tx *gorm.DB) error) *State { state.enters = append(state.enters, fc) return state }
go
{ "resource": "" }
q9041
Exit
train
func (state *State) Exit(fc func(value interface{}, tx *gorm.DB) error) *State { state.exits = append(state.exits, fc) return state }
go
{ "resource": "" }
q9042
To
train
func (event *Event) To(name string) *EventTransition { transition := &EventTransition{to: name} event.transitions = append(event.transitions, transition) return transition }
go
{ "resource": "" }
q9043
From
train
func (transition *EventTransition) From(states ...string) *EventTransition { transition.froms = states return transition }
go
{ "resource": "" }
q9044
Before
train
func (transition *EventTransition) Before(fc func(value interface{}, tx *gorm.DB) error) *EventTransition { transition.befores = append(transition.befores, fc) return transition }
go
{ "resource": "" }
q9045
After
train
func (transition *EventTransition) After(fc func(value interface{}, tx *gorm.DB) error) *EventTransition { transition.afters = append(transition.afters, fc) return transition }
go
{ "resource": "" }
q9046
GenerateReferenceKey
train
func GenerateReferenceKey(model interface{}, db *gorm.DB) string { var ( scope = db.NewScope(model) primaryValues []string ) for _, field := range scope.PrimaryFields() { primaryValues = append(primaryValues, fmt.Sprint(field.Field.Interface())) } return strings.Join(primaryValues, "::") }
go
{ "resource": "" }
q9047
GetStateChangeLogs
train
func GetStateChangeLogs(model interface{}, db *gorm.DB) []StateChangeLog { var ( changelogs []StateChangeLog scope = db.NewScope(model) ) db.Where("refer_table = ? AND refer_id = ?", scope.TableName(), GenerateReferenceKey(model, db)).Find(&changelogs) return changelogs }
go
{ "resource": "" }
q9048
GetUsersPublicProfile
train
func (c *Client) GetUsersPublicProfile(userID ID) (*User, error) { spotifyURL := c.baseURL + "users/" + string(userID) var user User err := c.get(spotifyURL, &user) if err != nil { return nil, err } return &user, nil }
go
{ "resource": "" }
q9049
CurrentUsersTracksOpt
train
func (c *Client) CurrentUsersTracksOpt(opt *Options) (*SavedTrackPage, error) { spotifyURL := c.baseURL + "me/tracks" if opt != nil { v := url.Values{} if opt.Country != nil { v.Set("country", *opt.Country) } if opt.Limit != nil { v.Set("limit", strconv.Itoa(*opt.Limit)) } if opt.Offset != nil { ...
go
{ "resource": "" }
q9050
FollowUser
train
func (c *Client) FollowUser(ids ...ID) error { return c.modifyFollowers("user", true, ids...) }
go
{ "resource": "" }
q9051
FollowArtist
train
func (c *Client) FollowArtist(ids ...ID) error { return c.modifyFollowers("artist", true, ids...) }
go
{ "resource": "" }
q9052
UnfollowUser
train
func (c *Client) UnfollowUser(ids ...ID) error { return c.modifyFollowers("user", false, ids...) }
go
{ "resource": "" }
q9053
UnfollowArtist
train
func (c *Client) UnfollowArtist(ids ...ID) error { return c.modifyFollowers("artist", false, ids...) }
go
{ "resource": "" }
q9054
CurrentUserFollows
train
func (c *Client) CurrentUserFollows(t string, ids ...ID) ([]bool, error) { if l := len(ids); l == 0 || l > 50 { return nil, errors.New("spotify: UserFollows supports 1 to 50 IDs") } if t != "artist" && t != "user" { return nil, errors.New("spotify: t must be 'artist' or 'user'") } spotifyURL := fmt.Sprintf("%s...
go
{ "resource": "" }
q9055
SetAuthInfo
train
func (a *Authenticator) SetAuthInfo(clientID, secretKey string) { a.config.ClientID = clientID a.config.ClientSecret = secretKey }
go
{ "resource": "" }
q9056
Token
train
func (a Authenticator) Token(state string, r *http.Request) (*oauth2.Token, error) { values := r.URL.Query() if e := values.Get("error"); e != "" { return nil, errors.New("spotify: auth failed - " + e) } code := values.Get("code") if code == "" { return nil, errors.New("spotify: didn't get access code") } ac...
go
{ "resource": "" }
q9057
Exchange
train
func (a Authenticator) Exchange(code string) (*oauth2.Token, error) { return a.config.Exchange(a.context, code) }
go
{ "resource": "" }
q9058
NewClient
train
func (a Authenticator) NewClient(token *oauth2.Token) Client { client := a.config.Client(a.context, token) return Client{ http: client, baseURL: baseAddress, } }
go
{ "resource": "" }
q9059
Token
train
func (c *Client) Token() (*oauth2.Token, error) { transport, ok := c.http.Transport.(*oauth2.Transport) if !ok { return nil, errors.New("spotify: oauth2 transport type not correct") } t, err := transport.Source.Token() if err != nil { return nil, err } return t, nil }
go
{ "resource": "" }
q9060
GetAlbum
train
func (c *Client) GetAlbum(id ID) (*FullAlbum, error) { spotifyURL := fmt.Sprintf("%salbums/%s", c.baseURL, id) var a FullAlbum err := c.get(spotifyURL, &a) if err != nil { return nil, err } return &a, nil }
go
{ "resource": "" }
q9061
GetAlbums
train
func (c *Client) GetAlbums(ids ...ID) ([]*FullAlbum, error) { if len(ids) > 20 { return nil, errors.New("spotify: exceeded maximum number of albums") } spotifyURL := fmt.Sprintf("%salbums?ids=%s", c.baseURL, strings.Join(toStringSlice(ids), ",")) var a struct { Albums []*FullAlbum `json:"albums"` } err := c...
go
{ "resource": "" }
q9062
GetAlbumTracks
train
func (c *Client) GetAlbumTracks(id ID) (*SimpleTrackPage, error) { return c.GetAlbumTracksOpt(id, -1, -1) }
go
{ "resource": "" }
q9063
GetAlbumTracksOpt
train
func (c *Client) GetAlbumTracksOpt(id ID, limit, offset int) (*SimpleTrackPage, error) { spotifyURL := fmt.Sprintf("%salbums/%s/tracks", c.baseURL, id) v := url.Values{} if limit != -1 { v.Set("limit", strconv.Itoa(limit)) } if offset != -1 { v.Set("offset", strconv.Itoa(offset)) } optional := v.Encode() if...
go
{ "resource": "" }
q9064
FeaturedPlaylistsOpt
train
func (c *Client) FeaturedPlaylistsOpt(opt *PlaylistOptions) (message string, playlists *SimplePlaylistPage, e error) { spotifyURL := c.baseURL + "browse/featured-playlists" if opt != nil { v := url.Values{} if opt.Locale != nil { v.Set("locale", *opt.Locale) } if opt.Country != nil { v.Set("country", *o...
go
{ "resource": "" }
q9065
UnfollowPlaylist
train
func (c *Client) UnfollowPlaylist(owner, playlist ID) error { spotifyURL := buildFollowURI(c.baseURL, owner, playlist) req, err := http.NewRequest("DELETE", spotifyURL, nil) if err != nil { return err } err = c.execute(req, nil) if err != nil { return err } return nil }
go
{ "resource": "" }
q9066
GetPlaylistsForUser
train
func (c *Client) GetPlaylistsForUser(userID string) (*SimplePlaylistPage, error) { return c.GetPlaylistsForUserOpt(userID, nil) }
go
{ "resource": "" }
q9067
GetPlaylist
train
func (c *Client) GetPlaylist(playlistID ID) (*FullPlaylist, error) { return c.GetPlaylistOpt(playlistID, "") }
go
{ "resource": "" }
q9068
GetPlaylistTracks
train
func (c *Client) GetPlaylistTracks(playlistID ID) (*PlaylistTrackPage, error) { return c.GetPlaylistTracksOpt(playlistID, nil, "") }
go
{ "resource": "" }
q9069
CreatePlaylistForUser
train
func (c *Client) CreatePlaylistForUser(userID, playlistName, description string, public bool) (*FullPlaylist, error) { spotifyURL := fmt.Sprintf("%susers/%s/playlists", c.baseURL, userID) body := struct { Name string `json:"name"` Public bool `json:"public"` Description string `json:"description"`...
go
{ "resource": "" }
q9070
NewTrackToRemove
train
func NewTrackToRemove(trackID string, positions []int) TrackToRemove { return TrackToRemove{ URI: fmt.Sprintf("spotify:track:%s", trackID), Positions: positions, } }
go
{ "resource": "" }
q9071
ReplacePlaylistTracks
train
func (c *Client) ReplacePlaylistTracks(playlistID ID, trackIDs ...ID) error { trackURIs := make([]string, len(trackIDs)) for i, u := range trackIDs { trackURIs[i] = fmt.Sprintf("spotify:track:%s", u) } spotifyURL := fmt.Sprintf("%splaylists/%s/tracks?uris=%s", c.baseURL, playlistID, strings.Join(trackURIs, ",")...
go
{ "resource": "" }
q9072
GetArtist
train
func (c *Client) GetArtist(id ID) (*FullArtist, error) { spotifyURL := fmt.Sprintf("%sartists/%s", c.baseURL, id) var a FullArtist err := c.get(spotifyURL, &a) if err != nil { return nil, err } return &a, nil }
go
{ "resource": "" }
q9073
GetArtists
train
func (c *Client) GetArtists(ids ...ID) ([]*FullArtist, error) { spotifyURL := fmt.Sprintf("%sartists?ids=%s", c.baseURL, strings.Join(toStringSlice(ids), ",")) var a struct { Artists []*FullArtist } err := c.get(spotifyURL, &a) if err != nil { return nil, err } return a.Artists, nil }
go
{ "resource": "" }
q9074
GetArtistsTopTracks
train
func (c *Client) GetArtistsTopTracks(artistID ID, country string) ([]FullTrack, error) { spotifyURL := fmt.Sprintf("%sartists/%s/top-tracks?country=%s", c.baseURL, artistID, country) var t struct { Tracks []FullTrack `json:"tracks"` } err := c.get(spotifyURL, &t) if err != nil { return nil, err } return t...
go
{ "resource": "" }
q9075
GetArtistAlbumsOpt
train
func (c *Client) GetArtistAlbumsOpt(artistID ID, options *Options, t *AlbumType) (*SimpleAlbumPage, error) { spotifyURL := fmt.Sprintf("%sartists/%s/albums", c.baseURL, artistID) // add optional query string if options were specified values := url.Values{} if t != nil { values.Set("album_type", t.encode()) } if...
go
{ "resource": "" }
q9076
PlayerDevices
train
func (c *Client) PlayerDevices() ([]PlayerDevice, error) { var result struct { PlayerDevices []PlayerDevice `json:"devices"` } err := c.get(c.baseURL+"me/player/devices", &result) if err != nil { return nil, err } return result.PlayerDevices, nil }
go
{ "resource": "" }
q9077
PlayerStateOpt
train
func (c *Client) PlayerStateOpt(opt *Options) (*PlayerState, error) { spotifyURL := c.baseURL + "me/player" if opt != nil { v := url.Values{} if opt.Country != nil { v.Set("market", *opt.Country) } if params := v.Encode(); params != "" { spotifyURL += "?" + params } } var result PlayerState err :...
go
{ "resource": "" }
q9078
PlayerCurrentlyPlayingOpt
train
func (c *Client) PlayerCurrentlyPlayingOpt(opt *Options) (*CurrentlyPlaying, error) { spotifyURL := c.baseURL + "me/player/currently-playing" if opt != nil { v := url.Values{} if opt.Country != nil { v.Set("market", *opt.Country) } if params := v.Encode(); params != "" { spotifyURL += "?" + params } ...
go
{ "resource": "" }
q9079
PlayerRecentlyPlayedOpt
train
func (c *Client) PlayerRecentlyPlayedOpt(opt *RecentlyPlayedOptions) ([]RecentlyPlayedItem, error) { spotifyURL := c.baseURL + "me/player/recently-played" if opt != nil { v := url.Values{} if opt.Limit != 0 { v.Set("limit", strconv.FormatInt(int64(opt.Limit), 10)) } if opt.BeforeEpochMs != 0 { v.Set("be...
go
{ "resource": "" }
q9080
TransferPlayback
train
func (c *Client) TransferPlayback(deviceID ID, play bool) error { reqData := struct { DeviceID []ID `json:"device_ids"` Play bool `json:"play"` }{ DeviceID: []ID{deviceID}, Play: play, } buf := new(bytes.Buffer) err := json.NewEncoder(buf).Encode(reqData) if err != nil { return err } req, err...
go
{ "resource": "" }
q9081
PlayOpt
train
func (c *Client) PlayOpt(opt *PlayOptions) error { spotifyURL := c.baseURL + "me/player/play" buf := new(bytes.Buffer) if opt != nil { v := url.Values{} if opt.DeviceID != nil { v.Set("device_id", opt.DeviceID.String()) } if params := v.Encode(); params != "" { spotifyURL += "?" + params } err :=...
go
{ "resource": "" }
q9082
PauseOpt
train
func (c *Client) PauseOpt(opt *PlayOptions) error { spotifyURL := c.baseURL + "me/player/pause" if opt != nil { v := url.Values{} if opt.DeviceID != nil { v.Set("device_id", opt.DeviceID.String()) } if params := v.Encode(); params != "" { spotifyURL += "?" + params } } req, err := http.NewRequest(h...
go
{ "resource": "" }
q9083
SeekOpt
train
func (c *Client) SeekOpt(position int, opt *PlayOptions) error { return c.playerFuncWithOpt( "me/player/seek", url.Values{ "position_ms": []string{strconv.FormatInt(int64(position), 10)}, }, opt, ) }
go
{ "resource": "" }
q9084
Repeat
train
func (c *Client) Repeat(state string) error { return c.RepeatOpt(state, nil) }
go
{ "resource": "" }
q9085
RepeatOpt
train
func (c *Client) RepeatOpt(state string, opt *PlayOptions) error { return c.playerFuncWithOpt( "me/player/repeat", url.Values{ "state": []string{state}, }, opt, ) }
go
{ "resource": "" }
q9086
Volume
train
func (c *Client) Volume(percent int) error { return c.VolumeOpt(percent, nil) }
go
{ "resource": "" }
q9087
VolumeOpt
train
func (c *Client) VolumeOpt(percent int, opt *PlayOptions) error { return c.playerFuncWithOpt( "me/player/volume", url.Values{ "volume_percent": []string{strconv.FormatInt(int64(percent), 10)}, }, opt, ) }
go
{ "resource": "" }
q9088
Shuffle
train
func (c *Client) Shuffle(shuffle bool) error { return c.ShuffleOpt(shuffle, nil) }
go
{ "resource": "" }
q9089
ShuffleOpt
train
func (c *Client) ShuffleOpt(shuffle bool, opt *PlayOptions) error { return c.playerFuncWithOpt( "me/player/shuffle", url.Values{ "state": []string{strconv.FormatBool(shuffle)}, }, opt, ) }
go
{ "resource": "" }
q9090
AddTracksToLibrary
train
func (c *Client) AddTracksToLibrary(ids ...ID) error { return c.modifyLibraryTracks(true, ids...) }
go
{ "resource": "" }
q9091
RemoveTracksFromLibrary
train
func (c *Client) RemoveTracksFromLibrary(ids ...ID) error { return c.modifyLibraryTracks(false, ids...) }
go
{ "resource": "" }
q9092
GetCategoryPlaylists
train
func (c *Client) GetCategoryPlaylists(catID string) (*SimplePlaylistPage, error) { return c.GetCategoryPlaylistsOpt(catID, nil) }
go
{ "resource": "" }
q9093
GetCategoryPlaylistsOpt
train
func (c *Client) GetCategoryPlaylistsOpt(catID string, opt *Options) (*SimplePlaylistPage, error) { spotifyURL := fmt.Sprintf("%sbrowse/categories/%s/playlists", c.baseURL, catID) if opt != nil { values := url.Values{} if opt.Country != nil { values.Set("country", *opt.Country) } if opt.Limit != nil { v...
go
{ "resource": "" }
q9094
MaxAcousticness
train
func (ta *TrackAttributes) MaxAcousticness(acousticness float64) *TrackAttributes { ta.floatAttributes["max_acousticness"] = acousticness return ta }
go
{ "resource": "" }
q9095
MinAcousticness
train
func (ta *TrackAttributes) MinAcousticness(acousticness float64) *TrackAttributes { ta.floatAttributes["min_acousticness"] = acousticness return ta }
go
{ "resource": "" }
q9096
TargetAcousticness
train
func (ta *TrackAttributes) TargetAcousticness(acousticness float64) *TrackAttributes { ta.floatAttributes["target_acousticness"] = acousticness return ta }
go
{ "resource": "" }
q9097
MaxDanceability
train
func (ta *TrackAttributes) MaxDanceability(danceability float64) *TrackAttributes { ta.floatAttributes["max_danceability"] = danceability return ta }
go
{ "resource": "" }
q9098
MinDanceability
train
func (ta *TrackAttributes) MinDanceability(danceability float64) *TrackAttributes { ta.floatAttributes["min_danceability"] = danceability return ta }
go
{ "resource": "" }
q9099
TargetDanceability
train
func (ta *TrackAttributes) TargetDanceability(danceability float64) *TrackAttributes { ta.floatAttributes["target_danceability"] = danceability return ta }
go
{ "resource": "" }