-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfile_object.go
56 lines (48 loc) · 1.61 KB
/
file_object.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
package yousign
import (
"net/http"
"time"
)
type FileObjectService struct {
client *Client
}
type FileObject struct {
ID *string `json:"id,omitempty"`
File *string `json:"file,omitempty"`
Member *Member `json:"member,omitempty"`
Page *int `json:"page,omitempty"`
Position *string `json:"position,omitempty"`
FieldName *string `json:"fieldName,omitempty"`
Mention *string `json:"mention,omitempty"`
Mention2Internal *string `json:"mention2 (internal),omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
ExecutedAt *time.Time `json:"executedAt,omitempty"`
}
type FileObjectRequest struct {
File *string `json:"file,omitempty"`
Page *int `json:"page,omitempty"`
Position *string `json:"position,omitempty"`
FieldName *string `json:"fieldName,omitempty"`
Mention *string `json:"mention,omitempty"`
Mention2 *string `json:"mention2,omitempty"`
Member *string `json:"member,omitempty"`
}
func (s *FileObjectService) Create(r *FileObjectRequest) (*FileObject, *http.Response, error) {
req, err := s.client.NewRequest("POST", "file_objects", nil, r)
if err != nil {
return nil, nil, err
}
var v FileObject
resp, err := s.client.Do(req, &v)
return &v, resp, err
}
func (s *FileObjectService) Get(id string) (*FileObject, *http.Response, error) {
req, err := s.client.NewRequest("GET", id, nil, nil)
if err != nil {
return nil, nil, err
}
var v FileObject
resp, err := s.client.Do(req, &v)
return &v, resp, err
}