Skip to content

Commit

Permalink
[Auto Generated] 1.4.12-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jigardafda committed Sep 27, 2024
1 parent 2e0985f commit 2d7da1b
Show file tree
Hide file tree
Showing 52 changed files with 9,242 additions and 1,986 deletions.
8,515 changes: 8,505 additions & 10 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ getData();

---

### Sample Usage - Fetch function.
### Sample Usage - Request function.

The fetch function allows you to make custom API requests with ease. It is available on both `platform` and `application` client.
The request function allows you to make custom API requests with ease. It is available on both `platform` and `application` client.

```javascript

Expand All @@ -140,7 +140,7 @@ let auditLog = await client.request({

```

The `fetch` function accepts an object with the following possible keys:
The `request` function accepts an object with the following possible keys:

- **method** (string): The HTTP method to use (e.g., 'GET', 'POST', 'PUT', 'DELETE').
- **url** (string): The URL endpoint for the request.
Expand Down Expand Up @@ -237,7 +237,7 @@ console.log("Active Theme: ", response.information.name);
The above code will log the curl command in the console

```bash
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.4.10-beta.2' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.4.12-beta.1' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
Active Theme: Emerge
```

Expand Down
2 changes: 1 addition & 1 deletion dist/application.js

Large diffs are not rendered by default.

