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 | 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 | /**
* Referrals Endpoints
* Referral program and tracking endpoints
*/
import type { ApiEndpoint } from '@/types/api-docs';
export const referralsEndpoints: ApiEndpoint[] = [
{
id: 'referrals-code',
method: 'GET',
path: '/api/referrals/code',
summary: 'Get referral code',
description: 'Returns user referral code',
category: 'referrals',
requiresAuth: true,
responses: [
{
status: 200,
description: 'Referral code',
example: {
success: true,
data: {
code: 'ABC123',
shareUrl: 'https://example.com/ref/ABC123',
},
},
},
{
status: 401,
description: 'Not authenticated',
example: { success: false, error: { code: 'UNAUTHORIZED', message: 'Authentication required' } },
},
],
},
{
id: 'referrals-stats',
method: 'GET',
path: '/api/referrals/stats',
summary: 'Get referral stats',
description: 'Returns referral statistics for current user',
category: 'referrals',
requiresAuth: true,
responses: [
{
status: 200,
description: 'Referral stats',
example: {
success: true,
data: {
totalReferrals: 5,
pendingReferrals: 2,
completedReferrals: 3,
earnings: 25.00,
pendingEarnings: 10.00,
},
},
},
{
status: 401,
description: 'Not authenticated',
example: { success: false, error: { code: 'UNAUTHORIZED', message: 'Authentication required' } },
},
],
},
{
id: 'referrals-validate',
method: 'POST',
path: '/api/referrals/validate',
summary: 'Validate referral code',
description: 'Validates a referral code',
category: 'referrals',
requiresAuth: false,
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'code', type: 'string', required: true, description: 'Referral code to validate' },
],
},
responses: [
{
status: 200,
description: 'Valid code',
example: {
success: true,
data: {
valid: true,
discount: 10,
discountType: 'percentage',
},
},
},
{
status: 400,
description: 'Invalid code',
example: { success: false, error: { code: 'INVALID_CODE', message: 'Referral code not found or expired' } },
},
],
},
];
|