Documentation
¶
Index ¶
- Constants
- Variables
- func DoHTTPRequest(url string) (*http.Response, error)
- func GetAddonDatabaseTimestamp() (string, error)
- func GetAuthenticatedReponse(method, token, url string, b []byte) (*http.Response, error)
- func GetByteArrayHash(bytes []byte) int
- func GetFileHash(file string) (int, error)
- func GetHTTPResponse(method, url string, b []byte) (*http.Response, error)
- func ReadTokenFromDisk()
- func ResponseToBytes(response *http.Response) []byte
- func ResponseToString(response *http.Response) string
- func SetOAuth(token string)
- func WriteBytesToFile(data []byte, file string) error
- type Addon
- type AddonAttachments
- type AddonAuthors
- type AddonCategories
- type AddonCategorySection
- type AddonDependency
- type AddonGameVersion
- type AddonLatestFile
- type AddonModules
- type AuthSession
- type AuthenticationResponse
- type File
- type FingerprintList
- type FingerprintMatch
- type Login
- type Register
- type RenewTokenResponseContract
- type TwitchOAuthRequest
- type TwitchOAuthResponse
Constants ¶
const (
//APIEndpoint URL of API
APIEndpoint = "https://addons-ecs.forgesvc.net/api/v2/"
)
Variables ¶
var ( //OAuthToken - Twitch oauth's token OAuthToken string //WriteSession - Unknown WriteSession = false )
var ( //EMPTY Empty req data EMPTY []byte )
Functions ¶
func DoHTTPRequest ¶
DoHTTPRequest does a basic http request
func GetAddonDatabaseTimestamp ¶
GetAddonDatabaseTimestamp Gets last update of addon DB
func GetAuthenticatedReponse ¶
GetAuthenticatedReponse wraps an http client with an authenication token
func GetByteArrayHash ¶
GetByteArrayHash Computes a murmur2 byte array hash
func GetFileHash ¶
GetFileHash Computes a murmur2 hash of a file
func GetHTTPResponse ¶
GetHTTPResponse gets response from URL (Wraps GetAuthenicatedResponse)
func ReadTokenFromDisk ¶
func ReadTokenFromDisk()
ReadTokenFromDisk Reads the auth token from a file
func ResponseToBytes ¶
ResponseToBytes Converts an http.Response to bytes
func ResponseToString ¶
ResponseToString Converts an http.Response to a string
func SetOAuth ¶
func SetOAuth(token string)
SetOAuth Takes in a twitch oauth code generated with OAuth.html
func WriteBytesToFile ¶
WriteBytesToFile Generic Write file bytes
Types ¶
type Addon ¶
type Addon struct {
Attachments []AddonAttachments `json:"attachments"`
Authors []AddonAuthors `json:"authors"`
AvatarURL interface{} `json:"avatarUrl"`
Categories []AddonCategories `json:"categories"`
CategoryList string `json:"categoryList"`
CategorySection AddonCategorySection `json:"categorySection"`
ClientURL string `json:"clientUrl"`
CommentCount int `json:"commentCount"`
DateCreated string `json:"dateCreated"`
DateModified string `json:"dateModified"`
DateReleased string `json:"dateReleased"`
DefaultFileID int `json:"defaultFileId"`
DonationURL interface{} `json:"donationUrl"`
DownloadCount float64 `json:"downloadCount"`
ExternalURL interface{} `json:"externalUrl"`
FullDescription string `json:"fullDescription"`
GameID int `json:"gameId"`
GameName string `json:"gameName"`
GamePopularityRank int `json:"gamePopularityRank"`
GameVersionLatestFiles []AddonGameVersion `json:"gameVersionLatestFiles"`
ID int `json:"id"`
InstallCount int `json:"installCount"`
IsAvailable bool `json:"isAvailable"`
IsFeatured bool `json:"isFeatured"`
LatestFiles []AddonLatestFile `json:"latestFiles"`
Likes int `json:"likes"`
Name string `json:"name"`
PackageType int `json:"packageType"`
PopularityScore float64 `json:"popularityScore"`
PortalName string `json:"portalName"`
PrimaryAuthorName string `json:"primaryAuthorName"`
PrimaryCategoryAvatarURL string `json:"primaryCategoryAvatarUrl"`
PrimaryCategoryName string `json:"primaryCategoryName"`
Rating int `json:"rating"`
SectionName string `json:"sectionName"`
Slug string `json:"slug"`
Stage int `json:"stage"`
Status int `json:"status"`
Summary string `json:"summary"`
WebsiteURL string `json:"websiteUrl"`
}
Addon of curseforge
func GetAllAddons ¶
GetAllAddons Uses the search to find as many addons as possible, not perfect but should get most of them. This is a very expensive call, takes a while and uses a lot of api requests
type AddonAttachments ¶
type AddonAttachments struct {
Description string `json:"description"`
ID int `json:"id"`
IsDefault bool `json:"isDefault"`
ProjectID int `json:"projectID"`
ThumbnailURL string `json:"thumbnailUrl"`
Title string `json:"title"`
URL string `json:"url"`
}
AddonAttachments embedded attachments on the curseforge page (images,etc)
type AddonAuthors ¶
AddonAuthors Represents an author of an addon
type AddonCategories ¶
type AddonCategories struct {
ID int `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
}
AddonCategories represents the category or an addon
type AddonCategorySection ¶
type AddonCategorySection struct {
ID int `json:"Id"`
ExtraIncludePattern interface{} `json:"extraIncludePattern"`
GameID int `json:"gameId"`
InitialInclusionPattern string `json:"initialInclusionPattern"`
Name string `json:"name"`
PackageType int `json:"packageType"`
Path string `json:"path"`
}
AddonCategorySection Section of addon
type AddonDependency ¶
AddonDependency a dependency of an addon
type AddonGameVersion ¶
type AddonGameVersion struct {
FileType int `json:"fileType"`
GameVersion string `json:"gameVersion"`
ProjectFileID int `json:"projectFileId"`
ProjectFileName string `json:"projectFileName"`
}
AddonGameVersion AddonGameVersion
type AddonLatestFile ¶
type AddonLatestFile struct {
AlternateFileID int `json:"alternateFileId"`
Dependencies []AddonDependency `json:"dependencies"`
DownloadURL string `json:"downloadUrl"`
FileDate string `json:"fileDate"`
FileName string `json:"fileName"`
FileNameOnDisk string `json:"fileNameOnDisk"`
FileStatus int `json:"fileStatus"`
GameVersion []string `json:"gameVersion"`
ID int `json:"id"`
IsAlternate bool `json:"isAlternate"`
IsAvailable bool `json:"isAvailable"`
Modules []AddonModules `json:"modules"`
PackageFingerprint int `json:"packageFingerprint"`
ReleaseType int `json:"releaseType"`
}
AddonLatestFile Latest file uploads
type AddonModules ¶
type AddonModules struct {
Fingerprint int `json:"fingerprint"`
FolderName string `json:"folderName"`
}
AddonModules Folders in addon File
type AuthSession ¶
type AuthSession struct {
UserID int `json:"UserID"`
Username string `json:"Username"`
DisplayName string `json:"DisplayName"`
SessionID string `json:"SessionID"`
Token string `json:"Token"`
EmailAddress string `json:"EmailAddress"`
EffectivePremiumStatus bool `json:"EffectivePremiumStatus"`
ActualPremiumStatus bool `json:"ActualPremiumStatus"`
SubscriptionToken int `json:"SubscriptionToken"`
Expires int `json:"Expires"`
RenewAfter int `json:"RenewAfter"`
IsTemporaryAccount bool `json:"IsTemporaryAccount"`
IsMerged bool `json:"IsMerged"`
Bans int `json:"Bans"`
}
AuthSession Session of auth
type AuthenticationResponse ¶
type AuthenticationResponse struct {
Status int `json:"Status"`
StatusMessage string `json:"StatusMessage"`
Session AuthSession `json:"Session"`
}
AuthenticationResponse Response of auth
type File ¶
type File struct {
ID int `json:"id"`
FileName string `json:"fileName"`
FileNameOnDisk string `json:"fileNameOnDisk"`
FileDate string `json:"fileDate"`
ReleaseType int `json:"releaseType"`
FileStatus int `json:"fileStatus"`
DownloadURL string `json:"downloadUrl"`
IsAlternate bool `json:"isAlternate"`
AlternateFileID int `json:"alternateFileId"`
Dependencies []AddonDependency `json:"dependencies"`
IsAvailable bool `json:"isAvailable"`
Modules []AddonModules `json:"modules"`
PackageFingerprint int64 `json:"packageFingerprint"`
GameVersion []string `json:"gameVersion"`
}
File a single file
func GetAddonFile ¶
GetAddonFile Gets an addons file with AddonID and fileId
func GetAddonFiles ¶
GetAddonFiles Gets files for addonID
type FingerprintList ¶
type FingerprintList struct {
IsCacheBuilt bool `json:"isCacheBuilt"`
ExactMatches []FingerprintMatch `json:"exactMatches"`
ExactFingerprints []int `json:"exactFingerprints"`
InstalledFingerprints []int `json:"installedFingerprints"`
}
FingerprintList List of fingerprint matches
func GetHashMatches ¶
func GetHashMatches(addons []int) (*FingerprintList, error)
GetHashMatches Gets addon Fingerprints
type FingerprintMatch ¶
FingerprintMatch match of addon fingerprint
type Register ¶
type Register struct {
Username string `json:"Username"`
Password string `json:"Password"`
Email string `json:"Email"`
Newsletter bool `json:"Newsletter"`
}
Register user/pass object
type RenewTokenResponseContract ¶
type RenewTokenResponseContract struct {
Token string `json:"Token"`
Expires int `json:"Expires"`
RenewAfter int `json:"RenewAfter"`
}
RenewTokenResponseContract OAuth stuffs
type TwitchOAuthRequest ¶
type TwitchOAuthRequest struct {
ClientID string `json:"ClientID"`
Code string `json:"Code"`
RedirectURI string `json:"RedirectUri"`
State string `json:"State"`
}
TwitchOAuthRequest https://logins-v1.curseapp.net/Help/Api/POST-login-twitch-oauth
type TwitchOAuthResponse ¶
type TwitchOAuthResponse struct {
Status int `json:"Status"`
Session AuthSession `json:"Session"`
TwitchUsername string `json:"TwitchUsername"`
TwitchDisplayName string `json:"TwitchDisplayName"`
TwitchAvatar string `json:"TwitchAvatar"`
TwitchUserID string `json:"TwitchUserID"`
}
TwitchOAuthResponse Response from above