11package com .contentstack .cms .stack ;
22
3+ import com .contentstack .cms .core .ErrorMessages ;
4+
35import com .contentstack .cms .BaseImplementation ;
46import okhttp3 .MediaType ;
57import okhttp3 .MultipartBody ;
@@ -225,12 +227,12 @@ public Call<AssetListResponse> findAsPojo() {
225227 * @since 2022-10-20
226228 */
227229 public Call <ResponseBody > fetch () {
228- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
230+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
229231 return this .service .single (this .headers , this .assetUid , this .params );
230232 }
231233
232234 public Call <AssetResponse > fetchAsPojo () { // New method for POJO conversion
233- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
235+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
234236 return this .service .singlePojo (this .headers , this .assetUid , this .params );
235237 }
236238
@@ -390,7 +392,7 @@ private MultipartBody createMultipartBody(String filePath, String parentUid, Str
390392 * @since 2022-10-20
391393 */
392394 public Call <ResponseBody > replace (@ NotNull String filePath , @ NotNull String description ) {
393- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
395+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
394396 MultipartBody .Part assetPath = uploadFile (filePath );
395397 RequestBody body = RequestBody .create (Objects .requireNonNull (MediaType .parse (String .valueOf (MultipartBody .FORM ))), description );
396398 return this .service .replace (this .headers , this .assetUid , assetPath , body , this .params );
@@ -443,7 +445,7 @@ private MultipartBody.Part uploadFile(@NotNull String filePath) {
443445 * @since 2022-10-20
444446 */
445447 public Call <ResponseBody > generatePermanentUrl (JSONObject body ) {
446- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
448+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
447449 return this .service .generatePermanentUrl (this .headers , this .assetUid , body );
448450 }
449451
@@ -473,7 +475,7 @@ public Call<ResponseBody> generatePermanentUrl(JSONObject body) {
473475 * @since 2022-10-20
474476 */
475477 public Call <ResponseBody > getPermanentUrl (String slugUrl ) {
476- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
478+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
477479 return this .service .downloadPermanentUrl (this .headers , this .assetUid , slugUrl , this .params );
478480 }
479481
@@ -490,7 +492,7 @@ public Call<ResponseBody> getPermanentUrl(String slugUrl) {
490492 * @since 0.1.0
491493 */
492494 public Call <ResponseBody > delete () {
493- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
495+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
494496 return this .service .delete (this .headers , this .assetUid );
495497 }
496498
@@ -580,7 +582,7 @@ public Call<ResponseBody> setVersionName(int versionNumber,
580582 * @since 0.1.0
581583 */
582584 public Call <ResponseBody > getVersionNameDetails () {
583- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
585+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
584586 return this .service .getVersionNameDetails (this .headers , this .assetUid , this .params );
585587 }
586588
@@ -601,7 +603,7 @@ public Call<ResponseBody> getVersionNameDetails() {
601603 * @since 0.1.0
602604 */
603605 public Call <ResponseBody > deleteVersionName (int versionNumber ) {
604- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
606+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
605607 return this .service .deleteVersionName (this .headers , this .assetUid , versionNumber );
606608 }
607609
@@ -618,7 +620,7 @@ public Call<ResponseBody> deleteVersionName(int versionNumber) {
618620 * @since 0.1.0
619621 */
620622 public Call <ResponseBody > getReferences () {
621- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
623+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
622624 return this .service .getReferences (this .headers , this .assetUid );
623625 }
624626
@@ -676,7 +678,7 @@ public Call<ResponseBody> getByType(@NotNull String assetType) {
676678 * @since 0.1.0
677679 */
678680 public Call <ResponseBody > updateDetails (JSONObject requestBody ) {
679- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
681+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
680682 return this .service .updateDetails (this .headers , this .assetUid , this .params , requestBody );
681683 }
682684
@@ -702,7 +704,7 @@ public Call<ResponseBody> updateDetails(JSONObject requestBody) {
702704 * @since 0.1.0
703705 */
704706 public Call <ResponseBody > publish (@ NotNull JSONObject requestBody ) {
705- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
707+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
706708 return this .service .publish (this .headers , this .assetUid , requestBody );
707709 }
708710
@@ -728,7 +730,7 @@ public Call<ResponseBody> publish(@NotNull JSONObject requestBody) {
728730 */
729731 public Call <ResponseBody > unpublish (
730732 @ NotNull JSONObject requestBody ) {
731- Objects .requireNonNull (this .assetUid , "Asset Uid Can Not Be Null OR Empty" );
733+ Objects .requireNonNull (this .assetUid , ErrorMessages . ASSET_UID_REQUIRED );
732734 return this .service .unpublish (this .headers , this .assetUid , requestBody );
733735 }
734736
0 commit comments