-
Notifications
You must be signed in to change notification settings - Fork 28
/
queue_movement.go
51 lines (44 loc) · 1.55 KB
/
queue_movement.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package transmissionrpc
import (
"context"
"fmt"
)
/*
Queue Movement Requests
https://github.com/transmission/transmission/blob/4.0.3/docs/rpc-spec.md#46-queue-movement-requests
*/
// QueueMoveTop moves IDs to the top of the queue list.
func (c *Client) QueueMoveTop(ctx context.Context, IDs []int64) (err error) {
payload := &queueMovePayload{IDs: IDs}
if err = c.rpcCall(ctx, "queue-move-top", payload, nil); err != nil {
err = fmt.Errorf("'queue-move-top' rpc method failed: %w", err)
}
return
}
// QueueMoveUp moves IDs of one position up on the queue list.
func (c *Client) QueueMoveUp(ctx context.Context, IDs []int64) (err error) {
payload := &queueMovePayload{IDs: IDs}
if err = c.rpcCall(ctx, "queue-move-up", payload, nil); err != nil {
err = fmt.Errorf("'queue-move-up' rpc method failed: %w", err)
}
return
}
// QueueMoveDown moves IDs of one position down on the queue list.
func (c *Client) QueueMoveDown(ctx context.Context, IDs []int64) (err error) {
payload := &queueMovePayload{IDs: IDs}
if err = c.rpcCall(ctx, "queue-move-down", payload, nil); err != nil {
err = fmt.Errorf("'queue-move-down' rpc method failed: %w", err)
}
return
}
// QueueMoveBottom moves IDs to the bottom of the queue list.
func (c *Client) QueueMoveBottom(ctx context.Context, IDs []int64) (err error) {
payload := &queueMovePayload{IDs: IDs}
if err = c.rpcCall(ctx, "queue-move-bottom", payload, nil); err != nil {
err = fmt.Errorf("'queue-move-bottom' rpc method failed: %w", err)
}
return
}
type queueMovePayload struct {
IDs []int64 `json:"ids"`
}