octopian-configuration-apis 1.0.0 → 1.0.1

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.1",
4
4
  "description": "a global javascript sdk",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -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,11 @@ 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;
239
455
  }
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
  /**
@@ -804,6 +805,54 @@ interface DABConfigurationServices {
804
805
  AuthToken?: string | null,
805
806
  Timeout?: number | null
806
807
  ) => BaseResponse<GetInteractorListOutput[] | BaseErrorResponse>;
808
+
809
+ MaintainAssetsList: (
810
+ Input: GetAssetListOutput[],
811
+ AuthToken?: string | null,
812
+ Timeout?: number | null
813
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
814
+
815
+ AddEnglishNews: (
816
+ Input: AddAssetsInput,
817
+ AuthToken?: string | null,
818
+ Timeout?: number | null
819
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
820
+
821
+ AddArabicNews: (
822
+ Input: AddAssetsInput,
823
+ AuthToken?: string | null,
824
+ Timeout?: number | null
825
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
826
+
827
+ AddGeneralDonations: (
828
+ Input: AddAssetsInput,
829
+ AuthToken?: string | null,
830
+ Timeout?: number | null
831
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
832
+
833
+ AddQuickDonations: (
834
+ Input: AddAssetsInput,
835
+ AuthToken?: string | null,
836
+ Timeout?: number | null
837
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
838
+
839
+ AddMainStepper: (
840
+ Input: AddAssetsInput,
841
+ AuthToken?: string | null,
842
+ Timeout?: number | null
843
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
844
+
845
+ AddBranches: (
846
+ Input: AddAssetsInput,
847
+ AuthToken?: string | null,
848
+ Timeout?: number | null
849
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
850
+
851
+ AddBankAccounts: (
852
+ Input: AddAssetsInput,
853
+ AuthToken?: string | null,
854
+ Timeout?: number | null
855
+ ) => BaseResponse<GetAssetListOutput[] | BaseErrorResponse>;
807
856
  }
808
857
 
809
858
  interface ConfigurationSDKConfig {
@@ -904,5 +953,6 @@ export {
904
953
  GetDABAssetsInput,
905
954
  GetInteractorListInput,
906
955
  GetUnitListOutput,
907
- GetInteractorListOutput
956
+ GetInteractorListOutput,
957
+ AddAssetsInput
908
958
  };
package/src/index.js CHANGED
@@ -38,7 +38,15 @@ const {
38
38
  GetCampaignsList,
39
39
  GetBranchesList,
40
40
  GetBanksAccountsList,
41
- GetInteractorsList
41
+ GetInteractorsList,
42
+ MaintainAssetsList,
43
+ AddEnglishNews,
44
+ AddArabicNews,
45
+ AddGeneralDonations,
46
+ AddQuickDonations,
47
+ AddMainStepper,
48
+ AddBranches,
49
+ AddBankAccounts
42
50
  } = require("./CoreServices/darAlBerServices");
43
51
 
44
52
  const ConfigurationServices = {
@@ -82,7 +90,15 @@ const DABConfigurationServices = {
82
90
  GetCampaignsList,
83
91
  GetBranchesList,
84
92
  GetBanksAccountsList,
85
- GetInteractorsList
93
+ GetInteractorsList,
94
+ MaintainAssetsList,
95
+ AddEnglishNews,
96
+ AddArabicNews,
97
+ AddGeneralDonations,
98
+ AddQuickDonations,
99
+ AddMainStepper,
100
+ AddBranches,
101
+ AddBankAccounts
86
102
  };
87
103
 
88
104
  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
+ }