generated from oklookat/gostarter
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
track.go
28 lines (22 loc) · 909 Bytes
/
track.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package govkm
import (
"context"
"github.com/oklookat/govkm/schema"
)
// Получить трек по ID.
func (c Client) Track(ctx context.Context, id schema.ID) (*schema.Response[schema.TrackResponse], error) {
return getEntityById[schema.TrackResponse](ctx, &c, "track", id)
}
// Получить треки по ID.
func (c Client) Tracks(ctx context.Context, id []schema.ID) (*schema.Response[schema.TracksResponse], error) {
params := valuesFileId(id)
return getAny[schema.TracksResponse](ctx, &c, params, "tracks/")
}
// Лайкнуть трек.
func (c Client) LikeTrack(ctx context.Context, id schema.ID) (*schema.Response[any], error) {
return likeUnlikeEntity(ctx, &c, "track", id, true)
}
// Снять лайки с трека.
func (c Client) UnlikeTrack(ctx context.Context, id schema.ID) (*schema.Response[any], error) {
return likeUnlikeEntity(ctx, &c, "track", id, false)
}