219 changes: 111 additions & 108 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gofynd/fdk-client-javascript",
"version": "1.4.10-beta.2",
"version": "1.4.12-beta.1",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -19,7 +19,7 @@
"loglevel": "^1.8.1",
"query-string": "^7.1.3",
"@gofynd/fp-signature": "^1.0.1",
"@gofynd/flick": "^1.0.8"
"@gofynd/flick": "^1.0.9"
},
"devDependencies": {
"axios-cookiejar-support": "^4.0.6",
Expand Down
27 changes: 8 additions & 19 deletions sdk/application/Cart/CartApplicationClient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ declare class Cart {
addItems: string;
applyCoupon: string;
applyRewardPoints: string;
checkoutCart: string;
checkoutCartV2: string;
deleteCart: string;
getAddressById: string;
Expand Down Expand Up @@ -41,7 +40,7 @@ declare class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.SaveAddressResponse>} - Success response
* @name addAddress
* @summary: Create a new address
* @summary: Creates a new address for a customer
* @description: Add a new address to their cart to save details such as name, email, contact information, and address. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/addAddress/).
*/
addAddress({ body, requestHeaders }?: CartApplicationValidator.AddAddressParam, { responseHeaders }?: object): Promise<CartApplicationModel.SaveAddressResponse>;
Expand Down Expand Up @@ -75,24 +74,14 @@ declare class Cart {
* @description: Users can redeem their accumulated reward points and apply them to the items in their cart, thereby availing discounts on their current purchases. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/applyRewardPoints/).
*/
applyRewardPoints({ body, id, i, b, buyNow, requestHeaders }?: CartApplicationValidator.ApplyRewardPointsParam, { responseHeaders }?: object): Promise<CartApplicationModel.CartDetailResponse>;
/**
* @param {CartApplicationValidator.CheckoutCartParam} arg - Arg object.
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.CartCheckoutResponse>} - Success response
* @name checkoutCart
* @summary: Checkout cart
* @description: The checkout cart initiates the order creation process based on the selected address and payment method. It revalidates the cart details to ensure safe and seamless order placement. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/checkoutCart/).
*/
checkoutCart({ body, buyNow, cartType, requestHeaders }?: CartApplicationValidator.CheckoutCartParam, { responseHeaders }?: object): Promise<CartApplicationModel.CartCheckoutResponse>;
/**
* @param {CartApplicationValidator.CheckoutCartV2Param} arg - Arg object.
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.CartCheckoutResponse>} - Success response
* @name checkoutCartV2
* @summary: Start cart checkout (latest)
* @description: Enhanced version of checkout process that supports multiple mode of payment(MOP). - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/checkoutCartV2/).
* @summary: Checkout cart
* @description: The checkout cart initiates the order creation process based on the items in the user’s cart, their selected address, and chosen payment methods. It also supports multiple payment method options and revalidates the cart details to ensure a secure and seamless order placement. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/checkoutCartV2/).
*/
checkoutCartV2({ body, buyNow, cartType, requestHeaders }?: CartApplicationValidator.CheckoutCartV2Param, { responseHeaders }?: object): Promise<CartApplicationModel.CartCheckoutResponse>;
/**
Expand All @@ -112,7 +101,7 @@ declare class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.Address>} - Success response
* @name getAddressById
* @summary: Get a address
* @summary: Get details for a single customer address
* @description: Get a specific customer address stored in the system by providing its unique identifier. This API provides detailed information about the address, including the recipient's name, address, city, postal code, and other relevant details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getAddressById/).
*/
getAddressById({ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault, requestHeaders, }?: CartApplicationValidator.GetAddressByIdParam, { responseHeaders }?: object): Promise<CartApplicationModel.Address>;
Expand All @@ -122,7 +111,7 @@ declare class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.GetAddressesResponse>} - Success response
* @name getAddresses
* @summary: List customer addresses
* @summary: Get a list of addresses for a customer
* @description: List all addresses saved by the customer, simplifying the checkout process by offering pre-saved address options for delivery. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getAddresses/).
*/
getAddresses({ cartId, buyNow, mobileNo, checkoutMode, tags, isDefault, requestHeaders, }?: CartApplicationValidator.GetAddressesParam, { responseHeaders }?: object): Promise<CartApplicationModel.GetAddressesResponse>;
Expand Down Expand Up @@ -245,7 +234,7 @@ declare class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.DeleteAddressResponse>} - Success response
* @name removeAddress
* @summary: Delete a address
* @summary: Removes an address from a customer's address list
* @description: Delete an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeAddress/).
*/
removeAddress({ id, requestHeaders }?: CartApplicationValidator.RemoveAddressParam, { responseHeaders }?: object): Promise<CartApplicationModel.DeleteAddressResponse>;
Expand All @@ -265,7 +254,7 @@ declare class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.CartDetailResponse>} - Success response
* @name selectAddress
* @summary: Select a delivery address
* @summary: Select customer address for order processing
* @description: Select an address from the saved customer addresses and validates the availability of items in the cart. Additionally, it verifies and updates the delivery promise based on the selected address. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/selectAddress/).
*/
selectAddress({ body, cartId, buyNow, i, b, requestHeaders }?: CartApplicationValidator.SelectAddressParam, { responseHeaders }?: object): Promise<CartApplicationModel.CartDetailResponse>;
Expand All @@ -285,7 +274,7 @@ declare class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.UpdateAddressResponse>} - Success response
* @name updateAddress
* @summary: Update a address
* @summary: Updates an existing customer address
* @description: Customer can modify the details of a previously saved addresses. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateAddress/).
*/
updateAddress({ id, body, requestHeaders }?: CartApplicationValidator.UpdateAddressParam, { responseHeaders }?: object): Promise<CartApplicationModel.UpdateAddressResponse>;
Expand Down
97 changes: 8 additions & 89 deletions sdk/application/Cart/CartApplicationClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Cart {
addItems: "/service/application/cart/v1.0/detail",
applyCoupon: "/service/application/cart/v1.0/coupon",
applyRewardPoints: "/service/application/cart/v1.0/redeem/points/",
checkoutCart: "/service/application/cart/v1.0/checkout",
checkoutCartV2: "/service/application/cart/v2.0/checkout",
deleteCart: "/service/application/cart/v1.0/cart_archive",
getAddressById: "/service/application/cart/v1.0/address/{id}",
Expand Down Expand Up @@ -69,7 +68,7 @@ class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.SaveAddressResponse>} - Success response
* @name addAddress
* @summary: Create a new address
* @summary: Creates a new address for a customer
* @description: Add a new address to their cart to save details such as name, email, contact information, and address. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/addAddress/).
*/
async addAddress(
Expand Down Expand Up @@ -389,94 +388,14 @@ class Cart {
return response;
}

/**
* @param {CartApplicationValidator.CheckoutCartParam} arg - Arg object.
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.CartCheckoutResponse>} - Success response
* @name checkoutCart
* @summary: Checkout cart
* @description: The checkout cart initiates the order creation process based on the selected address and payment method. It revalidates the cart details to ensure safe and seamless order placement. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/checkoutCart/).
*/
async checkoutCart(
{ body, buyNow, cartType, requestHeaders } = { requestHeaders: {} },
{ responseHeaders } = { responseHeaders: false }
) {
const { error } = CartApplicationValidator.checkoutCart().validate(
{ body, buyNow, cartType },
{ abortEarly: false, allowUnknown: true }
);
if (error) {
return Promise.reject(new FDKClientValidationError(error));
}

// Showing warrnings if extra unknown parameters are found
const {
error: warrning,
} = CartApplicationValidator.checkoutCart().validate(
{ body, buyNow, cartType },
{ abortEarly: false, allowUnknown: false }
);
if (warrning) {
Logger({
level: "WARN",
message: `Parameter Validation warrnings for application > Cart > checkoutCart \n ${warrning}`,
});
}

const query_params = {};
query_params["buy_now"] = buyNow;
query_params["cart_type"] = cartType;

const xHeaders = {};

const response = await ApplicationAPIClient.execute(
this._conf,
"post",
constructUrl({
url: this._urls["checkoutCart"],
params: {},
}),
query_params,
body,
{ ...xHeaders, ...requestHeaders },
{ responseHeaders }
);

let responseData = response;
if (responseHeaders) {
responseData = response[0];
}

const {
error: res_error,
} = CartApplicationModel.CartCheckoutResponse().validate(responseData, {
abortEarly: false,
allowUnknown: true,
});

if (res_error) {
if (this._conf.options.strictResponseCheck === true) {
return Promise.reject(new FDKResponseValidationError(res_error));
} else {
Logger({
level: "WARN",
message: `Response Validation Warnings for application > Cart > checkoutCart \n ${res_error}`,
});
}
}

return response;
}

/**
* @param {CartApplicationValidator.CheckoutCartV2Param} arg - Arg object.
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.CartCheckoutResponse>} - Success response
* @name checkoutCartV2
* @summary: Start cart checkout (latest)
* @description: Enhanced version of checkout process that supports multiple mode of payment(MOP). - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/checkoutCartV2/).
* @summary: Checkout cart
* @description: The checkout cart initiates the order creation process based on the items in the user’s cart, their selected address, and chosen payment methods. It also supports multiple payment method options and revalidates the cart details to ensure a secure and seamless order placement. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/checkoutCartV2/).
*/
async checkoutCartV2(
{ body, buyNow, cartType, requestHeaders } = { requestHeaders: {} },
Expand Down Expand Up @@ -633,7 +552,7 @@ class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.Address>} - Success response
* @name getAddressById
* @summary: Get a address
* @summary: Get details for a single customer address
* @description: Get a specific customer address stored in the system by providing its unique identifier. This API provides detailed information about the address, including the recipient's name, address, city, postal code, and other relevant details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getAddressById/).
*/
async getAddressById(
Expand Down Expand Up @@ -726,7 +645,7 @@ class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.GetAddressesResponse>} - Success response
* @name getAddresses
* @summary: List customer addresses
* @summary: Get a list of addresses for a customer
* @description: List all addresses saved by the customer, simplifying the checkout process by offering pre-saved address options for delivery. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getAddresses/).
*/
async getAddresses(
Expand Down Expand Up @@ -1726,7 +1645,7 @@ class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.DeleteAddressResponse>} - Success response
* @name removeAddress
* @summary: Delete a address
* @summary: Removes an address from a customer's address list
* @description: Delete an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeAddress/).
*/
async removeAddress(
Expand Down Expand Up @@ -1884,7 +1803,7 @@ class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.CartDetailResponse>} - Success response
* @name selectAddress
* @summary: Select a delivery address
* @summary: Select customer address for order processing
* @description: Select an address from the saved customer addresses and validates the availability of items in the cart. Additionally, it verifies and updates the delivery promise based on the selected address. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/selectAddress/).
*/
async selectAddress(
Expand Down Expand Up @@ -2046,7 +1965,7 @@ class Cart {
* @param {import("../ApplicationAPIClient").Options} - Options
* @returns {Promise<CartApplicationModel.UpdateAddressResponse>} - Success response
* @name updateAddress
* @summary: Update a address
* @summary: Updates an existing customer address
* @description: Customer can modify the details of a previously saved addresses. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateAddress/).
*/
async updateAddress(
Expand Down
Loading

0 comments on commit 2d7da1b

Please sign in to comment.