-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathactivities.go
More file actions
34 lines (28 loc) · 1.01 KB
/
activities.go
File metadata and controls
34 lines (28 loc) · 1.01 KB
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
package jules
import "fmt"
// ActivitiesService is the service for interacting with the Activities API.
type ActivitiesService struct {
client *Client
}
// NewActivitiesService creates a new ActivitiesService.
func NewActivitiesService(client *Client) *ActivitiesService {
return &ActivitiesService{client: client}
}
// Get retrieves an activity by session and activity ID.
func (s *ActivitiesService) Get(sessionID, activityID string) (*Activity, error) {
var activity Activity
path := fmt.Sprintf("sessions/%s/activities/%s", sessionID, activityID)
_, err := s.client.get(path, &activity)
return &activity, err
}
type ListActivitiesResponse struct {
Activities []Activity `json:"activities"`
NextPageToken string `json:"nextPageToken"`
}
// List lists all activities for a session.
func (s *ActivitiesService) List(sessionID string) (*ListActivitiesResponse, error) {
var resp ListActivitiesResponse
path := fmt.Sprintf("sessions/%s/activities", sessionID)
_, err := s.client.get(path, &resp)
return &resp, err
}