From e706228aded959b6d0f9111a5e8f708ec83e00e7 Mon Sep 17 00:00:00 2001 From: Jude Hung Date: Thu, 7 Oct 2021 19:55:33 +0800 Subject: [PATCH 1/7] feat(data): Add totalCount field into MultiEventsResponse DTO To resolve https://github.com/edgexfoundry/edgex-go/issues/3691, this commit introduces a new base DTO BaseWithTotalCountResponse with BaseResponse inlined and a TotalCount (type uint32) field. The target is to update all v2 Multi-instance response DTOs--such as MultiEventsResponse, MultiReadingsResponse, MultiDeviceCoreCommandsResponse--to use inlined BaseWithTotalCountResponse, rather than BaseResponse. closes #669 Signed-off-by: Jude Hung --- dtos/common/base.go | 15 +++++++++++++++ dtos/common/base_test.go | 13 +++++++++++++ dtos/responses/event.go | 10 +++++----- dtos/responses/event_test.go | 6 ++++-- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/dtos/common/base.go b/dtos/common/base.go index 97e461b1..115262b6 100644 --- a/dtos/common/base.go +++ b/dtos/common/base.go @@ -69,6 +69,21 @@ func NewBaseWithIdResponse(requestId string, message string, statusCode int, id } } +// BaseWithTotalCountResponse defines the base content for response DTOs (data transfer objects). +// This object and its properties correspond to the BaseWithTotalCountResponse object in the APIv2 specification: +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseWithTotalCountResponse +type BaseWithTotalCountResponse struct { + BaseResponse `json:",inline"` + TotalCount uint32 `json:"totalCount"` +} + +func NewBaseWithTotalCountResponse(requestId string, message string, statusCode int, totalCount uint32) BaseWithTotalCountResponse { + return BaseWithTotalCountResponse{ + BaseResponse: NewBaseResponse(requestId, message, statusCode), + TotalCount: totalCount, + } +} + // BaseWithServiceNameResponse defines the base content for response DTOs (data transfer objects). // This object and its properties correspond to the BaseWithServiceNameResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.x#/BaseWithServiceNameResponse diff --git a/dtos/common/base_test.go b/dtos/common/base_test.go index e9ad048c..c85cce33 100644 --- a/dtos/common/base_test.go +++ b/dtos/common/base_test.go @@ -52,6 +52,19 @@ func TestNewBaseWithIdResponse(t *testing.T) { assert.Equal(t, expectedId, actual.Id) } +func TestNewBaseWithTotalCountResponse(t *testing.T) { + expectedRequestId := "123456" + expectedStatusCode := 200 + expectedMessage := "unit test message" + expectedTotalCount := uint32(3) + actual := NewBaseWithTotalCountResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount) + + assert.Equal(t, expectedRequestId, actual.RequestId) + assert.Equal(t, expectedStatusCode, actual.StatusCode) + assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) +} + func TestBaseResponse_Marshal(t *testing.T) { expectedRequestId := "123456" expectedStatusCode := 200 diff --git a/dtos/responses/event.go b/dtos/responses/event.go index df17b401..d5d83b58 100644 --- a/dtos/responses/event.go +++ b/dtos/responses/event.go @@ -28,8 +28,8 @@ type EventResponse struct { // This object and its properties correspond to the MultiEventsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/MultiEventsResponse type MultiEventsResponse struct { - dtoCommon.BaseResponse `json:",inline"` - Events []dtos.Event `json:"events"` + dtoCommon.BaseWithTotalCountResponse `json:",inline"` + Events []dtos.Event `json:"events"` } func NewEventResponse(requestId string, message string, statusCode int, event dtos.Event) EventResponse { @@ -39,10 +39,10 @@ func NewEventResponse(requestId string, message string, statusCode int, event dt } } -func NewMultiEventsResponse(requestId string, message string, statusCode int, events []dtos.Event) MultiEventsResponse { +func NewMultiEventsResponse(requestId string, message string, statusCode int, totalCount uint32, events []dtos.Event) MultiEventsResponse { return MultiEventsResponse{ - BaseResponse: dtoCommon.NewBaseResponse(requestId, message, statusCode), - Events: events, + BaseWithTotalCountResponse: dtoCommon.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Events: events, } } diff --git a/dtos/responses/event_test.go b/dtos/responses/event_test.go index 1fe23507..75823876 100644 --- a/dtos/responses/event_test.go +++ b/dtos/responses/event_test.go @@ -34,10 +34,12 @@ func TestNewMultiEventsResponse(t *testing.T) { {Id: "7a1707f0-166f-4c4b-bc9d-1d54c74e0137"}, {Id: "11111111-2222-3333-4444-555555555555"}, } - actual := NewMultiEventsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedEvents) + expectedTotalCount := uint32(len(expectedEvents)) + actual := NewMultiEventsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedEvents) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) - assert.Equal(t, expectedEvents, actual.Events) + assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) } From 94063c0dedf8da0e0e5f120fbf88240b5b7f6763 Mon Sep 17 00:00:00 2001 From: Jude Hung Date: Tue, 12 Oct 2021 13:51:04 +0800 Subject: [PATCH 2/7] feat(data): Add totalCount field into MultiReadingsResponse DTO This commit updates MultiReadingsResponse to use inlined BaseWithTotalCountResponse, rather than BaseResponse. Also include reading Id map when converting to model. closes #669 Signed-off-by: Jude Hung --- dtos/responses/reading.go | 10 +++++----- dtos/responses/reading_test.go | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dtos/responses/reading.go b/dtos/responses/reading.go index 7a3d6aa1..f506751d 100644 --- a/dtos/responses/reading.go +++ b/dtos/responses/reading.go @@ -22,8 +22,8 @@ type ReadingResponse struct { // This object and its properties correspond to the MultiReadingsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/MultiReadingsResponse type MultiReadingsResponse struct { - common.BaseResponse `json:",inline"` - Readings []dtos.BaseReading `json:"readings"` + common.BaseWithTotalCountResponse `json:",inline"` + Readings []dtos.BaseReading `json:"readings"` } func NewReadingResponse(requestId string, message string, statusCode int, reading dtos.BaseReading) ReadingResponse { @@ -33,9 +33,9 @@ func NewReadingResponse(requestId string, message string, statusCode int, readin } } -func NewMultiReadingsResponse(requestId string, message string, statusCode int, readings []dtos.BaseReading) MultiReadingsResponse { +func NewMultiReadingsResponse(requestId string, message string, statusCode int, totalCount uint32, readings []dtos.BaseReading) MultiReadingsResponse { return MultiReadingsResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Readings: readings, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Readings: readings, } } diff --git a/dtos/responses/reading_test.go b/dtos/responses/reading_test.go index a2e3305d..f874ae03 100644 --- a/dtos/responses/reading_test.go +++ b/dtos/responses/reading_test.go @@ -34,10 +34,12 @@ func TestNewMultiReadingsResponse(t *testing.T) { {Id: "7a1707f0-166f-4c4b-bc9d-1d54c74e0137"}, {Id: "11111111-2222-3333-4444-555555555555"}, } - actual := NewMultiReadingsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedReadings) + expectedTotalCount := uint32(len(expectedReadings)) + actual := NewMultiReadingsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedReadings) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) assert.Equal(t, expectedReadings, actual.Readings) + assert.Equal(t, expectedTotalCount, actual.TotalCount) } From af86f722486bd9e559960834ec9bd5abd47d0bb0 Mon Sep 17 00:00:00 2001 From: Jude Hung Date: Thu, 14 Oct 2021 22:05:15 +0800 Subject: [PATCH 3/7] feat(metadata): Add totalCount field into core-metadata multi-instance response DTO update MultiDevicesResponse/MultiDeviceProfilesResponse/MultiDeviceServicesResponse/MultiProvisionWatchersResponse DTO to use BaseWithTotalCountResponse, so that a new field totalCount will be included as respsone DTO. Signed-off-by: Jude Hung --- dtos/responses/device.go | 10 +++++----- dtos/responses/device_test.go | 4 +++- dtos/responses/deviceprofile.go | 10 +++++----- dtos/responses/deviceprofile_test.go | 4 +++- dtos/responses/deviceservice.go | 10 +++++----- dtos/responses/deviceservice_test.go | 4 +++- dtos/responses/provisionwatcher.go | 10 +++++----- dtos/responses/provisionwatcher_test.go | 4 +++- 8 files changed, 32 insertions(+), 24 deletions(-) diff --git a/dtos/responses/device.go b/dtos/responses/device.go index cb07a867..69275724 100644 --- a/dtos/responses/device.go +++ b/dtos/responses/device.go @@ -29,13 +29,13 @@ func NewDeviceResponse(requestId string, message string, statusCode int, device // This object and its properties correspond to the MultiDevicesResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiDevicesResponse type MultiDevicesResponse struct { - common.BaseResponse `json:",inline"` - Devices []dtos.Device `json:"devices"` + common.BaseWithTotalCountResponse `json:",inline"` + Devices []dtos.Device `json:"devices"` } -func NewMultiDevicesResponse(requestId string, message string, statusCode int, devices []dtos.Device) MultiDevicesResponse { +func NewMultiDevicesResponse(requestId string, message string, statusCode int, totalCount uint32, devices []dtos.Device) MultiDevicesResponse { return MultiDevicesResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Devices: devices, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Devices: devices, } } diff --git a/dtos/responses/device_test.go b/dtos/responses/device_test.go index f6ceb5ee..3aac2ef7 100644 --- a/dtos/responses/device_test.go +++ b/dtos/responses/device_test.go @@ -33,10 +33,12 @@ func TestNewMultiDevicesResponse(t *testing.T) { {Name: "test device1"}, {Name: "test device2"}, } - actual := NewMultiDevicesResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedDevices) + expectedTotalCount := uint32(2) + actual := NewMultiDevicesResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedDevices) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedDevices, actual.Devices) } diff --git a/dtos/responses/deviceprofile.go b/dtos/responses/deviceprofile.go index 2b7d02c0..7e8f7a55 100644 --- a/dtos/responses/deviceprofile.go +++ b/dtos/responses/deviceprofile.go @@ -29,13 +29,13 @@ func NewDeviceProfileResponse(requestId string, message string, statusCode int, // This object and its properties correspond to the MultiDeviceProfilesResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiDeviceProfilesResponse type MultiDeviceProfilesResponse struct { - common.BaseResponse `json:",inline"` - Profiles []dtos.DeviceProfile `json:"profiles"` + common.BaseWithTotalCountResponse `json:",inline"` + Profiles []dtos.DeviceProfile `json:"profiles"` } -func NewMultiDeviceProfilesResponse(requestId string, message string, statusCode int, deviceProfiles []dtos.DeviceProfile) MultiDeviceProfilesResponse { +func NewMultiDeviceProfilesResponse(requestId string, message string, statusCode int, totalCount uint32, deviceProfiles []dtos.DeviceProfile) MultiDeviceProfilesResponse { return MultiDeviceProfilesResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Profiles: deviceProfiles, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Profiles: deviceProfiles, } } diff --git a/dtos/responses/deviceprofile_test.go b/dtos/responses/deviceprofile_test.go index 43e9e7f8..329a98cd 100644 --- a/dtos/responses/deviceprofile_test.go +++ b/dtos/responses/deviceprofile_test.go @@ -33,10 +33,12 @@ func TestNewMultiDeviceProfilesResponse(t *testing.T) { {Name: "test device profile1"}, {Name: "test device profile2"}, } - actual := NewMultiDeviceProfilesResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedDeviceProfiles) + expectedTotalCount := uint32(2) + actual := NewMultiDeviceProfilesResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedDeviceProfiles) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedDeviceProfiles, actual.Profiles) } diff --git a/dtos/responses/deviceservice.go b/dtos/responses/deviceservice.go index bd943e21..9e3e2fbe 100644 --- a/dtos/responses/deviceservice.go +++ b/dtos/responses/deviceservice.go @@ -29,13 +29,13 @@ func NewDeviceServiceResponse(requestId string, message string, statusCode int, // This object and its properties correspond to the MultiDeviceServicesResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiDeviceServicesResponse type MultiDeviceServicesResponse struct { - common.BaseResponse `json:",inline"` - Services []dtos.DeviceService `json:"services"` + common.BaseWithTotalCountResponse `json:",inline"` + Services []dtos.DeviceService `json:"services"` } -func NewMultiDeviceServicesResponse(requestId string, message string, statusCode int, deviceServices []dtos.DeviceService) MultiDeviceServicesResponse { +func NewMultiDeviceServicesResponse(requestId string, message string, statusCode int, totalCount uint32, deviceServices []dtos.DeviceService) MultiDeviceServicesResponse { return MultiDeviceServicesResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Services: deviceServices, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Services: deviceServices, } } diff --git a/dtos/responses/deviceservice_test.go b/dtos/responses/deviceservice_test.go index d43633f0..cc268956 100644 --- a/dtos/responses/deviceservice_test.go +++ b/dtos/responses/deviceservice_test.go @@ -33,10 +33,12 @@ func TestNewMultiDeviceServicesResponse(t *testing.T) { {Name: "test device service1"}, {Name: "test device service2"}, } - actual := NewMultiDeviceServicesResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedDeviceServices) + expectedTotalCount := uint32(2) + actual := NewMultiDeviceServicesResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedDeviceServices) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedDeviceServices, actual.Services) } diff --git a/dtos/responses/provisionwatcher.go b/dtos/responses/provisionwatcher.go index eb151968..1c9d3bc6 100644 --- a/dtos/responses/provisionwatcher.go +++ b/dtos/responses/provisionwatcher.go @@ -29,13 +29,13 @@ func NewProvisionWatcherResponse(requestId string, message string, statusCode in // This object and its properties correspond to the MultiProvisionWatchersResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiProvisionWatchersResponse type MultiProvisionWatchersResponse struct { - common.BaseResponse `json:",inline"` - ProvisionWatchers []dtos.ProvisionWatcher `json:"provisionWatchers"` + common.BaseWithTotalCountResponse `json:",inline"` + ProvisionWatchers []dtos.ProvisionWatcher `json:"provisionWatchers"` } -func NewMultiProvisionWatchersResponse(requestId string, message string, statusCode int, pws []dtos.ProvisionWatcher) MultiProvisionWatchersResponse { +func NewMultiProvisionWatchersResponse(requestId string, message string, statusCode int, totalCount uint32, pws []dtos.ProvisionWatcher) MultiProvisionWatchersResponse { return MultiProvisionWatchersResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - ProvisionWatchers: pws, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + ProvisionWatchers: pws, } } diff --git a/dtos/responses/provisionwatcher_test.go b/dtos/responses/provisionwatcher_test.go index bf925ad8..72346e8f 100644 --- a/dtos/responses/provisionwatcher_test.go +++ b/dtos/responses/provisionwatcher_test.go @@ -33,10 +33,12 @@ func TestNewMultiProvisionWatchersResponse(t *testing.T) { {Name: "test watcher1"}, {Name: "test watcher2"}, } - actual := NewMultiProvisionWatchersResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedProvisionWatchers) + expectedTotalCount := uint32(2) + actual := NewMultiProvisionWatchersResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedProvisionWatchers) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedProvisionWatchers, actual.ProvisionWatchers) } From eaa77a0159b0ecc5f0d7c049a05021f9343a078a Mon Sep 17 00:00:00 2001 From: Jude Hung Date: Fri, 15 Oct 2021 09:50:02 +0800 Subject: [PATCH 4/7] feat(command): Add totalCount field into MultiDeviceCoreCommandsResponse DTO This commit updates MultiDeviceCoreCommandsResponse to use inlined BaseWithTotalCountResponse, rather than BaseResponse. Signed-off-by: Jude Hung --- dtos/responses/corecommand.go | 10 +++++----- dtos/responses/corecommand_test.go | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dtos/responses/corecommand.go b/dtos/responses/corecommand.go index c071643a..4089cfe6 100644 --- a/dtos/responses/corecommand.go +++ b/dtos/responses/corecommand.go @@ -29,13 +29,13 @@ func NewDeviceCoreCommandResponse(requestId string, message string, statusCode i // This object and its properties correspond to the MultiDeviceCoreCommandsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.x#/MultiDeviceCoreCommandsResponse type MultiDeviceCoreCommandsResponse struct { - common.BaseResponse `json:",inline"` - DeviceCoreCommands []dtos.DeviceCoreCommand `json:"deviceCoreCommands"` + common.BaseWithTotalCountResponse `json:",inline"` + DeviceCoreCommands []dtos.DeviceCoreCommand `json:"deviceCoreCommands"` } -func NewMultiDeviceCoreCommandsResponse(requestId string, message string, statusCode int, commands []dtos.DeviceCoreCommand) MultiDeviceCoreCommandsResponse { +func NewMultiDeviceCoreCommandsResponse(requestId string, message string, statusCode int, totalCount uint32, commands []dtos.DeviceCoreCommand) MultiDeviceCoreCommandsResponse { return MultiDeviceCoreCommandsResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - DeviceCoreCommands: commands, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + DeviceCoreCommands: commands, } } diff --git a/dtos/responses/corecommand_test.go b/dtos/responses/corecommand_test.go index 4ad436f6..3fd1be4b 100644 --- a/dtos/responses/corecommand_test.go +++ b/dtos/responses/corecommand_test.go @@ -63,10 +63,12 @@ func TestNewMultiDeviceCoreCommandsResponse(t *testing.T) { }, }, } - actual := NewMultiDeviceCoreCommandsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedDeviceCoreCommands) + expectedTotalCount := uint32(2) + actual := NewMultiDeviceCoreCommandsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedDeviceCoreCommands) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedDeviceCoreCommands, actual.DeviceCoreCommands) } From e8f11e024030ece5a6f2af97ad500f2ec4e3e364 Mon Sep 17 00:00:00 2001 From: Jude Hung Date: Fri, 15 Oct 2021 15:25:57 +0800 Subject: [PATCH 5/7] feat(scheduler): Add totalCount field into multi-instance response DTOs This commit updates MultiIntervalsResponse and MultiIntervalActionsResponse to use inlined BaseWithTotalCountResponse, rather than BaseResponse, to include totalCount field. Signed-off-by: Jude Hung --- dtos/responses/interval.go | 10 +++++----- dtos/responses/interval_test.go | 4 +++- dtos/responses/intervalaction.go | 10 +++++----- dtos/responses/intervalaction_test.go | 4 +++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dtos/responses/interval.go b/dtos/responses/interval.go index ea596342..4219b22e 100644 --- a/dtos/responses/interval.go +++ b/dtos/responses/interval.go @@ -29,13 +29,13 @@ func NewIntervalResponse(requestId string, message string, statusCode int, inter // This object and its properties correspond to the MultiIntervalsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/MultiIntervalsResponse type MultiIntervalsResponse struct { - common.BaseResponse `json:",inline"` - Intervals []dtos.Interval `json:"intervals"` + common.BaseWithTotalCountResponse `json:",inline"` + Intervals []dtos.Interval `json:"intervals"` } -func NewMultiIntervalsResponse(requestId string, message string, statusCode int, intervals []dtos.Interval) MultiIntervalsResponse { +func NewMultiIntervalsResponse(requestId string, message string, statusCode int, totalCount uint32, intervals []dtos.Interval) MultiIntervalsResponse { return MultiIntervalsResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Intervals: intervals, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Intervals: intervals, } } diff --git a/dtos/responses/interval_test.go b/dtos/responses/interval_test.go index 09dfcfff..3ac854ad 100644 --- a/dtos/responses/interval_test.go +++ b/dtos/responses/interval_test.go @@ -33,10 +33,12 @@ func TestNewMultiIntervalsResponse(t *testing.T) { {Name: "test interval1"}, {Name: "test interval2"}, } - actual := NewMultiIntervalsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedIntervals) + expectedTotalCount := uint32(len(expectedIntervals)) + actual := NewMultiIntervalsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedIntervals) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedIntervals, actual.Intervals) } diff --git a/dtos/responses/intervalaction.go b/dtos/responses/intervalaction.go index ba81521c..a36d8a43 100644 --- a/dtos/responses/intervalaction.go +++ b/dtos/responses/intervalaction.go @@ -29,13 +29,13 @@ func NewIntervalActionResponse(requestId string, message string, statusCode int, // This object and its properties correspond to the MultiIntervalActionsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/MultiIntervalActionsResponse type MultiIntervalActionsResponse struct { - common.BaseResponse `json:",inline"` - Actions []dtos.IntervalAction `json:"actions"` + common.BaseWithTotalCountResponse `json:",inline"` + Actions []dtos.IntervalAction `json:"actions"` } -func NewMultiIntervalActionsResponse(requestId string, message string, statusCode int, actions []dtos.IntervalAction) MultiIntervalActionsResponse { +func NewMultiIntervalActionsResponse(requestId string, message string, statusCode int, totalCount uint32, actions []dtos.IntervalAction) MultiIntervalActionsResponse { return MultiIntervalActionsResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Actions: actions, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Actions: actions, } } diff --git a/dtos/responses/intervalaction_test.go b/dtos/responses/intervalaction_test.go index a3591928..747f0594 100644 --- a/dtos/responses/intervalaction_test.go +++ b/dtos/responses/intervalaction_test.go @@ -34,10 +34,12 @@ func TestNewMultiIntervalActionsResponse(t *testing.T) { {Name: "test action1"}, {Name: "test action2"}, } - actual := NewMultiIntervalActionsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedActions) + expectedTotalCount := uint32(len(expectedActions)) + actual := NewMultiIntervalActionsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedActions) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedActions, actual.Actions) } From a61439cd65611e5ce8184e3b9bd7360b1901b4f9 Mon Sep 17 00:00:00 2001 From: Jude Hung Date: Sat, 16 Oct 2021 23:08:29 +0800 Subject: [PATCH 6/7] feat(notification): Add totalCount field into multi-instance response DTOs This commit updates MultiNotificationsResponse, MultiSubscriptionsResponse, and MultiTransmissionsResponse to use inlined BaseWithTotalCountResponse, rather than BaseResponse, to include totalCount field. Signed-off-by: Jude Hung --- dtos/responses/notification.go | 11 +++++------ dtos/responses/notification_test.go | 4 +++- dtos/responses/subscription.go | 11 +++++------ dtos/responses/subscription_test.go | 4 +++- dtos/responses/transmission.go | 11 +++++------ dtos/responses/transmission_test.go | 4 +++- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/dtos/responses/notification.go b/dtos/responses/notification.go index 1530977d..df20ea51 100644 --- a/dtos/responses/notification.go +++ b/dtos/responses/notification.go @@ -30,14 +30,13 @@ func NewNotificationResponse(requestId string, message string, statusCode int, // This object and its properties correspond to the MultiNotificationsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/MultiNotificationsResponse type MultiNotificationsResponse struct { - common.BaseResponse `json:",inline"` - Notifications []dtos.Notification `json:"notifications"` + common.BaseWithTotalCountResponse `json:",inline"` + Notifications []dtos.Notification `json:"notifications"` } -func NewMultiNotificationsResponse(requestId string, message string, statusCode int, - notifications []dtos.Notification) MultiNotificationsResponse { +func NewMultiNotificationsResponse(requestId string, message string, statusCode int, totalCount uint32, notifications []dtos.Notification) MultiNotificationsResponse { return MultiNotificationsResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Notifications: notifications, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Notifications: notifications, } } diff --git a/dtos/responses/notification_test.go b/dtos/responses/notification_test.go index 2159fd99..ab1c1f83 100644 --- a/dtos/responses/notification_test.go +++ b/dtos/responses/notification_test.go @@ -34,10 +34,12 @@ func TestNewMultiNotificationsResponse(t *testing.T) { {Id: "abc"}, {Id: "def"}, } - actual := NewMultiNotificationsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedNotifications) + expectedTotalCount := uint32(len(expectedNotifications)) + actual := NewMultiNotificationsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedNotifications) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedNotifications, actual.Notifications) } diff --git a/dtos/responses/subscription.go b/dtos/responses/subscription.go index 30fa6ca5..5a52118d 100644 --- a/dtos/responses/subscription.go +++ b/dtos/responses/subscription.go @@ -30,14 +30,13 @@ func NewSubscriptionResponse(requestId string, message string, statusCode int, // This object and its properties correspond to the MultiSubscriptionsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/MultiSubscriptionsResponse type MultiSubscriptionsResponse struct { - common.BaseResponse `json:",inline"` - Subscriptions []dtos.Subscription `json:"subscriptions"` + common.BaseWithTotalCountResponse `json:",inline"` + Subscriptions []dtos.Subscription `json:"subscriptions"` } -func NewMultiSubscriptionsResponse(requestId string, message string, statusCode int, - subscriptions []dtos.Subscription) MultiSubscriptionsResponse { +func NewMultiSubscriptionsResponse(requestId string, message string, statusCode int, totalCount uint32, subscriptions []dtos.Subscription) MultiSubscriptionsResponse { return MultiSubscriptionsResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Subscriptions: subscriptions, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Subscriptions: subscriptions, } } diff --git a/dtos/responses/subscription_test.go b/dtos/responses/subscription_test.go index dd5e0e8c..91779953 100644 --- a/dtos/responses/subscription_test.go +++ b/dtos/responses/subscription_test.go @@ -34,10 +34,12 @@ func TestNewMultiSubscriptionsResponse(t *testing.T) { {Name: "test Subscription1"}, {Name: "test Subscription2"}, } - actual := NewMultiSubscriptionsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedSubscriptions) + expectedTotalCount := uint32(len(expectedSubscriptions)) + actual := NewMultiSubscriptionsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedSubscriptions) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedSubscriptions, actual.Subscriptions) } diff --git a/dtos/responses/transmission.go b/dtos/responses/transmission.go index 706a5d2a..b485465e 100644 --- a/dtos/responses/transmission.go +++ b/dtos/responses/transmission.go @@ -30,14 +30,13 @@ func NewTransmissionResponse(requestId string, message string, statusCode int, // This object and its properties correspond to the MultiNotificationsResponse object in the APIv2 specification: // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/MultiTransmissionsResponse type MultiTransmissionsResponse struct { - common.BaseResponse `json:",inline"` - Transmissions []dtos.Transmission `json:"transmissions"` + common.BaseWithTotalCountResponse `json:",inline"` + Transmissions []dtos.Transmission `json:"transmissions"` } -func NewMultiTransmissionsResponse(requestId string, message string, statusCode int, - transmissions []dtos.Transmission) MultiTransmissionsResponse { +func NewMultiTransmissionsResponse(requestId string, message string, statusCode int, totalCount uint32, transmissions []dtos.Transmission) MultiTransmissionsResponse { return MultiTransmissionsResponse{ - BaseResponse: common.NewBaseResponse(requestId, message, statusCode), - Transmissions: transmissions, + BaseWithTotalCountResponse: common.NewBaseWithTotalCountResponse(requestId, message, statusCode, totalCount), + Transmissions: transmissions, } } diff --git a/dtos/responses/transmission_test.go b/dtos/responses/transmission_test.go index f0894e53..d7f5d55c 100644 --- a/dtos/responses/transmission_test.go +++ b/dtos/responses/transmission_test.go @@ -34,10 +34,12 @@ func TestNewMultiTransmissionsResponse(t *testing.T) { {Id: "abc"}, {Id: "def"}, } - actual := NewMultiTransmissionsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTransmissions) + expectedTotalCount := uint32(len(expectedTransmissions)) + actual := NewMultiTransmissionsResponse(expectedRequestId, expectedMessage, expectedStatusCode, expectedTotalCount, expectedTransmissions) assert.Equal(t, expectedRequestId, actual.RequestId) assert.Equal(t, expectedStatusCode, actual.StatusCode) assert.Equal(t, expectedMessage, actual.Message) + assert.Equal(t, expectedTotalCount, actual.TotalCount) assert.Equal(t, expectedTransmissions, actual.Transmissions) } From 99ac5f5619a62648f944ac7ba717f4713b4f487b Mon Sep 17 00:00:00 2001 From: Jude Hung Date: Mon, 18 Oct 2021 10:34:43 +0800 Subject: [PATCH 7/7] feat(all): update the api version inside all godoc from 2.x to 2.1.0 Signed-off-by: Jude Hung --- dtos/autoevent.go | 2 +- dtos/common/base.go | 16 ++++++++-------- dtos/common/config.go | 2 +- dtos/common/count.go | 2 +- dtos/common/metrics.go | 2 +- dtos/common/ping.go | 2 +- dtos/common/version.go | 4 ++-- dtos/corecommand.go | 6 +++--- dtos/device.go | 4 ++-- dtos/devicecommand.go | 2 +- dtos/deviceprofile.go | 2 +- dtos/deviceresource.go | 2 +- dtos/deviceservice.go | 4 ++-- dtos/event.go | 2 +- dtos/interval.go | 4 ++-- dtos/intervalaction.go | 4 ++-- dtos/notification.go | 2 +- dtos/provisionwatcher.go | 4 ++-- dtos/reading.go | 8 ++++---- dtos/requests/device.go | 4 ++-- dtos/requests/deviceprofile.go | 2 +- dtos/requests/deviceservice.go | 4 ++-- dtos/requests/event.go | 2 +- dtos/requests/interval.go | 4 ++-- dtos/requests/intervalaction.go | 4 ++-- dtos/requests/notification.go | 2 +- dtos/requests/operation.go | 2 +- dtos/requests/provisionwatcher.go | 4 ++-- dtos/requests/subscription.go | 4 ++-- dtos/resourceoperation.go | 2 +- dtos/resourceproperties.go | 2 +- dtos/responses/corecommand.go | 4 ++-- dtos/responses/device.go | 4 ++-- dtos/responses/deviceprofile.go | 4 ++-- dtos/responses/deviceresource.go | 2 +- dtos/responses/deviceservice.go | 4 ++-- dtos/responses/event.go | 4 ++-- dtos/responses/interval.go | 4 ++-- dtos/responses/intervalaction.go | 4 ++-- dtos/responses/notification.go | 4 ++-- dtos/responses/provisionwatcher.go | 4 ++-- dtos/responses/reading.go | 4 ++-- dtos/responses/subscription.go | 4 ++-- dtos/responses/transmission.go | 4 ++-- dtos/subscription.go | 4 ++-- dtos/transmission.go | 2 +- 46 files changed, 83 insertions(+), 83 deletions(-) diff --git a/dtos/autoevent.go b/dtos/autoevent.go index 4b4a54e3..25c206d3 100644 --- a/dtos/autoevent.go +++ b/dtos/autoevent.go @@ -10,7 +10,7 @@ import ( ) // AutoEvent and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AutoEvent +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/AutoEvent type AutoEvent struct { Interval string `json:"interval" validate:"required,edgex-dto-duration"` OnChange bool `json:"onChange"` diff --git a/dtos/common/base.go b/dtos/common/base.go index 115262b6..b87283d8 100644 --- a/dtos/common/base.go +++ b/dtos/common/base.go @@ -11,9 +11,9 @@ import ( "github.com/edgexfoundry/go-mod-core-contracts/v2/common" ) -// Request defines the base content for request DTOs (data transfer objects). +// BaseRequest defines the base content for request DTOs (data transfer objects). // This object and its properties correspond to the BaseRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/BaseRequest type BaseRequest struct { Versionable `json:",inline"` RequestId string `json:"requestId" validate:"len=0|uuid"` @@ -28,7 +28,7 @@ func NewBaseRequest() BaseRequest { // BaseResponse defines the base content for response DTOs (data transfer objects). // This object and its properties correspond to the BaseResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/BaseResponse type BaseResponse struct { Versionable `json:",inline"` RequestId string `json:"requestId,omitempty"` @@ -43,7 +43,7 @@ type Versionable struct { // BaseWithIdResponse defines the base content for response DTOs (data transfer objects). // This object and its properties correspond to the BaseWithIdResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseWithIdResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/BaseWithIdResponse type BaseWithIdResponse struct { BaseResponse `json:",inline"` Id string `json:"id"` @@ -71,7 +71,7 @@ func NewBaseWithIdResponse(requestId string, message string, statusCode int, id // BaseWithTotalCountResponse defines the base content for response DTOs (data transfer objects). // This object and its properties correspond to the BaseWithTotalCountResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseWithTotalCountResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/BaseWithTotalCountResponse type BaseWithTotalCountResponse struct { BaseResponse `json:",inline"` TotalCount uint32 `json:"totalCount"` @@ -86,7 +86,7 @@ func NewBaseWithTotalCountResponse(requestId string, message string, statusCode // BaseWithServiceNameResponse defines the base content for response DTOs (data transfer objects). // This object and its properties correspond to the BaseWithServiceNameResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.x#/BaseWithServiceNameResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.1.0#/BaseWithServiceNameResponse type BaseWithServiceNameResponse struct { BaseResponse `json:",inline"` ServiceName string `json:"serviceName"` @@ -94,7 +94,7 @@ type BaseWithServiceNameResponse struct { // BaseWithMetricsResponse defines the base content for response DTOs (data transfer objects). // This object and its properties correspond to the BaseWithMetricsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.x#/BaseWithMetricsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.1.0#/BaseWithMetricsResponse type BaseWithMetricsResponse struct { BaseResponse `json:",inline"` ServiceName string `json:"serviceName"` @@ -103,7 +103,7 @@ type BaseWithMetricsResponse struct { // BaseWithConfigResponse defines the base content for response DTOs (data transfer objects). // This object and its properties correspond to the BaseWithConfigResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.x#/BaseWithConfigResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.1.0#/BaseWithConfigResponse type BaseWithConfigResponse struct { BaseResponse `json:",inline"` ServiceName string `json:"serviceName"` diff --git a/dtos/common/config.go b/dtos/common/config.go index f72d8f40..dc1c17f3 100644 --- a/dtos/common/config.go +++ b/dtos/common/config.go @@ -8,7 +8,7 @@ package common // ConfigResponse defines the configuration for the targeted service. // This object and its properties correspond to the ConfigResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/ConfigResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/ConfigResponse type ConfigResponse struct { Versionable `json:",inline"` Config interface{} `json:"config"` diff --git a/dtos/common/count.go b/dtos/common/count.go index 46f3b239..7c1f57b5 100644 --- a/dtos/common/count.go +++ b/dtos/common/count.go @@ -2,7 +2,7 @@ package common // CountResponse defines the Response Content for GET count DTO. // This object and its properties correspond to the CountResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/CountResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/CountResponse type CountResponse struct { BaseResponse `json:",inline"` Count uint32 diff --git a/dtos/common/metrics.go b/dtos/common/metrics.go index 9e508500..f8b62c7a 100644 --- a/dtos/common/metrics.go +++ b/dtos/common/metrics.go @@ -18,7 +18,7 @@ type Metrics struct { // MetricsResponse defines the providing memory and cpu utilization stats of the service. // This object and its properties correspond to the MetricsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/MetricsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/MetricsResponse type MetricsResponse struct { Versionable `json:",inline"` Metrics Metrics `json:"metrics"` diff --git a/dtos/common/ping.go b/dtos/common/ping.go index fe015211..b23320b0 100644 --- a/dtos/common/ping.go +++ b/dtos/common/ping.go @@ -12,7 +12,7 @@ import ( // PingResponse defines the content of response content for POST Ping DTO // This object and its properties correspond to the Ping object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/PingResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/PingResponse type PingResponse struct { Versionable `json:",inline"` Timestamp string `json:"timestamp"` diff --git a/dtos/common/version.go b/dtos/common/version.go index 477ec8bd..290c160f 100644 --- a/dtos/common/version.go +++ b/dtos/common/version.go @@ -8,7 +8,7 @@ package common // VersionResponse defines the latest version supported by the service. // This object and its properties correspond to the VersionResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/VersionResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/VersionResponse type VersionResponse struct { Versionable `json:",inline"` Version string `json:"version"` @@ -16,7 +16,7 @@ type VersionResponse struct { // VersionSdkResponse defines the latest sdk version supported by the service. // This object and its properties correspond to the VersionSdkResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/VersionSdkResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/VersionSdkResponse type VersionSdkResponse struct { VersionResponse `json:",inline"` SdkVersion string `json:"sdk_version"` diff --git a/dtos/corecommand.go b/dtos/corecommand.go index 1bbecbb8..70e2d244 100644 --- a/dtos/corecommand.go +++ b/dtos/corecommand.go @@ -6,7 +6,7 @@ package dtos // DeviceCoreCommand and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.x#/DeviceCoreCommand +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.1.0#/DeviceCoreCommand type DeviceCoreCommand struct { DeviceName string `json:"deviceName" validate:"required,edgex-dto-rfc3986-unreserved-chars"` ProfileName string `json:"profileName" validate:"required,edgex-dto-rfc3986-unreserved-chars"` @@ -14,7 +14,7 @@ type DeviceCoreCommand struct { } // CoreCommand and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.x#/CoreCommand +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.1.0#/CoreCommand type CoreCommand struct { Name string `json:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` Get bool `json:"get,omitempty" validate:"required_without=Set"` @@ -25,7 +25,7 @@ type CoreCommand struct { } // CoreCommandParameter and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.x#/CoreCommandParameter +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.1.0#/CoreCommandParameter type CoreCommandParameter struct { ResourceName string `json:"resourceName"` ValueType string `json:"valueType"` diff --git a/dtos/device.go b/dtos/device.go index 727b4c08..54a8ba08 100644 --- a/dtos/device.go +++ b/dtos/device.go @@ -10,7 +10,7 @@ import ( ) // Device and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Device +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/Device type Device struct { DBTimestamp `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` @@ -29,7 +29,7 @@ type Device struct { } // UpdateDevice and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDevice +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/UpdateDevice type UpdateDevice struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` diff --git a/dtos/devicecommand.go b/dtos/devicecommand.go index 2860d21a..c972bcda 100644 --- a/dtos/devicecommand.go +++ b/dtos/devicecommand.go @@ -8,7 +8,7 @@ package dtos import "github.com/edgexfoundry/go-mod-core-contracts/v2/models" // DeviceCommand and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceCommand +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceCommand type DeviceCommand struct { Name string `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` IsHidden bool `json:"isHidden" yaml:"isHidden"` diff --git a/dtos/deviceprofile.go b/dtos/deviceprofile.go index 5438ea9d..b2e99b11 100644 --- a/dtos/deviceprofile.go +++ b/dtos/deviceprofile.go @@ -15,7 +15,7 @@ import ( ) // DeviceProfile and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceProfile +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceProfile type DeviceProfile struct { DBTimestamp `json:",inline"` Id string `json:"id" validate:"omitempty,uuid"` diff --git a/dtos/deviceresource.go b/dtos/deviceresource.go index 3925f38c..611d82c7 100644 --- a/dtos/deviceresource.go +++ b/dtos/deviceresource.go @@ -8,7 +8,7 @@ package dtos import "github.com/edgexfoundry/go-mod-core-contracts/v2/models" // DeviceResource and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceResource +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceResource type DeviceResource struct { Description string `json:"description" yaml:"description"` Name string `json:"name" yaml:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` diff --git a/dtos/deviceservice.go b/dtos/deviceservice.go index c1058cd8..17d3095c 100644 --- a/dtos/deviceservice.go +++ b/dtos/deviceservice.go @@ -10,7 +10,7 @@ import ( ) // DeviceService and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceService +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceService type DeviceService struct { DBTimestamp `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` @@ -24,7 +24,7 @@ type DeviceService struct { } // UpdateDeviceService and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDeviceService +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/UpdateDeviceService type UpdateDeviceService struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` diff --git a/dtos/event.go b/dtos/event.go index bc9a72f9..fe3b7595 100644 --- a/dtos/event.go +++ b/dtos/event.go @@ -18,7 +18,7 @@ import ( ) // Event and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/Event +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/Event type Event struct { common.Versionable `json:",inline"` Id string `json:"id" validate:"required,uuid"` diff --git a/dtos/interval.go b/dtos/interval.go index d38209f4..b970c381 100644 --- a/dtos/interval.go +++ b/dtos/interval.go @@ -10,7 +10,7 @@ import ( ) // Interval and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/Interval +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/Interval type Interval struct { DBTimestamp `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` @@ -26,7 +26,7 @@ func NewInterval(name, interval string) Interval { } // UpdateInterval and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/UpdateInterval +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/UpdateInterval type UpdateInterval struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` diff --git a/dtos/intervalaction.go b/dtos/intervalaction.go index 1336e7fc..3fbea7bd 100644 --- a/dtos/intervalaction.go +++ b/dtos/intervalaction.go @@ -10,7 +10,7 @@ import ( ) // IntervalAction and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/IntervalAction +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/IntervalAction type IntervalAction struct { DBTimestamp `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` @@ -33,7 +33,7 @@ func NewIntervalAction(name string, intervalName string, address Address) Interv } // UpdateIntervalAction and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/UpdateIntervalAction +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/UpdateIntervalAction type UpdateIntervalAction struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` diff --git a/dtos/notification.go b/dtos/notification.go index 5b0ad940..5302f75b 100644 --- a/dtos/notification.go +++ b/dtos/notification.go @@ -12,7 +12,7 @@ import ( ) // Notification and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/Notification +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/Notification type Notification struct { DBTimestamp `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` diff --git a/dtos/provisionwatcher.go b/dtos/provisionwatcher.go index 7469d8ab..6253cbf0 100644 --- a/dtos/provisionwatcher.go +++ b/dtos/provisionwatcher.go @@ -10,7 +10,7 @@ import ( ) // ProvisionWatcher and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ProvisionWatcher +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/ProvisionWatcher type ProvisionWatcher struct { DBTimestamp `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` @@ -25,7 +25,7 @@ type ProvisionWatcher struct { } // UpdateProvisionWatcher and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateProvisionWatcher +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/UpdateProvisionWatcher type UpdateProvisionWatcher struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` diff --git a/dtos/reading.go b/dtos/reading.go index 62040c86..d669528e 100644 --- a/dtos/reading.go +++ b/dtos/reading.go @@ -18,7 +18,7 @@ import ( ) // BaseReading and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseReading +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/BaseReading type BaseReading struct { Id string `json:"id,omitempty"` Origin int64 `json:"origin" validate:"required"` @@ -32,20 +32,20 @@ type BaseReading struct { } // SimpleReading and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/SimpleReading +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/SimpleReading type SimpleReading struct { Value string `json:"value,omitempty" validate:"required"` } // BinaryReading and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BinaryReading +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/BinaryReading type BinaryReading struct { BinaryValue []byte `json:"binaryValue,omitempty" validate:"gt=0,required"` MediaType string `json:"mediaType,omitempty" validate:"required"` } // ObjectReading and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/ObjectReading +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/ObjectReading type ObjectReading struct { ObjectValue interface{} `json:"objectValue,omitempty" validate:"required"` } diff --git a/dtos/requests/device.go b/dtos/requests/device.go index 846d131f..582790eb 100644 --- a/dtos/requests/device.go +++ b/dtos/requests/device.go @@ -17,7 +17,7 @@ import ( // AddDeviceRequest defines the Request Content for POST Device DTO. // This object and its properties correspond to the AddDeviceRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AddDeviceRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/AddDeviceRequest type AddDeviceRequest struct { dtoCommon.BaseRequest `json:",inline"` Device dtos.Device `json:"device"` @@ -59,7 +59,7 @@ func AddDeviceReqToDeviceModels(addRequests []AddDeviceRequest) (Devices []model // UpdateDeviceRequest defines the Request Content for PUT event as pushed DTO. // This object and its properties correspond to the UpdateDeviceRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDeviceRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/UpdateDeviceRequest type UpdateDeviceRequest struct { dtoCommon.BaseRequest `json:",inline"` Device dtos.UpdateDevice `json:"device"` diff --git a/dtos/requests/deviceprofile.go b/dtos/requests/deviceprofile.go index a35ee9e0..3e864990 100644 --- a/dtos/requests/deviceprofile.go +++ b/dtos/requests/deviceprofile.go @@ -17,7 +17,7 @@ import ( // DeviceProfileRequest defines the Request Content for POST DeviceProfile DTO. // This object and its properties correspond to the DeviceProfileRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AddDeviceProfileRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/AddDeviceProfileRequest type DeviceProfileRequest struct { dtoCommon.BaseRequest `json:",inline"` Profile dtos.DeviceProfile `json:"profile"` diff --git a/dtos/requests/deviceservice.go b/dtos/requests/deviceservice.go index 4029602b..f69017ca 100644 --- a/dtos/requests/deviceservice.go +++ b/dtos/requests/deviceservice.go @@ -17,7 +17,7 @@ import ( // AddDeviceServiceRequest defines the Request Content for POST DeviceService DTO. // This object and its properties correspond to the AddDeviceServiceRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AddDeviceServiceRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/AddDeviceServiceRequest type AddDeviceServiceRequest struct { dtoCommon.BaseRequest `json:",inline"` Service dtos.DeviceService `json:"service"` @@ -59,7 +59,7 @@ func AddDeviceServiceReqToDeviceServiceModels(addRequests []AddDeviceServiceRequ // UpdateDeviceServiceRequest defines the Request Content for PUT event as pushed DTO. // This object and its properties correspond to the UpdateDeviceServiceRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDeviceServiceRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/UpdateDeviceServiceRequest type UpdateDeviceServiceRequest struct { dtoCommon.BaseRequest `json:",inline"` Service dtos.UpdateDeviceService `json:"service"` diff --git a/dtos/requests/event.go b/dtos/requests/event.go index 85725944..c0cca550 100644 --- a/dtos/requests/event.go +++ b/dtos/requests/event.go @@ -20,7 +20,7 @@ import ( // AddEventRequest defines the Request Content for POST event DTO. // This object and its properties correspond to the AddEventRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/AddEventRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/AddEventRequest type AddEventRequest struct { dtoCommon.BaseRequest `json:",inline"` Event dtos.Event `json:"event" validate:"required"` diff --git a/dtos/requests/interval.go b/dtos/requests/interval.go index 29ce77a2..c31f09e3 100644 --- a/dtos/requests/interval.go +++ b/dtos/requests/interval.go @@ -17,7 +17,7 @@ import ( // AddIntervalRequest defines the Request Content for POST Interval DTO. // This object and its properties correspond to the AddIntervalRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/AddIntervalRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/AddIntervalRequest type AddIntervalRequest struct { dtoCommon.BaseRequest `json:",inline"` Interval dtos.Interval `json:"interval"` @@ -59,7 +59,7 @@ func AddIntervalReqToIntervalModels(addRequests []AddIntervalRequest) (intervals // UpdateIntervalRequest defines the Request Content for PUT event as pushed DTO. // This object and its properties correspond to the UpdateIntervalRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/UpdateIntervalRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/UpdateIntervalRequest type UpdateIntervalRequest struct { dtoCommon.BaseRequest `json:",inline"` Interval dtos.UpdateInterval `json:"interval"` diff --git a/dtos/requests/intervalaction.go b/dtos/requests/intervalaction.go index 32eb50cb..cc273b32 100644 --- a/dtos/requests/intervalaction.go +++ b/dtos/requests/intervalaction.go @@ -17,7 +17,7 @@ import ( // AddIntervalRequest defines the Request Content for POST Interval DTO. // This object and its properties correspond to the AddIntervalRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/AddIntervalActionRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/AddIntervalActionRequest type AddIntervalActionRequest struct { dtoCommon.BaseRequest `json:",inline"` Action dtos.IntervalAction `json:"action"` @@ -66,7 +66,7 @@ func AddIntervalActionReqToIntervalActionModels(addRequests []AddIntervalActionR // UpdateIntervalActionRequest defines the Request Content for PUT event as pushed DTO. // This object and its properties correspond to the UpdateIntervalActionRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/UpdateIntervalActionRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/UpdateIntervalActionRequest type UpdateIntervalActionRequest struct { dtoCommon.BaseRequest `json:",inline"` Action dtos.UpdateIntervalAction `json:"action"` diff --git a/dtos/requests/notification.go b/dtos/requests/notification.go index d6a7e7c0..ca965134 100644 --- a/dtos/requests/notification.go +++ b/dtos/requests/notification.go @@ -17,7 +17,7 @@ import ( // AddNotificationRequest defines the Request Content for POST Notification DTO. // This object and its properties correspond to the AddNotificationRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/AddNotificationRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/AddNotificationRequest type AddNotificationRequest struct { dtoCommon.BaseRequest `json:",inline"` Notification dtos.Notification `json:"notification"` diff --git a/dtos/requests/operation.go b/dtos/requests/operation.go index d57c3df6..5efafa14 100644 --- a/dtos/requests/operation.go +++ b/dtos/requests/operation.go @@ -15,7 +15,7 @@ import ( // OperationRequest defines the Request Content for SMA POST Operation. // This object and its properties correspond to the OperationRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.x#/OperationRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/system-agent/2.1.0#/OperationRequest type OperationRequest struct { dtoCommon.BaseRequest `json:",inline"` ServiceName string `json:"serviceName" validate:"required"` diff --git a/dtos/requests/provisionwatcher.go b/dtos/requests/provisionwatcher.go index 65e903ca..97ecfb88 100644 --- a/dtos/requests/provisionwatcher.go +++ b/dtos/requests/provisionwatcher.go @@ -17,7 +17,7 @@ import ( // AddProvisionWatcherRequest defines the Request Content for POST ProvisionWatcher DTO. // This object and its properties correspond to the AddProvisionWatcherRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AddProvisionWatcherRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/AddProvisionWatcherRequest type AddProvisionWatcherRequest struct { dtoCommon.BaseRequest `json:",inline"` ProvisionWatcher dtos.ProvisionWatcher `json:"provisionWatcher"` @@ -59,7 +59,7 @@ func AddProvisionWatcherReqToProvisionWatcherModels(addRequests []AddProvisionWa // UpdateProvisionWatcherRequest defines the Request Content for PUT event as pushed DTO. // This object and its properties correspond to the UpdateProvisionWatcherRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateProvisionWatcherRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/UpdateProvisionWatcherRequest type UpdateProvisionWatcherRequest struct { dtoCommon.BaseRequest `json:",inline"` ProvisionWatcher dtos.UpdateProvisionWatcher `json:"provisionWatcher"` diff --git a/dtos/requests/subscription.go b/dtos/requests/subscription.go index 35574068..b4592027 100644 --- a/dtos/requests/subscription.go +++ b/dtos/requests/subscription.go @@ -19,7 +19,7 @@ var supportedChannelTypes = []string{common.EMAIL, common.REST} // AddSubscriptionRequest defines the Request Content for POST Subscription DTO. // This object and its properties correspond to the AddSubscriptionRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/AddSubscriptionRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/AddSubscriptionRequest type AddSubscriptionRequest struct { dtoCommon.BaseRequest `json:",inline"` Subscription dtos.Subscription `json:"subscription"` @@ -72,7 +72,7 @@ func AddSubscriptionReqToSubscriptionModels(reqs []AddSubscriptionRequest) (s [] // UpdateSubscriptionRequest defines the Request Content for PUT event as pushed DTO. // This object and its properties correspond to the UpdateSubscriptionRequest object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/UpdateSubscriptionRequest +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/UpdateSubscriptionRequest type UpdateSubscriptionRequest struct { dtoCommon.BaseRequest `json:",inline"` Subscription dtos.UpdateSubscription `json:"subscription"` diff --git a/dtos/resourceoperation.go b/dtos/resourceoperation.go index 92371b95..27c247d7 100644 --- a/dtos/resourceoperation.go +++ b/dtos/resourceoperation.go @@ -8,7 +8,7 @@ package dtos import "github.com/edgexfoundry/go-mod-core-contracts/v2/models" // ResourceOperation and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ResourceOperation +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/ResourceOperation type ResourceOperation struct { DeviceResource string `json:"deviceResource" yaml:"deviceResource" validate:"required"` // The replacement of Object field DefaultValue string `json:"defaultValue" yaml:"defaultValue"` diff --git a/dtos/resourceproperties.go b/dtos/resourceproperties.go index 57777a60..a6dffee9 100644 --- a/dtos/resourceproperties.go +++ b/dtos/resourceproperties.go @@ -8,7 +8,7 @@ package dtos import "github.com/edgexfoundry/go-mod-core-contracts/v2/models" // ResourceProperties and its properties care defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ResourceProperties +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/ResourceProperties type ResourceProperties struct { ValueType string `json:"valueType" yaml:"valueType" validate:"required,edgex-dto-value-type"` ReadWrite string `json:"readWrite" yaml:"readWrite" validate:"required,oneof='R' 'W' 'RW'"` diff --git a/dtos/responses/corecommand.go b/dtos/responses/corecommand.go index 4089cfe6..97a88f93 100644 --- a/dtos/responses/corecommand.go +++ b/dtos/responses/corecommand.go @@ -12,7 +12,7 @@ import ( // DeviceCoreCommandResponse defines the Response Content for GET DeviceCoreCommand DTO. // This object and its properties correspond to the DeviceCoreCommandResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.x#/DeviceCoreCommandResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.1.0#/DeviceCoreCommandResponse type DeviceCoreCommandResponse struct { common.BaseResponse `json:",inline"` DeviceCoreCommand dtos.DeviceCoreCommand `json:"deviceCoreCommand"` @@ -27,7 +27,7 @@ func NewDeviceCoreCommandResponse(requestId string, message string, statusCode i // MultiDeviceCoreCommandsResponse defines the Response Content for GET multiple DeviceCoreCommand DTOs. // This object and its properties correspond to the MultiDeviceCoreCommandsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.x#/MultiDeviceCoreCommandsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-command/2.1.0#/MultiDeviceCoreCommandsResponse type MultiDeviceCoreCommandsResponse struct { common.BaseWithTotalCountResponse `json:",inline"` DeviceCoreCommands []dtos.DeviceCoreCommand `json:"deviceCoreCommands"` diff --git a/dtos/responses/device.go b/dtos/responses/device.go index 69275724..8ae97395 100644 --- a/dtos/responses/device.go +++ b/dtos/responses/device.go @@ -12,7 +12,7 @@ import ( // DeviceResponse defines the Response Content for GET Device DTOs. // This object and its properties correspond to the DeviceResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceResponse type DeviceResponse struct { common.BaseResponse `json:",inline"` Device dtos.Device `json:"device"` @@ -27,7 +27,7 @@ func NewDeviceResponse(requestId string, message string, statusCode int, device // MultiDevicesResponse defines the Response Content for GET multiple Device DTOs. // This object and its properties correspond to the MultiDevicesResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiDevicesResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/MultiDevicesResponse type MultiDevicesResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Devices []dtos.Device `json:"devices"` diff --git a/dtos/responses/deviceprofile.go b/dtos/responses/deviceprofile.go index 7e8f7a55..3e6e7a51 100644 --- a/dtos/responses/deviceprofile.go +++ b/dtos/responses/deviceprofile.go @@ -12,7 +12,7 @@ import ( // DeviceProfileResponse defines the Response Content for GET DeviceProfile DTOs. // This object and its properties correspond to the DeviceProfileResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceProfileResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceProfileResponse type DeviceProfileResponse struct { common.BaseResponse `json:",inline"` Profile dtos.DeviceProfile `json:"profile"` @@ -27,7 +27,7 @@ func NewDeviceProfileResponse(requestId string, message string, statusCode int, // MultiDeviceProfilesResponse defines the Response Content for GET multiple DeviceProfile DTOs. // This object and its properties correspond to the MultiDeviceProfilesResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiDeviceProfilesResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/MultiDeviceProfilesResponse type MultiDeviceProfilesResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Profiles []dtos.DeviceProfile `json:"profiles"` diff --git a/dtos/responses/deviceresource.go b/dtos/responses/deviceresource.go index f8e3b3dd..70492c83 100644 --- a/dtos/responses/deviceresource.go +++ b/dtos/responses/deviceresource.go @@ -12,7 +12,7 @@ import ( // DeviceResourceResponse defines the Response Content for GET DeviceResource DTOs. // This object and its properties correspond to the DeviceResourceResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceResourceResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceResourceResponse type DeviceResourceResponse struct { common.BaseResponse `json:",inline"` Resource dtos.DeviceResource `json:"resource"` diff --git a/dtos/responses/deviceservice.go b/dtos/responses/deviceservice.go index 9e3e2fbe..ea562f95 100644 --- a/dtos/responses/deviceservice.go +++ b/dtos/responses/deviceservice.go @@ -12,7 +12,7 @@ import ( // DeviceServiceResponse defines the Response Content for GET DeviceService DTOs. // This object and its properties correspond to the DeviceServiceResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceServiceResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/DeviceServiceResponse type DeviceServiceResponse struct { common.BaseResponse `json:",inline"` Service dtos.DeviceService `json:"service"` @@ -27,7 +27,7 @@ func NewDeviceServiceResponse(requestId string, message string, statusCode int, // MultiDeviceServicesResponse defines the Response Content for GET multiple DeviceService DTOs. // This object and its properties correspond to the MultiDeviceServicesResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiDeviceServicesResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/MultiDeviceServicesResponse type MultiDeviceServicesResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Services []dtos.DeviceService `json:"services"` diff --git a/dtos/responses/event.go b/dtos/responses/event.go index d5d83b58..ee455a33 100644 --- a/dtos/responses/event.go +++ b/dtos/responses/event.go @@ -18,7 +18,7 @@ import ( // EventResponse defines the Response Content for GET event DTOs. // This object and its properties correspond to the EventResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/EventResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/EventResponse type EventResponse struct { dtoCommon.BaseResponse `json:",inline"` Event dtos.Event `json:"event"` @@ -26,7 +26,7 @@ type EventResponse struct { // MultiEventsResponse defines the Response Content for GET multiple event DTOs. // This object and its properties correspond to the MultiEventsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/MultiEventsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/MultiEventsResponse type MultiEventsResponse struct { dtoCommon.BaseWithTotalCountResponse `json:",inline"` Events []dtos.Event `json:"events"` diff --git a/dtos/responses/interval.go b/dtos/responses/interval.go index 4219b22e..07f1fd30 100644 --- a/dtos/responses/interval.go +++ b/dtos/responses/interval.go @@ -12,7 +12,7 @@ import ( // IntervalResponse defines the Response Content for GET Interval DTOs. // This object and its properties correspond to the IntervalResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/IntervalResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/IntervalResponse type IntervalResponse struct { common.BaseResponse `json:",inline"` Interval dtos.Interval `json:"interval"` @@ -27,7 +27,7 @@ func NewIntervalResponse(requestId string, message string, statusCode int, inter // MultiIntervalsResponse defines the Response Content for GET multiple Interval DTOs. // This object and its properties correspond to the MultiIntervalsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/MultiIntervalsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/MultiIntervalsResponse type MultiIntervalsResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Intervals []dtos.Interval `json:"intervals"` diff --git a/dtos/responses/intervalaction.go b/dtos/responses/intervalaction.go index a36d8a43..c8c957f1 100644 --- a/dtos/responses/intervalaction.go +++ b/dtos/responses/intervalaction.go @@ -12,7 +12,7 @@ import ( // IntervalActionResponse defines the Response Content for GET IntervalAction DTOs. // This object and its properties correspond to the IntervalActionResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/IntervalActionResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/IntervalActionResponse type IntervalActionResponse struct { common.BaseResponse `json:",inline"` Action dtos.IntervalAction `json:"action"` @@ -27,7 +27,7 @@ func NewIntervalActionResponse(requestId string, message string, statusCode int, // MultiIntervalActionsResponse defines the Response Content for GET multiple IntervalAction DTOs. // This object and its properties correspond to the MultiIntervalActionsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.x#/MultiIntervalActionsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-scheduler/2.1.0#/MultiIntervalActionsResponse type MultiIntervalActionsResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Actions []dtos.IntervalAction `json:"actions"` diff --git a/dtos/responses/notification.go b/dtos/responses/notification.go index df20ea51..a7d76623 100644 --- a/dtos/responses/notification.go +++ b/dtos/responses/notification.go @@ -12,7 +12,7 @@ import ( // NotificationResponse defines the Response Content for GET Notification DTO. // This object and its properties correspond to the NotificationResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/NotificationResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/NotificationResponse type NotificationResponse struct { common.BaseResponse `json:",inline"` Notification dtos.Notification `json:"notification"` @@ -28,7 +28,7 @@ func NewNotificationResponse(requestId string, message string, statusCode int, // MultiNotificationsResponse defines the Response Content for GET multiple Notification DTOs. // This object and its properties correspond to the MultiNotificationsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/MultiNotificationsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/MultiNotificationsResponse type MultiNotificationsResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Notifications []dtos.Notification `json:"notifications"` diff --git a/dtos/responses/provisionwatcher.go b/dtos/responses/provisionwatcher.go index 1c9d3bc6..b2d1c0c6 100644 --- a/dtos/responses/provisionwatcher.go +++ b/dtos/responses/provisionwatcher.go @@ -12,7 +12,7 @@ import ( // ProvisionWatcherResponse defines the Response Content for GET ProvisionWatcher DTOs. // This object and its properties correspond to the ProvisionWatcherResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ProvisionWatcherResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/ProvisionWatcherResponse type ProvisionWatcherResponse struct { common.BaseResponse `json:",inline"` ProvisionWatcher dtos.ProvisionWatcher `json:"provisionWatcher"` @@ -27,7 +27,7 @@ func NewProvisionWatcherResponse(requestId string, message string, statusCode in // MultiProvisionWatchersResponse defines the Response Content for GET multiple ProvisionWatcher DTOs. // This object and its properties correspond to the MultiProvisionWatchersResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/MultiProvisionWatchersResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/MultiProvisionWatchersResponse type MultiProvisionWatchersResponse struct { common.BaseWithTotalCountResponse `json:",inline"` ProvisionWatchers []dtos.ProvisionWatcher `json:"provisionWatchers"` diff --git a/dtos/responses/reading.go b/dtos/responses/reading.go index f506751d..5c077da1 100644 --- a/dtos/responses/reading.go +++ b/dtos/responses/reading.go @@ -12,7 +12,7 @@ import ( // ReadingResponse defines the Response Content for GET reading DTO. // This object and its properties correspond to the ReadingResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/ReadingResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/ReadingResponse type ReadingResponse struct { common.BaseResponse `json:",inline"` Reading dtos.BaseReading `json:"reading"` @@ -20,7 +20,7 @@ type ReadingResponse struct { // MultiReadingsResponse defines the Response Content for GET multiple reading DTO. // This object and its properties correspond to the MultiReadingsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/MultiReadingsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.1.0#/MultiReadingsResponse type MultiReadingsResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Readings []dtos.BaseReading `json:"readings"` diff --git a/dtos/responses/subscription.go b/dtos/responses/subscription.go index 5a52118d..708ff0da 100644 --- a/dtos/responses/subscription.go +++ b/dtos/responses/subscription.go @@ -12,7 +12,7 @@ import ( // SubscriptionResponse defines the Subscription Content for GET Subscription DTOs. // This object and its properties correspond to the SubscriptionResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/SubscriptionResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/SubscriptionResponse type SubscriptionResponse struct { common.BaseResponse `json:",inline"` Subscription dtos.Subscription `json:"subscription"` @@ -28,7 +28,7 @@ func NewSubscriptionResponse(requestId string, message string, statusCode int, // MultiSubscriptionsResponse defines the Subscription Content for GET multiple Subscription DTOs. // This object and its properties correspond to the MultiSubscriptionsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/MultiSubscriptionsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/MultiSubscriptionsResponse type MultiSubscriptionsResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Subscriptions []dtos.Subscription `json:"subscriptions"` diff --git a/dtos/responses/transmission.go b/dtos/responses/transmission.go index b485465e..87ad885e 100644 --- a/dtos/responses/transmission.go +++ b/dtos/responses/transmission.go @@ -12,7 +12,7 @@ import ( // TransmissionResponse defines the Response Content for GET Transmission DTO. // This object and its properties correspond to the NotificationResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/TransmissionResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/TransmissionResponse type TransmissionResponse struct { common.BaseResponse `json:",inline"` Transmission dtos.Transmission `json:"transmission"` @@ -28,7 +28,7 @@ func NewTransmissionResponse(requestId string, message string, statusCode int, // MultiTransmissionsResponse defines the Response Content for GET multiple Transmission DTOs. // This object and its properties correspond to the MultiNotificationsResponse object in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/MultiTransmissionsResponse +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/MultiTransmissionsResponse type MultiTransmissionsResponse struct { common.BaseWithTotalCountResponse `json:",inline"` Transmissions []dtos.Transmission `json:"transmissions"` diff --git a/dtos/subscription.go b/dtos/subscription.go index 652176e5..55fc3d28 100644 --- a/dtos/subscription.go +++ b/dtos/subscription.go @@ -10,7 +10,7 @@ import ( ) // Subscription and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/Subscription +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/Subscription type Subscription struct { DBTimestamp `json:",inline"` Id string `json:"id,omitempty" validate:"omitempty,uuid"` @@ -26,7 +26,7 @@ type Subscription struct { } // UpdateSubscription and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/UpdateSubscription +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/UpdateSubscription type UpdateSubscription struct { Id *string `json:"id" validate:"required_without=Name,edgex-dto-uuid"` Name *string `json:"name" validate:"required_without=Id,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"` diff --git a/dtos/transmission.go b/dtos/transmission.go index dd55626f..90cffb80 100644 --- a/dtos/transmission.go +++ b/dtos/transmission.go @@ -10,7 +10,7 @@ import ( ) // Transmission and its properties are defined in the APIv2 specification: -// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.x#/Transmission +// https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/support-notifications/2.1.0#/Transmission type Transmission struct { Created int64 `json:"created,omitempty"` Id string `json:"id,omitempty" validate:"omitempty,uuid"`