apiv2

package
v1.7.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Overview

Package apiv2 provides API endpoints for the application.

Package apiv2 provides API endpoints for the application.

Package apiv2 provides API endpoints for the application.

Package apiv2 provides API endpoints for the application.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCredentials = errors.New("no credentials presented")

ErrNoCredentials means nothing was presented to authenticate with, as opposed to something presented and rejected. On endpoints serving anonymous callers the first answers normally and the second is an expired token that needs a 401 to refresh.

Functions

func MetricsHandler added in v1.7.10

func MetricsHandler() http.Handler

MetricsHandler serves the Prometheus exposition format for everything registered on the default registry, the gRPC server metrics included.

Types

type API

API is the grpc server for the v2 api. It implements all four services, which are split for grouping rather than to be deployed apart: one process, one gateway mux, one set of interceptors.

func New

func New(db *gorm.DB) *API

New creates a new API and assigns the given db and a logger

func (*API) AddBookmark

AddBookmark adds a new bookmark.

func (*API) DeleteBookmark

func (a *API) DeleteBookmark(ctx context.Context, req *protobuf.DeleteBookmarkRequest) (*emptypb.Empty, error)

DeleteBookmark deletes a bookmark.

func (*API) ExportPersonalData

func (a *API) ExportPersonalData(ctx context.Context, req *emptypb.Empty) (*protobuf.ExportPersonalDataResponse, error)

ExportPersonalData exports the personal data of the current user.

func (*API) GetBookmarks

GetBookmarks retrieves bookmarks by stream ID.

func (*API) GetCourseBySlug

GetCourseBySlug retrieves a course by its slug, year, and term.

func (*API) GetFrontendConfig added in v1.7.10

func (a *API) GetFrontendConfig(ctx context.Context, req *emptypb.Empty) (*protobuf.GetFrontendConfigResponse, error)

GetFrontendConfig returns what the frontend needs to render its shell: branding, version and footer links. Public, because the shell renders before anyone signs in. Nothing in it is per-user.

func (*API) GetLiveCourses

func (a *API) GetLiveCourses(ctx context.Context, req *emptypb.Empty) (*protobuf.GetLiveCoursesResponse, error)

GetLiveCourses retrieves the currently live courses and their streams.

func (*API) GetLoginOptions added in v1.7.10

func (a *API) GetLoginOptions(ctx context.Context, req *emptypb.Empty) (*protobuf.GetLoginOptionsResponse, error)

GetLoginOptions reports which login methods this deployment offers, so that a client can render the right controls before anyone has authenticated.

func (*API) GetNotifications

func (a *API) GetNotifications(ctx context.Context, req *emptypb.Empty) (*protobuf.GetNotificationsResponse, error)

GetNotifications retrieves notifications for the current user.

func (*API) GetPinForCourse

GetPinForCourse checks if the user has pinned the course.

func (*API) GetPinnedCourses

func (a *API) GetPinnedCourses(ctx context.Context, req *emptypb.Empty) (*protobuf.GetPinnedCoursesResponse, error)

GetPinnedCourses retrieves the pinned courses for a user.

func (*API) GetProgressBatch

GetProgressBatch returns a batch of watch progresses for a list of streams for the current user

func (*API) GetPublicCourses

GetPublicCourses retrieves the public courses for a given semester.

func (*API) GetSemesters

func (a *API) GetSemesters(ctx context.Context, req *emptypb.Empty) (*protobuf.GetSemestersResponse, error)

GetSemesters retrieves all available semesters and the current semester.

func (*API) GetServerNotifications

func (a *API) GetServerNotifications(ctx context.Context, req *emptypb.Empty) (*protobuf.GetServerNotificationsResponse, error)

GetServerNotifications retrieves current server notifications.

func (*API) GetStream

func (a *API) GetStream(ctx context.Context, req *protobuf.GetStreamRequest) (*protobuf.CourseStream, error)

GetStream returns a stream by its ID including the course and lecture hall

func (*API) GetStreamPlaylist

GetStreamPlaylist returns the playlist for a stream

func (*API) GetSubtitles

func (a *API) GetSubtitles(ctx context.Context, req *protobuf.GetSubtitlesRequest) (*httpbody.HttpBody, error)

GetSubtitles returns the subtitles for a stream in a specific language

func (*API) GetThumbs

func (a *API) GetThumbs(ctx context.Context, req *protobuf.GetThumbsRequest) (*httpbody.HttpBody, error)

GetThumbs returns the thumbnails for a stream

func (*API) GetUser

func (a *API) GetUser(ctx context.Context, req *emptypb.Empty) (*protobuf.GetUserResponse, error)

GetUser retrieves the current user based on the context. It returns a GetUserResponse or an error if one occurs.

func (*API) GetUserCourses

GetUserCourses retrieves the courses for a user for a given semester.

func (*API) GetVideoSections

GetVideoSections returns a list of video sections for a stream

func (*API) HealthCheck

func (a *API) HealthCheck(ctx context.Context, req *emptypb.Empty) (*protobuf.HealthCheckResponse, error)

HealthCheck returns ok

func (*API) PinCourse

PinCourse pins or unpins a course for the user.

func (*API) Proxy

func (a *API) Proxy() func(c *gin.Context)

Proxy returns a gin handler that proxies requests to the grpc gateway server

func (*API) ResetPassword

ResetPassword resets the password for the user with the given username.

func (*API) Run

func (a *API) Run(lis net.Listener) error

Run starts the grpc server on port 12544 and the grpc gateway on ::8081/api/v2

func (*API) UpdateBookmark

UpdateBookmark updates an existing bookmark.

func (*API) UpdateProgress

func (a *API) UpdateProgress(ctx context.Context, req *protobuf.UpdateProgressRequest) (*protobuf.StreamProgress, error)

UpdateProgress updates the watch progress for a stream

func (*API) UpdateUserSettings

UpdateUserSettings updates the profile settings for the current user.

type StreamRequest

type StreamRequest interface {
	GetStreamId() uint32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL