cfapi

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

README

go-cfapi

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiErrors = map[int]string{
	202: "path not found in local database so it has been queued for processing. Retry request in a few seconds.",
	301: "project is available in database however the path used for the request is not the canonical path. Retry request using the canonical path.",
	400: "path provided is not a valid CurseForge path or a valid legacy curse.com project path.",
	404: "path is valid but CurseForge responded that no project exists. This may be because no project has ever lived at this path, or a project does but is hidden from public view.",
	500: "an unknown error occurred processing your request.",
}

Functions

func HttpGet

func HttpGet(url string, target interface{}) (int, error)

Types

type Api

type Api struct {
	Url  string
	Json jsoniter.API
}

func NewApi

func NewApi() *Api

func (*Api) GetMod

func (api *Api) GetMod(modid string) (ApiResponse, error)

type ApiFile

type ApiFile struct {
	Id         int
	Url        string
	Display    string
	Name       string
	Type       string
	Version    string
	Filesize   int
	Versions   []string
	Downloads  int
	UploadedAt time.Time `json:"uploaded_at"`
}

func (*ApiFile) GetCDN

func (file *ApiFile) GetCDN() string

type ApiFileFilter

type ApiFileFilter struct {
	McVer    string
	Type     string
	FileName string
}

type ApiResponse

type ApiResponse struct {
	Id      int
	Title   string
	Summary string
	Game    string
	Type    string
	Urls    struct {
		Curseforge string
		Project    string
	}
	Thumbnail string
	CreatedAt time.Time `json:"created_at"`
	Downloads struct {
		Monthly int
		Total   int
	}
	License     string
	Donate      string
	Categories  []string
	Members     []map[string]string
	Links       []string
	Files       []ApiFile
	Versions    map[string][]ApiFile
	Description string
	LastFetch   string
	Download    ApiFile
}

type ApiSelector

type ApiSelector struct {
	Id     string
	Filter ApiFileFilter
}

Jump to

Keyboard shortcuts

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