@gofynd/fdk-client-javascript 1.1.6 → 1.3.0
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/README.md +52 -3
- package/index.js +0 -3
- package/package.json +1 -2
- package/sdk/application/ApplicationAPIClient.d.ts +15 -1
- package/sdk/application/ApplicationAPIClient.js +12 -3
- package/sdk/application/ApplicationClient.d.ts +36 -6
- package/sdk/application/ApplicationClient.js +30 -43
- package/sdk/application/ApplicationConfig.d.ts +92 -12
- package/sdk/application/ApplicationConfig.js +48 -14
- package/sdk/application/Cart/CartApplicationClient.d.ts +200 -357
- package/sdk/application/Cart/CartApplicationClient.js +711 -483
- package/sdk/application/Cart/CartApplicationModel.d.ts +2054 -96
- package/sdk/application/Cart/CartApplicationModel.js +1224 -93
- package/sdk/application/Cart/CartApplicationValidator.d.ts +508 -30
- package/sdk/application/Cart/CartApplicationValidator.js +270 -15
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +274 -422
- package/sdk/application/Catalog/CatalogApplicationClient.js +865 -630
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +2320 -117
- package/sdk/application/Catalog/CatalogApplicationModel.js +1566 -172
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +798 -31
- package/sdk/application/Catalog/CatalogApplicationValidator.js +318 -3
- package/sdk/application/Common/CommonApplicationClient.d.ts +16 -21
- package/sdk/application/Common/CommonApplicationClient.js +52 -33
- package/sdk/application/Common/CommonApplicationModel.d.ts +368 -19
- package/sdk/application/Common/CommonApplicationModel.js +192 -40
- package/sdk/application/Common/CommonApplicationValidator.d.ts +42 -4
- package/sdk/application/Common/CommonApplicationValidator.js +21 -3
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +31 -18
- package/sdk/application/Communication/CommunicationApplicationClient.js +86 -47
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +157 -14
- package/sdk/application/Communication/CommunicationApplicationModel.js +104 -23
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +27 -4
- package/sdk/application/Communication/CommunicationApplicationValidator.js +21 -5
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +149 -118
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +457 -260
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +2235 -110
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +1113 -193
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +160 -8
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +88 -4
- package/sdk/application/Content/ContentApplicationClient.d.ts +149 -139
- package/sdk/application/Content/ContentApplicationClient.js +489 -278
- package/sdk/application/Content/ContentApplicationModel.d.ts +1010 -105
- package/sdk/application/Content/ContentApplicationModel.js +737 -396
- package/sdk/application/Content/ContentApplicationValidator.d.ts +214 -12
- package/sdk/application/Content/ContentApplicationValidator.js +113 -3
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +23 -29
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -47
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +148 -20
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +100 -87
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +55 -5
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +33 -6
- package/sdk/application/Lead/LeadApplicationClient.d.ts +57 -53
- package/sdk/application/Lead/LeadApplicationClient.js +188 -103
- package/sdk/application/Lead/LeadApplicationModel.d.ts +686 -54
- package/sdk/application/Lead/LeadApplicationModel.js +330 -244
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +91 -9
- package/sdk/application/Lead/LeadApplicationValidator.js +51 -6
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +40 -33
- package/sdk/application/Logistic/LogisticApplicationClient.js +131 -73
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +399 -28
- package/sdk/application/Logistic/LogisticApplicationModel.js +293 -24
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +48 -6
- package/sdk/application/Logistic/LogisticApplicationValidator.js +34 -6
- package/sdk/application/Order/OrderApplicationClient.d.ts +93 -133
- package/sdk/application/Order/OrderApplicationClient.js +329 -217
- package/sdk/application/Order/OrderApplicationModel.d.ts +1101 -66
- package/sdk/application/Order/OrderApplicationModel.js +776 -57
- package/sdk/application/Order/OrderApplicationValidator.d.ts +249 -14
- package/sdk/application/Order/OrderApplicationValidator.js +114 -5
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +400 -366
- package/sdk/application/Payment/PaymentApplicationClient.js +1176 -703
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3125 -99
- package/sdk/application/Payment/PaymentApplicationModel.js +1158 -62
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +494 -41
- package/sdk/application/Payment/PaymentApplicationValidator.js +297 -25
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +205 -350
- package/sdk/application/PosCart/PosCartApplicationClient.js +720 -491
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +1823 -89
- package/sdk/application/PosCart/PosCartApplicationModel.js +1117 -85
- package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +480 -29
- package/sdk/application/PosCart/PosCartApplicationValidator.js +262 -15
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +58 -47
- package/sdk/application/Rewards/RewardsApplicationClient.js +187 -102
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +343 -22
- package/sdk/application/Rewards/RewardsApplicationModel.js +230 -15
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +70 -7
- package/sdk/application/Rewards/RewardsApplicationValidator.js +45 -6
- package/sdk/application/Share/ShareApplicationClient.d.ts +52 -50
- package/sdk/application/Share/ShareApplicationClient.js +185 -97
- package/sdk/application/Share/ShareApplicationModel.d.ts +198 -15
- package/sdk/application/Share/ShareApplicationModel.js +131 -31
- package/sdk/application/Share/ShareApplicationValidator.d.ts +86 -8
- package/sdk/application/Share/ShareApplicationValidator.js +48 -4
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +30 -27
- package/sdk/application/Theme/ThemeApplicationClient.js +102 -56
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +1291 -48
- package/sdk/application/Theme/ThemeApplicationModel.js +895 -134
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +49 -5
- package/sdk/application/Theme/ThemeApplicationValidator.js +26 -3
- package/sdk/application/User/UserApplicationClient.d.ts +260 -305
- package/sdk/application/User/UserApplicationClient.js +910 -522
- package/sdk/application/User/UserApplicationModel.d.ts +992 -101
- package/sdk/application/User/UserApplicationModel.js +699 -248
- package/sdk/application/User/UserApplicationValidator.d.ts +457 -33
- package/sdk/application/User/UserApplicationValidator.js +265 -31
- package/sdk/common/AxiosHelper.js +7 -2
- package/sdk/common/FDKError.d.ts +3 -0
- package/sdk/common/FDKError.js +8 -0
- package/sdk/common/Paginator.d.ts +27 -12
- package/sdk/common/Paginator.js +15 -0
- package/sdk/common/RequestSigner.js +0 -1
- package/sdk/common/utils.d.ts +3 -0
- package/sdk/common/utils.js +29 -0
- package/sdk/partner/PartnerAPIClient.d.ts +16 -1
- package/sdk/partner/PartnerAPIClient.js +12 -2
- package/sdk/partner/PartnerClient.d.ts +22 -3
- package/sdk/partner/PartnerClient.js +20 -0
- package/sdk/partner/PartnerConfig.d.ts +40 -14
- package/sdk/partner/PartnerConfig.js +31 -6
- package/sdk/partner/Theme/ThemePartnerClient.d.ts +299 -0
- package/sdk/partner/Theme/ThemePartnerClient.js +768 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +1706 -0
- package/sdk/partner/Theme/ThemePartnerModel.js +1409 -0
- package/sdk/partner/Theme/ThemePartnerValidator.d.ts +22 -0
- package/sdk/partner/Theme/ThemePartnerValidator.js +157 -0
- package/sdk/partner/index.d.ts +3 -1
- package/sdk/partner/index.js +3 -1
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +30 -25
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +104 -53
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +190 -17
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +132 -15
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +52 -5
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +30 -4
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +133 -97
- package/sdk/platform/Billing/BillingPlatformClient.js +561 -191
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +1071 -68
- package/sdk/platform/Billing/BillingPlatformModel.js +762 -151
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +175 -12
- package/sdk/platform/Billing/BillingPlatformValidator.js +118 -8
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +454 -635
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +1646 -957
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +827 -57
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +492 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +3839 -175
- package/sdk/platform/Cart/CartPlatformModel.js +2423 -217
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +528 -638
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1600 -984
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +1081 -49
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +482 -23
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +652 -826
- package/sdk/platform/Catalog/CatalogPlatformClient.js +1979 -1264
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +6869 -326
- package/sdk/platform/Catalog/CatalogPlatformModel.js +4215 -351
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +1361 -71
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +624 -30
- package/sdk/platform/Common/CommonPlatformClient.d.ts +16 -21
- package/sdk/platform/Common/CommonPlatformClient.js +50 -33
- package/sdk/platform/Common/CommonPlatformModel.d.ts +423 -19
- package/sdk/platform/Common/CommonPlatformModel.js +214 -40
- package/sdk/platform/Common/CommonPlatformValidator.d.ts +37 -4
- package/sdk/platform/Common/CommonPlatformValidator.js +20 -3
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +731 -303
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +3095 -785
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +699 -41
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +463 -27
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +19 -5
- package/sdk/platform/Communication/CommunicationPlatformClient.js +59 -19
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +1708 -102
- package/sdk/platform/Communication/CommunicationPlatformModel.js +1360 -235
- package/sdk/platform/Communication/CommunicationPlatformValidator.d.ts +16 -3
- package/sdk/platform/Communication/CommunicationPlatformValidator.js +11 -3
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +127 -111
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +435 -225
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +882 -43
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +666 -78
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +184 -13
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +105 -10
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +327 -240
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +922 -438
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +297 -22
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +191 -17
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +184 -178
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +555 -311
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +4337 -188
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +2178 -248
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +332 -19
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +153 -10
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +605 -578
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1996 -987
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +872 -62
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +487 -35
- package/sdk/platform/Content/ContentPlatformModel.d.ts +1472 -108
- package/sdk/platform/Content/ContentPlatformModel.js +1085 -204
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +85 -82
- package/sdk/platform/Discount/DiscountPlatformClient.js +333 -175
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +281 -15
- package/sdk/platform/Discount/DiscountPlatformModel.js +189 -10
- package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +185 -13
- package/sdk/platform/Discount/DiscountPlatformValidator.js +88 -8
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +109 -52
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +570 -105
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +141 -6
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +118 -7
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +43 -63
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +153 -135
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +426 -20
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +379 -40
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +106 -8
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +60 -8
- package/sdk/platform/Finance/FinancePlatformClient.d.ts +260 -129
- package/sdk/platform/Finance/FinancePlatformClient.js +1182 -194
- package/sdk/platform/Finance/FinancePlatformModel.d.ts +1267 -50
- package/sdk/platform/Finance/FinancePlatformModel.js +1252 -38
- package/sdk/platform/Finance/FinancePlatformValidator.d.ts +233 -15
- package/sdk/platform/Finance/FinancePlatformValidator.js +229 -16
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +111 -97
- package/sdk/platform/Inventory/InventoryPlatformClient.js +330 -199
- package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +1354 -61
- package/sdk/platform/Inventory/InventoryPlatformModel.js +916 -83
- package/sdk/platform/Inventory/InventoryPlatformValidator.d.ts +168 -12
- package/sdk/platform/Inventory/InventoryPlatformValidator.js +82 -6
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +100 -106
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +372 -186
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +180 -14
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +94 -9
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +89 -104
- package/sdk/platform/Lead/LeadPlatformClient.js +305 -180
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +1045 -54
- package/sdk/platform/Lead/LeadPlatformModel.js +504 -142
- package/sdk/platform/Lead/LeadPlatformValidator.d.ts +173 -12
- package/sdk/platform/Lead/LeadPlatformValidator.js +92 -15
- package/sdk/platform/OAuthClient.js +6 -2
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +20 -14
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +58 -29
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +26 -4
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +16 -3
- package/sdk/platform/Order/OrderPlatformClient.d.ts +437 -556
- package/sdk/platform/Order/OrderPlatformClient.js +1500 -760
- package/sdk/platform/Order/OrderPlatformModel.d.ts +5225 -247
- package/sdk/platform/Order/OrderPlatformModel.js +3473 -260
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +859 -37
- package/sdk/platform/Order/OrderPlatformValidator.js +435 -23
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +16 -42
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -155
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +37 -6
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +19 -17
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +78 -45
- package/sdk/platform/Partner/PartnerPlatformModel.js +43 -369
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +418 -288
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +1509 -505
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +438 -30
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +312 -19
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +83 -73
- package/sdk/platform/Payment/PaymentPlatformClient.js +259 -154
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +3200 -93
- package/sdk/platform/Payment/PaymentPlatformModel.js +1334 -36
- package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +111 -11
- package/sdk/platform/Payment/PaymentPlatformValidator.js +68 -7
- package/sdk/platform/PlatformAPIClient.d.ts +16 -1
- package/sdk/platform/PlatformAPIClient.js +9 -1
- package/sdk/platform/PlatformApplicationClient.d.ts +22 -1798
- package/sdk/platform/PlatformApplicationClient.js +17 -1899
- package/sdk/platform/PlatformClient.d.ts +31 -12581
- package/sdk/platform/PlatformClient.js +30 -15089
- package/sdk/platform/PlatformConfig.d.ts +37 -11
- package/sdk/platform/PlatformConfig.js +32 -6
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +96 -92
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +344 -177
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +149 -12
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +82 -8
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +360 -23
- package/sdk/platform/Rewards/RewardsPlatformModel.js +238 -22
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +159 -92
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +473 -208
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +138 -13
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +100 -14
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +166 -178
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +518 -329
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +1408 -96
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +1034 -71
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +280 -18
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +134 -11
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +41 -66
- package/sdk/platform/Share/SharePlatformApplicationClient.js +149 -116
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +87 -7
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +42 -5
- package/sdk/platform/Share/SharePlatformModel.d.ts +250 -16
- package/sdk/platform/Share/SharePlatformModel.js +167 -19
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +229 -193
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +976 -352
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +345 -24
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +206 -14
- package/sdk/platform/Theme/ThemePlatformClient.d.ts +37 -0
- package/sdk/platform/Theme/ThemePlatformClient.js +235 -0
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +1527 -48
- package/sdk/platform/Theme/ThemePlatformModel.js +1099 -118
- package/sdk/platform/Theme/ThemePlatformValidator.d.ts +32 -0
- package/sdk/platform/Theme/ThemePlatformValidator.js +38 -0
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +138 -152
- package/sdk/platform/User/UserPlatformApplicationClient.js +470 -244
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +242 -18
- package/sdk/platform/User/UserPlatformApplicationValidator.js +129 -12
- package/sdk/platform/User/UserPlatformModel.d.ts +653 -101
- package/sdk/platform/User/UserPlatformModel.js +467 -424
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +153 -49
- package/sdk/platform/Webhook/WebhookPlatformClient.js +896 -88
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +632 -16
- package/sdk/platform/Webhook/WebhookPlatformModel.js +502 -54
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +170 -7
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +157 -7
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +16 -21
- package/sdk/public/Configuration/ConfigurationPublicClient.js +48 -33
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +370 -19
- package/sdk/public/Configuration/ConfigurationPublicModel.js +191 -40
- package/sdk/public/Configuration/ConfigurationPublicValidator.d.ts +42 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +21 -3
- package/sdk/public/Inventory/InventoryPublicClient.d.ts +54 -48
- package/sdk/public/Inventory/InventoryPublicClient.js +161 -98
- package/sdk/public/Inventory/InventoryPublicModel.d.ts +392 -21
- package/sdk/public/Inventory/InventoryPublicModel.js +267 -27
- package/sdk/public/Inventory/InventoryPublicValidator.d.ts +90 -8
- package/sdk/public/Inventory/InventoryPublicValidator.js +44 -4
- package/sdk/public/Partner/PartnerPublicClient.d.ts +22 -0
- package/sdk/public/Partner/PartnerPublicClient.js +110 -0
- package/sdk/public/Partner/PartnerPublicModel.d.ts +240 -0
- package/sdk/public/Partner/PartnerPublicModel.js +280 -0
- package/sdk/public/Partner/PartnerPublicValidator.d.ts +18 -0
- package/sdk/public/Partner/PartnerPublicValidator.js +19 -0
- package/sdk/public/PublicAPIClient.d.ts +14 -1
- package/sdk/public/PublicAPIClient.js +7 -1
- package/sdk/public/PublicClient.d.ts +21 -3
- package/sdk/public/PublicClient.js +20 -0
- package/sdk/public/PublicConfig.d.ts +27 -6
- package/sdk/public/PublicConfig.js +17 -1
- package/sdk/public/Webhook/WebhookPublicClient.d.ts +16 -11
- package/sdk/public/Webhook/WebhookPublicClient.js +48 -27
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +52 -16
- package/sdk/public/Webhook/WebhookPublicModel.js +33 -113
- package/sdk/public/Webhook/WebhookPublicValidator.d.ts +18 -3
- package/sdk/public/Webhook/WebhookPublicValidator.js +14 -4
- package/sdk/public/index.d.ts +1 -0
- package/sdk/public/index.js +2 -0
- package/sdk/application/ApplicationModels.d.ts +0 -3
- package/sdk/application/ApplicationModels.js +0 -20
- package/sdk/platform/Partner/PartnerPlatformClient.d.ts +0 -145
- package/sdk/platform/Partner/PartnerPlatformClient.js +0 -799
- package/sdk/platform/Partner/PartnerPlatformValidator.d.ts +0 -14
- package/sdk/platform/Partner/PartnerPlatformValidator.js +0 -87
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Get started with the Javascript Development SDK for Fynd Platform
|
|
|
15
15
|
|
|
16
16
|
#### Node
|
|
17
17
|
|
|
18
|
-
```
|
|
18
|
+
```bash
|
|
19
19
|
npm install @gofynd/fdk-client-javascript
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -29,21 +29,23 @@ const {
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
#### Browser
|
|
32
|
+
|
|
32
33
|
you can load fdk-client-javascript's application browser bundle from CDN; `ApplicationConfig`, `ApplicationClient` and `ApplicationModels` will be attached to browser's `window` object.
|
|
33
34
|
|
|
34
35
|
```html
|
|
35
36
|
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@<version>/dist/application.js"></script>
|
|
36
37
|
```
|
|
38
|
+
|
|
37
39
|
Install Specific version
|
|
40
|
+
|
|
38
41
|
```html
|
|
39
|
-
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@1.0
|
|
42
|
+
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@1.1.0/dist/application.js"></script>
|
|
40
43
|
```
|
|
41
44
|
|
|
42
45
|
```js
|
|
43
46
|
const { ApplicationConfig, ApplicationClient } = window;
|
|
44
47
|
```
|
|
45
48
|
|
|
46
|
-
|
|
47
49
|
### Logging
|
|
48
50
|
|
|
49
51
|
For logging support user can pass `logLevel` in `ApplicationConfig` or `PlatformConfig` while declaration.
|
|
@@ -53,6 +55,7 @@ Available logging levels: TRACE, DEBUG, INFO, WARN, ERROR.
|
|
|
53
55
|
|
|
54
56
|
Default log level: ERROR
|
|
55
57
|
```
|
|
58
|
+
|
|
56
59
|
### Sample Usage - ApplicationClient
|
|
57
60
|
|
|
58
61
|
```javascript
|
|
@@ -121,7 +124,9 @@ async function getData() {
|
|
|
121
124
|
|
|
122
125
|
getData();
|
|
123
126
|
```
|
|
127
|
+
|
|
124
128
|
---
|
|
129
|
+
|
|
125
130
|
### Cookie
|
|
126
131
|
|
|
127
132
|
Following code snippet will read and write cookies on behalf of you <br />
|
|
@@ -142,15 +147,53 @@ module.exports = cookieJar
|
|
|
142
147
|
```
|
|
143
148
|
|
|
144
149
|
get the stored cookie from the CookieJar instance
|
|
150
|
+
|
|
145
151
|
```javascript
|
|
146
152
|
const cookieJar = require('path/to/cookieJar') // replace with actual path
|
|
147
153
|
|
|
148
154
|
let cookies = await cookieJar.getCookies("https://api.fynd.com");
|
|
149
155
|
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Headers
|
|
160
|
+
|
|
161
|
+
#### Adding Request Headers
|
|
162
|
+
|
|
163
|
+
To include request headers when calling a method, add `requestHeaders` object in the first argument.
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const requestHeaders = {
|
|
167
|
+
"x-api-version": "1.0"
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const options = {
|
|
171
|
+
responseHeaders: true
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const [response, headers] = await platformClient.application("<APPLICATION_ID>").theme.getAllPages({theme_id: "<THEME_ID>", requestHeaders: requestHeaders}, options);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### get Response Headers
|
|
178
|
+
|
|
179
|
+
To retrieve the response headers, simply set the `responseHeaders` option to `true` when calling the desired method. Below is an example demonstrating how to achieve this:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
const options = {
|
|
183
|
+
responseHeaders: true
|
|
184
|
+
}
|
|
185
|
+
const [response, headers] = await platformClient.application("<APPLICATION_ID>").theme.getAllPages({theme_id: "<THEME_ID>"}, options);
|
|
186
|
+
|
|
187
|
+
console.log("[API RESPONSE]: ", response);
|
|
188
|
+
console.log("[RESPONSE HEADERS]: ", headers);
|
|
189
|
+
```
|
|
190
|
+
|
|
150
191
|
---
|
|
151
192
|
|
|
152
193
|
### Log Curl
|
|
194
|
+
|
|
153
195
|
To print the curl command in the console for all network calls made using `applicationClient` or `platformClient`, set the logger level to debug.
|
|
196
|
+
|
|
154
197
|
```javascript
|
|
155
198
|
const {
|
|
156
199
|
ApplicationClient, ApplicationConfig,
|
|
@@ -167,12 +210,16 @@ let applicationClient = new ApplicationClient(applicationConfig);
|
|
|
167
210
|
let response = await applicationClient.theme.getAppliedTheme();
|
|
168
211
|
console.log("Active Theme: ", response.information.name);
|
|
169
212
|
```
|
|
213
|
+
|
|
170
214
|
The above code will log the curl command in the console
|
|
215
|
+
|
|
171
216
|
```bash
|
|
172
217
|
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 0.1.36' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
|
|
173
218
|
Active Theme: Emerge
|
|
174
219
|
```
|
|
220
|
+
|
|
175
221
|
---
|
|
222
|
+
|
|
176
223
|
### TypeScript
|
|
177
224
|
|
|
178
225
|
fdk-client-javascript includes Typescript definitions.
|
|
@@ -180,7 +227,9 @@ fdk-client-javascript includes Typescript definitions.
|
|
|
180
227
|
```typescript
|
|
181
228
|
import { ApplicationConfig, ApplicationClient } from "fdk-client-javascript";
|
|
182
229
|
```
|
|
230
|
+
|
|
183
231
|
---
|
|
232
|
+
|
|
184
233
|
### Documentation
|
|
185
234
|
|
|
186
235
|
- [Application Front](documentation/application/README.md)
|
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
2
|
const { ApplicationConfig, ApplicationClient, ApplicationModel } = require('./sdk/application');
|
|
4
3
|
const { PartnerConfig, PartnerClient, PartnerModel } = require('./sdk/partner');
|
|
5
4
|
const { PlatformConfig, PlatformClient, PlatformModel } = require('./sdk/platform');
|
|
@@ -11,8 +10,6 @@ const Constant = require('./sdk/common/Constant');
|
|
|
11
10
|
module.exports = {
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
13
|
ApplicationConfig,
|
|
17
14
|
ApplicationClient,
|
|
18
15
|
ApplicationModel,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gofynd/fdk-client-javascript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"axios": "^0.27.2",
|
|
16
16
|
"camelcase": "^6.3.0",
|
|
17
17
|
"crypto-js": "^4.1.1",
|
|
18
|
-
"isomorphic-base64": "^1.0.2",
|
|
19
18
|
"joi": "^17.7.0",
|
|
20
19
|
"loglevel": "^1.8.1",
|
|
21
20
|
"query-string": "^7.1.3"
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export = APIClient;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} Options
|
|
4
|
+
* @property {boolean} responseHeaders - Whether response headers are returned or not.
|
|
5
|
+
*/
|
|
2
6
|
declare class APIClient {
|
|
3
7
|
/**
|
|
4
8
|
* @param {object} conf
|
|
@@ -6,6 +10,16 @@ declare class APIClient {
|
|
|
6
10
|
* @param {string} url
|
|
7
11
|
* @param {object} query
|
|
8
12
|
* @param {object} body
|
|
13
|
+
* @param {object} xHeaders
|
|
9
14
|
*/
|
|
10
|
-
static execute(conf: object, method: string, url: string, query: object, body: object, xHeaders: any): any;
|
|
15
|
+
static execute(conf: object, method: string, url: string, query: object, body: object, xHeaders: object, options: any): any;
|
|
11
16
|
}
|
|
17
|
+
declare namespace APIClient {
|
|
18
|
+
export { Options };
|
|
19
|
+
}
|
|
20
|
+
type Options = {
|
|
21
|
+
/**
|
|
22
|
+
* - Whether response headers are returned or not.
|
|
23
|
+
*/
|
|
24
|
+
responseHeaders: boolean;
|
|
25
|
+
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
const { fdkAxios } = require("../common/AxiosHelper");
|
|
2
|
-
const {
|
|
2
|
+
const { convertStringToBase64 } = require("../common/utils");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Options
|
|
6
|
+
* @property {boolean} responseHeaders - Whether response headers are returned or not.
|
|
7
|
+
*/
|
|
3
8
|
|
|
4
9
|
class APIClient {
|
|
5
10
|
/**
|
|
@@ -8,10 +13,13 @@ class APIClient {
|
|
|
8
13
|
* @param {string} url
|
|
9
14
|
* @param {object} query
|
|
10
15
|
* @param {object} body
|
|
16
|
+
* @param {object} xHeaders
|
|
11
17
|
*/
|
|
12
18
|
|
|
13
|
-
static execute(conf, method, url, query, body, xHeaders) {
|
|
14
|
-
const token =
|
|
19
|
+
static execute(conf, method, url, query, body, xHeaders, options) {
|
|
20
|
+
const token = convertStringToBase64(
|
|
21
|
+
`${conf.applicationID}:${conf.applicationToken}`
|
|
22
|
+
);
|
|
15
23
|
|
|
16
24
|
let headers = { Authorization: "Bearer " + token };
|
|
17
25
|
if (conf.cookie) {
|
|
@@ -37,6 +45,7 @@ class APIClient {
|
|
|
37
45
|
params: query,
|
|
38
46
|
data: body,
|
|
39
47
|
headers: { ...headers, ...extraHeaders, ...xHeaders },
|
|
48
|
+
responseHeaders: options.responseHeaders,
|
|
40
49
|
};
|
|
41
50
|
rawRequest = JSON.parse(JSON.stringify(rawRequest));
|
|
42
51
|
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export = ApplicationClient;
|
|
2
|
+
/**
|
|
3
|
+
* Represents the client for the application.
|
|
4
|
+
*
|
|
5
|
+
* @class
|
|
6
|
+
*/
|
|
2
7
|
declare class ApplicationClient {
|
|
3
|
-
|
|
4
|
-
config:
|
|
8
|
+
/** @param {import("./ApplicationConfig")} config - The application configuration. */
|
|
9
|
+
constructor(config: import("./ApplicationConfig"));
|
|
10
|
+
config: import("./ApplicationConfig");
|
|
5
11
|
cart: Cart;
|
|
6
12
|
catalog: Catalog;
|
|
7
13
|
common: Common;
|
|
@@ -18,10 +24,34 @@ declare class ApplicationClient {
|
|
|
18
24
|
share: Share;
|
|
19
25
|
theme: Theme;
|
|
20
26
|
user: User;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Sets the cookie for the application.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} cookie - The cookie to set, This cookie will be included
|
|
31
|
+
* in the headers of every subsequent request.
|
|
32
|
+
*/
|
|
33
|
+
setCookie(cookie: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the location details for the application.
|
|
36
|
+
*
|
|
37
|
+
* @param {import("./ApplicationConfig").LocationObject} locationDetails -
|
|
38
|
+
* The location details to set.
|
|
39
|
+
*/
|
|
40
|
+
setLocationDetails(locationDetails: import("./ApplicationConfig").LocationObject): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the currency code in ApplicationConfig.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} currencyCode - The currency code to set.
|
|
45
|
+
* @throws {FDKClientValidationError} When the provided currency code is not a string.
|
|
46
|
+
*/
|
|
47
|
+
setCurrencyCode(currencyCode: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the extra headers for the application.
|
|
50
|
+
*
|
|
51
|
+
* @param {object} header - The header object to set.
|
|
52
|
+
* @throws {FDKClientValidationError} When the provided header is not an object.
|
|
53
|
+
*/
|
|
54
|
+
setExtraHeaders(header: object): void;
|
|
25
55
|
}
|
|
26
56
|
import Cart = require("./Cart/CartApplicationClient");
|
|
27
57
|
import Catalog = require("./Catalog/CatalogApplicationClient");
|
|
@@ -1,96 +1,77 @@
|
|
|
1
|
-
const { LocationValidator } = require("./ApplicationModels");
|
|
2
|
-
|
|
3
1
|
const Cart = require("./Cart/CartApplicationClient");
|
|
4
|
-
|
|
5
2
|
const Catalog = require("./Catalog/CatalogApplicationClient");
|
|
6
|
-
|
|
7
3
|
const Common = require("./Common/CommonApplicationClient");
|
|
8
|
-
|
|
9
4
|
const Communication = require("./Communication/CommunicationApplicationClient");
|
|
10
|
-
|
|
11
5
|
const Configuration = require("./Configuration/ConfigurationApplicationClient");
|
|
12
|
-
|
|
13
6
|
const Content = require("./Content/ContentApplicationClient");
|
|
14
|
-
|
|
15
7
|
const FileStorage = require("./FileStorage/FileStorageApplicationClient");
|
|
16
|
-
|
|
17
8
|
const Lead = require("./Lead/LeadApplicationClient");
|
|
18
|
-
|
|
19
9
|
const Logistic = require("./Logistic/LogisticApplicationClient");
|
|
20
|
-
|
|
21
10
|
const Order = require("./Order/OrderApplicationClient");
|
|
22
|
-
|
|
23
11
|
const Payment = require("./Payment/PaymentApplicationClient");
|
|
24
|
-
|
|
25
12
|
const PosCart = require("./PosCart/PosCartApplicationClient");
|
|
26
|
-
|
|
27
13
|
const Rewards = require("./Rewards/RewardsApplicationClient");
|
|
28
|
-
|
|
29
14
|
const Share = require("./Share/ShareApplicationClient");
|
|
30
|
-
|
|
31
15
|
const Theme = require("./Theme/ThemeApplicationClient");
|
|
32
|
-
|
|
33
16
|
const User = require("./User/UserApplicationClient");
|
|
34
|
-
|
|
35
17
|
const { FDKClientValidationError } = require("../common/FDKError");
|
|
36
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Represents the client for the application.
|
|
21
|
+
*
|
|
22
|
+
* @class
|
|
23
|
+
*/
|
|
37
24
|
class ApplicationClient {
|
|
25
|
+
/** @param {import("./ApplicationConfig")} config - The application configuration. */
|
|
38
26
|
constructor(config) {
|
|
39
27
|
this.config = config;
|
|
40
|
-
|
|
41
28
|
this.cart = new Cart(config);
|
|
42
|
-
|
|
43
29
|
this.catalog = new Catalog(config);
|
|
44
|
-
|
|
45
30
|
this.common = new Common(config);
|
|
46
|
-
|
|
47
31
|
this.communication = new Communication(config);
|
|
48
|
-
|
|
49
32
|
this.configuration = new Configuration(config);
|
|
50
|
-
|
|
51
33
|
this.content = new Content(config);
|
|
52
|
-
|
|
53
34
|
this.fileStorage = new FileStorage(config);
|
|
54
|
-
|
|
55
35
|
this.lead = new Lead(config);
|
|
56
|
-
|
|
57
36
|
this.logistic = new Logistic(config);
|
|
58
|
-
|
|
59
37
|
this.order = new Order(config);
|
|
60
|
-
|
|
61
38
|
this.payment = new Payment(config);
|
|
62
|
-
|
|
63
39
|
this.posCart = new PosCart(config);
|
|
64
|
-
|
|
65
40
|
this.rewards = new Rewards(config);
|
|
66
|
-
|
|
67
41
|
this.share = new Share(config);
|
|
68
|
-
|
|
69
42
|
this.theme = new Theme(config);
|
|
70
|
-
|
|
71
43
|
this.user = new User(config);
|
|
72
44
|
}
|
|
73
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Sets the cookie for the application.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} cookie - The cookie to set, This cookie will be included
|
|
50
|
+
* in the headers of every subsequent request.
|
|
51
|
+
*/
|
|
74
52
|
setCookie(cookie) {
|
|
75
53
|
this.config.cookie = cookie;
|
|
76
54
|
}
|
|
77
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Sets the location details for the application.
|
|
58
|
+
*
|
|
59
|
+
* @param {import("./ApplicationConfig").LocationObject} locationDetails -
|
|
60
|
+
* The location details to set.
|
|
61
|
+
*/
|
|
78
62
|
setLocationDetails(locationDetails) {
|
|
79
|
-
const {
|
|
80
|
-
error,
|
|
81
|
-
} = LocationValidator.validateLocationObj().validate(locationDetails, {
|
|
82
|
-
abortEarly: false,
|
|
83
|
-
allowUnknown: true,
|
|
84
|
-
});
|
|
85
|
-
if (error) {
|
|
86
|
-
throw new FDKClientValidationError(error);
|
|
87
|
-
}
|
|
88
63
|
this.config.locationDetails = {
|
|
89
64
|
...this.config.locationDetails,
|
|
90
65
|
...locationDetails,
|
|
91
66
|
};
|
|
92
67
|
}
|
|
93
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Sets the currency code in ApplicationConfig.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} currencyCode - The currency code to set.
|
|
73
|
+
* @throws {FDKClientValidationError} When the provided currency code is not a string.
|
|
74
|
+
*/
|
|
94
75
|
setCurrencyCode(currencyCode) {
|
|
95
76
|
if (typeof currencyCode !== "string") {
|
|
96
77
|
throw new FDKClientValidationError("Currency code should be string only");
|
|
@@ -98,6 +79,12 @@ class ApplicationClient {
|
|
|
98
79
|
this.config.currencyCode = currencyCode;
|
|
99
80
|
}
|
|
100
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Sets the extra headers for the application.
|
|
84
|
+
*
|
|
85
|
+
* @param {object} header - The header object to set.
|
|
86
|
+
* @throws {FDKClientValidationError} When the provided header is not an object.
|
|
87
|
+
*/
|
|
101
88
|
setExtraHeaders(header) {
|
|
102
89
|
if (typeof header === "object") {
|
|
103
90
|
this.config.extraHeaders.push(header);
|
|
@@ -1,20 +1,100 @@
|
|
|
1
1
|
export = ApplicationConfig;
|
|
2
|
+
/**
|
|
3
|
+
* Represents the location object for validation.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} LocationObject
|
|
6
|
+
* @property {string} pincode - The pincode of the location.
|
|
7
|
+
* @property {string} country - The country of the location.
|
|
8
|
+
* @property {string} country_iso_code - The ISO code of the country.
|
|
9
|
+
* @property {string} city - The city of the location.
|
|
10
|
+
* @property {Object} location - The geographical coordinates of the location.
|
|
11
|
+
* @property {string} location.longitude - The longitude of the location.
|
|
12
|
+
* @property {string} location.latitude - The latitude of the location.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Represents the configuration for an application.
|
|
16
|
+
*
|
|
17
|
+
* @class
|
|
18
|
+
*/
|
|
2
19
|
declare class ApplicationConfig {
|
|
20
|
+
/** @typedef {"TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR"} logLevelEnum */
|
|
3
21
|
/**
|
|
4
|
-
* @param {object} _conf
|
|
5
|
-
* @param {
|
|
22
|
+
* @param {object} _conf - The application configuration.
|
|
23
|
+
* @param {string} _conf.applicationID - The ID of the application.
|
|
24
|
+
* @param {string} [_conf.applicationToken] - The token for the application.
|
|
25
|
+
* @param {string} [_conf.domain='https://api.fynd.com'] - The domain for
|
|
26
|
+
* API. \n Write full domain. Default is `'https://api.fynd.com'`
|
|
27
|
+
* @param {logLevelEnum} [_conf.logLevel='ERROR'] - The log level. Available
|
|
28
|
+
* options: TRACE, DEBUG, INFO, WARN, ERROR. Default is `'ERROR'`
|
|
29
|
+
* @param {LocationObject} [_conf.locationDetails] - The location details.
|
|
30
|
+
* @param {string} [_conf.currencyCode='INR'] - The currency code. Default is `'INR'`
|
|
31
|
+
* @param {object} [_opts] - Additional options.
|
|
6
32
|
*/
|
|
7
|
-
constructor(_conf:
|
|
8
|
-
|
|
9
|
-
|
|
33
|
+
constructor(_conf: {
|
|
34
|
+
applicationID: string;
|
|
35
|
+
applicationToken?: string;
|
|
36
|
+
domain?: string;
|
|
37
|
+
logLevel?: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
38
|
+
locationDetails?: LocationObject;
|
|
39
|
+
currencyCode?: string;
|
|
40
|
+
}, _opts?: object);
|
|
41
|
+
applicationID: string;
|
|
42
|
+
applicationToken: string;
|
|
10
43
|
opts: any;
|
|
11
|
-
domain:
|
|
12
|
-
logLevel:
|
|
44
|
+
domain: string;
|
|
45
|
+
logLevel: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
13
46
|
extraHeaders: any[];
|
|
14
|
-
locationDetails:
|
|
15
|
-
currencyCode:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
47
|
+
locationDetails: LocationObject;
|
|
48
|
+
currencyCode: string;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the log level for the application.
|
|
51
|
+
*
|
|
52
|
+
* @param {logLevelEnum} level - The log level to set.
|
|
53
|
+
*/
|
|
54
|
+
setLogLevel(level: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR"): void;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the cookie for the application.
|
|
57
|
+
*
|
|
58
|
+
* @param {string} cookie - The cookie to set, This cookie will be included
|
|
59
|
+
* in the headers of every subsequent request.
|
|
60
|
+
*/
|
|
61
|
+
setCookie(cookie: string): void;
|
|
62
|
+
cookie: string;
|
|
63
|
+
/**
|
|
64
|
+
* Validates the application configuration.
|
|
65
|
+
*
|
|
66
|
+
* @throws {FDKInvalidCredentialError} When the credentials are invalid or missing.
|
|
67
|
+
*/
|
|
19
68
|
validate(): void;
|
|
20
69
|
}
|
|
70
|
+
declare namespace ApplicationConfig {
|
|
71
|
+
export { LocationObject };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Represents the location object for validation.
|
|
75
|
+
*/
|
|
76
|
+
type LocationObject = {
|
|
77
|
+
/**
|
|
78
|
+
* - The pincode of the location.
|
|
79
|
+
*/
|
|
80
|
+
pincode: string;
|
|
81
|
+
/**
|
|
82
|
+
* - The country of the location.
|
|
83
|
+
*/
|
|
84
|
+
country: string;
|
|
85
|
+
/**
|
|
86
|
+
* - The ISO code of the country.
|
|
87
|
+
*/
|
|
88
|
+
country_iso_code: string;
|
|
89
|
+
/**
|
|
90
|
+
* - The city of the location.
|
|
91
|
+
*/
|
|
92
|
+
city: string;
|
|
93
|
+
/**
|
|
94
|
+
* - The geographical coordinates of the location.
|
|
95
|
+
*/
|
|
96
|
+
location: {
|
|
97
|
+
longitude: string;
|
|
98
|
+
latitude: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
@@ -1,13 +1,38 @@
|
|
|
1
|
-
const {
|
|
2
|
-
FDKInvalidCredentialError,
|
|
3
|
-
FDKClientValidationError,
|
|
4
|
-
} = require("../common/FDKError");
|
|
1
|
+
const { FDKInvalidCredentialError } = require("../common/FDKError");
|
|
5
2
|
const { Logger, setLoggerLevel } = require("../common/Logger");
|
|
6
|
-
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the location object for validation.
|
|
6
|
+
*
|
|
7
|
+
* @typedef {Object} LocationObject
|
|
8
|
+
* @property {string} pincode - The pincode of the location.
|
|
9
|
+
* @property {string} country - The country of the location.
|
|
10
|
+
* @property {string} country_iso_code - The ISO code of the country.
|
|
11
|
+
* @property {string} city - The city of the location.
|
|
12
|
+
* @property {Object} location - The geographical coordinates of the location.
|
|
13
|
+
* @property {string} location.longitude - The longitude of the location.
|
|
14
|
+
* @property {string} location.latitude - The latitude of the location.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents the configuration for an application.
|
|
19
|
+
*
|
|
20
|
+
* @class
|
|
21
|
+
*/
|
|
7
22
|
class ApplicationConfig {
|
|
23
|
+
/** @typedef {"TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR"} logLevelEnum */
|
|
24
|
+
|
|
8
25
|
/**
|
|
9
|
-
* @param {object} _conf
|
|
10
|
-
* @param {
|
|
26
|
+
* @param {object} _conf - The application configuration.
|
|
27
|
+
* @param {string} _conf.applicationID - The ID of the application.
|
|
28
|
+
* @param {string} [_conf.applicationToken] - The token for the application.
|
|
29
|
+
* @param {string} [_conf.domain='https://api.fynd.com'] - The domain for
|
|
30
|
+
* API. \n Write full domain. Default is `'https://api.fynd.com'`
|
|
31
|
+
* @param {logLevelEnum} [_conf.logLevel='ERROR'] - The log level. Available
|
|
32
|
+
* options: TRACE, DEBUG, INFO, WARN, ERROR. Default is `'ERROR'`
|
|
33
|
+
* @param {LocationObject} [_conf.locationDetails] - The location details.
|
|
34
|
+
* @param {string} [_conf.currencyCode='INR'] - The currency code. Default is `'INR'`
|
|
35
|
+
* @param {object} [_opts] - Additional options.
|
|
11
36
|
*/
|
|
12
37
|
constructor(_conf, _opts) {
|
|
13
38
|
this.applicationID = _conf.applicationID || "";
|
|
@@ -22,23 +47,32 @@ class ApplicationConfig {
|
|
|
22
47
|
this.validate();
|
|
23
48
|
}
|
|
24
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Sets the log level for the application.
|
|
52
|
+
*
|
|
53
|
+
* @param {logLevelEnum} level - The log level to set.
|
|
54
|
+
*/
|
|
25
55
|
setLogLevel(level) {
|
|
26
56
|
setLoggerLevel(level.toUpperCase());
|
|
27
57
|
this.logLevel = level.toUpperCase();
|
|
28
58
|
}
|
|
29
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Sets the cookie for the application.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} cookie - The cookie to set, This cookie will be included
|
|
64
|
+
* in the headers of every subsequent request.
|
|
65
|
+
*/
|
|
30
66
|
setCookie(cookie) {
|
|
31
67
|
this.cookie = cookie;
|
|
32
68
|
}
|
|
33
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Validates the application configuration.
|
|
72
|
+
*
|
|
73
|
+
* @throws {FDKInvalidCredentialError} When the credentials are invalid or missing.
|
|
74
|
+
*/
|
|
34
75
|
validate() {
|
|
35
|
-
const { error } = LocationValidator.validateLocationObj().validate(
|
|
36
|
-
this.locationDetails,
|
|
37
|
-
{ abortEarly: false, allowUnknown: true }
|
|
38
|
-
);
|
|
39
|
-
if (error) {
|
|
40
|
-
throw new FDKClientValidationError(error);
|
|
41
|
-
}
|
|
42
76
|
if (!this.applicationID) {
|
|
43
77
|
Logger({ level: "ERROR", message: "No Application ID Present" });
|
|
44
78
|
throw new FDKInvalidCredentialError("No Application ID Present");
|