# WebDesk 3rd party App Market client API for Go This allows you to make custom (known as 3rd party) App Market server clients for your intended purpose. ## Features - Listing currently uploaded apps - Uploading new apps - Editing app info - Delete apps ## Prerequisites - Go (1.23.1 or later, older will work with go.mod changes to the version) ## Usage Import in your Go code: ``` import ( "git.fluffy.pw/matu6968/webdesk-appmarket-golang" ) ``` # Configuration In the .env file this is the only thing you can set ``` AUTH_TOKEN=bearer-token-here # Put your token generated from the server .env file ``` # API usage 1. List uploaded apps: ``` // Create new client c := client.NewClient("http://localhost:8080", os.Getenv("AUTH_TOKEN")) // List all apps apps, err := c.GetApps() if err != nil { log.Fatal("Failed to get apps:", err) } fmt.Printf("Found %d apps\n", len(apps)) ``` 2. Upload an app: ``` // Upload new app metadata := client.AppMetadata{ Name: "Camera", Ver: "6", Info: "This is a camera app", Pub: "matu6968", } newApp, err := c.UploadApp(metadata, "./index.js") if err != nil { log.Fatal("Failed to upload app:", err) } fmt.Printf("Uploaded app with ID: %s\n", newApp.AppID) ``` 3. Edit an app: ``` // Edit app metadata.Ver = "7" // only specify what you want to edit metadata.Name = "Camera" // only specify what you want to edit metadata.Info = "This is a newer camera app" // only specify what you want to edit metadata.Pub = "matu6968" // only specify what you want to edit err = c.EditApp(newApp.AppID, metadata, "./index.js") // replace newApp.AppID with the app id you want to delete if err != nil { log.Fatal("Failed to edit app:", err) } fmt.Println("App updated successfully") ``` 4. Delete an app: ``` // Delete app err = c.DeleteApp(newApp.AppID) // replace newApp.AppID with the app id you want to delete if err != nil { log.Fatal("Failed to delete app:", err) } fmt.Println("App deleted successfully") ```