2015-05-01 04:08:42 +00:00
|
|
|
package plugin
|
2015-04-08 05:10:44 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/drone/drone/common"
|
|
|
|
)
|
|
|
|
|
|
|
|
type GetTokenReq struct {
|
|
|
|
Sha string
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetTokenResp struct {
|
|
|
|
Token *common.Token
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) GetToken(sha string) (*common.Token, error) {
|
|
|
|
req := &GetTokenReq{sha}
|
|
|
|
res := &GetTokenResp{}
|
|
|
|
err := c.Call("Datastore.GetToken", req, res)
|
|
|
|
return res.Token, err
|
|
|
|
}
|
|
|
|
|
|
|
|
type InsertTokenReq struct {
|
|
|
|
Token *common.Token
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) InsertToken(token *common.Token) error {
|
|
|
|
req := &InsertTokenReq{token}
|
|
|
|
return c.Call("Datastore.InsertToken", req, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeleteTokenReq struct {
|
|
|
|
Token *common.Token
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) DeleteToken(token *common.Token) error {
|
|
|
|
req := &DeleteTokenReq{token}
|
|
|
|
return c.Call("Datastore.DeleteToken", req, nil)
|
|
|
|
}
|