Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Pass API Knowledge Base
https://github.com/howard-metropia/mass-api_knowledge
Admin
pass-api knowlege base
Tokens:
82,867
Snippets:
569
Trust Score:
1.9
Update:
1 year ago
Context
Chat
Benchmark
27
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Example of Successful Documentation Sync Output Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md This snippet provides an example of the console output when the documentation synchronization script runs successfully. It details the configuration, change detection, files to be synced, and a summary of the sync operation, confirming completion. ```bash $ ./docs/scripts/sync-to-github.sh š GitHub Documentation Sync āāāāāāāāāāāāāāāāāāāāāāāāāāāāāā š Configuration: Source: metropia_test/docs/ Target: howard-metropia/mass-api_knowledge Branch: main š Detecting changes... ā Found 3 modified files ā Found 1 new file š Files to sync: M docs/maas-api/src/middlewares.md M docs/maas-api/src/token-verifier.md M docs/PROJECT-DOC-MAP.md A docs/maas-api/src/new-feature.md š Syncing to GitHub... ā Repository cloned ā Files copied ā Changes committed ā Pushed to remote š Sync Summary: Modified: 3 files Added: 1 file Deleted: 0 files ⨠Sync completed successfully! ``` -------------------------------- ### Run MaaS API Application Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/README.md Command to start the MaaS API application after all dependencies have been installed. ```bash npm run app ``` -------------------------------- ### Configure and Test Documentation Sync Scripts Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md Instructions to make the synchronization scripts (`sync-to-github.sh`, `auto-sync-workflow.sh`) executable and to perform a test connection to verify the setup before initiating full synchronization. ```bash # Make sync scripts executable chmod +x docs/scripts/sync-to-github.sh chmod +x docs/scripts/auto-sync-workflow.sh # Test connection ./docs/scripts/sync-to-github.sh --test ``` -------------------------------- ### JavaScript: Integrating Koa.js with Main Module Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/index.md This example shows how the `index.js` module can be adapted for the Koa.js framework. It includes middleware setup and route integration, showcasing its flexibility for different Node.js web frameworks. ```JavaScript const Koa = require('koa'); const app = new Koa(); // Middleware app.use(require('./middlewares')); app.use(require('./token-verifier')); // Routes app.use(require('./controllers').routes()); module.exports = app; ``` -------------------------------- ### Basic Documentation Sync Workflow Steps Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md This example outlines the fundamental steps for manually updating and syncing documentation. It includes generating documentation, reviewing changes with Git, executing the sync script with a commit message, and verifying the successful completion of the sync operation. ```bash # 1. Update documentation ./docs/scripts/claude-doc-generator.sh # 2. Review changes git status git diff # 3. Sync to knowledge base ./docs/scripts/sync-to-github.sh -m "Update middleware documentation" # 4. Verify sync echo "Documentation synced successfully!" ``` -------------------------------- ### JSON Example: Successful Trip Start Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/trip.md Illustrates the JSON structure returned upon a successful trip start, including trip and user IDs, start time, location, status, and estimated duration. ```json { "success": true, "data": { "tripId": "trip_123456", "userId": "user_789", "startTime": "2023-06-22T10:00:00Z", "startLocation": { "latitude": 37.7749, "longitude": -122.4194, "address": "San Francisco, CA" }, "status": "active", "estimatedDuration": 1800 } } ``` -------------------------------- ### Example of Documentation Sync Error Output Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md This snippet shows an example of the console output when the documentation synchronization script encounters errors, specifically related to missing GitHub tokens or inaccessible target repositories. It also provides troubleshooting steps for resolving common issues. ```bash $ ./docs/scripts/sync-to-github.sh š GitHub Documentation Sync āāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā Error: GitHub token not found š” Please set GITHUB_TOKEN environment variable ā Error: Target repository not accessible š” Check repository permissions and token scope š§ Troubleshooting: 1. Verify GitHub token: gh auth status 2. Check repository access: gh repo view howard-metropia/mass-api_knowledge 3. Review token permissions: repo, workflow ``` -------------------------------- ### Practical Examples for doc-map.sh Filtering and Reporting Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/DOC-MAP-USAGE.md Provides practical examples of using the `doc-map.sh` script for checking documentation coverage, generating status reports, viewing pending files, and verifying updated files using various filter and format options. ```bash # Check documentation coverage ./docs/scripts/doc-map.sh --no-stats=false # Generate documentation status report ./docs/scripts/doc-map.sh --format=markdown --links > reports/doc-status.md # View pending files ./docs/scripts/doc-map.sh --filter=not_added --links # Verify updated files ./docs/scripts/doc-map.sh --filter=updated --links ``` -------------------------------- ### Install MaaS API Dependencies Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/README.md Instructions to navigate into the project directory and install the required Node.js packages for the MaaS API project using npm. ```bash cd maas-api npm install ``` -------------------------------- ### Perform Batch Documentation Sync Operations Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md This section demonstrates how to perform batch synchronization operations. It includes examples for iterating through multiple projects to sync documentation and specifying different target repositories or branches for the sync process. ```bash # Sync multiple projects for project in maas-api mobility-platform; do echo "Syncing $project..." ./docs/scripts/sync-to-github.sh --project $project done # Sync with different targets ./docs/scripts/sync-to-github.sh --target-repo "backup-knowledge-repo" ./docs/scripts/sync-to-github.sh --target-branch "development" ``` -------------------------------- ### Example: Successful GET User Profile Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/profile.md An example of a successful JSON response when retrieving user profile information, including personal details, contact information, address, preferences, and timestamps. ```json { "success": true, "data": { "userId": "user_123", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "phone": "+1234567890", "avatar": "https://cdn.example.com/avatars/user_123.jpg", "dateOfBirth": "1990-01-15", "address": { "street": "123 Main St", "city": "San Francisco", "state": "CA", "zipCode": "94105", "country": "USA" }, "preferences": { "notifications": true, "language": "en", "timezone": "America/Los_Angeles" }, "createdAt": "2023-01-01T00:00:00Z", "updatedAt": "2023-06-22T10:30:00Z" } } ``` -------------------------------- ### Example Request for GET Intermodal API Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/intermodal.md Illustrates a sample GET request to the intermodal API endpoint, providing specific values for origin, destination, transportation modes, time, and optimization criteria to plan a multi-modal journey. ```bash GET /api/v2/intermodal?origin=37.7749,-122.4194&destination=37.4419,-122.1430&modes=walking,public_transit,ridehail&time=2023-06-22T08:00:00Z&optimize=time ``` -------------------------------- ### HTTP Request Example for User Registration Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/account.md This HTTP example demonstrates how to register a new user by sending a POST request to the `/api/v2/register` endpoint. The request body includes the user's email, password, phone number, and name. ```http POST /api/v2/register Content-Type: application/json { "email": "user@example.com", "password": "securePassword123", "phone": "+886912345678", "firstName": "John", "lastName": "Doe" } ``` -------------------------------- ### Example: Wallet Summary API Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/wallet.md An example JSON structure representing a successful response for a wallet summary query, including user ID, balances (cash, points, credits), currency, and recent transaction details. ```json { "success": true, "data": { "userId": "user_123", "balance": { "cash": 45.75, "points": 1250, "credits": 3 }, "currency": "USD", "recentTransactions": [ { "id": "txn_456", "type": "debit", "amount": 8.50, "description": "Ride payment", "timestamp": "2023-06-22T10:30:00Z" } ], "pendingTransactions": 0 } } ``` -------------------------------- ### GitHub Actions Workflow for Documentation Sync Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md This YAML configuration defines a GitHub Actions workflow that automatically syncs documentation to a knowledge base. It triggers on pushes to the `main` branch within the `docs/` directory and on a daily schedule. The workflow checks out the repository, sets up Node.js, installs dependencies, generates documentation, and then syncs it using a custom script and a GitHub token. ```YAML name: Sync Documentation to Knowledge Base on: push: branches: [main] paths: ['docs/**'] schedule: # Run daily at 2 AM UTC - cron: '0 2 * * *' jobs: sync-docs: runs-on: ubuntu-latest steps: - name: Checkout Source uses: actions/checkout@v3 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '18' - name: Install Dependencies run: | npm install sudo apt-get install -y rsync jq - name: Generate Documentation run: | ./docs/scripts/claude-doc-generator.sh --force - name: Sync to Knowledge Base env: GITHUB_TOKEN: ${{ secrets.SYNC_TOKEN }} TARGET_REPO: 'howard-metropia/mass-api_knowledge' run: | ./docs/scripts/sync-to-github.sh --auto ``` -------------------------------- ### Referral Status API Response Example Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/referral.md Example JSON response for a successful referral status query, detailing the referral ID, status, timestamps, and reward distribution for both referrer and referee. ```json { "success": true, "data": { "referralId": "ref_123456", "status": "completed", "refereeJoinedAt": "2023-06-23T14:20:00Z", "rewardsDistributed": true, "referrerReward": { "credited": true, "amount": 10.00, "creditedAt": "2023-06-23T14:25:00Z" }, "refereeReward": { "applied": true, "amount": 5.00, "appliedAt": "2023-06-23T14:25:00Z" } } } ``` -------------------------------- ### HTTP Request Example for Standard User Login Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/account.md This HTTP example demonstrates how to perform a standard user login by sending a POST request to the `/api/v2/login` endpoint. The request body requires the user's email and password. ```http POST /api/v2/login Content-Type: application/json { "email": "user@example.com", "password": "securePassword123" } ``` -------------------------------- ### Basic Koa Application Setup with Middleware Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/middlewares.md This JavaScript snippet demonstrates the basic setup of a Koa application. It initializes a Koa instance, applies a stack of custom middlewares, and then configures routing. The application listens on port 3000. ```javascript const Koa = require('koa'); const middlewares = require('./middlewares'); const app = new Koa(); // Apply middleware stack middlewares(app); // Add routes after middleware app.use(router.routes()); app.use(router.allowedMethods()); app.listen(3000); ``` -------------------------------- ### Example: Point Store API Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/wallet.md An example JSON structure for the point redemption store response, categorizing available items with their point costs, values, and descriptions, along with the user's current points. ```json { "success": true, "data": { "categories": [ { "id": "transportation", "name": "Transportation", "items": [ { "id": "ride_credit", "name": "Free Ride Credit", "pointCost": 500, "value": "$10.00", "description": "Credit for your next ride" } ] } ], "userPoints": 1250 } } ``` -------------------------------- ### HTTP Example: Successful Guest API Access Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/guest-account-api-filter.md This HTTP example demonstrates a successful guest access scenario. A GET request to `/api/v2/profile` with a guest token receives a 200 OK response, indicating permitted access. ```http GET /api/v2/profile HTTP/1.1 Authorization: Bearer guest_token_here userid: guest_user_123 HTTP/1.1 200 OK Content-Type: application/json { "status": "success", "data": { "profile": {...} } } ``` -------------------------------- ### JavaScript Route Configuration for Welcome Coin Endpoint Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/welcome-coin.md Specifies the API route configuration for the welcome coin endpoint, defining a GET method for the root path. ```javascript const routerConfigs = [ { method: 'GET', path: '/', key: 'get' } ]; ``` -------------------------------- ### Example: Successful PUT User Profile Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/profile.md An example of a successful JSON response after updating user profile information, confirming the update and showing the modified fields. ```json { "success": true, "message": "Profile updated successfully", "data": { "firstName": "John", "lastName": "Smith", "phone": "+1234567891", "updatedAt": "2023-06-22T10:30:00Z" } } ``` -------------------------------- ### Example Request Body for Adding Points Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/point.md A JSON example demonstrating the structure and content required in the request body when adding points to a user's account via the POST /api/v1/points endpoint. ```json { "points": 50, "activityType": "trip_completed", "activityId": "trip_123456", "description": "Points earned for completing a shared ride trip", "metadata": { "tripDistance": 15.2, "tripMode": "ridehail", "sharedRide": true, "peakHours": false }, "multiplier": 1.5, "bonusEligible": true } ``` -------------------------------- ### Example: Point History API Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/wallet.md An example JSON structure for a paginated point transaction history response, detailing individual transactions (earned/redeemed), total points, and pagination metadata. ```json { "success": true, "data": { "transactions": [ { "id": "point_txn_789", "type": "earned", "points": 100, "description": "Completed trip bonus", "timestamp": "2023-06-22T10:00:00Z", "source": "trip_completion" }, { "id": "point_txn_790", "type": "redeemed", "points": -50, "description": "Coffee shop discount", "timestamp": "2023-06-21T15:30:00Z", "merchant": "Local Coffee" } ], "totalPoints": 1250, "page": 1, "limit": 20, "hasMore": true } } ``` -------------------------------- ### Example: iOS App Version API Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/app-version.md Illustrates a successful JSON response from the GET OS Version endpoint for an iOS platform request. It includes details such as current, minimum, and latest versions, update status, app store URL, features, compatibility, and release information. ```json { "success": true, "data": { "platform": "ios", "currentVersion": "2.1.0", "minimumVersion": "2.0.0", "latestVersion": "2.1.0", "updateRequired": false, "updateAvailable": false, "appStoreUrl": "https://apps.apple.com/app/mobility-app/id123456789", "features": { "tollCalculation": true, "bikeSharing": true, "ridehail": true }, "compatibility": { "minimumIOSVersion": "12.0", "supportedDevices": ["iPhone", "iPad"] }, "releaseInfo": { "releaseDate": "2023-06-15T00:00:00Z", "releaseNotes": "Bug fixes and performance improvements" } } } ``` -------------------------------- ### API Endpoint: GET Welcome Coin Information Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/welcome-coin.md Documents the GET endpoint for retrieving welcome coin details and user eligibility, requiring JWT authentication. ```APIDOC GET /api/v2/welcome_coin/ Purpose: Retrieve welcome coin information and eligibility Authentication: Required (JWT token) Response: Welcome coin details and reward information ``` -------------------------------- ### Example: Default System Preferences Retrieval Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/preference.md Illustrates a successful JSON response when retrieving default system preferences, showing the initial configuration settings. ```json { "success": true, "data": { "notifications": { "push": true, "email": true, "sms": false }, "theme": "light", "language": "en", "units": "metric", "privacy": { "shareLocation": false, "analytics": true } } } ``` -------------------------------- ### HTTP Request Example for OAuth User Login (Google) Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/account.md This HTTP example demonstrates how to perform an OAuth login, specifically for Google, by sending a POST request to the `/api/v2/openid_login/google` endpoint. The request body includes the Google access token and the user's email. ```http POST /api/v2/openid_login/google Content-Type: application/json { "access_token": "google_access_token_here", "email": "user@gmail.com" } ``` -------------------------------- ### Repository Configuration for Documentation Sync Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md Defines the source (local) and target (remote) repositories and their respective paths for the documentation synchronization process, including the target branch. ```bash # Source repository (local) SOURCE_REPO: metropia_test SOURCE_PATH: docs/ # Target repository (remote) TARGET_REPO: howard-metropia/mass-api_knowledge TARGET_BRANCH: main SYNC_PATH: docs/ ``` -------------------------------- ### Example Successful Response for Device Logging Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/here-device-id.md Provides an example of the JSON response returned upon successful device information logging, including log details, tracking status, HERE integration info, analytics, and privacy considerations. ```json { "success": true, "data": { "logId": "log_987654321", "deviceId": "device_abc123def456", "loggedAt": "2023-06-22T10:30:00Z", "status": "logged", "tracking": { "trackingEnabled": true, "anonymized": true, "dataRetention": "90_days" }, "hereIntegration": { "registeredWithHere": true, "hereDeviceId": "here_device_xyz789", "serviceLevel": "standard" }, "analytics": { "firstSeen": "2023-06-01T00:00:00Z", "totalSessions": 45, "lastActivity": "2023-06-22T10:30:00Z" }, "privacy": { "dataMinimization": true, "purposeLimitation": "service_optimization", "consentStatus": "granted" } } } ``` -------------------------------- ### JSON: Successful Promocode Validation Response Example Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/promocode.md Example JSON response for a successful promotional code validation, including details like validity, discount type, value, description, expiration, and usage limits. ```JSON { "success": true, "data": { "promocode": "SAVE20", "valid": true, "discount": { "type": "percentage", "value": 20, "maxAmount": 50.00 }, "description": "20% off your next ride", "expiresAt": "2023-12-31T23:59:59Z", "usageLimit": 1, "usageCount": 0 } } ``` -------------------------------- ### JSON Example: Successful Response for Referral Creation Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/referral.md Provides a detailed JSON example of a successful API response after a referral has been created. It includes the referralId, referrerId, refereeEmail, referralCode, referralLink, status, timestamps, and comprehensive rewards and trackingData objects for both referrer and referee. ```json { "success": true, "data": { "referralId": "ref_123456", "referrerId": "user_789", "refereeEmail": "friend@example.com", "referralCode": "FRIEND789", "referralLink": "https://app.example.com/invite/FRIEND789", "status": "pending", "createdAt": "2023-06-22T10:30:00Z", "expiresAt": "2023-07-22T10:30:00Z", "rewards": { "referrer": { "type": "credit", "amount": 10.00, "currency": "USD", "description": "Referral bonus" }, "referee": { "type": "discount", "amount": 5.00, "currency": "USD", "description": "Welcome discount" } }, "trackingData": { "channel": "email", "campaign": "friend_referral_2023" } } } ``` -------------------------------- ### Common Error API Response Example Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/referral.md Example JSON response for an API error, providing details such as the error message, a specific error code, and additional context or suggestions. ```json { "success": false, "error": "Referee already exists", "code": "REFEREE_EXISTS", "details": { "message": "This email address is already registered", "suggestion": "Try referring a different friend" } } ``` -------------------------------- ### Example Request Body for Gift Card Redemption Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/giftcard.md Provides a JSON example of the request body required for the POST /api/v1/redeem endpoint, including the gift card code, redemption source, and optional metadata. ```json { "giftCardCode": "MOBILITY2023-ABCD-1234", "redemptionSource": "mobile_app", "metadata": { "campaignId": "summer_promo_2023", "referralCode": "FRIEND_REF_123" } } ``` -------------------------------- ### HTTP Request Example for Initiating Password Reset Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/account.md This HTTP example demonstrates how to initiate a password reset process by sending a POST request to the `/api/v2/forget_password` endpoint. The request body only requires the user's email address. ```http POST /api/v2/forget_password Content-Type: application/json { "email": "user@example.com" } ``` -------------------------------- ### HTTP Request Example for Phone Number Verification Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/account.md This HTTP example demonstrates how to verify a user's phone number by sending a POST request to the `/api/v2/verify_phone` endpoint. The request body includes the phone number and the verification code received. ```http POST /api/v2/verify_phone Content-Type: application/json { "phone": "+886912345678", "code": "123456" } ``` -------------------------------- ### Example Request Body for POST /api/v2/find_ubike Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/shared-bike.md Provides a sample JSON payload for the `/find_ubike` endpoint. This example demonstrates the required parameters such as latitude, longitude, search radius, maximum results, bike type, and a flag to include availability information. ```json { "latitude": 37.7749, "longitude": -122.4194, "radius": 1000, "maxResults": 10, "bikeType": "standard", "includeAvailability": true } ``` -------------------------------- ### Example Request Body for Send Event API Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/send_event.md Provides a detailed JSON example of the request body for the `/send_event` endpoint, showcasing various event data fields, metadata, and delivery options. ```json { "eventType": "user_trip_completed", "destination": "analytics_platform", "eventData": { "userId": "user_123", "tripId": "trip_456", "startTime": "2023-06-22T10:00:00Z", "endTime": "2023-06-22T10:30:00Z", "distance": 5.2, "duration": 1800, "transportMode": "car", "fare": 18.50, "rating": 4.5 }, "metadata": { "source": "mobile_app", "version": "2.1.0", "platform": "ios", "timestamp": "2023-06-22T10:30:00Z", "sessionId": "session_789" }, "delivery": { "priority": "high", "retryPolicy": "exponential_backoff", "maxRetries": 3, "timeout": 10000 } } ``` -------------------------------- ### Start MaaS API Server Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/CLAUDE.md Initiates the MaaS API server application. This command first changes the directory to 'maas-api' and then uses 'npm run app' to start the server, typically invoking a 'mar api' command internally. ```bash cd maas-api && npm run app ``` -------------------------------- ### Generate Documentation Map in HTML Format Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/DOC-MAP-USAGE.md Illustrates how to generate the documentation map in HTML format, redirecting the output to a file for web viewing. ```bash ./docs/scripts/doc-map.sh --format=html > doc-map.html ``` -------------------------------- ### API Endpoint: GET /api/v2/hard_coded Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/basic.md Retrieves static configuration data. This endpoint requires JWT token authentication and accepts a 'version' query parameter for configuration versioning. ```bash GET /api/v2/hard_coded?version=123456789 ``` ```APIDOC Purpose: Retrieve static configuration data Authentication: Required (JWT token) Query Parameters: - version: Timestamp for configuration versioning Response: Static configuration object ``` -------------------------------- ### Set Up Target GitHub Repository for Sync Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md Steps to clone or initialize the target GitHub repository (`mass-api_knowledge`) and configure Git user credentials (name and email), ensuring the local environment is correctly set up for pushing synchronized documentation. ```bash # Clone or initialize target repository git clone https://github.com/howard-metropia/mass-api_knowledge.git # Configure Git credentials git config user.name "Your Name" git config user.email "your.email@example.com" # Set up remote origin git remote add origin https://github.com/howard-metropia/mass-api_knowledge.git ``` -------------------------------- ### Successful Response for GET Suggestion Card Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/suggestion-card.md Example JSON response for a successful GET request to retrieve a suggestion card. It includes card details like ID, type, title, description, action, priority, and timestamps. ```json { "id": "123", "type": "route_recommendation", "title": "Try a faster route", "description": "Save 10 minutes on your commute", "action": { "type": "navigate", "route_id": "456" }, "priority": "medium", "expires_at": "2025-12-31T23:59:59Z", "created_at": "2025-06-22T10:00:00Z" } ``` -------------------------------- ### JavaScript Example for Complete User Registration Flow Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/account.md This JavaScript snippet demonstrates a complete user registration flow, including initial registration, phone verification, and account activation. It uses `fetch` to make sequential API calls, showing the typical steps a client application would take. ```javascript // 1. User registration const registerResponse = await fetch('/api/v2/register', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: 'user@example.com', password: 'password123', phone: '+886912345678' }) }); // 2. Phone verification const verifyResponse = await fetch('/api/v2/verify_phone', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ phone: '+886912345678', code: '123456' }) }); // 3. Account activation const activateResponse = await fetch('/api/v2/activation', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: 'user@example.com', activationCode: 'activation_code_from_email' }) }); ``` -------------------------------- ### JSON: Successful GET Location Prediction Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/predict-location.md Example JSON response for a successful GET request to retrieve location predictions, showing a single prediction object with ID, user ID, coordinates, confidence, and timestamp. ```json { "success": true, "data": [ { "id": "pred_123", "userId": "user_456", "predictedLocation": { "latitude": 37.7749, "longitude": -122.4194 }, "confidence": 0.85, "timestamp": "2023-06-22T10:30:00Z" } ] } ``` -------------------------------- ### Example: Successful User Preference Update Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/preference.md Illustrates a successful JSON response after updating user preferences, confirming the update and showing the modified data. ```json { "success": true, "message": "Preferences updated successfully", "data": { "notifications": { "push": false, "email": true, "sms": true }, "updatedAt": "2023-06-22T10:30:00Z" } } ``` -------------------------------- ### JavaScript: Database Connection Bootstrap Handler Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/bootstraps.md An example bootstrap handler for establishing a MongoDB database connection. It uses 'MongoClient' to connect and stores the client globally for application-wide access. ```JavaScript // bootstrap/database.js const { MongoClient } = require('mongodb'); module.exports = async function initializeDatabase() { const client = new MongoClient(process.env.MONGODB_URL); await client.connect(); // Store client globally or in dependency injection container global.dbClient = client; console.log('Database connection established'); }; ``` -------------------------------- ### Use Cases: Integration Application Scenarios Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/parking.md Examples of applications where the parking search API can be integrated, including mobile apps, navigation systems, and smart city management. ```APIDOC - Mobile app parking finder interface - Navigation system parking integration - Smart city parking management systems ``` -------------------------------- ### JSON Response Example for Successful Welcome Coin Retrieval Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/welcome-coin.md Illustrates a successful JSON response from the welcome coin API, detailing user ID, coin status, eligibility, rewards, and campaign information. ```json { "success": true, "data": { "userId": "user_123", "welcomeCoins": { "available": 500, "claimed": false, "expiresAt": "2023-12-22T23:59:59Z", "issuedAt": "2023-06-22T10:30:00Z" }, "eligibility": { "isEligible": true, "reason": "new_user", "requirements": [ "first_time_user", "verified_account", "valid_email" ] }, "rewards": { "coinValue": 500, "equivalentCredits": 10.00, "currency": "USD", "usageOptions": [ { "type": "ride_credit", "description": "Use for ride payments", "minAmount": 100 }, { "type": "discount", "description": "Apply as discount on services", "percentage": 20 } ] }, "campaignInfo": { "campaignId": "welcome_2023_q2", "name": "Summer Welcome Bonus", "description": "Welcome to our mobility platform!" } } } ``` -------------------------------- ### Survey Action Tracking API Response Example Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/microsurvey.md An example of a successful JSON response for tracking survey-related actions. It lists individual actions (viewed, started, completed) with timestamps and metadata, along with a summary including total actions and conversion funnel metrics. ```json { "success": true, "data": { "actions": [ { "actionId": "action_345678", "surveyId": "survey_123456", "userId": "user_456789", "action": "survey_viewed", "timestamp": "2023-06-22T10:25:00Z", "metadata": { "source": "push_notification", "platform": "mobile_app" } }, { "actionId": "action_345679", "surveyId": "survey_123456", "userId": "user_456789", "action": "survey_started", "timestamp": "2023-06-22T10:26:00Z", "metadata": { "startMethod": "direct_tap" } }, { "actionId": "action_345680", "surveyId": "survey_123456", "userId": "user_456789", "action": "survey_completed", "timestamp": "2023-06-22T10:30:00Z", "metadata": { "completionTime": 95, "interruptionCount": 0 } } ], "summary": { "totalActions": 3, "conversionFunnel": { "viewed": 1, "started": 1, "completed": 1, "conversionRate": 100 }, "averageCompletionTime": 95 } } } ``` -------------------------------- ### JavaScript Dependencies for Koa.js Welcome Coin Controller Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/welcome-coin.md Lists the required Node.js modules for the welcome coin API controller, including Koa routing, Joi validation, and custom service/schema modules. ```javascript const Router = require('@koa/router'); // Koa routing const JoiRouter = require('@koa-better-modules/joi-router'); // Joi validation router const service = require('@maas/features/maas/welcome-coin/service'); // Welcome coin service const validator = require('@maas/features/maas/welcome-coin/schema'); // Joi schemas const { setRouteByConfigs } = require('@maas/core/router'); // Route configuration ``` -------------------------------- ### Example Request Body for Device Logging Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/here-device-id.md Illustrates the structure and content of the JSON request body required for the POST /api/v1/here-device-id endpoint, including deviceInfo, hereServiceInfo, location, and sessionInfo. ```json { "deviceInfo": { "deviceId": "device_abc123def456", "deviceType": "mobile", "platform": "ios", "osVersion": "16.0", "appVersion": "2.1.0", "manufacturer": "Apple", "model": "iPhone 14 Pro" }, "hereServiceInfo": { "serviceType": "geocoding", "requestCount": 1, "lastUsed": "2023-06-22T10:30:00Z", "apiVersion": "8.0" }, "location": { "country": "US", "region": "CA", "timezone": "America/Los_Angeles" }, "sessionInfo": { "sessionId": "session_789012", "userId": "user_456789", "startTime": "2023-06-22T10:00:00Z" } } ``` -------------------------------- ### cURL Example to Get a Suggestion Card Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/suggestion-card.md Provides a cURL command to retrieve a suggestion card by its ID, including the necessary Authorization header with a JWT token. ```bash curl -X GET \ https://api.example.com/api/v1/suggestion_card/123 \ -H 'Authorization: Bearer <jwt-token>' ``` -------------------------------- ### JavaScript: Expected Application Structure Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/index.md This snippet illustrates the anticipated structure of the `index.js` module once it's fully configured with application logic. It outlines key components like server instance, port, middleware, routes, and configuration. ```JavaScript { server: app, port: 3000, middleware: [...], routes: [...], config: {...} } ``` -------------------------------- ### Successful Batch Action Recording Response Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/user-actions.md Example of a successful JSON response for batch user action recording, summarizing the number of actions processed and their categories. ```json { "success": true, "data": { "batchId": "batch_789012", "actionsRecorded": 5, "summary": { "button_clicks": 3, "screen_views": 1, "api_calls": 1 }, "recordedAt": "2023-06-22T10:30:15Z", "processingTime": 45 } } ``` -------------------------------- ### Integrate doc-map.sh with Update Checking and Documentation Generation Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/DOC-MAP-USAGE.md Demonstrates how the `doc-map.sh` script integrates with other documentation-related scripts, showing how to check updates and view the latest status after updating documentation. ```bash # Check updates will automatically suggest documentation map commands ./docs/scripts/check-updates.sh # View latest status after updating documentation ./docs/scripts/update-docs.sh && ./docs/scripts/doc-map.sh --links ``` -------------------------------- ### JavaScript: Integrating Express.js with Main Module Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/index.md This example demonstrates how the `index.js` module can be extended to integrate with the Express.js framework. It includes middleware configuration for JSON parsing and routes, providing a foundation for a RESTful API server. ```JavaScript const express = require('express'); const app = express(); // Middleware configuration app.use(express.json()); app.use(require('./middlewares')); // Route configuration app.use('/api', require('./controllers')); module.exports = app; ``` -------------------------------- ### Required System Dependencies for Documentation Sync Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md Lists the essential command-line tools required for the documentation synchronization script to function correctly, including `git` for version control, `curl` for HTTP requests, `jq` for JSON processing, and `rsync` for file synchronization. GitHub CLI is also recommended. ```bash # Core tools git # Version control curl # HTTP requests for GitHub API jq # JSON processing rsync # File synchronization # GitHub CLI (optional but recommended) gh # GitHub command line tool ``` -------------------------------- ### API Endpoint: Get Total User Trip Count Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/trip.md Documents the GET /api/v2/trip_count endpoint, which provides the total number of trips for a user. The response includes various trip count statistics. ```bash GET /api/v2/trip_count ``` ```APIDOC Purpose: Get total number of user trips Response: Trip count statistics ``` -------------------------------- ### Basic Usage of doc-map.sh Script Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/DOC-MAP-USAGE.md Demonstrates various basic commands for the `doc-map.sh` script, including displaying the documentation tree, showing file links, and filtering by update status or documentation presence. ```bash # Basic tree display ./docs/scripts/doc-map.sh # Display file links ./docs/scripts/doc-map.sh --links # Show only updated files ./docs/scripts/doc-map.sh --filter=updated --links # Show only files that need updates ./docs/scripts/doc-map.sh --filter=need_update # Show only files without documentation ./docs/scripts/doc-map.sh --filter=not_added ``` -------------------------------- ### JSON: Invalid Promocode Response Example Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/promocode.md Example JSON response for an invalid or expired promotional code, indicating failure, an error message, a specific error code, and the reason for invalidity. ```JSON { "success": false, "error": "Promocode expired or invalid", "code": "PROMOCODE_INVALID", "data": { "promocode": "EXPIRED20", "valid": false, "reason": "expired" } } ``` -------------------------------- ### JavaScript: Importing the Main Module Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/index.md This snippet shows how to import the `index.js` module into another file using `require()`. It then logs the imported module, which is currently an empty array, demonstrating its initial state. ```JavaScript const app = require('./src/index'); console.log(app); // Output: [] ``` -------------------------------- ### Integrate Documentation Generation with Sync Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md This snippet illustrates how to combine documentation generation with the sync process. It shows a combined command to generate and then sync documentation, and a conditional sync that only proceeds if changes are detected by a `check-updates.sh` script. ```bash # Combined workflow: Generate + Sync ./docs/scripts/claude-doc-generator.sh --force && \ ./docs/scripts/sync-to-github.sh -m "Auto-update: $(date)" # Conditional sync (only if changes detected) if ./docs/scripts/check-updates.sh --has-changes; then ./docs/scripts/sync-to-github.sh -m "Auto-sync: Documentation updates" fi ``` -------------------------------- ### Initialize Node.js Express Application with Basic Configuration Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/index.md This snippet sets up a basic Node.js Express application. It initializes Express, configures middleware for JSON and URL-encoded body parsing, and defines a '/health' endpoint for status checks. This serves as the foundational entry point for an API. ```javascript const express = require('express'); const app = express(); // Basic configuration app.use(express.json()); app.use(express.urlencoded({ extended: true })); // Health check app.get('/health', (req, res) => { res.json({ status: 'ok', timestamp: new Date().toISOString() }); }); module.exports = app; ``` -------------------------------- ### API: Get Detailed Trip Information (GET /api/v2/reservation/trip_detail/:id) Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/reservation.md Documents the endpoint for fetching detailed trip information associated with a specific reservation, specifying the required path parameter and the structure of the returned data. ```APIDOC GET /api/v2/reservation/trip_detail/:id Purpose: Get detailed trip information for a reservation Parameters: id (path) - Reservation identifier Response: Detailed trip and reservation information ``` -------------------------------- ### JavaScript: Koa.js Router Configuration Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/promocode.md Initializes the Koa router with an API version prefix and creates an instance for Joi schema validation. ```JavaScript const router = new Router({ prefix: '/api/v2' }); const joiRouter = new JoiRouter(); ``` -------------------------------- ### Koa.js Router Configuration for Welcome Coin API Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/welcome-coin.md Defines the base router and Joi validation instance for the welcome coin API, setting the API version and prefix. ```javascript const router = new Router({ prefix: '/api/v2/welcome_coin' }); // API v2 with welcome_coin prefix const joiRouter = new JoiRouter(); // Joi validation instance ``` -------------------------------- ### Perform Basic Manual Documentation Sync Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md Commands for manually triggering the documentation synchronization script from the project root, including options for specifying a custom commit message and performing a dry run to test the sync without making actual changes. ```bash # Navigate to project root cd /path/to/metropia_test # Run sync script ./docs/scripts/sync-to-github.sh # With custom commit message ./docs/scripts/sync-to-github.sh -m "Update API documentation" # Dry run (test without actual sync) ./docs/scripts/sync-to-github.sh --dry-run ``` -------------------------------- ### Example Request Body for User Action Tracking Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/controllers/user-actions.md Provides a sample JSON payload for the POST /api/v2/user_actions/ endpoint, demonstrating the structure for action type, name, screen, metadata, and context. ```json { "actionType": "button_click", "actionName": "book_ride", "screen": "home_screen", "metadata": { "buttonText": "Book Now", "destination": "Downtown", "timestamp": "2023-06-22T10:30:00Z" }, "context": { "appVersion": "2.1.0", "platform": "ios", "sessionId": "session_abc123" } } ``` -------------------------------- ### HTTP Example: Non-Authenticated URL Bypass Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/guest-account-api-filter.md This HTTP example shows a scenario where an endpoint, such as `/api/v2/login`, does not require authentication and bypasses all guest access checks. A POST request receives a 200 OK response without an authorization header. ```http POST /api/v2/login HTTP/1.1 Content-Type: application/json { "email": "user@example.com", "password": "password123" } HTTP/1.1 200 OK # No authentication required, bypasses all checks ``` -------------------------------- ### Perform Advanced Manual Documentation Sync Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/GITHUB_SYNC_GUIDE.md Commands for advanced manual synchronization, allowing users to include specific directories, exclude certain files (e.g., temporary or log files), force synchronization (ignoring change detection), and enable verbose output for detailed logging during the sync process. ```bash # Sync specific directories only ./docs/scripts/sync-to-github.sh --include "docs/maas-api/" # Exclude certain files ./docs/scripts/sync-to-github.sh --exclude "*.tmp,*.log" # Force sync (ignore change detection) ./docs/scripts/sync-to-github.sh --force # Verbose output ./docs/scripts/sync-to-github.sh --verbose ``` -------------------------------- ### JavaScript: Importing and Inspecting Current Bootstraps Source: https://github.com/howard-metropia/mass-api_knowledge/blob/main/docs/maas-api/src/bootstraps.md Demonstrates how to import the 'bootstraps.js' module and inspect its current state, which is an empty array, confirming no configurations are defined yet. ```JavaScript const bootstraps = require('./src/bootstraps'); console.log(bootstraps); // Output: [] console.log(bootstraps.length); // Output: 0 ```