octopian-configuration-apis 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octopian-configuration-apis",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "a global javascript sdk",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -1498,4 +1498,13 @@ export async function CreateNewCorrespondence(
1498
1498
  return APIResponse;
1499
1499
  }
1500
1500
  }
1501
+
1502
+ export async function UpdateConfiguration(AuthToken = null, Timeout = 30000) {
1503
+ let APIResponse = await apiHandler.GetMethod(
1504
+ ConfigurationAPIConstants.uriUpdateConfiguration(),
1505
+ AuthToken,
1506
+ Timeout
1507
+ );
1508
+ return APIResponse;
1509
+ }
1501
1510
  //#endregion
@@ -1,4 +1,4 @@
1
- import { GetAssetList, GetInteractorTypeList, GetUnitList,GetInteractorList,GetAssetBlazorViewList } from "./configurationServices";
1
+ import { GetAssetList, GetInteractorTypeList, GetUnitList,GetInteractorList,GetAssetBlazorViewList, UpdateConfiguration } from "./configurationServices";
2
2
 
3
3
  export async function GetEnglishNewsList(Input, AuthToken = null, Timeout = 30000) {
4
4
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
@@ -31,7 +31,7 @@ export async function GetEnglishNewsList(Input, AuthToken = null, Timeout = 3000
31
31
  return NewsAssets;
32
32
  }
33
33
 
34
- export async function GetArabicNewsList(Input, AuthToken = null, Timeout = 30000) {
34
+ export async function AddEnglishNews(Input, AuthToken = null, Timeout = 30000) {
35
35
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
36
36
  let InteractorType = InteractorTypes.Result.find(x => x.Alias == "NewsFeed");
37
37
  if (!InteractorType) {
@@ -51,6 +51,36 @@ export async function GetArabicNewsList(Input, AuthToken = null, Timeout = 30000
51
51
  Result: "News not found"
52
52
  }
53
53
  }
54
+ let NewsAssets = await MaintainAssetList({
55
+ ...Input,
56
+ AssetId: 0,
57
+ AssetSubGroupId: News.ObjectId,
58
+ dtoState: 1,
59
+ isGuestPublic: true,
60
+ isActive: true,
61
+ })
62
+ return NewsAssets;
63
+ }
64
+ export async function GetArabicNewsList(Input, AuthToken = null, Timeout = 30000) {
65
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
66
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "NewsFeed");
67
+ if (!InteractorType) {
68
+ return {
69
+ StatusCode: 400,
70
+ Result: "InteractorType not found"
71
+ }
72
+ }
73
+ let AssetsList = await GetAssetBlazorViewList({
74
+ interactorTypeId: InteractorType.InteractorTypeId,
75
+ deploymentEnvironment: null
76
+ })
77
+ let News = AssetsList.Result.find(x => x.Alias == "LatestNews");
78
+ if (!News) {
79
+ return {
80
+ StatusCode: 400,
81
+ Result: "News not found"
82
+ }
83
+ }
54
84
  let NewsAssets = await GetAssetList({
55
85
  AssetId: -12345,
56
86
  AssetSubGroupId: News.ObjectId,
@@ -61,6 +91,36 @@ export async function GetArabicNewsList(Input, AuthToken = null, Timeout = 30000
61
91
  })
62
92
  return NewsAssets;
63
93
  }
94
+ export async function AddArabicNews(Input, AuthToken = null, Timeout = 30000) {
95
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
96
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "NewsFeed");
97
+ if (!InteractorType) {
98
+ return {
99
+ StatusCode: 400,
100
+ Result: "InteractorType not found"
101
+ }
102
+ }
103
+ let AssetsList = await GetAssetBlazorViewList({
104
+ interactorTypeId: InteractorType.InteractorTypeId,
105
+ deploymentEnvironment: null
106
+ })
107
+ let News = AssetsList.Result.find(x => x.Alias == "LatestNewsArabic");
108
+ if (!News) {
109
+ return {
110
+ StatusCode: 400,
111
+ Result: "News not found"
112
+ }
113
+ }
114
+ let NewsAssets = await MaintainAssetList({
115
+ ...Input,
116
+ AssetId: 0,
117
+ AssetSubGroupId: News.ObjectId,
118
+ dtoState: 1,
119
+ isGuestPublic: true,
120
+ isActive: true,
121
+ })
122
+ return NewsAssets;
123
+ }
64
124
 
65
125
  export async function GetGeneralDonationsList(Input, AuthToken = null, Timeout = 30000) {
66
126
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
@@ -93,6 +153,37 @@ export async function GetGeneralDonationsList(Input, AuthToken = null, Timeout =
93
153
  return GeneralDonationsAssets;
94
154
  }
95
155
 
156
+ export async function AddGeneralDonations(Input, AuthToken = null, Timeout = 30000) {
157
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
158
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "Donations");
159
+ if (!InteractorType) {
160
+ return {
161
+ StatusCode: 400,
162
+ Result: "InteractorType not found"
163
+ }
164
+ }
165
+ let AssetsList = await GetAssetBlazorViewList({
166
+ interactorTypeId: InteractorType.InteractorTypeId,
167
+ deploymentEnvironment: null
168
+ })
169
+ let GeneralDonations = AssetsList.Result.find(x => x.Alias == "GeneralDonations");
170
+ if (!GeneralDonations) {
171
+ return {
172
+ StatusCode: 400,
173
+ Result: "News not found"
174
+ }
175
+ }
176
+ let GeneralDonationsAssets = await MaintainAssetList({
177
+ ...Input,
178
+ AssetId: 0,
179
+ AssetSubGroupId: GeneralDonations.ObjectId,
180
+ dtoState: 1,
181
+ isGuestPublic: true,
182
+ isActive: true,
183
+ })
184
+ return GeneralDonationsAssets;
185
+ }
186
+
96
187
  export async function GetQuickDonationsList(Input, AuthToken = null, Timeout = 30000) {
97
188
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
98
189
  let InteractorType = InteractorTypes.Result.find(x => x.Alias == "Donations");
@@ -123,7 +214,36 @@ export async function GetQuickDonationsList(Input, AuthToken = null, Timeout = 3
123
214
  })
124
215
  return QuickDonationsAssets;
125
216
  }
