Socket
Socket
Sign inDemoInstall

rentmyjsdk

Package Overview
Dependencies
35
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.3 to 1.2.4

2

package.json
{
"name": "rentmyjsdk",
"version": "1.2.3",
"version": "1.2.4",
"description": "RentMy javaScript API SDK",

@@ -5,0 +5,0 @@ "main": "rentmy.js",

@@ -14,3 +14,3 @@ const fs = require('fs')

const moduleName = file.split('.').slice(0, -1).join('.')
preparedContent += ` ${moduleName}:{`
try {

@@ -24,6 +24,7 @@ const jsonContents = require(`${APIPath}/${file}`) || false

}
preparedContent += '},'
})
}
preparedContent += '}'
console.log(preparedContent)
writeInFile(preparedContent)

@@ -34,71 +35,77 @@ });

const apiNames = Object.keys(jsonContent)
const moduleNames = Object.keys(jsonContent)
let template = ``
for (const apiName of apiNames) {
template += ` ${apiName}:{
for (const moduleName of moduleNames) {
const apiNames = Object.keys(jsonContent[moduleName])
template += ` ${moduleName}:{`
for (const apiName of apiNames) {
template += ` ${apiName}:{
body: {
required: {`
const required = jsonContent[apiName]['params']['body']['required']
for (const requiredKey of required) {
const beautifiedKey = requiredKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${requiredKey.trim()}",`
}
template += `}, optional:{`
const required = jsonContent[moduleName][apiName]['params']['body']['required']
for (const requiredKey of required) {
const beautifiedKey = requiredKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${requiredKey.trim()}",`
}
template += `}, optional:{`
const optional = jsonContent[apiName]['params']['body']['optional']
for (const optionalKey of optional) {
const beautifiedKey = optionalKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${optionalKey.trim()}",`
}
if (jsonContent[apiName]['params']['body']['fillable']) {
const optional = jsonContent[moduleName][apiName]['params']['body']['optional']
for (const optionalKey of optional) {
const beautifiedKey = optionalKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${optionalKey.trim()}",`
}
if (jsonContent[moduleName][apiName]['params']['body']['fillable']) {
template += `
template += `
},fillable:{`
const keys = Object.keys(jsonContent[apiName]['params']['body']['fillable'])
for (const key of keys) {
template += `${key} :{ required: {`
const fillableRequired = jsonContent[apiName]['params']['body']['fillable'][key]['required']
for (const requiredKey of fillableRequired) {
const beautifiedKey = requiredKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${requiredKey.trim()}",`
}
template += `}, optional:{`
const keys = Object.keys(jsonContent[moduleName][apiName]['params']['body']['fillable'])
for (const key of keys) {
template += `${key} :{ required: {`
const fillableRequired = jsonContent[moduleName][apiName]['params']['body']['fillable'][key]['required']
for (const requiredKey of fillableRequired) {
const beautifiedKey = requiredKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${requiredKey.trim()}",`
}
template += `}, optional:{`
const fillableOptional = jsonContent[apiName]['params']['body']['fillable'][key]['optional']
for (const optionalKey of fillableOptional) {
const beautifiedKey = optionalKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${optionalKey.trim()}",`
const fillableOptional = jsonContent[moduleName][apiName]['params']['body']['fillable'][key]['optional']
for (const optionalKey of fillableOptional) {
const beautifiedKey = optionalKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${optionalKey.trim()}",`
}
}
template += `}}`
}
template += `}}`
}
template += `}
template += `}
},
query:{
required: {`
const query = jsonContent[apiName]['params']['query']['required']
for (const queryKey of query) {
const beautifiedKey = queryKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${queryKey.trim()}",`
}
template += `},
const query = jsonContent[moduleName][apiName]['params']['query']['required']
for (const queryKey of query) {
const beautifiedKey = queryKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${queryKey.trim()}",`
}
template += `},
optional:{`
const optionalQuery = jsonContent[apiName]['params']['query']['optional']
for (const optionalqueryKey of optionalQuery) {
const beautifiedKey = optionalqueryKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${optionalqueryKey.trim()}",`
}
template += `}
const optionalQuery = jsonContent[moduleName][apiName]['params']['query']['optional']
for (const optionalqueryKey of optionalQuery) {
const beautifiedKey = optionalqueryKey.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` ${beautifiedKey.smallCaps()}: "${optionalqueryKey.trim()}",`
}
template += `}
},
urlPlaceholders:[`
jsonContent[apiName]['path'].replace(/{{\w+}}/g, function(key) {
key = key.trim().slice(2, key.length-2)
const beautifiedKey = key.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` "${beautifiedKey.smallCaps()}",`
})
template += `]
jsonContent[moduleName][apiName]['path'].replace(/{{\w+}}/g, function (key) {
key = key.trim().slice(2, key.length - 2)
const beautifiedKey = key.trim().replace(/(^|_)./g, s => s.slice(-1).toUpperCase())
template += ` "${beautifiedKey.smallCaps()}",`
})
template += `]
},`
}
template += `}, `
}

