Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 0 additions & 4 deletions cmd/ascAppUpload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func TestRunAscAppUpload(t *testing.T) {
AppId: 1,
AppName: "Sample App",
BundleId: "sample.bundle.id",
JamfId: "1",
},
createReleaseResponse: asc.CreateReleaseResponse{
Status: "success",
Expand Down Expand Up @@ -112,7 +111,6 @@ func TestRunAscAppUpload(t *testing.T) {
AppId: 1,
AppName: "Sample App",
BundleId: "sample.bundle.id",
JamfId: "1",
},
createReleaseResponse: asc.CreateReleaseResponse{Status: "failure", Message: errorMessage},
}
Expand Down Expand Up @@ -141,7 +139,6 @@ func TestRunAscAppUpload(t *testing.T) {
AppId: 1,
AppName: "Sample App",
BundleId: "sample.bundle.id",
JamfId: "1",
},
createReleaseResponse: asc.CreateReleaseResponse{Status: "success", Data: asc.Release{ReleaseID: 1}},
jamfAppInfoError: errors.New(errorMessage),
Expand Down Expand Up @@ -169,7 +166,6 @@ func TestRunAscAppUpload(t *testing.T) {
AppId: 1,
AppName: "Sample App",
BundleId: "sample.bundle.id",
JamfId: "1",
},
createReleaseResponse: asc.CreateReleaseResponse{Status: "success", Data: asc.Release{ReleaseID: 1}},
jamfAppInfo: asc.JamfAppInformationResponse{
Expand Down
12 changes: 7 additions & 5 deletions pkg/asc/asc.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type App struct {
AppId int `json:"app_id"`
AppName string `json:"app_name"`
BundleId string `json:"bundle_id"`
JamfId string `json:"jamf_id"`
}

type JamfAppInformationResponse struct {
Expand Down Expand Up @@ -124,15 +123,18 @@ func sendRequest(sys *SystemInstance, method, url string, body io.Reader, header
// GetAppById returns the app addressed by appId from the ASC backend
func (sys *SystemInstance) GetAppById(appId string) (App, error) {
sys.logger.Debugf("Getting ASC App with ID %v...", appId)
var app App

data, err := sendRequest(sys, http.MethodGet, fmt.Sprintf("api/v1/apps/%v", appId), nil, nil)
if err != nil {
return app, fmt.Errorf("fetching app %v failed: %w", appId, err)
return App{}, fmt.Errorf("fetching app %v failed: %w", appId, err)
}

json.Unmarshal(data, &app)
return app, nil
var apps []App
json.Unmarshal(data, &apps)
if len(apps) == 0 {
return App{}, fmt.Errorf("no app found with id %v", appId)
}
return apps[0], nil
}

// CreateRelease creates a release in ASC
Expand Down
Loading