-
Notifications
You must be signed in to change notification settings - Fork 6
/
notification.go
49 lines (42 loc) · 1.7 KB
/
notification.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
package transloadit
import (
"context"
"errors"
"time"
)
// NotificationList contains a list of notifications.
type NotificationList struct {
Notifications []Notification `json:"items"`
Count int `json:"count"`
}
// Notification contains details about a notification.
type Notification struct {
ID string `json:"id"`
AssemblyID string `json:"assembly_id"`
AccountID string `json:"account_id"`
URL string `json:"url"`
ResponseCode int `json:"response_code"`
ResponseData string `json:"response_data"`
Duration float32 `json:"duration"`
Created time.Time `json:"created"`
Error string `json:"error"`
}
// ListNotifications will return a list containing all notifications matching
// the criteria defined using the ListOptions structure.
//
// Deprecated: As of December 2021, the List Notifications API endpoint from
// Transloadit has been removed. This function will now always return an error.
func (client *Client) ListNotifications(ctx context.Context, options *ListOptions) (list NotificationList, err error) {
return list, errors.New("transloadit: listing assembly notifications is no longer available")
}
// ReplayNotification instructs the endpoint to replay the notification
// corresponding to the provided assembly ID.
// If notifyURL is not empty it will override the notify URL used in the
// assembly instructions.
func (client *Client) ReplayNotification(ctx context.Context, assemblyID string, notifyURL string) error {
params := make(map[string]interface{})
if notifyURL != "" {
params["notify_url"] = notifyURL
}
return client.request(ctx, "POST", "assembly_notifications/"+assemblyID+"/replay", params, nil)
}