Documentation ¶
Index ¶
- Constants
- func GetNextToken(offset int, limit int, total int, pagingRequestId string) string
- func ParsePaginationToken(pToken *pagination.Token) (int, int, string, error)
- func WithBearerToken(token string) uhttp.RequestOption
- type AICCLaunch
- type ApprovalManager
- type Associations
- type Channel
- type Characteristics
- type Client
- func (c *Client) GenerateLearningActivityReport(ctx context.Context) (*v2.RateLimitDescription, error)
- func (c *Client) GetCourses(ctx context.Context, offset int, limit int, pagingRequestId string) ([]Course, string, int, *v2.RateLimitDescription, error)
- func (c *Client) GetLearningActivityReport(ctx context.Context) (*v2.RateLimitDescription, error)
- func (c *Client) GetUsers(ctx context.Context, offset int, limit int) ([]User, int, *v2.RateLimitDescription, error)
- type ContentType
- type Course
- type Credentials
- type CustomAttribute
- type Journey
- type Lifecycle
- type LocalizedChannel
- type LocalizedMetadata
- type Pagination
- type Parent
- type ProviderSpecificAttributes
- type Publication
- type Report
- type ReportConfigurations
- type ReportCsvPreferences
- type ReportEntry
- type ReportSort
- type ReportStatus
- type Skill
- type StatusesStore
- type Technology
- type User
Constants ¶
const ( ApiPathCoursesList = "/content-discovery/v2/organizations/%s/catalog-content" ApiPathLearningActivityReport = "/reporting/v1/organizations/%s/report-requests/learning-activity" ApiPathReport = "/reporting/v1/organizations/%s/report-requests/%s" ApiPathUsersList = "/user-management/v1/organizations/%s/users" BaseApiUrl = "https://api.percipio.com" HeaderNamePagingRequestId = "x-paging-request-id" HeaderNameTotalCount = "x-total-count" PageSizeDefault = 1000 ReportLookBackDefault = 10 * time.Hour * 24 * 365 // 10 years )
Variables ¶
This section is empty.
Functions ¶
func GetNextToken ¶
GetNextToken given a limit, offset, and `pagingRequestId` that were used to fetch _this_ page of data, and total number of resources, return the next pagination token as a string.
func ParsePaginationToken ¶
ParsePaginationToken - takes as pagination token and returns offset, limit, and `pagingRequestId` in that order.
func WithBearerToken ¶
func WithBearerToken(token string) uhttp.RequestOption
WithBearerToken - TODO(marcos): move this function to `baton-sdk`.
Types ¶
type AICCLaunch ¶
type ApprovalManager ¶
type Associations ¶
type Associations struct { Areas []string `json:"areas"` Subjects []string `json:"subjects"` Channels []Channel `json:"channels"` LocalizedChannels []LocalizedChannel `json:"localizedChannels"` LicensedLocales string `json:"licensedLocales"` Skills []Skill `json:"skills"` Journeys []Journey `json:"journeys"` Parent Parent `json:"parent"` TranslationGroupId string `json:"translationGroupId"` }
type Characteristics ¶
type Client ¶
type Client struct { StatusesStore StatusesStore ReportStatus ReportStatus // contains filtered or unexported fields }
func (*Client) GenerateLearningActivityReport ¶
func (c *Client) GenerateLearningActivityReport( ctx context.Context, ) ( *v2.RateLimitDescription, error, )
GenerateLearningActivityReport makes a post request to the API asking it to start generating a report. We'll need to then poll a _different_ endpoint to get the actual report data.
func (*Client) GetCourses ¶
func (c *Client) GetCourses( ctx context.Context, offset int, limit int, pagingRequestId string, ) ( []Course, string, int, *v2.RateLimitDescription, error, )
GetCourses Given a limit/offset and a pagination token (see below), fetch a page's worth of course data. Returns _five_ values:
- the list of courses
- the "pagination token", required to get any page but the first.
- the total number of courses, so that we don't have to fetch an extra page to confirm there are no more courses.
- rate limit data read from headers.
- any error
func (*Client) GetLearningActivityReport ¶
type ContentType ¶
type Course ¶
type Course struct { AICCLaunch AICCLaunch `json:"aiccLaunch"` AlternateImageUrl string `json:"alternateImageUrl"` Associations Associations `json:"associations"` By []string `json:"by"` Characteristics Characteristics `json:"characteristics"` Code string `json:"code"` ContentType ContentType `json:"contentType"` Credentials Credentials `json:"credentials"` Duration string `json:"duration"` ExpertiseLevels []string `json:"expertiseLevels"` Id string `json:"id"` ImageUrl string `json:"imageUrl"` Keywords []string `json:"keywords"` LearningObjectives []string `json:"learningObjectives"` Lifecycle Lifecycle `json:"lifecycle"` Link string `json:"link"` LocaleCodes []string `json:"localeCodes"` LocalizedMetadata []LocalizedMetadata `json:"localizedMetadata"` Modalities []string `json:"modalities"` ProviderSpecificAttributes ProviderSpecificAttributes `json:"providerSpecificAttributes"` Publication Publication `json:"publication"` Technologies []Technology `json:"technologies"` XApiActivityId string `json:"xapiActivityId"` XApiActivityTypeId string `json:"xapiActivityTypeId"` }
type Credentials ¶
type Credentials struct { // Continuing Professional Education credits. Possible values include 1.5. CpeCredits float64 `json:"cpeCredits"` // National Association of State Boards of Accountancy. Seems like a CPA thing. NasbaReady bool `json:"nasbaReady"` // Professional Development Unit credits. Possible values include 0.75. PduCredits float64 `json:"pduCredits"` }
type CustomAttribute ¶
type Lifecycle ¶
type Lifecycle struct { IncludedFromActivity bool `json:"includedFromActivity"` LastUpdatedDate time.Time `json:"lastUpdatedDate"` PlannedRetirementDate time.Time `json:"plannedRetirementDate"` PublishDate time.Time `json:"publishDate"` RetiredDate time.Time `json:"retiredDate"` Status string `json:"status"` }
type LocalizedChannel ¶
type LocalizedMetadata ¶
type Pagination ¶
type Publication ¶
type Report ¶
type Report []ReportEntry
type ReportConfigurations ¶
type ReportConfigurations struct { Audience string `json:"audience,omitempty"` ContentType string `json:"contentType,omitempty"` CsvPreferences ReportCsvPreferences `json:"csvPreferences,omitempty"` Encrypt bool `json:"encrypt,omitempty"` End time.Time `json:"end,omitempty"` FileMask string `json:"fileMask,omitempty"` FolderName string `json:"folderName,omitempty"` FormatType string `json:"formatType,omitempty"` IncludeMillisInFilename bool `json:"includeMillisInFilename,omitempty"` IsFileRequiredInSftp bool `json:"isFileRequiredInSftp,omitempty"` IsPgpFileExtnNotReqrd bool `json:"isPgpFileExtnNotReqrd,omitempty"` Locale string `json:"locale,omitempty"` Mapping string `json:"mapping,omitempty"` Plugin string `json:"plugin,omitempty"` SftpId string `json:"sftpId,omitempty"` Sort ReportSort `json:"sort,omitempty"` Start time.Time `json:"start,omitempty"` Status string `json:"status,omitempty"` Template string `json:"template,omitempty"` TimeFrame string `json:"timeFrame,omitempty"` TransformName string `json:"transformName,omitempty"` Zip bool `json:"zip,omitempty"` }
type ReportCsvPreferences ¶
type ReportEntry ¶
type ReportEntry struct { Audience string `json:"audience"` BusinessUnit string `json:"businessUnit"` CompletedDate time.Time `json:"completedDate"` ContentTitle string `json:"contentTitle"` ContentType string `json:"contentType"` ContentUUID string `json:"contentUuid"` CostCenterCode string `json:"costCenterCode"` CountryName string `json:"countryName"` DepartmentCode string `json:"departmentCode"` DepartmentOwner string `json:"departmentOwner"` DeptName string `json:"deptName"` DirectManagerName string `json:"directManagerName"` Division string `json:"division"` DivisionCode string `json:"divisionCode"` DivisionOwner string `json:"divisonOwner"` // [SIC] DurationHms string `json:"durationHms"` EmailAddress string `json:"emailAddress"` EmployeeClass string `json:"employeeClass"` EmployeeId string `json:"employeeId"` EstimatedDurationHms string `json:"estimatedDurationHms"` FirstAccess time.Time `json:"firstAccess"` FirstName string `json:"firstName"` Geo string `json:"geo"` HireDate string `json:"hireDate"` HrbpOwner string `json:"hrbpOwner"` IsAManager string `json:"isAManager"` LanguageCode string `json:"languageCode"` LastName string `json:"lastName"` ManagerEmail string `json:"managerEmail"` ManagerId string `json:"managerId"` Status string `json:"status"` UserId string `json:"userId"` UserStatus string `json:"userStatus"` UserUUID string `json:"userUuid"` }
type ReportSort ¶
type ReportStatus ¶
type StatusesStore ¶
func (StatusesStore) Get ¶
func (r StatusesStore) Get(courseId string) map[string]string
Get - return a mapping of user IDs to course completion status. TODO(marcos) Should we use enums instead?
func (StatusesStore) Load ¶
func (r StatusesStore) Load(report *Report) error
Load given a Report (which again, can be on the order of 1 GB), and just create a mapping of course IDs to a mapping of user IDs to statuses. e.g.:
{ "00000000-0000-0000-0000-000000000000": { "00000000-0000-0000-0000-000000000001": "in_progress", "00000000-0000-0000-0000-000000000002": "completed", }, }
type Technology ¶
type User ¶
type User struct { Id string `json:"id"` ApprovalManager ApprovalManager `json:"approvalManager"` CustomAttributes []CustomAttribute `json:"customAttributes"` Email string `json:"email"` ExternalUserId string `json:"externalUserId"` FirstName string `json:"firstName"` HasCoaching bool `json:"hasCoaching"` HasEnterpriseCoaching bool `json:"hasEnterpriseCoaching"` HasEnterpriseCoachingDashboard bool `json:"hasEnterpriseCoachingDashboard"` IsActive bool `json:"isActive"` IsInstructor bool `json:"isInstructor"` JobTitle string `json:"jobTitle"` LastName string `json:"lastName"` LoginName string `json:"loginName"` Role string `json:"role"` UpdatedAt string `json:"updatedAt"` }