Skip to content

Commit e6c73b8

Browse files
committed
fix: more struct dupes
1 parent 34cfa2f commit e6c73b8

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

axm/services/devicemanagement/service.go renamed to axm/services/devicemanagement/crud.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type (
3232
//
3333
// Apple Business Manager API docs:
3434
// https://developer.apple.com/documentation/applebusinessmanagerapi/get-the-assigned-server-information-for-an-orgdevice
35-
GetAssignedDeviceManagementServiceInformationByDeviceID(ctx context.Context, deviceID string, opts *GetAssignedServerInfoOptions) (*MDMServerResponse, error)
35+
GetAssignedDeviceManagementServiceInformationByDeviceID(ctx context.Context, deviceID string, opts *RequestQueryOptions) (*MDMServerResponse, error)
3636

3737
// AssignDevicesToServer assigns devices to an MDM server
3838
//
@@ -167,7 +167,7 @@ func (s *DeviceManagementService) GetAssignedDeviceManagementServiceIDForADevice
167167
// GetAssignedDeviceManagementServiceInformationByDeviceID retrieves the assigned device management service information for a device
168168
// URL: GET https://api-business.apple.com/v1/orgDevices/{id}/assignedServer
169169
// https://developer.apple.com/documentation/applebusinessmanagerapi/get-the-assigned-server-information-for-an-orgdevice
170-
func (s *DeviceManagementService) GetAssignedDeviceManagementServiceInformationByDeviceID(ctx context.Context, deviceID string, opts *GetAssignedServerInfoOptions) (*MDMServerResponse, error) {
170+
func (s *DeviceManagementService) GetAssignedDeviceManagementServiceInformationByDeviceID(ctx context.Context, deviceID string, opts *RequestQueryOptions) (*MDMServerResponse, error) {
171171
if deviceID == "" {
172172
return nil, fmt.Errorf("device ID is required")
173173
}
@@ -180,7 +180,7 @@ func (s *DeviceManagementService) GetAssignedDeviceManagementServiceInformationB
180180
}
181181

182182
if opts == nil {
183-
opts = &GetAssignedServerInfoOptions{}
183+
opts = &RequestQueryOptions{}
184184
}
185185

186186
queryParams := s.client.QueryBuilder()

axm/services/devicemanagement/crud_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func TestGetAssignedDeviceManagementServiceInformationByDeviceID_Success(t *test
271271

272272
ctx := context.Background()
273273
deviceID := "DVVS36G1YD3JKQNI"
274-
opts := &GetAssignedServerInfoOptions{
274+
opts := &RequestQueryOptions{
275275
Fields: []string{FieldServerName, FieldServerType},
276276
}
277277

@@ -306,7 +306,7 @@ func TestGetAssignedDeviceManagementServiceInformationByDeviceID_EmptyDeviceID(t
306306
defer mockHandler.CleanupMockState()
307307

308308
ctx := context.Background()
309-
opts := &GetAssignedServerInfoOptions{}
309+
opts := &RequestQueryOptions{}
310310

311311
result, err := client.GetAssignedDeviceManagementServiceInformationByDeviceID(ctx, "", opts)
312312

@@ -549,8 +549,8 @@ func TestOptionsStructures(t *testing.T) {
549549
}
550550
assert.Equal(t, 50, opts2.Limit)
551551

552-
// Test GetAssignedServerInfoOptions
553-
opts3 := &GetAssignedServerInfoOptions{
552+
// Test RequestQueryOptions
553+
opts3 := &RequestQueryOptions{
554554
Fields: []string{FieldServerName, FieldCreatedDateTime},
555555
}
556556
assert.Len(t, opts3.Fields, 2)

axm/services/devicemanagement/models.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,6 @@ type MDMServerResponse struct {
107107
Links *Links `json:"links,omitempty"`
108108
}
109109

110-
// GetAssignedServerInfoOptions represents the query parameters for getting assigned server info
111-
type GetAssignedServerInfoOptions struct {
112-
// Field selection - fields to return for mdmServers
113-
// Possible values: serverName, serverType, createdDateTime, updatedDateTime, devices
114-
Fields []string `json:"fields,omitempty"`
115-
}
116-
117110
// OrgDeviceActivity represents a device activity (assign/unassign operations)
118111
type OrgDeviceActivity struct {
119112
ID string `json:"id"`

examples/axm/devicemanagement/GetAssignedDeviceManagementServiceInfo/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ your-abm-api-key
122122
// Example 2: Get assigned server information with specific fields
123123
fmt.Println("\n=== Example 2: Get Assigned Server Information (Specific Fields) ===")
124124

125-
specificFieldsOptions := &devicemanagement.GetAssignedServerInfoOptions{
125+
specificFieldsOptions := &devicemanagement.RequestQueryOptions{
126126
Fields: []string{
127127
"serverName",
128128
"serverType",
@@ -157,7 +157,7 @@ your-abm-api-key
157157
device := devicesResponse.Data[i]
158158
fmt.Printf("\nDevice %d: %s (Serial: %s)\n", i+1, device.ID, device.Attributes.SerialNumber)
159159

160-
serverInfo, err := client.DeviceManagement.GetAssignedDeviceManagementServiceInformationByDeviceID(ctx, device.ID, &devicemanagement.GetAssignedServerInfoOptions{
160+
serverInfo, err := client.DeviceManagement.GetAssignedDeviceManagementServiceInformationByDeviceID(ctx, device.ID, &devicemanagement.RequestQueryOptions{
161161
Fields: []string{
162162
"serverName",
163163
"serverType",
@@ -181,7 +181,7 @@ your-abm-api-key
181181
// Example 4: Get server information with all available fields
182182
fmt.Println("\n=== Example 4: Get Server Information (All Available Fields) ===")
183183

184-
allFieldsOptions := &devicemanagement.GetAssignedServerInfoOptions{
184+
allFieldsOptions := &devicemanagement.RequestQueryOptions{
185185
Fields: []string{
186186
"serverName",
187187
"serverType",

0 commit comments

Comments
 (0)