Documentation
¶
Index ¶
- Constants
- Variables
- func ToPtr[T any](v T) *T
- type Address
- type Announcement
- type AnnouncementAvailability
- type AnnouncementService
- func (as *AnnouncementService) DeleteAnnouncement(ctx context.Context, courseID string, announcementID string) error
- func (as *AnnouncementService) DeleteAnnouncements(ctx context.Context, courseID string) error
- func (as *AnnouncementService) GetAllAnnouncements(ctx context.Context, courseID string) ([]Announcement, error)
- func (as *AnnouncementService) GetAnnouncement(ctx context.Context, courseID string, announcementID string) (Announcement, error)
- type Avatar
- type BlackboardClient
- func (c *BlackboardClient) Delete(ctx context.Context, path string) (*http.Response, error)
- func (c *BlackboardClient) Get(ctx context.Context, path string) (*http.Response, error)
- func (c *BlackboardClient) GetRemainingCalls(ctx context.Context) (int, error)
- func (c *BlackboardClient) Patch(ctx context.Context, path string, jsonBody interface{}) (*http.Response, error)
- func (c *BlackboardClient) Post(ctx context.Context, path string, jsonBody interface{}) (*http.Response, error)
- func (c *BlackboardClient) Put(ctx context.Context, path string, jsonBody interface{}) (*http.Response, error)
- func (c *BlackboardClient) SetUserAgent(name string)
- type ColumnAvailability
- type ColumnScore
- type Contact
- type ContactUpdate
- type CopyHistory
- type Course
- type CourseAvailability
- type CourseCreateRequest
- type CourseDuration
- type CourseEnrollment
- type CourseLocale
- type CourseMembership
- type CourseService
- func (cs *CourseService) AddChildCourse(ctx context.Context, courseID string, childID string) error
- func (cs *CourseService) CopyCourseByCourseID(ctx context.Context, sourceID, destinationID string) (string, error)
- func (cs *CourseService) Create(ctx context.Context, req *CourseCreateRequest) (*Course, error)
- func (cs *CourseService) CreateMembership(ctx context.Context, username, courseID string, update EnrollmentRequest) error
- func (cs *CourseService) CreateSimple(ctx context.Context, courseID string, title string, termID string) (*Course, error)
- func (cs *CourseService) DeleteCourse(ctx context.Context, courseID string) error
- func (cs *CourseService) DoesCourseExist(ctx context.Context, courseID string) (bool, error)
- func (cs *CourseService) EnrollUserIntoCourse(ctx context.Context, courseID string, username string, role string, ...) error
- func (cs *CourseService) GetCourseByCourseId(ctx context.Context, courseID string) (*Course, error)
- func (cs *CourseService) GetCourseById(ctx context.Context, ID string) (*Course, error)
- func (cs *CourseService) GetMembershipByID(ctx context.Context, userID string, courseID string) (*CourseMembership, error)
- func (cs *CourseService) GetMembershipByUsername(ctx context.Context, username string, courseID string) (*CourseMembership, error)
- func (cs *CourseService) GetUsers(ctx context.Context, courseID string) ([]CourseUser, error)
- func (cs *CourseService) RemoveUser(ctx context.Context, courseID string, username string) error
- func (cs *CourseService) Update(ctx context.Context, courseID string, req *CourseUpdateRequest) (*Course, error)
- func (cs *CourseService) UpdateMembership(ctx context.Context, username, courseID string, update EnrollmentRequest) error
- func (cs *CourseService) UpdateMembershipAvailability(ctx context.Context, username string, courseID string, availability string) error
- type CourseUpdateRequest
- type CourseUser
- type CreateResult
- type DeleteResult
- type DiscussionService
- type Duration
- type Enrollment
- type EnrollmentRequest
- type FailedOperation
- type GradeUpdate
- type GradebookColumn
- type GradebookGrading
- type GradebookService
- func (gs *GradebookService) CreateColumn(ctx context.Context, courseID, name, description string, score float64) error
- func (gs *GradebookService) CreateColumnPro(ctx context.Context, courseID string, column GradebookColumn) error
- func (gs *GradebookService) DeleteColumn(ctx context.Context, courseID string, columnID string) error
- func (gs *GradebookService) DeleteColumns(ctx context.Context, courseID string) error
- func (gs *GradebookService) GetColumn(ctx context.Context, courseID string, columnID string) (*GradebookColumn, error)
- func (gs *GradebookService) GetColumns(ctx context.Context, courseID string) ([]GradebookColumn, error)
- func (gs *GradebookService) UpdateColumnValue(ctx context.Context, courseID string, columnID string, username string, ...) error
- type Job
- type Locale
- type MembershipAvailability
- type Name
- type NameUpdate
- type PronunciationAudio
- type Token
- type UpdateResult
- type User
- type UserAvailability
- type UserService
- func (us *UserService) AddInstitutionRoles(ctx context.Context, username string, roles []string) error
- func (us *UserService) CreateUser(ctx context.Context, username string, fName string, lName string, email string, ...) error
- func (us *UserService) Delete(ctx context.Context, username string) error
- func (s *UserService) DoesUserExist(ctx context.Context, username string) (bool, error)
- func (us *UserService) GetCourses(ctx context.Context, username string) ([]CourseEnrollment, error)
- func (us *UserService) GetUserByUsername(ctx context.Context, username string) (*User, error)
- func (us *UserService) Update(ctx context.Context, username string, update UserUpdate) error
- func (us *UserService) UpdateEmail(ctx context.Context, username, newEmail string) error
- func (us *UserService) UpdateInstitutionEmail(ctx context.Context, username, newEmail string) error
- func (us *UserService) UpdateName(ctx context.Context, username, fName, lName string) error
- func (us *UserService) UpdatePassword(ctx context.Context, username, newPassword string) error
- func (us *UserService) UpdateUserAvailability(ctx context.Context, username string, availability string) error
- type UserUpdate
Constants ¶
const ( MaxResponseSize int64 = 3 * 1024 * 1024 // 3MB AvailabilityYes string = "Yes" AvailabilityNo string = "No" AvailabilityDisabled string = "Disabled" RoleStudent string = "Student" RoleInstructor string = "Instructor" RoleTA string = "TeachingAssistant" RoleCourseBuilder string = "CourseBuilder" RoleFacilitator string = "BbFacilitator" RoleSpectator string = "BbSpectator" RoleGrader string = "Grader" RoleGuest string = "Guest" HTTPTimeoutSeconds = 10 )
Variables ¶
var ( // Client ErrEmptyStringParameter = errors.New("there is a parameter that is empty string") // User ErrUserNotFound = errors.New("user account doesn't exist") ErrUserExist = errors.New("user already exists") ErrMissingName = errors.New("missing first and last name") ErrInvalidUsername = errors.New("invalid username") // Course ErrCourseNotFound = errors.New("course doesn't exist") ErrCourseExist = errors.New("course already exists") ErrUserAlreadyEnrolled = errors.New("user already enrolled in course, use UpdateMembership() if needed") ErrInvalidRole = errors.New("invalid course role") ErrNotAuthorized = errors.New("user not authorized to do this action") ErrInsufficientPrivileges = errors.New("insufficient privileges to preform action") ErrClientInitError = errors.New("clientID, clientSecret, and baseURL are required") ErrTokenExpired = errors.New("token expired") ErrTokenMissing = errors.New("token file missing") )
Functions ¶
Types ¶
type Address ¶
type Address struct {
Street1 string `json:"street1,omitempty"`
Street2 string `json:"street2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
ZipCode string `json:"zipCode,omitempty"`
Country string `json:"country,omitempty"`
}
Address represents the address object on a Blackboard user.
type Announcement ¶
type Announcement struct {
ID string `json:"id"`
Title string `json:"title"`
Body string `json:"body"`
Draft bool `json:"draft"`
Availability AnnouncementAvailability `json:"availability"`
CreatorUserID string `json:"creatorUserId"`
Created string `json:"created"`
Modified string `json:"modified"`
Position int `json:"position"`
Creator string `json:"creator"`
}
type AnnouncementAvailability ¶
type AnnouncementAvailability struct {
Duration Duration `json:"duration"`
}
type AnnouncementService ¶
type AnnouncementService struct {
// contains filtered or unexported fields
}
AnnouncementService handles announcement operations for Blackboard courses.
func (*AnnouncementService) DeleteAnnouncement ¶
func (as *AnnouncementService) DeleteAnnouncement(ctx context.Context, courseID string, announcementID string) error
DeleteAnnouncement deletes a specific announcement by ID.
func (*AnnouncementService) DeleteAnnouncements ¶ added in v0.8.17
func (as *AnnouncementService) DeleteAnnouncements(ctx context.Context, courseID string) error
DeleteAnnouncements deletes all announcements for the given course.
func (*AnnouncementService) GetAllAnnouncements ¶
func (as *AnnouncementService) GetAllAnnouncements(ctx context.Context, courseID string) ([]Announcement, error)
GetAllAnnouncements returns all announcements from a course
func (*AnnouncementService) GetAnnouncement ¶
func (as *AnnouncementService) GetAnnouncement(ctx context.Context, courseID string, announcementID string) (Announcement, error)
GetAnnouncement returns a single announcement by its ID.
type Avatar ¶
type Avatar struct {
Source string `json:"source,omitempty"`
UploadID string `json:"uploadId,omitempty"`
ResourceID string `json:"resourceId,omitempty"`
}
Avatar represents the ___ object on a Blackboard user.
type BlackboardClient ¶
type BlackboardClient struct {
// Sub Services
// TODO: Make plural
Users *UserService
Courses *CourseService
Announcement *AnnouncementService
Gradebook *GradebookService
Discussion *DiscussionService
// contains filtered or unexported fields
}
BlackboardClient is the main client for interacting with the Blackboard REST API.
func NewClient ¶
func NewClient(clientID, clientSecret, baseURL string) (*BlackboardClient, error)
NewClient initializes and returns a new Blackboard API Client. It requires a Client ID and Client Secret obtained from the Blackboard Developer Portal.
func (*BlackboardClient) GetRemainingCalls ¶
func (c *BlackboardClient) GetRemainingCalls(ctx context.Context) (int, error)
GetRemainingCalls returns the number of apis calls left of the key. This does consume a call.
func (*BlackboardClient) SetUserAgent ¶ added in v0.8.17
func (c *BlackboardClient) SetUserAgent(name string)
SetUserAgent sets the user agent string for the client.
type ColumnAvailability ¶
type ColumnAvailability struct {
Available string `json:"available"`
}
type ColumnScore ¶
type ColumnScore struct {
Possible float64 `json:"possible"`
}
type Contact ¶
type Contact struct {
HomePhone string `json:"homePhone,omitempty"`
MobilePhone string `json:"mobilePhone,omitempty"`
BusinessPhone string `json:"businessPhone,omitempty"`
BusinessFax string `json:"businessFax,omitempty"`
Email string `json:"email,omitempty"`
InstitutionEmail string `json:"institutionEmail,omitempty"`
WebPage string `json:"webPage,omitempty"`
}
Contact represents the contact object on a Blackboard user.
type ContactUpdate ¶
type CopyHistory ¶
type CopyHistory struct {
UUID string `json:"uuid,omitempty"`
}
type Course ¶
type Course struct {
// Required for creation
CourseID string `json:"courseId"`
Name string `json:"name"`
TermID string `json:"termId"`
// Optional for creation
Description string `json:"description,omitempty"`
Availability CourseAvailability `json:"availability"`
Organization bool `json:"organization,omitempty"`
UltraStatus string `json:"ultraStatus,omitempty"`
AllowGuests bool `json:"allowGuests,omitempty"`
AllowObservers bool `json:"allowObservers"`
ClosedComplete bool `json:"closedComplete"`
Enrollment Enrollment `json:"enrollment,omitzero"`
Locale CourseLocale `json:"locale,omitzero"`
// Read-only (set by server, ignored on create)
ID string `json:"id,omitempty"`
UUID string `json:"uuid,omitempty"`
Created *time.Time `json:"created,omitempty"`
Modified *time.Time `json:"modified,omitempty"`
ExternalID string `json:"externalId,omitempty"`
DataSourceID string `json:"dataSourceId,omitempty"`
// Stuff Populated on GET'ing
HasChildren bool `json:"hasChildren,omitempty"`
ParentID string `json:"parentId,omitempty"`
ExternalAccessURL string `json:"externalAccessUrl,omitempty"`
GuestAccessURL string `json:"guestAccessUrl,omitempty"`
CopyHistory []CopyHistory `json:"copyHistory"`
IsChild bool `json:"-"`
}
type CourseAvailability ¶
type CourseAvailability struct {
Available string `json:"available"`
Duration CourseDuration `json:"duration,omitzero"`
}
type CourseCreateRequest ¶
type CourseCreateRequest struct {
Name *string `json:"name"`
CourseID *string `json:"courseId"`
TermID *string `json:"termId,omitempty"`
Availability *CourseAvailability `json:"availability,omitempty"`
DataSourceID *string `json:"dataSourceId,omitempty"`
Description *string `json:"description,omitempty"`
}
type CourseDuration ¶
type CourseEnrollment ¶
type CourseLocale ¶
type CourseMembership ¶
type CourseMembership struct {
ID string `json:"id,omitempty"`
ChildCourseID *string `json:"childCourseId,omitempty"`
UserID string `json:"userId,omitempty"`
CourseID string `json:"courseId,omitempty"`
DataSourceID string `json:"dataSourceId,omitempty"`
Created time.Time `json:"created,omitempty"`
Modified time.Time `json:"modified,omitempty"`
CourseRoleID *string `json:"courseRoleId"`
Availability *MembershipAvailability `json:"availability,omitempty"`
User *User `json:"user,omitempty"`
}
type CourseService ¶
type CourseService struct {
// contains filtered or unexported fields
}
CourseService provides methods for interacting with Blackboard courses.
func (*CourseService) AddChildCourse ¶
func (*CourseService) CopyCourseByCourseID ¶
func (cs *CourseService) CopyCourseByCourseID(ctx context.Context, sourceID, destinationID string) (string, error)
TODO: Rename parameters
func (*CourseService) Create ¶
func (cs *CourseService) Create(ctx context.Context, req *CourseCreateRequest) (*Course, error)
Create creates a course using the provided request, allowing full control over fields.
func (*CourseService) CreateMembership ¶
func (cs *CourseService) CreateMembership(ctx context.Context, username, courseID string, update EnrollmentRequest) error
func (*CourseService) CreateSimple ¶ added in v0.8.17
func (cs *CourseService) CreateSimple(ctx context.Context, courseID string, title string, termID string) (*Course, error)
CreateSimple creates a course using only the required fields.
func (*CourseService) DeleteCourse ¶
func (cs *CourseService) DeleteCourse(ctx context.Context, courseID string) error
Tested 11/4/25
func (*CourseService) DoesCourseExist ¶
DoesCourseExist checks if course exists.
func (*CourseService) EnrollUserIntoCourse ¶
func (cs *CourseService) EnrollUserIntoCourse(ctx context.Context, courseID string, username string, role string, availability string) error
EnrollUserIntoCourse is a wrapper function that calls CreateMembership.
func (*CourseService) GetCourseByCourseId ¶
func (*CourseService) GetCourseById ¶
func (*CourseService) GetMembershipByID ¶
func (cs *CourseService) GetMembershipByID(ctx context.Context, userID string, courseID string) (*CourseMembership, error)
func (*CourseService) GetMembershipByUsername ¶
func (cs *CourseService) GetMembershipByUsername(ctx context.Context, username string, courseID string) (*CourseMembership, error)
func (*CourseService) GetUsers ¶
func (cs *CourseService) GetUsers(ctx context.Context, courseID string) ([]CourseUser, error)
func (*CourseService) RemoveUser ¶
RemoveUser will remove a user from a course.
func (*CourseService) Update ¶
func (cs *CourseService) Update(ctx context.Context, courseID string, req *CourseUpdateRequest) (*Course, error)
func (*CourseService) UpdateMembership ¶
func (cs *CourseService) UpdateMembership(ctx context.Context, username, courseID string, update EnrollmentRequest) error
func (*CourseService) UpdateMembershipAvailability ¶
type CourseUpdateRequest ¶
type CourseUpdateRequest struct {
Name *string `json:"name,omitempty"`
TermID *string `json:"termId,omitempty"`
Availability *CourseAvailability `json:"availability,omitempty"`
DataSourceID *string `json:"dataSourceId,omitempty"`
Description *string `json:"description,omitempty"`
}
type CourseUser ¶
type CreateResult ¶
type CreateResult struct {
Created []string
Failed []FailedOperation
}
func (CreateResult) Error ¶
func (r CreateResult) Error() string
func (CreateResult) HasErrors ¶
func (r CreateResult) HasErrors() bool
func (CreateResult) Summary ¶
func (r CreateResult) Summary() string
type DeleteResult ¶
type DeleteResult struct {
Deleted []string
Failed []FailedOperation
}
func (DeleteResult) Error ¶
func (r DeleteResult) Error() string
func (DeleteResult) HasErrors ¶
func (r DeleteResult) HasErrors() bool
func (DeleteResult) Summary ¶
func (r DeleteResult) Summary() string
type DiscussionService ¶
type DiscussionService struct {
// contains filtered or unexported fields
}
DiscussionService handles discussions operations for Blackboard courses.
func (*DiscussionService) DeleteStudentReplies ¶
func (d *DiscussionService) DeleteStudentReplies(ctx context.Context, courseID string) (DeleteResult, error)
ClearDiscussionStudentReplies deletes all posts where author is a student.
type Enrollment ¶
type EnrollmentRequest ¶
type EnrollmentRequest struct {
ChildCourseID *string `json:"childCourseId,omitempty"`
DataSourceID *string `json:"dataSourceId,omitempty"`
Availability *MembershipAvailability `json:"availability,omitempty"`
CourseRoleID *string `json:"courseRoleId,omitempty"`
DisplayOrder *int `json:"displayOrder,omitempty"`
}
type FailedOperation ¶
type GradeUpdate ¶ added in v0.8.17
type GradebookColumn ¶
type GradebookColumn struct {
ID string `json:"id,omitempty"`
ExternalID string `json:"externalId,omitempty"`
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
Created string `json:"created,omitempty"`
Modified string `json:"modified,omitempty"`
Score ColumnScore `json:"score,omitzero"`
Availability ColumnAvailability `json:"availability,omitzero"`
Grading GradebookGrading `json:"grading,omitzero"`
IncludeInCalculations bool `json:"includeInCalculations,omitempty"`
ShowStatisticsToStudents bool `json:"showStatisticsToStudents,omitempty"`
}
type GradebookGrading ¶
type GradebookService ¶
type GradebookService struct {
// contains filtered or unexported fields
}
GradebookService handles gradebook operations for Blackboard courses.
func (*GradebookService) CreateColumn ¶
func (*GradebookService) CreateColumnPro ¶
func (gs *GradebookService) CreateColumnPro(ctx context.Context, courseID string, column GradebookColumn) error
func (*GradebookService) DeleteColumn ¶
func (*GradebookService) DeleteColumns ¶
func (gs *GradebookService) DeleteColumns(ctx context.Context, courseID string) error
func (*GradebookService) GetColumn ¶
func (gs *GradebookService) GetColumn(ctx context.Context, courseID string, columnID string) (*GradebookColumn, error)
func (*GradebookService) GetColumns ¶
func (gs *GradebookService) GetColumns(ctx context.Context, courseID string) ([]GradebookColumn, error)
func (*GradebookService) UpdateColumnValue ¶
func (gs *GradebookService) UpdateColumnValue(ctx context.Context, courseID string, columnID string, username string, update GradeUpdate) error
type Job ¶
type Job struct {
Title string `json:"title,omitempty"`
Department string `json:"department,omitempty"`
Company string `json:"company,omitempty"`
}
Job represents the job object on a Blackboard user.
type Locale ¶
type Locale struct {
ID string `json:"id,omitempty"`
Calendar *string `json:"calendar,omitempty"`
FirstDayOfWeek *string `json:"firstDayOfWeek,omitempty"`
}
Locale represents the local object on a Blackboard user.
type MembershipAvailability ¶
type MembershipAvailability struct {
Available *string `json:"available,omitempty"`
}
type Name ¶
type Name struct {
Given string `json:"given,omitempty"`
Family string `json:"family,omitempty"`
Middle string `json:"middle,omitempty"`
Other string `json:"other,omitempty"`
Suffix string `json:"suffix,omitempty"`
Title string `json:"title,omitempty"`
PreferredDisplayName string `json:"preferredDisplayName,omitempty"`
}
Name represents the name object on a Blackboard user.
type NameUpdate ¶
type PronunciationAudio ¶
type PronunciationAudio struct {
UploadID string `json:"uploadId,omitempty"`
}
PronunciationAudio represents the ___ object on a Blackboard user.
type Token ¶
type UpdateResult ¶
type UpdateResult struct {
Updated []string
Failed []FailedOperation
}
func (UpdateResult) Error ¶
func (r UpdateResult) Error() string
func (UpdateResult) HasErrors ¶
func (r UpdateResult) HasErrors() bool
func (UpdateResult) Summary ¶
func (r UpdateResult) Summary() string
type User ¶
type User struct {
ID string `json:"id,omitempty"`
UUID string `json:"uuid,omitempty"`
ExternalID string `json:"externalId,omitempty"`
DataSourceID string `json:"dataSourceId,omitempty"`
UserName string `json:"userName"`
StudentID string `json:"studentId,omitempty"`
Password string `json:"password,omitempty"`
EducationLevel string `json:"educationLevel,omitempty"`
Gender string `json:"gender,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
BirthDate *time.Time `json:"birthDate,omitempty"`
InstitutionRoleIDs []string `json:"institutionRoleIds"`
SystemRoleIDs []string `json:"systemRoleIds,omitempty"`
Availability UserAvailability `json:"availability,omitzero"`
Name Name `json:"name,omitzero"`
Job Job `json:"job,omitzero"`
Contact Contact `json:"contact,omitzero"`
Address Address `json:"address,omitzero"`
Locale Locale `json:"locale,omitzero"`
Avatar Avatar `json:"avatar,omitzero"`
Pronunciation string `json:"pronunciation,omitempty"`
PronunciationAudio PronunciationAudio `json:"pronunciationAudio,omitzero"`
}
User represents a Blackboard user.
func (*User) FullNameLastFirst ¶ added in v0.8.17
GetNameLastFirst returns users full name (last name first).
type UserAvailability ¶
type UserAvailability struct {
Available string `json:"available"`
}
UserAvailability represents the available object on a Blackboard user.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService provides methods for interacting with Blackboard users.
func (*UserService) AddInstitutionRoles ¶
func (*UserService) CreateUser ¶
func (*UserService) Delete ¶
func (us *UserService) Delete(ctx context.Context, username string) error
func (*UserService) DoesUserExist ¶
DoesUserExist checks if the user exist, but this may not be needed. Since most functions interacting with uses will return a 409 if user is not there.
func (*UserService) GetCourses ¶
func (us *UserService) GetCourses(ctx context.Context, username string) ([]CourseEnrollment, error)
func (*UserService) GetUserByUsername ¶
GetUserObject fetches user data and maps to User struct
func (*UserService) Update ¶
func (us *UserService) Update(ctx context.Context, username string, update UserUpdate) error
func (*UserService) UpdateEmail ¶
func (us *UserService) UpdateEmail(ctx context.Context, username, newEmail string) error
func (*UserService) UpdateInstitutionEmail ¶
func (us *UserService) UpdateInstitutionEmail(ctx context.Context, username, newEmail string) error
func (*UserService) UpdateName ¶
func (us *UserService) UpdateName(ctx context.Context, username, fName, lName string) error
func (*UserService) UpdatePassword ¶
func (us *UserService) UpdatePassword(ctx context.Context, username, newPassword string) error
func (*UserService) UpdateUserAvailability ¶
type UserUpdate ¶
type UserUpdate struct {
Contact *ContactUpdate `json:"contact,omitempty"`
Name *NameUpdate `json:"name,omitempty"`
Password *string `json:"password,omitempty"`
InstitutionRoleIDs []string `json:"institutionRoleIds,omitempty"`
Availability *UserAvailability `json:"availability,omitempty"`
}