@@ -105,0 +112,0 @@ return template

export default {
all: {},
cart: {
addToCart: {
body: {
required: {
quantity: "quantity",
productId: "product_id",
variantsProductsId: "variants_products_id",
rentalType: "rental_type",
location: "location",
rentStart: "rent_start",
rentEnd: "rent_end",
},
optional: {
token: "token",
drivingLicenseRequired: "driving_license_required",
salesTax: "sales_tax",
depositAmount: "deposit_amount",
depositeTax: "deposite_tax",
isAdmin: "is_admin",
price: "price",
priceId: "price_id",
rentalDuration: "rental_duration",
term: "term",
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
packageAddToCart: {
body: {
required: {
quantity: "quantity",
packageId: "package_id",
rentalType: "rental_type",
location: "location",
variantsProductsId: "variants_products_id",
rentStart: "rent_start",
rentEnd: "rent_end",
},
optional: {
token: "token",
drivingLicenseRequired: "driving_license_required",
salesTax: "sales_tax",
depositAmount: "deposit_amount",
depositeTax: "deposite_tax",
isAdmin: "is_admin",
price: "price",
priceId: "price_id",
rentalDuration: "rental_duration",
term: "term",
customFields: "custom_fields",
products: "products",
zone: "zone",
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
addOrUpdateToCartWithoutDate: {
body: {
required: {
quantity: "quantity",
productId: "product_id",
variantsProductsId: "variants_products_id",
rentalType: "rental_type",
location: "location",
productType: "product_type",
type: "type",
},
optional: {
token: "token",
cartItemId: "cart_item_id",
price: "price",
increment: "increment",
id: "id",
action: "action",
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
setOrUpdateRentalDates: {
body: {
required: {
startDate: "start_date",
endDate: "end_date",
token: "token",
type: "type",
source: "source",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
deleteCartItem: {
body: {
required: {
cartItemId: "cart_item_id",
productId: "product_id",
token: "token",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
checkAvailability: {
body: {
required: {},
optional: {}
},
query: {
required: {
type: "type",
token: "token",
},
optional: {}
},
urlPlaceholders: []
},
viewCart: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: ["cartToken",]
},
updateCart: {
body: {
required: {
id: "id",
increment: "increment",
token: "token",
price: "price",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
},
checkout: {
getAdditionalServices: {
body: {
required: {},
optional: {}
},
query: {
required: {
type: "type",
cartToken: "cart_token",
},
optional: {}
},
urlPlaceholders: []
},
addServicesWithCartTotal: {
body: {
required: {
additionalCharges: "additional_charges",
cartToken: "cart_token",
},
optional: {
},
fillable: {
additional_charges: {
required: {
id: "id",
isSelected: "is_selected",
value: "value",
orderAdditionalChargeId: "order_additional_charge_id",
selectedOption: "selected_option",
},
optional: {}
}
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
getDeliveryAddress: {
body: {
required: {
shippingCost: "shipping_cost",
shippingMethod: "shipping_method",
tax: "tax",
token: "token",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
getDeliveryCost: {
body: {
required: {
address: "address",
},
optional: {
},
fillable: {
address: {
required: {
shippingAddress1: "shipping_address1",
shippingCity: "shipping_city",
shippingCountry: "shipping_country",
shippingFirstName: "shipping_first_name",
shippingLastName: "shipping_last_name",
shippingName: "shipping_name",
shippingState: "shipping_state",
shippingZipcode: "shipping_zipcode",
country: "country",
shippingPhone: "shipping_phone",
},
optional: {
shippingAddress2: "shipping_address2",
shippingMethod: "shipping_method",
shippingMobile: "shipping_mobile",
cardExpMonth: "card_exp_month",
cardExpYear: "card_exp_year",
startTime: "start_time",
endTime: "end_time",
}
}
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
orderCreate: {
body: {
required: {
firstName: "first_name",
lastName: "last_name",
mobile: "mobile",
email: "email",
addressLine1: "address_line1",
city: "city",
state: "state",
country: "country",
zipcode: "zipcode",
delivery: "delivery",
shippingMethod: "shipping_method",
currency: "currency",
token: "token",
gatewayId: "gateway_id",
type: "type",
note: "note",
paymentGatewayName: "payment_gateway_name",
},
optional: {
address2: "address2",
specialInstructions: "special_instructions",
specialRequests: "special_requests",
drivingLicense: "driving_license",
fieldSelection: "fieldSelection",
fieldText: "fieldText",
pickup: "pickup",
customValues: "custom_values",
signature: "signature",
account: "account",
shippingAddress1: "shipping_address1",
shippingAddress2: "shipping_address2",
shippingCity: "shipping_city",
shippingCountry: "shipping_country",
shippingEmail: "shipping_email",
shippingFirstName: "shipping_first_name",
shippingLastName: "shipping_last_name",
shippingMobile: "shipping_mobile",
shippingState: "shipping_state",
shippingZipcode: "shipping_zipcode",
expiry: "expiry",
cvv2: "cvv2",
paymentAmount: "payment_amount",
amountTendered: "amount_tendered",
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
orderDetails: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: ["orderUid",]
},
getOrderAdditionalServicesAfterComplete: {
body: {
required: {},
optional: {}
},
query: {
required: {
type: "type",
},
optional: {}
},
urlPlaceholders: ["orderId",]
},
},
config: {
navigation: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
settings: {
body: {
required: {},
optional: {}
},
query: {
required: {
type: "type",
},
optional: {}
},
urlPlaceholders: []
},
categories: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
contents: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
countries: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
deliverySettings: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
locations: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
enabledPaymentGateWays: {
body: {
required: {},
optional: {}
},
query: {
required: {
isOnline: "is_online",
},
optional: {}
},
urlPlaceholders: []
},
},
pages: {
sendEmailFromContact: {
body: {
required: {
firstName: "first_name",
lastName: "last_name",
email: "email",
phone: "phone",
message: "message",
},
optional: {
tempPhone: "tempPhone",
type: "type",
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
customPage: {
body: {
required: {},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: ["slug",]
},
newsSubscribe: {
body: {
required: {
email: "email",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
},
products: {
productsOnlineList: {
body: {
required: {
pageNo: "page_no",
limit: "limit",
},
optional: {
priceMax: "price_max",
priceMin: "price_min",
all: "all",
sortBy: "sort_by",
sortDir: "sort_dir",
purchaseType: "purchase_type",
tagId: "tag_id",
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
productsSearch: {
body: {
required: {
pageNo: "page_no",
limit: "limit",
search: "search",
},
optional: {
priceMax: "price_max",
priceMin: "price_min",
sortBy: "sort_by",
sortDir: "sort_dir",
purchaseType: "purchase_type",
category: "category",
categoryId: "category_id",
}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
productDetails: {
body: {
required: {},
optional: {}
},
query: {
required: {
location: "location",
},
optional: {
token: "token",
startDate: "start_date",
endDate: "end_date",
}
},
urlPlaceholders: ["productUuid",]
},
packageDetails: {
body: {
required: {},
optional: {}
},
query: {
required: {
location: "location",
},
optional: {
token: "token",
startDate: "start_date",
endDate: "end_date",
}
},
urlPlaceholders: ["productUuid", "time",]
},
productVariantChain: {
body: {
required: {},
optional: {}
},
query: {
required: {
productId: "product_id",
variantId: "variant_id",
},
optional: {
variantChain: "variant_chain",
}
},
urlPlaceholders: []
},
productLastVariantChain: {
body: {
required: {},
optional: {}
},
query: {
required: {
productId: "product_id",
variantId: "variant_id",
variantChain: "variant_chain",
},
optional: {}
},
urlPlaceholders: []
},
productListByCategory: {
body: {
required: {
pageNo: "page_no",
limit: "limit",
tagId: "tag_id",
sortBy: "sort_by",
sortDir: "sort_dir",
search: "search",
categoryId: "category_id",
priceMax: "price_max",
priceMin: "price_min",
purchaseType: "purchase_type",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: ["categoryId",]
},
},
template: {
testsApi: {
body: {
required: {
sortDir: "sort_dir",
search: "search",
},
optional: {
optionbody: "optionbody",
}
},
query: {
required: {
requiredquery: "requiredquery",
},
optional: {
optionalrequa: "optionalrequa",
}
},
urlPlaceholders: ["urlVlaue",]
},
},
token: {
storeToken: {
body: {
required: {
storeName: "store_name",
disableDefaultTime: "disable_default_time",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
appToken: {
body: {
required: {
storeName: "store_name",
disableDefaultTime: "disable_default_time",
},
optional: {}
},
query: {
required: {},
optional: {}
},
urlPlaceholders: []
},
},
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc