# NabzClan App Store

Access the NabzClan App Store API for applications, categories, and search functionality.

## Endpoints Overview

| Endpoint                                  | Description       |
| ----------------------------------------- | ----------------- |
| `GET /api/appstore`                       | API information   |
| `GET /api/appstore/apps`                  | List applications |
| `GET /api/appstore/apps/{id}`             | Get single app    |
| `GET /api/appstore/categories`            | List categories   |
| `GET /api/appstore/search`                | Search apps       |
| `GET /api/appstore/download/{version_id}` | Download app      |
| `GET /api/appstore/repo`                  | AltStore source   |

---

## List Applications

`GET /api/appstore/apps`

### Parameters

| Name       | Type    | Required | Description                            |
| ---------- | ------- | -------- | -------------------------------------- |
| `page`     | int     | No       | Page number (default: 1)               |
| `per_page` | int     | No       | Items per page (max: 100, default: 20) |
| `category` | int     | No       | Filter by category ID                  |
| `type`     | string  | No       | Filter by type: `app` or `game`        |
| `sort`     | string  | No       | Sort by: `latest`, `popular`, `name`   |
| `all`      | boolean | No       | Set to `true` to return all apps       |

### Example Request

```bash
curl -X GET "https://developer.nabzclan.vip/api/appstore/apps?per_page=10&sort=popular" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Response

```json
{
    "success": true,
    "data": [
        {
            "id": 123,
            "name": "App Name",
            "bundle_id": "com.example.app",
            "developer": "Developer Name",
            "description": "App description...",
            "category": "Games",
            "type": "app",
            "icon_url": "https://appstore.nabzclan.vip/images/icon.jpg",
            "latest_version": "1.0.0",
            "download_url": "https://developer.nabzclan.vip/api/appstore/download/400",
            "downloads": 1234,
            "rating": {
                "average": 4.5,
                "total_reviews": 100
            },
            "slug": "app-name",
            "created_at": "2025-01-01 00:00:00"
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "per_page": 10,
            "total": 895,
            "total_pages": 90,
            "has_more": true
        }
    }
}
```

---

## Get Single Application

`GET /api/appstore/apps/{id}`

Get a single application with all its versions. The `{id}` can be the app ID or slug.

### Example Request

```bash
curl -X GET "https://developer.nabzclan.vip/api/appstore/apps/123" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Response

```json
{
    "success": true,
    "data": {
        "id": 123,
        "name": "App Name",
        "bundle_id": "com.example.app",
        "developer": "Developer Name",
        "description": "Full app description...",
        "category": "Games",
        "type": "app",
        "icon_url": "https://appstore.nabzclan.vip/images/icon.jpg",
        "latest_version": "2.0.0",
        "download_url": "https://developer.nabzclan.vip/api/appstore/download/456",
        "downloads": 2000,
        "rating": {
            "average": 4.8,
            "total_reviews": 500
        },
        "versions": [
            {
                "id": 456,
                "version": "2.0.0",
                "downloads": 2000,
                "size_formatted": "100 MB",
                "download_url": "https://developer.nabzclan.vip/api/appstore/download/456",
                "changelog": "What's new..."
            },
            {
                "id": 400,
                "version": "1.0.0",
                "downloads": 3000,
                "size_formatted": "90.6 MB",
                "download_url": "https://developer.nabzclan.vip/api/appstore/download/400"
            }
        ],
        "screenshots": [
            "https://appstore.nabzclan.vip/screenshots/screen1.jpg",
            "https://appstore.nabzclan.vip/screenshots/screen2.jpg"
        ]
    }
}
```

---

## List Categories

`GET /api/appstore/categories`

### Example Request

```bash
curl -X GET "https://developer.nabzclan.vip/api/appstore/categories" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Response

```json
{
    "success": true,
    "data": [
        {
            "id": 4,
            "name": "Games",
            "slug": "games",
            "app_count": 150
        },
        {
            "id": 7,
            "name": "Tools",
            "slug": "tools",
            "app_count": 85
        }
    ]
}
```

---

## Search Applications

`GET /api/appstore/search`

Search applications by title, bundle ID, developer, or description.

### Parameters

| Name       | Type   | Required | Description                     |
| ---------- | ------ | -------- | ------------------------------- |
| `q`        | string | Yes      | Search query (min 2 characters) |
| `page`     | int    | No       | Page number                     |
| `per_page` | int    | No       | Items per page (max: 100)       |

### Example Request

```bash
curl -X GET "https://developer.nabzclan.vip/api/appstore/search?q=roblox" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

---

## Download Application

`GET /api/appstore/download/{version_id}`

> **Note:** This endpoint requires a VIP subscription. Free plan users will receive a 403 error.

Streams the application file through our proxy. Requires VIP plan access.

### Example

```bash
curl -L -O https://developer.nabzclan.vip/api/appstore/download/123 \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Error Response (Non-VIP Users)

```json
{
    "success": false,
    "error": {
        "message": "VIP subscription required to download apps. Please upgrade your plan.",
        "code": 403
    }
}
```

---

## AltStore Source

`GET /api/appstore/repo`

Returns the repository in AltStore/SideStore-compatible JSON format.

### Example Request

```bash
curl -X GET "https://developer.nabzclan.vip/api/appstore/repo" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Response

```json
{
    "name": "Nabzclan - App Store",
    "identifier": "com.nabzclan.repo.altstore",
    "sourceURL": "https://appstore.nabzclan.vip/api/repo",
    "apps": [
        {
            "name": "App Name",
            "bundleIdentifier": "com.example.app",
            "version": "1.0.0",
            "downloadURL": "https://appstore.nabzclan.vip/download-repo-source/123",
            "developerName": "Developer",
            "iconURL": "https://appstore.nabzclan.vip/images/icon.jpg"
        }
    ]
}
```
