﻿{
    "info":  {
                 "name":  "Modular Backend API",
                 "schema":  "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
             },
    "variable":  [
                     {
                         "key":  "baseUrl",
                         "value":  "http://192.168.1.104:8080/api/v1"
                     },
                     {
                         "key":  "token",
                         "value":  ""
                     },
                     {
                         "key":  "cityId",
                         "value":  "1"
                     },
                     {
                         "key":  "addressId",
                         "value":  ""
                     },
                     {
                         "key":  "productSlug",
                         "value":  "demo-cotton-towel"
                     },
                     {
                         "key":  "productId",
                         "value":  "14924"
                     },
                     {
                         "key":  "commentId",
                         "value":  "1"
                     },
                     {
                         "key":  "reviewId",
                         "value":  "1"
                     },
                     {
                         "key":  "questionId",
                         "value":  "1"
                     },
                     {
                         "key":  "provinceId",
                         "value":  "1"
                     }
                 ],
    "item":  [
                 {
                     "name":  "Locations",
                     "item":  [
                                  {
                                      "name":  "List provinces",
                                      "request":  {
                                                      "method":  "GET",
                                                      "url":  "{{baseUrl}}/locations/provinces"
                                                  }
                                  },
                                  {
                                      "name":  "List cities by province",
                                      "request":  {
                                                      "method":  "GET",
                                                      "url":  "{{baseUrl}}/locations/provinces/{{provinceId}}/cities"
                                                  }
                                  }
                              ]
                 },
                 {
                     "name":  "Addresses",
                     "item":  [
                                  {
                                      "name":  "Create",
                                      "event":  [
                                                    {
                                                        "listen":  "test",
                                                        "script":  {
                                                                       "type":  "text/javascript",
                                                                       "exec":  [
                                                                                    "const addressId = pm.response.json()?.data?.id;",
                                                                                    "if (addressId) pm.collectionVariables.set(\u0027addressId\u0027, addressId);"
                                                                                ]
                                                                   }
                                                    }
                                                ],
                                      "request":  {
                                                      "method":  "POST",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\r\n    \"city_id\":  \"{{cityId}}\",\r\n    \"title\":  \"Ø®Ø§Ù†Ù‡\",\r\n    \"recipient_name\":  \"Ú©Ø§Ø±Ø¨Ø± Ù†Ù…ÙˆÙ†Ù‡\",\r\n    \"mobile\":  \"09121234567\",\r\n    \"postal_code\":  \"1416712345\",\r\n    \"address\":  \"Ø®ÛŒØ§Ø¨Ø§Ù† Ø§Ù†Ù‚Ù„Ø§Ø¨ØŒ Ø®ÛŒØ§Ø¨Ø§Ù† Ø§Ø¨ÙˆØ±ÛŒØ­Ø§Ù†ØŒ Ú©ÙˆÚ†Ù‡ Ø§Ø±Ø¯ÛŒØ¨Ù‡Ø´ØªØŒ Ù¾Ù„Ø§Ú© Û±Û²ØŒ ÙˆØ§Ø­Ø¯ Û¸\",\r\n    \"national_code\":  \"0012345678\",\r\n    \"is_default\":  true\r\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/addresses"
                                                  }
                                  },
                                  {
                                      "name":  "List mine",
                                      "request":  {
                                                      "method":  "GET",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     }
                                                                 ],
                                                      "url":  "{{baseUrl}}/addresses"
                                                  }
                                  },
                                  {
                                      "name":  "Get one",
                                      "request":  {
                                                      "method":  "GET",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     }
                                                                 ],
                                                      "url":  "{{baseUrl}}/addresses/{{addressId}}"
                                                  }
                                  },
                                  {
                                      "name":  "Update",
                                      "request":  {
                                                      "method":  "PATCH",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\n  \"title\": \"Ø®Ø§Ù†Ù‡ - ÙˆÛŒØ±Ø§ÛŒØ´â€ŒØ´Ø¯Ù‡\",\n  \"is_default\": true\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/addresses/{{addressId}}"
                                                  }
                                  },
                                  {
                                      "name":  "Delete",
                                      "request":  {
                                                      "method":  "DELETE",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     }
                                                                 ],
                                                      "url":  "{{baseUrl}}/addresses/{{addressId}}"
                                                  }
                                  }
                              ]
                 },
                 {
                     "name":  "Comments",
                     "item":  [
                                  {
                                      "name":  "List newest",
                                      "request":  {
                                                      "method":  "GET",
                                                      "header":  [

                                                                 ],
                                                      "url":  "{{baseUrl}}/products/{{productSlug}}/comments?sort=newest\u0026per_page=20"
                                                  }
                                  },
                                  {
                                      "name":  "Create",
                                      "request":  {
                                                      "method":  "POST",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\n  \"comment\": \"Ú©Ø§Ù…Ù†Øª ØªØ³Øª\",\n  \"rating\": 5\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/products/{{productSlug}}/comments"
                                                  }
                                  },
                                  {
                                      "name":  "Like",
                                      "request":  {
                                                      "method":  "PUT",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\n  \"reaction\": \"helpful\"\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/comments/{{commentId}}/reaction"
                                                  }
                                  },
                                  {
                                      "name":  "Dislike",
                                      "request":  {
                                                      "method":  "PUT",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\n  \"reaction\": \"not_helpful\"\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/comments/{{commentId}}/reaction"
                                                  }
                                  }
                              ]
                 },
                 {
                     "name":  "Questions",
                     "item":  [
                                  {
                                      "name":  "List",
                                      "request":  {
                                                      "method":  "GET",
                                                      "header":  [

                                                                 ],
                                                      "url":  "{{baseUrl}}/products/{{productId}}/questions"
                                                  }
                                  },
                                  {
                                      "name":  "Ask",
                                      "request":  {
                                                      "method":  "POST",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\n  \"question\": \"Ø¢ÛŒØ§ Ù…ÙˆØ¬ÙˆØ¯ Ø§Ø³ØªØŸ\"\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/products/{{productId}}/questions"
                                                  }
                                  },
                                  {
                                      "name":  "Answer",
                                      "request":  {
                                                      "method":  "POST",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\n  \"answer\": \"Ø¨Ù„Ù‡.\"\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/product-questions/{{questionId}}/answers"
                                                  }
                                  }
                              ]
                 },
                 {
                     "name":  "Reviews",
                     "item":  [
                                  {
                                      "name":  "List helpful",
                                      "request":  {
                                                      "method":  "GET",
                                                      "header":  [

                                                                 ],
                                                      "url":  "{{baseUrl}}/products/{{productSlug}}/reviews?sort=helpful"
                                                  }
                                  },
                                  {
                                      "name":  "Like",
                                      "request":  {
                                                      "method":  "PUT",
                                                      "header":  [
                                                                     {
                                                                         "key":  "Authorization",
                                                                         "value":  "Bearer {{token}}"
                                                                     },
                                                                     {
                                                                         "key":  "Content-Type",
                                                                         "value":  "application/json"
                                                                     }
                                                                 ],
                                                      "body":  {
                                                                   "mode":  "raw",
                                                                   "options":  {
                                                                                   "raw":  {
                                                                                               "language":  "json"
                                                                                           }
                                                                               },
                                                                   "raw":  "{\n  \"reaction\": \"helpful\"\n}"
                                                               },
                                                      "url":  "{{baseUrl}}/product-reviews/{{reviewId}}/reaction"
                                                  }
                                  }
                              ]
                 }
             ]
}