126
-
217
+ export async function AddQuickDonations(Input, AuthToken = null, Timeout = 30000) {
218
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
219
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "Donations");
220
+ if (!InteractorType) {
221
+ return {
222
+ StatusCode: 400,
223
+ Result: "InteractorType not found"
224
+ }
225
+ }
226
+ let AssetsList = await GetAssetBlazorViewList({
227
+ interactorTypeId: InteractorType.InteractorTypeId,
228
+ deploymentEnvironment: null
229
+ })
230
+ let QuickDonations = AssetsList.Result.find(x => x.Alias == "QuickDonations");
231
+ if (!QuickDonations) {
232
+ return {
233
+ StatusCode: 400,
234
+ Result: "News not found"
235
+ }
236
+ }
237
+ let QuickDonationsAssets = await MaintainAssetList({
238
+ ...Input,
239
+ AssetId: 0,
240
+ AssetSubGroupId: QuickDonations.ObjectId,
241
+ dtoState: 1,
242
+ isGuestPublic: true,
243
+ isActive: true,
244
+ })
245
+ return QuickDonationsAssets;
246
+ }
127
247
  export async function GetCampaignsList(Input, AuthToken = null, Timeout = 30000) {
128
248
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
129
249
  let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
@@ -155,6 +275,36 @@ export async function GetCampaignsList(Input, AuthToken = null, Timeout = 30000)
155
275
  return MainStepperAssets;
156
276
  }
157
277
 
