npm package: @mojito-inc/loyalty-cli
Description: CLI tool for managing Mojito's Loyalty operations
Author: Mojito Inc
Latest version: 1.0.1

# 🧪 Mojito Loyalty CLI

`@mojito-inc/loyalty-cli` is a command-line tool to interact with the Mojito Loyalty Platform.  
It supports authentication, mission & reward handling, claims, redemptions, and leaderboard queries – all from your terminal.

- 🔗 https://getmojito.com/loyalty
- 📚 Docs: https://loyaltydocs.getmojito.com/
- 📧 Support: dev-support@mojito.xyz

---

## 📦 Installation

1. Before installing, make sure **Node.js** is available in your system.
    
    **Install Node.js**:  
[https://nodejs.org/en/download/](https://nodejs.org/en/download/)

    Verify installation:
    ```sh
    node -v
    npm -v 
    ```
2. Install CLI:
    ```sh
    npm install @mojito-inc/loyalty-cli
    ```
    

2. Install CLI (If globally required):
    ```sh
    npm install -g @mojito-inc/loyalty-cli
    ```


3. Run the CLI:
    
    Once installed successfully, you can access the CLI tool via `mojito loyalty` in your terminal.

    ```sh
    mojito-loyalty --help
    ```

---

## ⚙️ Global Options

You can specify the environment using:

```sh
--env <env>  Specify environment: dev, staging, sandbox, or prod (default: prod)
```

---

## 🔑 Authentication Commands

### `fetchSignMessage`

Fetch the sign message for a user:
```sh
mojito-loyalty fetchSignMessage <walletAddress> -k <apiKey>
```

### `generateJWT`

Generate a JWT token:
```sh
mojito-loyalty generateJWT <walletAddress> <signature> <message> -k <apiKey>
```

---

## 🎯 Mission Commands

### `getMissions`

Fetch missions for a user:
```sh
mojito-loyalty getMissions <tenantId> <user_reference> -k <apiKey> [options]
```

Options:
- `--status <status>`: Mission status (default: `AVAILABLE`)
- `--missionId <id>`
- `--sortBy <field>`: Sort field (default: `created_at`)
- `--order <asc|desc>`: Sort order (default: `desc`)
- `--limit <n>`: Number of results (default: `10`)
- `--offset <n>`: Pagination offset (default: `0`)

### `fetchMission`

Fetch mission details by ID:
```sh
mojito-loyalty fetchMission <missionId> -k <apiKey>
```

---

## 🧾 Claim Commands

### `initiateClaim`

Initiate a claim process:
```sh
mojito-loyalty initiateClaim <missionId> <userReference> -k <apiKey>
```

### `getClaimStatus`

Get claim status:
```sh
mojito-loyalty getClaimStatus <tenantId> <missionId> <userId> <claimId> -k <apiKey>
```

---

## 🎁 Reward Commands

### `getRewards`

Fetch rewards for a user:
```sh
mojito-loyalty getRewards <tenantId> <user_reference> -k <apiKey> [options]
```

Options:
- `--status <status>` (default: `AVAILABLE`)
- `--sortBy <field>` (default: `created_at`)
- `--order <asc|desc>` (default: `desc`)
- `--limit <n>` (default: `10`)
- `--offset <n>` (default: `0`)

### `fetchReward`

Fetch reward details by ID:
```sh
mojito-loyalty fetchReward <rewardId> -k <apiKey>
```

### `initiateReward`

Initiate reward redemption:
```sh
mojito-loyalty initiateReward <rewardId> <userReference> <walletAddress> -k <apiKey>
```

### `getRedeemStatus`

Fetch reward redemption status:
```sh
mojito-loyalty getRedeemStatus <tenantId> <rewardId> <userId> <redeemId> -k <apiKey>
```

---

## 🧮 User Credits

### `getUserCredits`

Get user’s available credit points:
```sh
mojito-loyalty getUserCredits <tenantId> <user_reference> -k <apiKey>
```

---

## 🏆 Leaderboard

### `getLeaderboard`

Fetch leaderboard data:
```sh
mojito-loyalty getLeaderboard <tenantId> -k <apiKey> [options]
```

Options:
- `--sort <field>` (default: `Points`)
- `--date-range <range>` (default: `ALLTIME`)
- `--limit <n>` (default: `10`)
- `--offset <n>` (default: `0`)

---

## 💳 Transactions

### `getTransactions`

Fetch user transaction history:
```sh
mojito-loyalty getTransactions <tenantId> <userReference> -k <apiKey> [options]
```

Options:
- `--date-range <range>` (default: `ALLTIME`)
- `--limit <n>` (default: `10`)
- `--offset <n>` (default: `0`)

---

## 📞 Support

- **Docs**: [https://loyaltydocs.getmojito.com/](https://loyaltydocs.getmojito.com/)
- **Email**: dev-support@mojito.xyz