forked from adlio/trello
-
Notifications
You must be signed in to change notification settings - Fork 0
/
token.go
37 lines (32 loc) · 863 Bytes
/
token.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
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT licese.
// Details in the LICENSE file.
package trello
import (
"fmt"
"time"
)
type Token struct {
client *Client
ID string `json:"id"`
DateCreated time.Time `json:"dateCreated"`
DateExpires *time.Time `json:"dateExpires"`
IDMember string `json:"idMember"`
Identifier string `json:"identifier"`
Permissions []Permission `json:"permissions"`
}
type Permission struct {
IDModel string `json:"idModel"`
ModelType string `json:"modelType"`
Read bool `json:"read"`
Write bool `json:"write"`
}
func (c *Client) GetToken(tokenID string, args Arguments) (token *Token, err error) {
path := fmt.Sprintf("tokens/%s", tokenID)
err = c.Get(path, args, &token)
if token != nil {
token.client = c
}
return
}