278
+ export async function AddMainStepper(Input, AuthToken = null, Timeout = 30000) {
279
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
280
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
281
+ if (!InteractorType) {
282
+ return {
283
+ StatusCode: 400,
284
+ Result: "InteractorType not found"
285
+ }
286
+ }
287
+ let AssetsList = await GetAssetBlazorViewList({
288
+ interactorTypeId: InteractorType.InteractorTypeId,
289
+ deploymentEnvironment: null
290
+ })
291
+ let MainStepper = AssetsList.Result.find(x => x.Alias == "MainStepper");
292
+ if (!MainStepper) {
293
+ return {
294
+ StatusCode: 400,
295
+ Result: "News not found"
296
+ }
297
+ }
298
+ let MainStepperAssets = await MaintainAssetList({
299
+ ...Input,
300
+ AssetId: 0,
301
+ AssetSubGroupId: MainStepper.ObjectId,
302
+ dtoState: 1,
303
+ isGuestPublic: true,
304
+ isActive: true,
305
+ })
306
+ return MainStepperAssets;
307
+ }
158
308
  export async function GetBranchesList(Input, AuthToken = null, Timeout = 30000) {
159
309
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
160
310
  let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
@@ -185,6 +335,36 @@ export async function GetBranchesList(Input, AuthToken = null, Timeout = 30000)
185
335
  })
186
336
  return BranchesAssets;
187
337
  }
338
+ export async function AddBranches(Input, AuthToken = null, Timeout = 30000) {
339
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
340
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
341
+ if (!InteractorType) {
342
+ return {
343
+ StatusCode: 400,
344
+ Result: "InteractorType not found"
345
+ }
346
+ }
347
+ let AssetsList = await GetAssetBlazorViewList({
348
+ interactorTypeId: InteractorType.InteractorTypeId,
349
+ deploymentEnvironment: null
350
+ })
351
+ let Branches = AssetsList.Result.find(x => x.Alias == "OurBranches");
352
+ if (!Branches) {
353
+ return {
354
+ StatusCode: 400,
355
+ Result: "News not found"
356
+ }
357
+ }
358
+ let BranchesAssets = await MaintainAssetList({
359
+ ...Input,
360
+ AssetId: 0,
361
+ AssetSubGroupId: Branches.ObjectId,
362
+ dtoState: 1,
363
+ isGuestPublic: true,
364
+ isActive: true,
365
+ })
366
+ return BranchesAssets;
367
+ }
188
368
 
189
369
  export async function GetBanksAccountsList(Input, AuthToken = null, Timeout = 30000) {
190
370
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
@@ -216,7 +396,36 @@ export async function GetBanksAccountsList(Input, AuthToken = null, Timeout = 30
216
396
  })
217
397
  return BankAccountsAssets;
218
398
  }
219
-
399
+ export async function AddBankAccounts(Input, AuthToken = null, Timeout = 30000) {
400
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
401
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
402
+ if (!InteractorType) {
403
+ return {
404
+ StatusCode: 400,
405
+ Result: "InteractorType not found"
406
+ }
407
+ }
408
+ let AssetsList = await GetAssetBlazorViewList({
409
+ interactorTypeId: InteractorType.InteractorTypeId,
410
+ deploymentEnvironment: null
411
+ })
412
+ let BankAccounts = AssetsList.Result.find(x => x.Alias == "BankAccounts");
413
+ if (!BankAccounts) {
414
+ return {
415
+ StatusCode: 400,
416
+ Result: "News not found"
417
+ }
418
+ }
419
+ let BankAccountsAssets = await MaintainAssetList({
420
+ ...Input,
421
+ AssetId: 0,
422
+ AssetSubGroupId: BankAccounts.ObjectId,
423
+ dtoState: 1,
424
+ isGuestPublic: true,
425
+ isActive: true,
426
+ })
427
+ return BankAccountsAssets;
428
+ }
220
429
  export async function GetInteractorsList(Input, AuthToken = null, Timeout = 30000) {
221
430
  let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
222
431
  let InteractorType = InteractorTypes.Result.find(x => x.Alias == "Donator");
@@ -236,4 +445,16 @@ export async function GetInteractorsList(Input, AuthToken = null, Timeout = 3000
236
445
  }
237
446
  let InteractorsList = await GetInteractorList({unitId: Unit.UnitId,pageIndex: Input.PageIndex,pageSize: Input.PageSize},AuthToken,Timeout)
238
447
  return InteractorsList;
448
+ }
449
+
450
+ export async function MaintainAssetsList(Input, AuthToken = null, Timeout = 30000) {
451
+ let response = await MaintainAssetList({
452
+ Input
453
+ })
454
+ return response;
455
+ }
456
+
457
+ export async function UpdateDarAlBerConfiguration( AuthToken = null, Timeout = 30000) {
458
+ let response = await UpdateConfiguration(AuthToken, Timeout)
459
+ return response;
239
460
  }
