Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cf-problem-sheet Backend API #75

Closed
Harsha9554 opened this issue Dec 3, 2023 · 3 comments
Closed

cf-problem-sheet Backend API #75

Harsha9554 opened this issue Dec 3, 2023 · 3 comments
Assignees
Labels
cf-problem-sheet Feat: Codeforces problem sheet enhancement New feature or request

Comments

@Harsha9554
Copy link
Contributor

This issue is part of the feature #74

here's a simple design for the API call:

API Endpoint:

GET http://localhost:3000/api/cf-problem-sheet

Query Parameters:

  • handle (required): Codeforces handle of the user.
  • minProblemRating (optional): Minimum problem rating.
  • maxProblemRating (optional): Maximum problem rating.
  • numberOfPreviousContests (optional): Number of previous contests to consider.

Example Request:

GET http://localhost:3000/api/cf-problem-sheet?handle=harsha9554&minProblemRating=0&maxProblemRating=1400&numberOfPreviousContests=5

Example Response:

{
    "meta": {
        "handle": "harsha9554",
        "minProblemRating": 0,
        "maxProblemRating": 1400,
        "numberOfPreviousContests": 5
    },
    "problems": [
        {
            "contestId": 1903,
            "index": "A",
            "name": "Halloumi Boxes",
            "type": "PROGRAMMING",
            "points": 500,
            "rating": 800,
            "tags": [
                "brute force",
                "greedy",
                "sortings"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1903/A"
        },
        {
            "contestId": 1901,
            "index": "A",
            "name": "Line Trip",
            "type": "PROGRAMMING",
            "rating": 800,
            "tags": [
                "greedy",
                "math"
            ],
            "points": 0,
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1901/A"
        },
        {
            "contestId": 1900,
            "index": "A",
            "name": "Cover in Water",
            "type": "PROGRAMMING",
            "points": 500,
            "rating": 800,
            "tags": [
                "constructive algorithms",
                "greedy",
                "implementation",
                "strings"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1900/A"
        },
        {
            "contestId": 1900,
            "index": "B",
            "name": "Laura and Operations",
            "type": "PROGRAMMING",
            "points": 1000,
            "rating": 900,
            "tags": [
                "dp",
                "math"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1900/B"
        },
        {
            "contestId": 1901,
            "index": "B",
            "name": "Chip and Ribbon",
            "type": "PROGRAMMING",
            "rating": 1100,
            "tags": [
                "greedy",
                "math"
            ],
            "points": 0,
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1901/B"
        },
        {
            "contestId": 1903,
            "index": "B",
            "name": "StORage room",
            "type": "PROGRAMMING",
            "points": 1000,
            "rating": 1200,
            "tags": [
                "bitmasks",
                "brute force",
                "constructive algorithms",
                "greedy"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1903/B"
        },
        {
            "contestId": 1900,
            "index": "C",
            "name": "Anji's Binary Tree",
            "type": "PROGRAMMING",
            "points": 1250,
            "rating": 1300,
            "tags": [
                "dfs and similar",
                "dp",
                "trees"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1900/C"
        },
        {
            "contestId": 1903,
            "index": "C",
            "name": "Theofanis' Nightmare",
            "type": "PROGRAMMING",
            "points": 1500,
            "rating": 1400,
            "tags": [
                "constructive algorithms",
                "dp",
                "fft",
                "greedy",
                "hashing"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1903/C"
        },
        {
            "contestId": 1901,
            "index": "C",
            "name": "Add, Divide and Floor",
            "type": "PROGRAMMING",
            "rating": 1400,
            "tags": [
                "constructive algorithms",
                "greedy",
                "math"
            ],
            "points": 0,
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1901/C"
        }
    ]
}

This design provides a clear structure for the API call, specifying required and optional parameters, along with an example request and response for better understanding. @Jaideep-C

@Jaideep-C Jaideep-C added enhancement New feature or request cf-problem-sheet Feat: Codeforces problem sheet labels Dec 3, 2023
@Jaideep-C
Copy link
Member

What happens when minProblemRating is absent?
What value are you choosing?

@Harsha9554
Copy link
Contributor Author

So, the way I've written the logic is that if you don't pass minProblemRating or the value for minProblemRating is not given by the user the default minProblemRating is 0. @Jaideep-C

@Jaideep-C
Copy link
Member

This issue is resolved in #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cf-problem-sheet Feat: Codeforces problem sheet enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants