Skip to content

Commit

Permalink
Included Admin Audit Events
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogarin committed Feb 23, 2021
1 parent cd35dc8 commit 9edb3c9
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 39 deletions.
77 changes: 77 additions & 0 deletions sdk/admin_audit_events_api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package webexteams

import (
"github.com/go-resty/resty/v2"
"github.com/google/go-querystring/query"
)

// AdminAuditEventsService is the service to communicate with the AdminAuditEvents API endpoint
type AdminAuditEventsService service

// AuditEvents is the AuditEvents definition
type AuditEvents struct {
Items []struct {
Created string `json:"created,omitempty"` // The date and time the event took place.
ActorOrgID string `json:"actorOrgId,omitempty"` // The orgId of the person who made the change.
ID string `json:"id,omitempty"` // A unique identifier for the event.
ActorID string `json:"actorId,omitempty"` // The personId of the person who made the change.
Data struct {
ActorOrgName string `json:"actorOrgName,omitempty"` // The display name of the organization.
TargetName string `json:"targetName,omitempty"` // The name of the resource being acted upon.
EventDescription string `json:"eventDescription,omitempty"` // A description for the event.
ActorName string `json:"actorName,omitempty"` // The name of the person who performed the action.
ActorEmail string `json:"actorEmail,omitempty"` // The email of the person who performed the action.
AdminRoles []string `json:"adminRoles,omitempty"` // Admin roles for the person.
TrackingID string `json:"trackingId,omitempty"` // A tracking identifier for the event.
TargetType string `json:"targetType,omitempty"` // The type of resource changed by the event.
TargetID string `json:"targetId,omitempty"` // The identifier for the resource changed by the event.
EventCategory string `json:"eventCategory,omitempty"` // The category of resource changed by the event.
ActorUserAgent string `json:"actorUserAgent,omitempty"` // The browser user agent of the person who performed the action.
ActorIP string `json:"actorIp,omitempty"` // The IP address of the person who performed the action.
TargetOrgID string `json:"targetOrgId,omitempty"` // The orgId of the organization.
ActionText string `json:"actionText,omitempty"` // A more detailed description of the change made by the person.
TargetOrgName string `json:"targetOrgName,omitempty"` // The name of the organization being acted upon.
} `json:"data,omitempty"` // data
} `json:"items,omitempty"` // items
}

// ListAdminAuditEventsQueryParams defines the query parameters for this request
type ListAdminAuditEventsQueryParams struct {
OrgID string `url:"orgId,omitempty"` // List events in this organization, by ID
From string `url:"from,omitempty"` // List events which occurred after a specific date and tim
To string `url:"to,omitempty"` // List events which occurred before a specific date and time
ActorID string `url:"actorId,omitempty"` // List events performed by this person, by ID
Max int `url:"max,omitempty"` // Limit the maximum number of events in the response. The maximum value is 200 Default: 100
Offset int `url:"offset,omitempty"` // Offset from the first result that you want to fetch. Default: 0
}

// ListAdminAuditEvents List Admin Audit Events
/* List admin audit events in your organization. Several query parameters are available to filter the response.
@param orgId List events in this organization, by ID
@param from List events which occurred after a specific date and tim
@param to List events which occurred before a specific date and time
@param actorId List events performed by this person, by ID
@param max Limit the maximum number of events in the response. The maximum value is 200 Default: 100
@param offset Offset from the first result that you want to fetch. Default: 0
*/
func (s *AdminAuditEventsService) ListAdminAuditEvents(listAdminAuditEventsQueryParams *ListAdminAuditEventsQueryParams) (*AuditEvents, *resty.Response, error) {

path := "/adminAudit/events"

queryString, _ := query.Values(listAdminAuditEventsQueryParams)

response, err := RestyClient.R().
SetQueryString(queryString.Encode()).
SetResult(&AuditEvents{}).
SetError(&Error{}).
Get(path)

if err != nil {
return nil, nil, err
}

result := response.Result().(*AuditEvents)
return result, response, err

}
30 changes: 16 additions & 14 deletions sdk/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ type Client struct {
common service // Reuse a single struct instead of allocating one for each service on the heap.

// API Services
Contents *ContentsService
Events *EventsService
Devices *DevicesService
Licenses *LicensesService
Memberships *MembershipsService
Messages *MessagesService
Organizations *OrganizationsService
People *PeopleService
Recordings *RecordingsService
Roles *RolesService
Rooms *RoomsService
TeamMemberships *TeamMembershipsService
Teams *TeamsService
Webhooks *WebhooksService
AdminAuditEvents *AdminAuditEventsService
Contents *ContentsService
Events *EventsService
Devices *DevicesService
Licenses *LicensesService
Memberships *MembershipsService
Messages *MessagesService
Organizations *OrganizationsService
People *PeopleService
Recordings *RecordingsService
Roles *RolesService
Rooms *RoomsService
TeamMemberships *TeamMembershipsService
Teams *TeamsService
Webhooks *WebhooksService
}

