@@ -134,11 +134,33 @@ func (c *OtaApiClient) GetOtaStatusByOtaID(otaid string, limit int, order string
134
134
return nil , err
135
135
}
136
136
137
- func (c * OtaApiClient ) GetOtaLastStatusByDeviceID (deviceID string ) (* OtaStatusByDeviceResponse , error ) {
137
+ func (c * OtaApiClient ) GetOtaStatusByOtaIDs (otaids string ) (* OtaStatusList , error ) {
138
+
139
+ ids := strings .Split (otaids , "," )
140
+ if len (ids ) == 0 {
141
+ return nil , fmt .Errorf ("invalid ota-ids: empty" )
142
+ }
143
+
144
+ returnStatus := OtaStatusList {}
145
+ for _ , id := range ids {
146
+ if id != "" {
147
+ resp , err := c .GetOtaStatusByOtaID (id , 1 , OrderDesc )
148
+ if err != nil {
149
+ return nil , err
150
+ }
151
+ returnStatus .Ota = append (returnStatus .Ota , resp .Ota )
152
+ }
153
+
154
+ }
155
+
156
+ return & returnStatus , nil
157
+ }
158
+
159
+ func (c * OtaApiClient ) GetOtaLastStatusByDeviceID (deviceID string ) (* OtaStatusList , error ) {
138
160
return c .GetOtaStatusByDeviceID (deviceID , 1 , OrderDesc )
139
161
}
140
162
141
- func (c * OtaApiClient ) GetOtaStatusByDeviceID (deviceID string , limit int , order string ) (* OtaStatusByDeviceResponse , error ) {
163
+ func (c * OtaApiClient ) GetOtaStatusByDeviceID (deviceID string , limit int , order string ) (* OtaStatusList , error ) {
142
164
143
165
if deviceID == "" {
144
166
return nil , fmt .Errorf ("invalid device-id: empty" )
@@ -167,7 +189,7 @@ func (c *OtaApiClient) GetOtaStatusByDeviceID(deviceID string, limit int, order
167
189
bodyb , err := io .ReadAll (res .Body )
168
190
169
191
if res .StatusCode == 200 {
170
- var otaResponse OtaStatusByDeviceResponse
192
+ var otaResponse OtaStatusList
171
193
if err == nil && bodyb != nil {
172
194
err = json .Unmarshal (bodyb , & otaResponse )
173
195
if err != nil {
0 commit comments