/
attachment_actions_api.go
77 lines (59 loc) · 2.67 KB
/
attachment_actions_api.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package webexteams
import (
"time"
"github.com/go-resty/resty/v2"
)
// AttachmentActionsService manages the interactions with the attachment actions API methods.
type AttachmentActionsService service
// AttachmentActionCreateRequest create request for AttachmentAction
type AttachmentActionCreateRequest struct {
Type string `json:"type"` // The type of action.
MessageID string `json:"messageId"` // The unique identifier of the message.
Inputs map[string]interface{} `json:"inputs,omitempty"` // Action inputs
}
// AttachmentAction represents a Webex Teams attachment action.
type AttachmentAction struct {
ID string `json:"id,omitempty"` // The unique identifier of the attachment action.
Type string `json:"type,omitempty"` // The type of action.
MessageID string `json:"messageId,omitempty"` // The ID of the message to which the attachment action belongs.
Inputs map[string]interface{} `json:"inputs,omitempty"` // Action inputs
PersonID string `json:"personId,omitempty"` // The person ID of the person who created the action.
RoomID string `json:"roomId,omitempty"` // The room ID of the attachment action.
Created time.Time `json:"created,omitempty"` // Action creation date/time.
}
// CreateAttachmentAction creates an attachment action.
/*
Creates an attachment action
@param attachActionCreateRequest
@return AttachmentAction
*/
func (s *AttachmentActionsService) CreateAttachmentAction(attachActionCreateRequest *AttachmentActionCreateRequest) (*AttachmentAction, *resty.Response, error) {
path := "/attachment/actions"
response, err := s.client.R().
SetBody(attachActionCreateRequest).
SetResult(&AttachmentAction{}).
SetError(&Error{}).
Post(path)
if err != nil {
return nil, nil, err
}
result := response.Result().(*AttachmentAction)
return result, response, err
}
// GetAttachmentAction Shows details for an action, by attachment action ID.
/* Shows details for an attachment action, by attachment action ID.
Specify the attachment action ID in the attachmentActionID parameter in the URI.
@param attachmentActionID The unique identifier for the attachment action.
*/
func (s *AttachmentActionsService) GetAttachmentAction(attachmentActionID string) (*AttachmentAction, *resty.Response, error) {
path := "/attachment/actions/" + attachmentActionID
response, err := s.client.R().
SetResult(&AttachmentAction{}).
SetError(&Error{}).
Get(path)
if err != nil {
return nil, nil, err
}
result := response.Result().(*AttachmentAction)
return result, response, err
}