Skip to content

Commit 107c7ba

Browse files
fix: naming conventions are corrected [CS-35325]
fix: naming conventions are corrected [CS-35325]
1 parent 9e3f9d6 commit 107c7ba

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

src/main/java/com/contentstack/cms/app/App.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public class App {
2323
protected HashMap<String, Object> params;
2424
private String appUid;
2525
private Retrofit client;
26+
/**
27+
* Error message for internal uses
28+
*/
29+
private final String ErrorMessage = "App/Manifest uid is required";
2630

2731
/**
2832
* Instantiates a new Organization.
@@ -34,7 +38,7 @@ public App(Retrofit client, @NotNull String organizationUid) {
3438
this.headers = new HashMap<>();
3539
this.params = new HashMap<>();
3640
if (organizationUid.isEmpty()) {
37-
throw new IllegalArgumentException("Organization UID could not be empty");
41+
throw new IllegalArgumentException("Organization uid could not be empty");
3842
}
3943
this.headers.put("organization_uid", organizationUid);
4044
this.client = client;
@@ -54,7 +58,7 @@ public App(Retrofit client, @NotNull String organizationUid) {
5458
public App(Retrofit client, @NotNull String organizationUid, @NotNull String uid) {
5559
this.headers = new HashMap<>();
5660
if (organizationUid.isEmpty()) {
57-
throw new IllegalArgumentException("Organization UID could not be empty for app/manifest operations");
61+
throw new IllegalArgumentException("Organization uid could not be empty");
5862
}
5963
this.headers.put("organization_uid", organizationUid);
6064
this.appUid = uid;
@@ -65,7 +69,7 @@ public App(Retrofit client, @NotNull String organizationUid, @NotNull String uid
6569

6670
public Installation installation() {
6771
if (this.appUid == null || this.appUid.isEmpty()) {
68-
throw new BadArgumentException("app uid/Manifest uid is required");
72+
throw new BadArgumentException(ErrorMessage);
6973
}
7074
return new Installation(this.client, this.headers.get("organization_uid"), this.appUid);
7175
}
@@ -150,7 +154,7 @@ public Call<ResponseBody> fetch(@NotNull String manifestUid) {
150154

151155
private void validate() {
152156
if (!this.headers.containsKey("organization_uid"))
153-
throw new IllegalStateException("organization uid can not be null or empty");
157+
throw new IllegalStateException("Organization uid can not be null or empty");
154158
}
155159

156160
/**
@@ -212,7 +216,7 @@ public Call<ResponseBody> update(JSONObject body) {
212216
validate();
213217
isValidJSON(body);
214218
if (this.appUid == null || this.appUid.isEmpty()) {
215-
throw new BadArgumentException("appUid/ManifestUid is required");
219+
throw new BadArgumentException(ErrorMessage);
216220
}
217221
return service.updateById(this.headers, this.appUid, body);
218222
}
@@ -233,7 +237,7 @@ public Call<ResponseBody> update(@NotNull String id, JSONObject body) {
233237
public Call<ResponseBody> delete() {
234238
validate();
235239
if (this.appUid == null || this.appUid.isEmpty()) {
236-
throw new BadArgumentException("appUid/ManifestUid is required");
240+
throw new BadArgumentException(ErrorMessage);
237241
}
238242
return service.delete(this.headers, this.appUid);
239243
}
@@ -306,7 +310,7 @@ public Call<ResponseBody> updateOauth(@NotNull String uid, JSONObject body) {
306310
public Call<ResponseBody> updateOauth(JSONObject body) {
307311
validate();
308312
if (this.appUid == null || this.appUid.isEmpty()) {
309-
throw new BadArgumentException("app uid / manifest uid required");
313+
throw new BadArgumentException(ErrorMessage);
310314
}
311315
return service.updateAuthConfiguration(this.headers, this.appUid, body);
312316
}

src/main/java/com/contentstack/cms/app/AppService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
public interface AppService {
1111

12-
@POST("manifest")
12+
@POST("manifests")
1313
Call<ResponseBody> create(
1414
@HeaderMap Map<String, String> headers,
1515
@QueryMap Map<String, Object> query,
1616
@Body JSONObject body
1717
);
1818

19-
@GET("manifest/{uid}")
19+
@GET("manifests/{uid}")
2020
Call<ResponseBody> fetch(
2121
@HeaderMap Map<String, String> headers,
2222
@Path("uid") String uid,

src/main/java/com/contentstack/cms/app/InstallationService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
import retrofit2.http.Body;
77
import retrofit2.http.HeaderMap;
88
import retrofit2.http.POST;
9-
import retrofit2.http.QueryMap;
9+
import retrofit2.http.Path;
1010

1111
import java.util.Map;
1212

1313
public interface InstallationService {
1414

1515

16-
@POST("manifest")
16+
@POST("manifests/{uid}/install")
1717
Call<ResponseBody> create(
1818
@HeaderMap Map<String, String> headers,
19-
@QueryMap Map<String, Object> query,
19+
@Path("uid") String uid,
2020
@Body JSONObject body
2121
);
2222
}

0 commit comments

Comments
 (0)