File size: 2,454 Bytes
3d23b0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
export const userRatingSchema = {
    summary: 'Get User Rating',
    description: 'Fetches GeeksforGeeks user rating and platform details',
    tags: ['GFG'],
    querystring: {
        type: 'object',
        properties: {
            username: { type: 'string', description: 'GFG username' },
        },
        required: ['username'],
    },
    response: {
        200: {
            type: 'object',
            properties: {
                username: { type: 'string' },
                platform: { type: 'string' },
                rating: { type: ['number', 'string'] },
                level: { type: 'string' }
            }
        }
    }
};

export const userSubmissionsSchema = {
    summary: 'Get User Submissions',
    description: 'Fetches problems solved by a GFG user',
    tags: ['GFG'],
    body: {
        type: 'object',
        properties: {
            handle: { type: 'string', description: 'GFG handle' },
            requestType: { type: 'string', default: "" },
            year: { type: 'string', default: "" },
            month: { type: 'string', default: "" }
        },
        required: ['handle']
    }
};

export const userPostsSchema = {
    summary: 'Get User Posts',
    description: 'Fetches articles and posts written by a GFG user',
    tags: ['GFG'],
    params: {
        type: 'object',
        properties: {
            username: { type: 'string' }
        },
        required: ['username']
    },
    querystring: {
        type: 'object',
        properties: {
            fetch_type: { type: 'string', default: 'posts' },
            page: { type: 'number', default: 1 }
        }
    }
};

export const promotionalEventsSchema = {
    summary: 'Get Promotional Events',
    description: 'Fetches promotional events from GFG',
    tags: ['GFG'],
    querystring: {
        type: 'object',
        properties: {
            page_source: { type: 'string' },
            user_country_code: { type: 'string', default: 'IN' }
        },
        required: ['page_source']
    }
};

export const contestLeaderboardSchema = {
    summary: 'Get Contest Leaderboard',
    description: 'Fetches the leaderboard for GFG weekly coding contests',
    tags: ['GFG'],
    querystring: {
        type: 'object',
        properties: {
            leaderboard_type: { type: 'number', default: 0 },
            page: { type: 'number', default: 1 },
            year_month: { type: 'string', default: "" }
        }
    }
};