/
var
/
www
/
vhosts
/
nabawater
/
api
/
modules
/
v1
/
config
/
/var/www/vhosts/nabawater/api/modules/v1/config
mkdir
upload
Name
Size
Mode
Actions
swagger-spec.php
28811
0644
edit
dl
rm
Edit:
/var/www/vhosts/nabawater/api/modules/v1/config/swagger-spec.php
(28811B)
<?php /** * OpenAPI 3.0 Specification for Naba Water API */ return [ "openapi" => "3.0.0", "info" => [ "title" => "Naba Water API", "description" => "Complete API documentation for Naba Water application", "version" => "1.0.0", "contact" => [ "name" => "API Support", "email" => "support@nabawater.com" ] ], "servers" => [ [ "url" => Yii::$app->request->hostInfo . "/api/v1", "description" => "API Server" ] ], "components" => [ "securitySchemes" => [ "bearerAuth" => [ "type" => "http", "scheme" => "bearer", "bearerFormat" => "JWT" ] ], "schemas" => [ "ApiResponse" => [ "type" => "object", "properties" => [ "status" => ["type" => "integer", "example" => 200], "message" => ["type" => "string", "example" => "Success"], "data" => ["type" => "object"], "time" => ["type" => "integer"], "system" => [ "type" => "object", "properties" => [ "nc" => ["type" => "integer"] ] ] ] ] ] ], "tags" => [ ["name" => "User", "description" => "User authentication and management"], ["name" => "Ads", "description" => "Advertisement management"], ["name" => "Home", "description" => "Home page content"], ["name" => "Cart", "description" => "Shopping cart operations"], ["name" => "Order", "description" => "Order management"], ["name" => "Branch", "description" => "Branch information"], ["name" => "Category", "description" => "Product categories"], ["name" => "Promotion", "description" => "Promotions and offers"], ["name" => "Address", "description" => "User address management"], ["name" => "Notification", "description" => "Push notifications"], ["name" => "Favourite", "description" => "User favourites"], ["name" => "Rating", "description" => "Product ratings"], ["name" => "Wallet", "description" => "Wallet operations"], ["name" => "Delivery", "description" => "Delivery boy operations"], ["name" => "Vendor", "description" => "Vendor operations"] ], "paths" => [ // User APIs "/user/otp-login" => [ "post" => [ "tags" => ["User"], "summary" => "Request OTP for login", "description" => "Send OTP to user's mobile number. Call this first before login.", "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["username"], "properties" => [ "username" => [ "type" => "string", "description" => "User's mobile number or email", "example" => "+966501234567" ], "device_type" => [ "type" => "integer", "description" => "1=Android, 2=iOS (returns OTP in response for testing)", "example" => 2 ] ] ] ] ] ], "responses" => [ "200" => [ "description" => "OTP sent successfully", "content" => [ "application/json" => [ "schema" => [ "type" => "object", "properties" => [ "status" => ["type" => "integer"], "message" => ["type" => "string"], "data" => [ "type" => "object", "properties" => [ "otp" => [ "type" => "string", "description" => "Only returned when device_type=2" ] ] ] ] ] ] ] ] ] ] ], "/user/login" => [ "post" => [ "tags" => ["User"], "summary" => "User login with OTP", "description" => "Authenticate user with OTP. First call /user/otp-login to get OTP, then use it here.", "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["login_type", "device_type", "device_token", "otp", "username"], "properties" => [ "login_type" => [ "type" => "string", "enum" => ["1", "2", "3"], "description" => "1=Normal, 2=Facebook, 3=Google", "example" => "1" ], "device_type" => [ "type" => "string", "example" => "android", "description" => "android or ios" ], "device_token" => [ "type" => "string", "description" => "Firebase device token for push notifications" ], "otp" => [ "type" => "string", "description" => "OTP received from /user/otp-login", "example" => "1234" ], "username" => [ "type" => "string", "description" => "Mobile number or email", "example" => "+966501234567" ] ] ] ] ] ], "responses" => [ "200" => [ "description" => "Login successful. Copy the 'access_token' from data and use it in the Authorize button.", "content" => [ "application/json" => [ "schema" => [ "type" => "object", "properties" => [ "status" => ["type" => "integer", "example" => 200], "message" => ["type" => "string", "example" => "Logged in successfully"], "data" => [ "type" => "object", "properties" => [ "user_id" => ["type" => "integer"], "user_key" => ["type" => "string"], "first_name" => ["type" => "string"], "last_name" => ["type" => "string"], "email" => ["type" => "string"], "mobile_number" => ["type" => "string"], "access_token" => [ "type" => "string", "description" => "JWT token - Copy this and paste in Authorize button" ], "profile_image" => ["type" => "string"] ] ], "time" => ["type" => "integer"], "system" => [ "type" => "object", "properties" => [ "nc" => ["type" => "integer"] ] ] ] ] ] ] ] ] ] ], "/user/register" => [ "post" => [ "tags" => ["User"], "summary" => "User registration", "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["user_email", "user_password", "user_phone"], "properties" => [ "user_email" => ["type" => "string", "format" => "email"], "user_password" => ["type" => "string"], "user_phone" => ["type" => "string"], "user_name" => ["type" => "string"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Registration successful"] ] ] ], "/user" => [ "get" => [ "tags" => ["User"], "summary" => "Get user profile", "security" => [["bearerAuth" => []]], "responses" => [ "200" => ["description" => "User profile retrieved"] ] ] ], "/user/update" => [ "post" => [ "tags" => ["User"], "summary" => "Update user profile", "security" => [["bearerAuth" => []]], "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "properties" => [ "user_name" => ["type" => "string"], "user_email" => ["type" => "string"], "user_phone" => ["type" => "string"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Profile updated successfully"] ] ] ], "/user/change-password" => [ "post" => [ "tags" => ["User"], "summary" => "Change user password", "security" => [["bearerAuth" => []]], "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["old_password", "new_password"], "properties" => [ "old_password" => ["type" => "string"], "new_password" => ["type" => "string"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Password changed successfully"] ] ] ], // Ads APIs "/ads/get-active-ads" => [ "get" => [ "tags" => ["Ads"], "summary" => "Get active ads", "description" => "Retrieve all active advertisements", "responses" => [ "200" => [ "description" => "Success", "content" => [ "application/json" => [ "schema" => [ "allOf" => [ ["\$ref" => "#/components/schemas/ApiResponse"], [ "properties" => [ "data" => [ "type" => "array", "items" => [ "type" => "object", "properties" => [ "ads_id" => ["type" => "integer"], "title" => ["type" => "string"], "description" => ["type" => "string"], "image_path" => ["type" => "string"], "product_id" => ["type" => "integer"], "product_key" => ["type" => "string"], "product_name" => ["type" => "string"] ] ] ] ] ] ] ] ] ] ] ] ] ], "/ads/track-impression" => [ "post" => [ "tags" => ["Ads"], "summary" => "Track ad impression", "description" => "Increment impression count for an ad", "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["ads_id"], "properties" => [ "ads_id" => ["type" => "integer", "description" => "Advertisement ID"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Impression tracked successfully"] ] ] ], "/ads/track-click" => [ "post" => [ "tags" => ["Ads"], "summary" => "Track ad click", "description" => "Increment click count for an ad", "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["ads_id"], "properties" => [ "ads_id" => ["type" => "integer"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Click tracked successfully"] ] ] ], // Home APIs "/home" => [ "get" => [ "tags" => ["Home"], "summary" => "Get home page data", "parameters" => [ [ "name" => "latitude", "in" => "query", "required" => true, "schema" => ["type" => "number", "format" => "float"] ], [ "name" => "longitude", "in" => "query", "required" => true, "schema" => ["type" => "number", "format" => "float"] ], [ "name" => "item_purchase_type", "in" => "query", "required" => true, "schema" => ["type" => "string"] ] ], "responses" => [ "200" => ["description" => "Home data retrieved"] ] ] ], "/home/product-details" => [ "get" => [ "tags" => ["Home"], "summary" => "Get product details", "parameters" => [ [ "name" => "item_id", "in" => "query", "required" => true, "schema" => ["type" => "integer"] ] ], "responses" => [ "200" => ["description" => "Product details retrieved"] ] ] ], // Category APIs "/category" => [ "get" => [ "tags" => ["Category"], "summary" => "Get all categories", "responses" => [ "200" => ["description" => "Categories retrieved"] ] ] ], "/category/view" => [ "get" => [ "tags" => ["Category"], "summary" => "Get category details", "parameters" => [ [ "name" => "id", "in" => "query", "required" => true, "schema" => ["type" => "integer"] ] ], "responses" => [ "200" => ["description" => "Category details retrieved"] ] ] ], // Cart APIs "/cart" => [ "get" => [ "tags" => ["Cart"], "summary" => "Get cart items", "security" => [["bearerAuth" => []]], "responses" => [ "200" => ["description" => "Cart items retrieved"] ] ] ], "/cart/add" => [ "post" => [ "tags" => ["Cart"], "summary" => "Add item to cart", "security" => [["bearerAuth" => []]], "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["item_id", "quantity"], "properties" => [ "item_id" => ["type" => "integer"], "quantity" => ["type" => "integer"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Item added to cart"] ] ] ], // Order APIs "/order" => [ "get" => [ "tags" => ["Order"], "summary" => "Get user orders", "security" => [["bearerAuth" => []]], "responses" => [ "200" => ["description" => "Orders retrieved"] ] ] ], "/order/place-order" => [ "post" => [ "tags" => ["Order"], "summary" => "Place a new order", "security" => [["bearerAuth" => []]], "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "properties" => [ "address_id" => ["type" => "integer"], "payment_method" => ["type" => "string"], "items" => ["type" => "array"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Order placed successfully"] ] ] ], // Branch APIs "/branch" => [ "get" => [ "tags" => ["Branch"], "summary" => "Get all branches", "responses" => [ "200" => ["description" => "Branches retrieved"] ] ] ], "/branch/info" => [ "get" => [ "tags" => ["Branch"], "summary" => "Get branch information", "parameters" => [ [ "name" => "branch_id", "in" => "query", "required" => true, "schema" => ["type" => "integer"] ] ], "responses" => [ "200" => ["description" => "Branch info retrieved"] ] ] ], // Promotion APIs "/promotion" => [ "get" => [ "tags" => ["Promotion"], "summary" => "Get all promotions", "responses" => [ "200" => ["description" => "Promotions retrieved"] ] ] ], "/promotion/buy" => [ "post" => [ "tags" => ["Promotion"], "summary" => "Buy promotion", "security" => [["bearerAuth" => []]], "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["promotion_id"], "properties" => [ "promotion_id" => ["type" => "integer"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Promotion purchased"] ] ] ], // Address APIs "/user-address" => [ "get" => [ "tags" => ["Address"], "summary" => "Get user addresses", "security" => [["bearerAuth" => []]], "responses" => [ "200" => ["description" => "Addresses retrieved"] ] ] ], "/user-address/create" => [ "post" => [ "tags" => ["Address"], "summary" => "Create new address", "security" => [["bearerAuth" => []]], "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "properties" => [ "address" => ["type" => "string"], "latitude" => ["type" => "number"], "longitude" => ["type" => "number"], "address_type" => ["type" => "string"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Address created"] ] ] ], // Notification APIs "/notification" => [ "get" => [ "tags" => ["Notification"], "summary" => "Get user notifications", "security" => [["bearerAuth" => []]], "responses" => [ "200" => ["description" => "Notifications retrieved"] ] ] ], // Favourite APIs "/favourite/{id}" => [ "post" => [ "tags" => ["Favourite"], "summary" => "Toggle favourite", "security" => [["bearerAuth" => []]], "parameters" => [ [ "name" => "id", "in" => "path", "required" => true, "schema" => ["type" => "integer"] ] ], "responses" => [ "200" => ["description" => "Favourite toggled"] ] ] ], // Rating APIs "/rating/create" => [ "post" => [ "tags" => ["Rating"], "summary" => "Create rating", "security" => [["bearerAuth" => []]], "requestBody" => [ "required" => true, "content" => [ "application/json" => [ "schema" => [ "type" => "object", "required" => ["item_id", "rating"], "properties" => [ "item_id" => ["type" => "integer"], "rating" => ["type" => "integer", "minimum" => 1, "maximum" => 5], "review" => ["type" => "string"] ] ] ] ] ], "responses" => [ "200" => ["description" => "Rating created"] ] ] ], // Language API "/language" => [ "get" => [ "tags" => ["System"], "summary" => "Get available languages", "responses" => [ "200" => ["description" => "Languages retrieved"] ] ] ] ] ];
Save
cmd:
run