Files
reforger_crawler_main/models/apiModels.go
T
ilbinek 0ef27b0072
Cross Compile Go / build (push) Has been cancelled
dependents size fix
2026-08-10 14:15:00 +02:00

95 lines
3.5 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 one page of the addons that depend on a given addon.
// Total is the full number of matches, not the length of this page.
type DependentsResponse struct {
AddonID string `json:"addonId"`
Dependents []AddonSearchResult `json:"dependents"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
// DependenciesResponse lists one page of the addons a given addon depends on.
// Total is the full number of matches, not the length of this page.
type DependenciesResponse struct {
AddonID string `json:"addonId"`
Dependencies []AddonSearchResult `json:"dependencies"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
// SearchResponse contains the search results
type SearchResponse struct {
Query string `json:"query"`
Results []AddonSearchResult `json:"results"`
Total int `json:"total"`
}