-
Notifications
You must be signed in to change notification settings - Fork 0
/
pin.go
42 lines (35 loc) · 992 Bytes
/
pin.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
package sips
import "time"
// RequestStatus is the status of a given pinning request.
type RequestStatus string
const (
Queued RequestStatus = "queued"
Pinning RequestStatus = "pinning"
Pinned RequestStatus = "pinned"
Failed RequestStatus = "failed"
)
func (s RequestStatus) Values() []string {
return []string{
string(Queued),
string(Pinning),
string(Pinned),
string(Failed),
}
}
// PinStatus indicates the status of a pinning request and provides
// associated info.
type PinStatus struct {
RequestID string `json:"requestid"`
Status RequestStatus `json:"status"`
Created time.Time `json:"created"`
Delegates []string `json:"delegates,omitempty"`
Info interface{} `json:"info,omitempty"`
Pin Pin `json:"pin"`
}
// Pin describes a single pinned item.
type Pin struct {
CID string `json:"cid"`
Name string `json:"name"`
Origins []string `json:"origins,omitempty"`
Meta interface{} `json:"meta,omitempty"`
}