Skip to content

Commit faa9cd2

Browse files
author
Paola Nicosia
committed
refactor: changed marketplace api prefix
1 parent de955f3 commit faa9cd2

File tree

8 files changed

+20
-11
lines changed

8 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### BREAKING
11+
12+
**Starting from this version, `miactl` is compatible only with Mia-Platform Console v13.2.1 or higher.**
13+
14+
The breaking change consists of:
15+
16+
- marketplace endpoints use `/api/marketplace` prefix instead of `/api/backend/marketplace`.
17+
1018
### Changed
1119

20+
- improved errors table when creating/updating marketplace items
1221
- update go version to 1.24.0
1322

1423
## [v0.17.1] - 2025-02-07

internal/cmd/marketplace/apply/apply.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ miactl marketplace apply -f ./path/to/myFantasticGoTemplate.json -f ./path/to/my
6161
# Apply all the valid configuration files in the directory myFantasticGoTemplates to the Marketplace
6262
miactl marketplace apply -f myFantasticGoTemplates`
6363

64-
applyEndpointTemplate = "/api/backend/marketplace/tenants/%s/resources"
64+
applyEndpointTemplate = "/api/marketplace/tenants/%s/resources"
6565

6666
imageAssetType = "imageAssetType"
6767
imageKey = "image"

internal/cmd/marketplace/apply/upload_image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
)
3333

3434
const (
35-
uploadImageEndpointTemplate = "/api/backend/marketplace/tenants/%s/files"
35+
uploadImageEndpointTemplate = "/api/marketplace/tenants/%s/files"
3636
multipartFieldName = "marketplace_image"
3737

3838
localPathKey = "localPath"

internal/cmd/marketplace/delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import (
2929

3030
const (
3131
// deleteItemEndpointTemplate formatting template for item deletion by objectID backend endpoint; specify tenantID, objectID
32-
deleteItemEndpointTemplate = "/api/backend/marketplace/tenants/%s/resources/%s"
32+
deleteItemEndpointTemplate = "/api/marketplace/tenants/%s/resources/%s"
3333
// deleteItemByTupleEndpointTemplate formatting template for item deletion by the tuple itemID versionID endpoint; specify companyID, itemID, version
34-
deleteItemByTupleEndpointTemplate = "/api/backend/marketplace/tenants/%s/resources/%s/versions/%s"
34+
deleteItemByTupleEndpointTemplate = "/api/marketplace/tenants/%s/resources/%s/versions/%s"
3535

3636
cmdDeleteLongDescription = `Delete a single Marketplace item
3737

internal/cmd/marketplace/get.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
)
2828

2929
const (
30-
getItemByObjectIDEndpointTemplate = "/api/backend/marketplace/%s"
31-
getItemByItemIDAndVersionEndpointTemplate = "/api/backend/marketplace/tenants/%s/resources/%s/versions/%s"
30+
getItemByObjectIDEndpointTemplate = "/api/marketplace/%s"
31+
getItemByItemIDAndVersionEndpointTemplate = "/api/marketplace/tenants/%s/resources/%s/versions/%s"
3232

3333
cmdGetLongDescription = `Get a single Marketplace item
3434

internal/cmd/marketplace/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
)
2929

3030
const (
31-
listMarketplaceEndpoint = "/api/backend/marketplace/"
31+
listMarketplaceEndpoint = "/api/marketplace/"
3232
listCmdLong = `List Marketplace items
3333
3434
This command lists the Marketplace items of a company.

internal/cmd/marketplace/list_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func TestBuildMarketplaceItemsList(t *testing.T) {
125125
func privateAndPublicMarketplaceHandler(t *testing.T) http.HandlerFunc {
126126
t.Helper()
127127
return func(w http.ResponseWriter, r *http.Request) {
128-
if strings.EqualFold(r.URL.Path, "/api/backend/marketplace/") &&
128+
if strings.EqualFold(r.URL.Path, "/api/marketplace/") &&
129129
r.Method == http.MethodGet &&
130130
r.URL.Query().Get("includeTenantId") == "my-company" {
131131
_, err := w.Write([]byte(marketplaceItemsBodyContent(t)))
@@ -140,7 +140,7 @@ func privateAndPublicMarketplaceHandler(t *testing.T) http.HandlerFunc {
140140
func privateCompanyMarketplaceHandler(t *testing.T) http.HandlerFunc {
141141
t.Helper()
142142
return func(w http.ResponseWriter, r *http.Request) {
143-
if strings.EqualFold(r.URL.Path, "/api/backend/marketplace/") &&
143+
if strings.EqualFold(r.URL.Path, "/api/marketplace/") &&
144144
r.Method == http.MethodGet &&
145145
r.URL.Query().Get("tenantId") == "my-company" {
146146
_, err := w.Write([]byte(marketplacePrivateCompanyBodyContent(t)))
@@ -155,7 +155,7 @@ func privateCompanyMarketplaceHandler(t *testing.T) http.HandlerFunc {
155155
func wrongPayloadHandler(t *testing.T) http.HandlerFunc {
156156
t.Helper()
157157
return func(w http.ResponseWriter, r *http.Request) {
158-
if strings.EqualFold(r.URL.Path, "/api/backend/marketplace/") &&
158+
if strings.EqualFold(r.URL.Path, "/api/marketplace/") &&
159159
r.Method == http.MethodGet &&
160160
r.URL.Query().Get("tenantId") == "my-company" {
161161
_, err := w.Write([]byte("{}")) // Incorrect payload

internal/cmd/marketplace/list_versions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/spf13/cobra"
2929
)
3030

31-
const listItemVersionsEndpointTemplate = "/api/backend/marketplace/tenants/%s/resources/%s/versions"
31+
const listItemVersionsEndpointTemplate = "/api/marketplace/tenants/%s/resources/%s/versions"
3232

3333
var (
3434
ErrGenericServerError = errors.New("server error while fetching item versions")

0 commit comments

Comments
 (0)