Change backend request code to use new CurseForge API (WIP)

See the packwiz Discord for more information, as the changes with the new API Terms and Conditions have some implications for packwiz.
This commit isn't fully functional yet; I have more changes to make.
This commit is contained in:
comp500
2022-05-07 18:18:57 +01:00
parent 9ace015690
commit 0c5ff0b7bb
5 changed files with 173 additions and 181 deletions

View File

@@ -192,7 +192,7 @@ var importCmd = &cobra.Command{
fmt.Println("Querying Curse API for mod info...")
modInfos, err := getModInfoMultiple(modIDs)
modInfos, err := cfDefaultClient.getModInfoMultiple(modIDs)
if err != nil {
fmt.Printf("Failed to obtain mod information: %s\n", err)
os.Exit(1)
@@ -236,16 +236,14 @@ var importCmd = &cobra.Command{
// 2nd pass: query files that weren't in the previous results
fmt.Println("Querying Curse API for file info...")
modFileInfos, err := getFileInfoMultiple(remainingFileIDs)
modFileInfos, err := cfDefaultClient.getFileInfoMultiple(remainingFileIDs)
if err != nil {
fmt.Printf("Failed to obtain mod file information: %s\n", err)
os.Exit(1)
}
for _, v := range modFileInfos {
for _, file := range v {
modFileInfosMap[file.ID] = file
}
modFileInfosMap[v.ID] = v
}
// 3rd pass: create mod files for every file