Simple condensing of common endpoint string
This commit is contained in:
parent
097a45d0a6
commit
651bf932cc
1 changed files with 59 additions and 46 deletions
|
|
@ -1,190 +1,203 @@
|
|||
const CONTENT_BASE_URL = '/content/api/v1/content';
|
||||
const LOCATION_BASE_URL = '/location/api/v1/location';
|
||||
const SCHEDULE_BASE_URL = '/schedule/api/v1/schedule';
|
||||
const PARTS_BASE_URL = '/parts/api/v1/parts';
|
||||
const VEHICLE_BASE_URL = '/vehicle/api/v1/vehicle';
|
||||
const PRICE_BASE_URL = '/price/api/v1/price';
|
||||
const ACCOUNT_BASE_URL = '/account/api/v1/account';
|
||||
const EXPERIMENTS_BASE_URL = '/experiments/api/v1/experiments';
|
||||
const ANALYTICS_BASE_URL = '/analytics/api/v1/analytics';
|
||||
const CLIENT_AUTH_BASE_URL = '/clientauth/api/v1/clientauth';
|
||||
const COVERAGE_BASE_URL = '/coverage/api/v1/coverage';
|
||||
const ORDER_BASE_URL = '/order/api/v1/order';
|
||||
|
||||
const endpoints = Object.freeze({
|
||||
GetRouteInfo: {
|
||||
url: (applicationAbbreviation) => `/content/api/v1/content/${applicationAbbreviation}/RouteInfo`,
|
||||
url: (applicationAbbreviation) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/RouteInfo`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetHomepageInfo: {
|
||||
url: (applicationAbbreviation) => `/content/api/v1/content/${applicationAbbreviation}/HomepageInfo`,
|
||||
url: (applicationAbbreviation) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/HomepageInfo`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetPageData: {
|
||||
url: (applicationAbbreviation, pageName) => `/content/api/v1/content/${applicationAbbreviation}/${pageName}`,
|
||||
url: (applicationAbbreviation, pageName) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/${pageName}`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetAlertReasons: {
|
||||
url: '/location/api/v1/location/alert-reasons',
|
||||
url: `${LOCATION_BASE_URL}/alert-reasons`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetShopTimeSlots: {
|
||||
url: '/schedule/api/v1/schedule/shop-time-slots',
|
||||
url: `${SCHEDULE_BASE_URL}/shop-time-slots`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetMobileTimeSlots: {
|
||||
url: '/schedule/api/v1/schedule/mobile-time-slots',
|
||||
url: `${SCHEDULE_BASE_URL}/mobile-time-slots`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetMobilePremiumFee: {
|
||||
url: '/parts/api/v1/parts/mobile-premium-fee',
|
||||
url: `${PARTS_BASE_URL}/mobile-premium-fee`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetVehicleYears: {
|
||||
url: '/vehicle/api/v1/vehicle/years',
|
||||
url: `${VEHICLE_BASE_URL}/years`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetVehicleMakes: {
|
||||
url: '/vehicle/api/v1/vehicle/makes/',
|
||||
url: `${VEHICLE_BASE_URL}/makes/`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetVehicleModels: {
|
||||
url: '/vehicle/api/v1/vehicle/models',
|
||||
url: `${VEHICLE_BASE_URL}/models`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetVehicleStyles: {
|
||||
url: '/vehicle/api/v1/vehicle/styles',
|
||||
url: `${VEHICLE_BASE_URL}/styles`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetDamageOptions: {
|
||||
url: '/parts/api/v1/parts/damage-options',
|
||||
url: `${PARTS_BASE_URL}/damage-options`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetPartsOrQuestions: {
|
||||
url: '/parts/api/v1/parts/parts-or-questions',
|
||||
url: `${PARTS_BASE_URL}/parts-or-questions`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetParts: {
|
||||
url: '/parts/api/v1/parts/parts',
|
||||
url: `${PARTS_BASE_URL}/parts`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetInsurancePriceOrderItems: {
|
||||
url: '/price/api/v1/price/order-items-with-insurance-pricing',
|
||||
url: `${PRICE_BASE_URL}/order-items-with-insurance-pricing`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetPriceOrderItems: {
|
||||
url: '/price/api/v1/price/order-items',
|
||||
url: `${PRICE_BASE_URL}/order-items`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetProviders: {
|
||||
url: '/location/api/v1/location/providers',
|
||||
url: `${LOCATION_BASE_URL}/providers`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetCapabilityQuestions: {
|
||||
url: '/parts/api/v1/parts/capability-questions',
|
||||
url: `${PARTS_BASE_URL}/capability-questions`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetPartFromCapabilityAnswer: {
|
||||
url: '/parts/api/v1/parts/part-from-capability-answer',
|
||||
url: `${PARTS_BASE_URL}/part-from-capability-answer`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetWipers: {
|
||||
url: '/parts/api/v1/parts/wipers',
|
||||
url: `${PARTS_BASE_URL}/wipers`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetRainDefense: {
|
||||
url: '/parts/api/v1/parts/rain-defense',
|
||||
url: `${PARTS_BASE_URL}/rain-defense`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetSupportingItems: {
|
||||
url: '/parts/api/v1/parts/supporting-items',
|
||||
url: `${PARTS_BASE_URL}/supporting-items`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetMobileFeePart: {
|
||||
url: '/parts/api/v1/parts/mobile-fee',
|
||||
url: `${PARTS_BASE_URL}/mobile-fee`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetServiceabilityDetails: {
|
||||
url: '/location/api/v1/location/serviceability-details',
|
||||
url: `${LOCATION_BASE_URL}/serviceability-details`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetVehicle: {
|
||||
url: '/vehicle/api/v1/vehicle/lookup',
|
||||
url: `${VEHICLE_BASE_URL}/lookup`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetAccountInfo: {
|
||||
url: '/account/api/v1/account/',
|
||||
url: `${ACCOUNT_BASE_URL}/`,
|
||||
method: 'GET'
|
||||
},
|
||||
LogExperimentExposureIfAssigned: {
|
||||
url: '/experiments/api/v1/experiments/log-exposure',
|
||||
url: `${EXPERIMENTS_BASE_URL}/log-exposure`,
|
||||
method: 'POST'
|
||||
},
|
||||
LogPageView: {
|
||||
url: '/analytics/api/v1/analytics/log-page-view',
|
||||
url: `${ANALYTICS_BASE_URL}/log-page-view`,
|
||||
method: 'POST'
|
||||
},
|
||||
LogCustomEvent: {
|
||||
url: '/analytics/api/v1/analytics/log-custom-event',
|
||||
url: `${ANALYTICS_BASE_URL}/log-custom-event`,
|
||||
method: 'POST'
|
||||
},
|
||||
LookupVehicleByVin: {
|
||||
url: '/vehicle/api/v1/vehicle/lookup',
|
||||
url: `${VEHICLE_BASE_URL}/lookup`,
|
||||
method: 'POST'
|
||||
},
|
||||
LookupVinByAddress: {
|
||||
url: '/vehicle/api/v1/vehicle/lookup-vin-by-address',
|
||||
url: `${VEHICLE_BASE_URL}/lookup-vin-by-address`,
|
||||
method: 'POST'
|
||||
},
|
||||
LookupVinByPlate: {
|
||||
url: '/vehicle/api/v1/vehicle/lookup-vin-by-plate',
|
||||
url: `${VEHICLE_BASE_URL}/lookup-vin-by-plate`,
|
||||
method: 'POST'
|
||||
},
|
||||
InitializeSession: {
|
||||
url: '/analytics/api/v1/analytics/initialize',
|
||||
url: `${ANALYTICS_BASE_URL}/initialize`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetExperimentsByUser: {
|
||||
url: '/analytics/api/v1/analytics/get-experiments',
|
||||
url: `${ANALYTICS_BASE_URL}/get-experiments`,
|
||||
method: 'GET'
|
||||
},
|
||||
RunExperimentsForTrigger: {
|
||||
url: '/experiments/api/v1/experiments/run',
|
||||
url: `${EXPERIMENTS_BASE_URL}/run`,
|
||||
method: 'POST'
|
||||
},
|
||||
ValidateZip: {
|
||||
url: '/location/api/v1/location/zip',
|
||||
url: `${LOCATION_BASE_URL}/zip`,
|
||||
method: 'GET'
|
||||
},
|
||||
GooglePlaces: {
|
||||
url: (apiKey) => `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places`
|
||||
},
|
||||
ValidateClientTag: {
|
||||
url: '/clientauth/api/v1/clientauth/validate-client-tag',
|
||||
url: `${CLIENT_AUTH_BASE_URL}/validate-client-tag`,
|
||||
method: 'GET'
|
||||
},
|
||||
ValidateClientSignature: {
|
||||
url: '/clientauth/api/v1/clientauth/validate-client-signature',
|
||||
url: `${CLIENT_AUTH_BASE_URL}/validate-client-signature`,
|
||||
method: 'POST'
|
||||
},
|
||||
IsVinbyAddressPermissible: {
|
||||
url: '/vehicle/api/v1/vehicle/is-vin-by-address-permissible',
|
||||
url: `${VEHICLE_BASE_URL}/is-vin-by-address-permissible`,
|
||||
method: 'Get'
|
||||
},
|
||||
CoveragePolicyInfo: {
|
||||
url: '/coverage/api/v1/coverage/policy-information',
|
||||
url: `${COVERAGE_BASE_URL}/policy-information`,
|
||||
method: 'POST'
|
||||
},
|
||||
RegisterClaim: {
|
||||
url: '/coverage/api/v1/coverage/register-claim',
|
||||
url: `${COVERAGE_BASE_URL}/register-claim`,
|
||||
method: 'POST'
|
||||
},
|
||||
SaveSession: {
|
||||
url: '/order/api/v1/order/save-session/iss',
|
||||
url: `${ORDER_BASE_URL}/save-session/iss`,
|
||||
method: 'POST'
|
||||
},
|
||||
LoadSession: {
|
||||
url: '/order/api/v1/order/load-session/iss',
|
||||
url: `${ORDER_BASE_URL}/load-session/iss`,
|
||||
method: 'POST'
|
||||
},
|
||||
DuplicateSearch: {
|
||||
// eslint-disable-next-line max-len
|
||||
url: (accountNumber, policyNumber, dateOfLoss) => `/order/api/v1/order/duplicate-check/${accountNumber}/${policyNumber}/${dateOfLoss}`,
|
||||
url: (accountNumber, policyNumber, dateOfLoss) => `${ORDER_BASE_URL}/duplicate-check/${accountNumber}/${policyNumber}/${dateOfLoss}`,
|
||||
method: 'GET'
|
||||
},
|
||||
FinalDeductible: {
|
||||
url: '/coverage/api/v1/coverage/final-deductible',
|
||||
url: `${COVERAGE_BASE_URL}/final-deductible`,
|
||||
method: 'POST'
|
||||
},
|
||||
GetPaymentSignature: {
|
||||
url: '/order/api/v1/order/sign',
|
||||
url: `${ORDER_BASE_URL}/sign`,
|
||||
method: 'POST'
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue