-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver_stamp.go
60 lines (51 loc) · 1.69 KB
/
server_stamp.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
52
53
54
55
56
57
58
59
60
package yousign
import (
"encoding/json"
"net/http"
"time"
)
type ServerStampService struct {
client *Client
}
type ServerStamp struct {
ID *string `json:"id,omitempty"`
File *string `json:"file,omitempty"`
Certificate *string `json:"certificate,omitempty"`
FileObjects []FileObject `json:"fileObjects,omitempty"`
Config json.RawMessage `json:"config,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
Status *string `json:"status,omitempty"`
Company *string `json:"company,omitempty"`
}
type ServerStampRequest struct {
File *string `json:"file,omitempty"`
Certificate *string `json:"certificate,omitempty"`
Config *ServerStampConfig `json:"config,omitempty"`
FileObjects []FileObjectRequest `json:"fileObjects,omitempty"`
SignImage *string `json:"signImage,omitempty"`
}
type ServerStampConfig struct {
Webhook struct {
ServerStampFinished []Webhook `json:"server_stamp.finished,omitempty"`
}
}
func (s *ServerStampService) Create(r *ServerStampRequest) (*ServerStamp, *http.Response, error) {
req, err := s.client.NewRequest("POST", "server_stamps", nil, r)
if err != nil {
return nil, nil, err
}
var v ServerStamp
resp, err := s.client.Do(req, &v)
return &v, resp, err
}
func (s *ServerStampService) Get(id string) (*ServerStamp, *http.Response, error) {
req, err := s.client.NewRequest("GET", id, nil, nil)
if err != nil {
return nil, nil, err
}
var v ServerStamp
resp, err := s.client.Do(req, &v)
return &v, resp, err
}