Files
reforger_crawler_main/models/apiModels.go
ilbinek 0d07148db6
Some checks failed
Cross Compile Go / build (push) Has been cancelled
dependencies added
2026-07-09 14:41:50 +02:00

89 lines
3.2 KiB
Go

package models
// SimplifiedAddon contains only essential addon information for API responses
type SimplifiedAddon struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Summary string `json:"summary"`
SubscriberCount int `json:"subscriberCount"`
CurrentVersionNumber string `json:"currentVersionNumber"`
Preview string `json:"preview"`
Author string `json:"author"`
AddonFiles []SimplifiedAddonFile `json:"addonFiles"`
}
// SimplifiedAddonFile contains only essential addon file information for API responses
type SimplifiedAddonFile struct {
Path string `json:"path"`
Hash string `json:"hash"`
Version string `json:"version"`
AddonID string `json:"addonId"`
}
// DuplicateFileInfo holds information about a duplicate file
type DuplicateFileInfo struct {
Path string `json:"path"`
Hash string `json:"hash"`
Version string `json:"version"`
AddonID string `json:"addonId"`
}
// AddonWithDuplicates holds addon information and its duplicate files
type AddonWithDuplicates struct {
Addon SimplifiedAddon `json:"addon"`
Duplicates []DuplicateFileInfo `json:"duplicates"`
}
// DuplicatesResponse is the main response structure
type DuplicatesResponse struct {
SourceAddon SimplifiedAddon `json:"sourceAddon"`
DuplicateAddons map[string]AddonWithDuplicates `json:"duplicateAddons"`
}
// AddonSearchResult contains minimal addon information for search results
type AddonSearchResult struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Summary string `json:"summary"`
Preview string `json:"preview"`
SubscriberCount int `json:"subscriberCount"`
CurrentVersionNumber string `json:"currentVersionNumber"`
Author string `json:"author"`
}
// DependencyReportItem is one dependency entry reported by the scraper
type DependencyReportItem struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
}
// DependencyReport is the scraper payload that replaces all edges for an addon
type DependencyReport struct {
AddonID string `json:"addonId"`
Dependencies []DependencyReportItem `json:"dependencies"`
}
// DependentsResponse lists the addons that depend on a given addon
type DependentsResponse struct {
AddonID string `json:"addonId"`
Dependents []AddonSearchResult `json:"dependents"`
Total int `json:"total"`
}
// DependenciesResponse lists the addons a given addon depends on
type DependenciesResponse struct {
AddonID string `json:"addonId"`
Dependencies []AddonSearchResult `json:"dependencies"`
Total int `json:"total"`
}
// SearchResponse contains the search results
type SearchResponse struct {
Query string `json:"query"`
Results []AddonSearchResult `json:"results"`
Total int `json:"total"`
}