package/src/index.d.ts CHANGED
@@ -76,6 +76,7 @@ import { CreateNewCorrespondenceInput } from "./modals/input-modals/CreateNewCor
76
76
  import { GetInteractorListOutput } from "./modals/output-modals/GetInteractorListOutput";
77
77
  import { GetInteractorListInput } from "./modals/input-modals/GetInteractorListInput";
78
78
  import { GetUnitListOutput } from "./modals/output-modals/GetUnitListOutput";
79
+ import { AddAssetsInput } from "./modals/input-modals/AddAssetsInput";
79
80
  // Define each module with its specific functions
80
81
  interface ConfigurationServices {
81
82
  /**
@@ -754,6 +755,11 @@ interface ConfigurationServices {
754
755
  AuthToken?: string | null,
755
756
  Timeout?: number | null
756
757
  ) => BaseResponse<GetInteractorListOutput[] | BaseErrorResponse>;
758
+
759
+ UpdateConfiguration: (
760
+ AuthToken?: string | null,
761
+ Timeout?: number | null
762
+ ) => BaseResponse<boolean | BaseErrorResponse>;
757
763
  }
758
764
 
759
765
  interface DABConfigurationServices {
@@ -804,6 +810,59 @@ interface DABConfigurationServices {
804
810
  AuthToken?: string | null,
805
811
  Timeout?: number | null
806
812
  ) => BaseResponse<GetInteractorListOutput[] | BaseErrorResponse>;
813
+
814
+ MaintainAssetsList: (
815
+ Input: GetAssetListOutput[],
816
+ AuthToken?: string | null,
817
+ Timeout?: number | null
818
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
819
+
820
+ AddEnglishNews: (
821
+ Input: AddAssetsInput,
822
+ AuthToken?: string | null,
823
+ Timeout?: number | null
824
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
825
+
826
+ AddArabicNews: (
827
+ Input: AddAssetsInput,
828
+ AuthToken?: string | null,
829
+ Timeout?: number | null
830
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
831
+
832
+ AddGeneralDonations: (
833
+ Input: AddAssetsInput,
834
+ AuthToken?: string | null,
835
+ Timeout?: number | null
836
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
837
+
838
+ AddQuickDonations: (
839
+ Input: AddAssetsInput,
840
+ AuthToken?: string | null,
841
+ Timeout?: number | null
842
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
843
+
844
+ AddMainStepper: (
845
+ Input: AddAssetsInput,
846
+ AuthToken?: string | null,
847
+ Timeout?: number | null
848
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
849
+
850
+ AddBranches: (
851
+ Input: AddAssetsInput,
852
+ AuthToken?: string | null,
853
+ Timeout?: number | null
854
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
855
+
856
+ AddBankAccounts: (
857
+ Input: AddAssetsInput,
858
+ AuthToken?: string | null,
859
+ Timeout?: number | null
860
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
861
+
862
+ UpdateDarAlBerConfiguration: (
863
+ AuthToken?: string | null,
864
+ Timeout?: number | null
865
+ ) => BaseResponse<boolean | BaseErrorResponse>;
807
866
  }
808
867
 
809
868
  interface ConfigurationSDKConfig {
@@ -904,5 +963,6 @@ export {
904
963
  GetDABAssetsInput,
905
964
  GetInteractorListInput,
906
965
  GetUnitListOutput,
907
- GetInteractorListOutput
966
+ GetInteractorListOutput,
967
+ AddAssetsInput
908
968
  };
package/src/index.js CHANGED
@@ -28,7 +28,8 @@ const {
28
28
  CreateNewCorrespondence,
29
29
  GetDefaultConfigurationList,
30
30
  getCorrespondenceList,
31
- GetAssetBlazorViewList
31
+ GetAssetBlazorViewList,
32
+ UpdateConfiguration
32
33
  } = require("./CoreServices/configurationServices");
33
34
  const {
34
35
  GetEnglishNewsList,
@@ -38,7 +39,16 @@ const {
38
39
  GetCampaignsList,
39
40
  GetBranchesList,
40
41
  GetBanksAccountsList,
41
- GetInteractorsList
42
+ GetInteractorsList,
43
+ MaintainAssetsList,
44
+ AddEnglishNews,
45
+ AddArabicNews,
46
+ AddGeneralDonations,
47
+ AddQuickDonations,
48
+ AddMainStepper,
49
+ AddBranches,
50
+ AddBankAccounts,
51
+ UpdateDarAlBerConfiguration
42
52
  } = require("./CoreServices/darAlBerServices");
43
53
 
44
54
  const ConfigurationServices = {
@@ -71,7 +81,8 @@ const ConfigurationServices = {
71
81
  CreateNewCorrespondence,
72
82
  GetDefaultConfigurationList,
73
83
  getCorrespondenceList,
74
- GetAssetBlazorViewList
84
+ GetAssetBlazorViewList,
85
+ UpdateConfiguration
75
86
  };
76
87
 
77
88
  const DABConfigurationServices = {
@@ -82,7 +93,16 @@ const DABConfigurationServices = {
82
93
  GetCampaignsList,
83
94
  GetBranchesList,
84
95
  GetBanksAccountsList,
85
- GetInteractorsList
96
+ GetInteractorsList,
97
+ MaintainAssetsList,
98
+ AddEnglishNews,
99
+ AddArabicNews,
100
+ AddGeneralDonations,
101
+ AddQuickDonations,
102
+ AddMainStepper,
103
+ AddBranches,
104
+ AddBankAccounts,
105
+ UpdateDarAlBerConfiguration
86
106
  };
87
107
 
88
108
  const {
@@ -0,0 +1,21 @@
1
+ export interface AddAssetsInput {
2
+ deploymentEnvironment: "DEV" | "PROD";
3
+ description?: string;
4
+ descriptionTranslations?: string;
5
+ externalId?: string;
6
+ externalImagePath?: string;
7
+ extra1?: string;
8
+ extra2?: string;
9
+ name: string;
10
+ key?: string;
11
+ weight?: string;
12
+ translations?: string;
13
+ imagePath?: string;
14
+ cost?:string,
15
+ costDetails?:string,
16
+ price?:string,
17
+ priceDetails?:string,
18
+ quantity?:string,
19
+ balance?:string,
20
+ unitOfMeasure?:string
21
+ }
@@ -90,10 +90,14 @@ export class ConfigurationAPIConstants {
90
90
  static uriGetInteractorList(){
91
91
  return ConfigurationURI + "/api/Organization/GetInteractorList";
92
92
  }
93
+ static uriUpdateConfiguration(){
94
+ return CustomURI + "/api/AssetsUpdate/UpdateConfigration";
95
+ }
93
96
  }
94
97
 
95
98
  //#region BaseConstants
96
99
  let ConfigurationURI = "/configuration";
97
100
  let authenticationURI = "/ConfigurationAuthentication";
98
101
  let storageURI = "/storage";
102
+ let CustomURI = "/CustomApi";
99
103
  //#endregion