Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /**
* Loyalty Endpoints
* Loyalty points and rewards program endpoints
*/
import type { ApiEndpoint } from '@/types/api-docs';
export const loyaltyEndpoints: ApiEndpoint[] = [
{
id: 'loyalty-balance',
method: 'GET',
path: '/api/loyalty/balance',
summary: 'Get loyalty balance',
description: 'Returns current loyalty points balance and tier',
category: 'loyalty',
requiresAuth: true,
responses: [
{
status: 200,
description: 'Loyalty balance',
example: {
success: true,
data: {
points: 500,
tier: 'Gold',
nextTier: 'Platinum',
pointsToNextTier: 500,
},
},
},
{
status: 401,
description: 'Not authenticated',
example: { success: false, error: { code: 'UNAUTHORIZED', message: 'Authentication required' } },
},
],
},
{
id: 'loyalty-history',
method: 'GET',
path: '/api/loyalty/history',
summary: 'Get points history',
description: 'Returns history of loyalty points transactions',
category: 'loyalty',
requiresAuth: true,
parameters: [
{ name: 'page', type: 'number', required: false, location: 'query', description: 'Page number' },
{ name: 'limit', type: 'number', required: false, location: 'query', description: 'Items per page' },
],
responses: [
{
status: 200,
description: 'Points history',
example: {
success: true,
data: {
transactions: [
{ id: 1, type: 'EARNED', points: 50, description: 'Purchase reward', createdAt: '2024-01-15T10:00:00Z' },
{ id: 2, type: 'REDEEMED', points: -25, description: 'Discount applied', createdAt: '2024-01-10T10:00:00Z' },
],
pagination: { page: 1, limit: 10, total: 25, totalPages: 3 },
},
},
},
{
status: 401,
description: 'Not authenticated',
example: { success: false, error: { code: 'UNAUTHORIZED', message: 'Authentication required' } },
},
],
},
{
id: 'loyalty-redeem',
method: 'POST',
path: '/api/loyalty/redeem',
summary: 'Redeem points',
description: 'Redeems loyalty points for discount',
category: 'loyalty',
requiresAuth: true,
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'points', type: 'number', required: true, description: 'Points to redeem' },
],
},
responses: [
{
status: 200,
description: 'Points redeemed',
example: {
success: true,
data: {
discount: 5.00,
pointsRedeemed: 100,
remainingPoints: 400,
},
},
},
{
status: 400,
description: 'Insufficient points',
example: { success: false, error: { code: 'INSUFFICIENT_POINTS', message: 'Not enough points to redeem' } },
},
{
status: 401,
description: 'Not authenticated',
example: { success: false, error: { code: 'UNAUTHORIZED', message: 'Authentication required' } },
},
],
},
];
|