cav2

package module
v0.0.0-...-2a7fe58 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

CAV2

Curse Api Version 2 - in go

Use the Twitch OAuth Generator to get your oauth token

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OAuthToken string

	WriteSession = false
)
View Source
var (
	EMPTY []byte
)

Functions

func GetAddonDatabaseTimestamp

func GetAddonDatabaseTimestamp() (string, error)

func GetAuthenticatedReponse

func GetAuthenticatedReponse(method, token, url string, b []byte) (*http.Response, error)

func GetByteArrayHash

func GetByteArrayHash(bytes []byte) int

func GetFileHash

func GetFileHash(file string) (int, error)

func GetHTTPResponse

func GetHTTPResponse(method, url string, b []byte) (*http.Response, error)

func ReadTokenFromDisk

func ReadTokenFromDisk()

Reads the auth token from a file

func ResponseToString

func ResponseToString(response *http.Response) string

func SetOAuth

func SetOAuth(token string)

Takes in a twitch oauth code generated with OAuth.html

func TwitchApi

func TwitchApi() bool

func UseCurseMeta

func UseCurseMeta()

func UseTwitch

func UseTwitch()

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"`
}

func GetAddon

func GetAddon(addonID string) (*Addon, error)

func GetAddons

func GetAddons(addons []int) ([]Addon, error)

func GetAllAddons

func GetAllAddons() ([]Addon, error)

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

func Search(query string) ([]Addon, error)

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"`
}

type AddonAuthors

type AddonAuthors struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type AddonCategories

type AddonCategories struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

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"`
}

type AddonDependency

type AddonDependency struct {
	AddonID int `json:"addonId"`
	Type    int `json:"type"`
}

type AddonGameVersion

type AddonGameVersion struct {
	FileType        int    `json:"fileType"`
	GameVersion     string `json:"gameVersion"`
	ProjectFileID   int    `json:"projectFileId"`
	ProjectFileName string `json:"projectFileName"`
}

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"`
}

type AddonModules

type AddonModules struct {
	Fimgerprint int    `json:"fimgerprint"`
	FolderName  string `json:"folderName"`
}

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"`
}

type AuthenticationResponse

type AuthenticationResponse struct {
	Status        int         `json:"Status"`
	StatusMessage string      `json:"StatusMessage"`
	Session       AuthSession `json:"Session"`
}

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       []interface{}  `json:"dependencies"`
	IsAvailable        bool           `json:"isAvailable"`
	Modules            []AddonModules `json:"modules"`
	PackageFingerprint int64          `json:"packageFingerprint"`
	GameVersion        []string       `json:"gameVersion"`
}

func GetAddonFiles

func GetAddonFiles(addonID string) ([]File, error)

type FingerprintList

type FingerprintList struct {
	IsCacheBuilt          bool               `json:"isCacheBuilt"`
	ExactMatches          []FingerprintMatch `json:"exactMatches"`
	ExactFingerprints     []int              `json:"exactFingerprints"`
	InstalledFingerprints []int              `json:"installedFingerprints"`
}

func GetHashMatches

func GetHashMatches(addons []int) (*FingerprintList, error)

type FingerprintMatch

type FingerprintMatch struct {
	AddonID int  `json:"id"`
	File    File `json:"file"`
}

type Login

type Login struct {
	Username string `json:"Username"`
	Password string `json:"Password"`
}

type Register

type Register struct {
	Username   string `json:"Username"`
	Password   string `json:"Password"`
	Email      string `json:"Email"`
	Newsletter bool   `json:"Newsletter"`
}

type RenewTokenResponseContract

type RenewTokenResponseContract struct {
	Token      string `json:"Token"`
	Expires    int    `json:"Expires"`
	RenewAfter int    `json:"RenewAfter"`
}

type TwitchOAuthRequest

type TwitchOAuthRequest struct {
	ClientID    string `json:"ClientID"`
	Code        string `json:"Code"`
	RedirectUri string `json:"RedirectUri"`
	State       string `json:"State"`
}

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"`
}

Jump to

Keyboard shortcuts

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