Skip to content

[WIRE-422] Custom templates support #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed output
  • Loading branch information
rjtokenring committed Jun 4, 2024
commit 1715c171ac17a1134670e8aea9c215cf6765e4a7
9 changes: 5 additions & 4 deletions command/template/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
package template

import (
"github.com/sirupsen/logrus"

"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cloud-cli/config"
storageapi "github.com/arduino/arduino-cloud-cli/internal/storage-api"
)
Expand All @@ -28,12 +27,14 @@ func ImportCustomTemplate(cred *config.Credentials, filePath string) error {

apiclient := storageapi.NewClient(cred)

_, err := apiclient.ImportCustomTemplate(filePath)
feedback.Printf("Importing template %s", filePath)

templateImported, err := apiclient.ImportCustomTemplate(filePath)
if err != nil {
return err
}

logrus.Infof("Template imported")
feedback.Printf("Template '%s' (%s) imported successfully", templateImported.Name, templateImported.TemplateId)

return nil
}
4 changes: 3 additions & 1 deletion internal/storage-api/dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package storageapi

type (
ImportCustomTemplateResponse struct {
TemplateID string `json:"template_id"`
Message string `json:"message"`
Name string `json:"name"`
TemplateId string `json:"template_id"`
}
)