Files
CanvasArchiver/internal/models/models.go
Joren 666369714b feat: add --api flag for Canvas API token authentication
- Add APIToken field to Credentials struct with omitempty JSON tag
- Implement GetAPIToken() method with persistent token storage
- Add SaveRefreshToken() helper to preserve API tokens during OAuth
- Implement --api CLI flag to use API token instead of OAuth
- Validate empty refresh tokens and skip refresh if invalid
- Update README with API token usage documentation
2026-06-19 21:12:43 +02:00

43 lines
946 B
Go

package models
type Credentials struct {
RefreshToken string `json:"refresh_token,omitempty"`
APIToken string `json:"api_token,omitempty"`
}
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
type Course struct {
ID int `json:"id"`
Name string `json:"name"`
}
type Folder struct {
ID int `json:"id"`
FullName string `json:"full_name"`
}
type File struct {
DisplayName string `json:"display_name"`
URL string `json:"url"`
FolderID int `json:"folder_id"`
}
type Module struct {
Name string `json:"name"`
Items []ModuleItem `json:"items"`
}
type ModuleItem struct {
Title string `json:"title"`
Type string `json:"type"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
ExternalURL string `json:"external_url"`
ContentID int `json:"content_id"`
Indent int `json:"indent"`
}