agdapi

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepoOwner = "Kengxxiao"
	RepoName  = "ArknightsGameData"
)
View Source
const (
	DefaultPrefix = "assets/torappu/dynamicassets"
)

Variables

View Source
var (

	// RepoCommitMessageRegex is for matching that a commit is a resource-updating commit.
	//
	// Examples:
	// - [CN UPDATE] Client:2.0.01 Data:23-05-11-16-35-19-8a6fe7 [BOT TEST] - Match: CN, 2.0.01, 23-05-11-16-35-19-8a6fe7
	// - [EN UPDATE] Client:15.9.01 Data:23-04-25-10-10-55-972129 - Match: EN, 15.9.01, 23-04-25-10-10-55-972129
	RepoCommitMessageRegex = regexp.MustCompile("\\[(CN|EN|JP|KR) UPDATE] Client:([.\\d]*) Data:([-\\w]*)")

	// RepoFilePathRegex is for matching that a file in the repo is a part of the resources of Arknights.
	// Examples:
	// - .github/workflows/push.yml - Not Match
	// - README.md - Not Match
	// - en_US/gamedata/[uc]lua/GlobalConfig.lua - Match: GameServer=en_US, Name=[uc]lua/GlobalConfig.lua
	// - zh_CN/gamedata/[uc]lua/GlobalConfig.lua - Match: GameServer=zh_CN, Name=[uc]lua/GlobalConfig.lua
	RepoFilePathRegex = regexp.MustCompile("^(zh_CN|en_US|ja_JP|ko_KR)/(.*)$")
)

Functions

func GetFromAGDAPI

func GetFromAGDAPI(ctx context.Context, resVersion string, dst string, filters ...*regexp.Regexp) error

func GetRes

func GetRes(ctx context.Context, resourceVersion ResourceVersion, resourceInfoList []ResourceInfo, dst string) error

GetRes gets the resources specified by infos into dst.

Types

type ResourceInfo

type ResourceInfo struct {
	Name string
}

func FilterResInfos

func FilterResInfos(infos []ResourceInfo, predicate func(i ResourceInfo) bool) []ResourceInfo

FilterResInfos returns a slice containing all ResourceInfo matching the specified predicate.

func FilterResInfosRegexp

func FilterResInfosRegexp(infos []ResourceInfo, r []*regexp.Regexp) []ResourceInfo

FilterResInfosRegexp returns a slice containing all ResourceInfo matching the specified regexp.

func GetResourceInfoList

func GetResourceInfoList(ctx context.Context, resourceVersion ResourceVersion) ([]ResourceInfo, error)

GetResourceInfoList returns a list of resource info for a specific resource version.

Up to 100,000 entries of resource info are supported. If there are more than 100,000 entries, an error will be returned.

type ResourceVersion

type ResourceVersion struct {
	GameServer      ark.Server
	ClientVersion   string
	ResourceVersion string
	CommitSHA       string
}

func GetLatestResourceVersion

func GetLatestResourceVersion(ctx context.Context, server ark.Server) (*ResourceVersion, error)

GetLatestResourceVersion returns the latest resource version from the repository.

Only the first 30 commits will be checked. If those commits do not match RepoCommitMessageRegex, an error will be returned.

func GetResourceVersion

func GetResourceVersion(ctx context.Context, resVersion string) (ResourceVersion, error)

GetResourceVersion returns the resource version from the repository specified by resVersion.

Only the first 30 commits will be checked. If those commits do not match RepoCommitMessageRegex and their resource version does not match, an error will be returned.

Jump to

Keyboard shortcuts

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