Skip to content

Commit b03b2c7

Browse files
author
YangSen-qn
committed
modify add response body
1 parent dd062ba commit b03b2c7

File tree

2 files changed

+165
-2
lines changed

2 files changed

+165
-2
lines changed

src/main/java/com/qiniu/iam/apis/ApiModifyGroup.java

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,164 @@ public ModifyGroupParam setDescription(String description) {
160160
*/
161161
public static class Response extends Api.Response {
162162

163+
/**
164+
* 返回的用户分组响应
165+
*/
166+
private ModifyGroupResp data;
167+
163168
protected Response(com.qiniu.http.Response response) throws QiniuException {
164169
super(response);
170+
171+
this.data = Json.decode(response.bodyString(), ModifyGroupResp.class);
165172
}
166173

174+
/**
175+
* 响应信息
176+
*
177+
* @return ModifyGroupResp
178+
*/
179+
public ModifyGroupResp getData() {
180+
return this.data;
181+
}
182+
183+
/**
184+
* 返回的用户分组信息
185+
*/
186+
public static final class ModifyGroupData {
187+
188+
/**
189+
* 记录 ID
190+
*/
191+
@SerializedName("id")
192+
private String id;
193+
194+
/**
195+
* 根用户 uid
196+
*/
197+
@SerializedName("root_uid")
198+
private Integer rootUid;
199+
200+
/**
201+
* 用户分组别名
202+
*/
203+
@SerializedName("alias")
204+
private String alias;
205+
206+
/**
207+
* 用户分组描述
208+
*/
209+
@SerializedName("description")
210+
private String description;
211+
212+
/**
213+
* 用户分组是否启用
214+
*/
215+
@SerializedName("enabled")
216+
private Boolean enabled;
217+
218+
/**
219+
* 用户分组创建时间
220+
*/
221+
@SerializedName("created_at")
222+
private String createdAt;
223+
224+
/**
225+
* 用户分组上次更新时间
226+
*/
227+
@SerializedName("updated_at")
228+
private String updatedAt;
229+
230+
/**
231+
* 获取变量值
232+
* 记录 ID
233+
*
234+
* @return id
235+
*/
236+
public String getId() {
237+
return this.id;
238+
}
239+
240+
/**
241+
* 获取变量值
242+
* 根用户 uid
243+
*
244+
* @return rootUid
245+
*/
246+
public Integer getRootUid() {
247+
return this.rootUid;
248+
}
249+
250+
/**
251+
* 获取变量值
252+
* 用户分组别名
253+
*
254+
* @return alias
255+
*/
256+
public String getAlias() {
257+
return this.alias;
258+
}
259+
260+
/**
261+
* 获取变量值
262+
* 用户分组描述
263+
*
264+
* @return description
265+
*/
266+
public String getDescription() {
267+
return this.description;
268+
}
269+
270+
/**
271+
* 获取变量值
272+
* 用户分组是否启用
273+
*
274+
* @return enabled
275+
*/
276+
public Boolean getEnabled() {
277+
return this.enabled;
278+
}
279+
280+
/**
281+
* 获取变量值
282+
* 用户分组创建时间
283+
*
284+
* @return createdAt
285+
*/
286+
public String getCreatedAt() {
287+
return this.createdAt;
288+
}
289+
290+
/**
291+
* 获取变量值
292+
* 用户分组上次更新时间
293+
*
294+
* @return updatedAt
295+
*/
296+
public String getUpdatedAt() {
297+
return this.updatedAt;
298+
}
299+
}
300+
301+
/**
302+
* 返回的用户分组响应
303+
*/
304+
public static final class ModifyGroupResp {
305+
306+
/**
307+
* 用户分组信息
308+
*/
309+
@SerializedName("data")
310+
private ModifyGroupData data;
311+
312+
/**
313+
* 获取变量值
314+
* 用户分组信息
315+
*
316+
* @return data
317+
*/
318+
public ModifyGroupData getData() {
319+
return this.data;
320+
}
321+
}
167322
}
168323
}

src/test/java/com/qiniu/iam/apis/GroupsApiTest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,16 @@ void testGroups() {
118118
ApiModifyGroup.Request modifyGroupRequest = new ApiModifyGroup.Request(baseUrl, groupAlias, modifyGroupParam);
119119
ApiModifyGroup modifyGroupApi = new ApiModifyGroup(null, config);
120120
ApiModifyGroup.Response modifyGroupResponse = modifyGroupApi.request(modifyGroupRequest);
121-
Assertions.assertNotNull(modifyGroupResponse, "4. 创建分组失败:" + modifyGroupRequest);
122-
Assertions.assertTrue(modifyGroupResponse.isOK(), "4.1 创建分组失败:" + modifyGroupRequest);
121+
Assertions.assertNotNull(modifyGroupResponse, "4. 修改分组失败:" + modifyGroupResponse);
122+
Assertions.assertTrue(modifyGroupResponse.isOK(), "4.1 修改分组失败:" + modifyGroupResponse);
123+
ApiModifyGroup.Response.ModifyGroupData modifyGroupResponseData = modifyGroupResponse.getData().getData();
124+
Assertions.assertNotNull(modifyGroupResponseData.getId(), "4.2 修改分组失败:" + modifyGroupResponse);
125+
Assertions.assertNotNull(modifyGroupResponseData.getRootUid(), "4.3 修改分组失败:" + modifyGroupResponse);
126+
Assertions.assertNotNull(modifyGroupResponseData.getAlias(), "4.4 修改分组失败:" + modifyGroupResponse);
127+
Assertions.assertEquals(modifyGroupResponseData.getDescription(), groupDescription, "4.5 修改分组失败:" + modifyGroupResponse);
128+
Assertions.assertEquals(modifyGroupResponseData.getEnabled(), true, "4.6 修改分组失败:" + modifyGroupResponse);
129+
Assertions.assertNotNull(modifyGroupResponseData.getCreatedAt(), "4.7 修改分组失败:" + modifyGroupResponse);
130+
Assertions.assertNotNull(modifyGroupResponseData.getUpdatedAt(), "4.8 修改分组失败:" + modifyGroupResponse);
123131

124132
groupAlias = newGroupAlias;
125133

0 commit comments

Comments
 (0)