type service struct {
Expand All @@ -54,6 +55,7 @@ func NewClient() *Client {
}

// API Services
c.AdminAuditEvents = (*AdminAuditEventsService)(&c.common)
c.Contents = (*ContentsService)(&c.common)
c.Events = (*EventsService)(&c.common)
c.Devices = (*DevicesService)(&c.common)
Expand Down
51 changes: 26 additions & 25 deletions sdk/messages_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,40 @@ import (
// MessagesService is the service to communicate with the Messages API endpoint
type MessagesService service

// Attachment is the object to manage attachments in messages
type Attachment struct {
Content map[string]interface{} `json:"content"`
ContentType string `json:"contentType"`

Content map[string]interface{} `json:"content"`
ContentType string `json:"contentType"`
}

// MessageCreateRequest is the Create Message Request Parameters
type MessageCreateRequest struct {
RoomID string `json:"roomId,omitempty"` // Room ID.
ToPersonID string `json:"toPersonId,omitempty"` // Person ID (for type=direct).
ToPersonEmail string `json:"toPersonEmail,omitempty"` // Person email (for type=direct).
Text string `json:"text,omitempty"` // Message in plain text format.
Markdown string `json:"markdown,omitempty"` // Message in markdown format.
Files []string `json:"files,omitempty"` // File URL array.
Attachments []Attachment `json:"attachments,omitempty"` //Attachment Array
RoomID string `json:"roomId,omitempty"` // Room ID.
ToPersonID string `json:"toPersonId,omitempty"` // Person ID (for type=direct).
ToPersonEmail string `json:"toPersonEmail,omitempty"` // Person email (for type=direct).
Text string `json:"text,omitempty"` // Message in plain text format.
Markdown string `json:"markdown,omitempty"` // Message in markdown format.
Files []string `json:"files,omitempty"` // File URL array.
Attachments []Attachment `json:"attachments,omitempty"` //Attachment Array
}

// Message is the Message definition
type Message struct {
ID string `json:"id,omitempty"` // Message ID.
RoomID string `json:"roomId,omitempty"` // Room ID.
RoomType string `json:"roomType,omitempty"` // Room type (group or direct).
ToPersonID string `json:"toPersonId,omitempty"` // Person ID (for type=direct).
ToPersonEmail string `json:"toPersonEmail,omitempty"` // Person email (for type=direct).
Text string `json:"text,omitempty"` // Message in plain text format.
Markdown string `json:"markdown,omitempty"` // Message in markdown format.
HTML string `json:"html,omitempty"` // Message in HTML format.
Files []string `json:"files,omitempty"` // File URL array.
PersonID string `json:"personId,omitempty"` // Person ID.
PersonEmail string `json:"personEmail,omitempty"` // Person Email.
Created time.Time `json:"created,omitempty"` // Message creation date/time.
MentionedPeople []string `json:"mentionedPeople,omitempty"` // Person ID array.
MentionedGroups []string `json:"mentionedGroups,omitempty"` // Groups array.
Attachments []Attachment `json:"attachments,omitempty"` // Attachment array
ID string `json:"id,omitempty"` // Message ID.
RoomID string `json:"roomId,omitempty"` // Room ID.
RoomType string `json:"roomType,omitempty"` // Room type (group or direct).
ToPersonID string `json:"toPersonId,omitempty"` // Person ID (for type=direct).
ToPersonEmail string `json:"toPersonEmail,omitempty"` // Person email (for type=direct).
Text string `json:"text,omitempty"` // Message in plain text format.
Markdown string `json:"markdown,omitempty"` // Message in markdown format.
HTML string `json:"html,omitempty"` // Message in HTML format.
Files []string `json:"files,omitempty"` // File URL array.
PersonID string `json:"personId,omitempty"` // Person ID.
PersonEmail string `json:"personEmail,omitempty"` // Person Email.
Created time.Time `json:"created,omitempty"` // Message creation date/time.
MentionedPeople []string `json:"mentionedPeople,omitempty"` // Person ID array.
MentionedGroups []string `json:"mentionedGroups,omitempty"` // Groups array.
Attachments []Attachment `json:"attachments,omitempty"` // Attachment array
}

// Messages is the List of Messages
Expand Down

0 comments on commit 9edb3c9

Please sign in to comment.