Draft of the /api page in frontend.
This commit is contained in:
parent
513d0ec682
commit
f22b139e51
0
nise-frontend/src/app/api/api.component.css
Normal file
0
nise-frontend/src/app/api/api.component.css
Normal file
25
nise-frontend/src/app/api/api.component.html
Normal file
25
nise-frontend/src/app/api/api.component.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<div class="main term mb-2">
|
||||||
|
<div class="fade-stuff">
|
||||||
|
<h1 class="mb-4"># <span class="board">/api/</span> stuff</h1>
|
||||||
|
<p>
|
||||||
|
if you'd like to retrieve data from our database, you are invited to use the same endpoints meant for the frontend but in a programmatic way. <u>currently there's no rate limits.</u>
|
||||||
|
</p>
|
||||||
|
<p>as of today, you MUST pass the following parameters:</p>
|
||||||
|
<ul>
|
||||||
|
<li>The <code>X-NISE-API</code> header with a value of <code>20240218</code> in every request.</li>
|
||||||
|
<li>The <code>Accept</code> header with a value of <code>application/json</code> (if you want JSON instead of XML)</li>
|
||||||
|
</ul>
|
||||||
|
<h1 class="mt-4">## scores search</h1>
|
||||||
|
<p>score search is based on predicates. a predicate is a list of specifications/conditions to match results. predicates can be combined with operators such as <code>AND</code> and <code>OR</code></p>
|
||||||
|
|
||||||
|
<h1 class="mt-4">## get single score</h1>
|
||||||
|
<p>if you have a <code>replay_id</code>, you can retrieve all the information 'bout that score.</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>ENDPOINT:</strong> <code>/api/score/{replay_id}</code></li>
|
||||||
|
<li><strong>METHOD:</strong> GET</li>
|
||||||
|
</ul>
|
||||||
|
Example:
|
||||||
|
<code style="font-size: 12px">curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439</code>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
22
nise-frontend/src/app/api/api.component.ts
Normal file
22
nise-frontend/src/app/api/api.component.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {CalculatePageRangePipe} from "../../corelib/calculate-page-range.pipe";
|
||||||
|
import {CuteLoadingComponent} from "../../corelib/components/cute-loading/cute-loading.component";
|
||||||
|
import {DatePipe, DecimalPipe, NgForOf, NgIf} from "@angular/common";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-api',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
CalculatePageRangePipe,
|
||||||
|
CuteLoadingComponent,
|
||||||
|
DatePipe,
|
||||||
|
DecimalPipe,
|
||||||
|
NgForOf,
|
||||||
|
NgIf
|
||||||
|
],
|
||||||
|
templateUrl: './api.component.html',
|
||||||
|
styleUrl: './api.component.css'
|
||||||
|
})
|
||||||
|
export class ApiComponent {
|
||||||
|
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ import {SearchComponent} from "./search/search.component";
|
|||||||
import {ContributeComponent} from "./contribute/contribute.component";
|
import {ContributeComponent} from "./contribute/contribute.component";
|
||||||
import {BanlistComponent} from "./banlist/banlist.component";
|
import {BanlistComponent} from "./banlist/banlist.component";
|
||||||
import {ProfileComponent} from "./profile/profile.component";
|
import {ProfileComponent} from "./profile/profile.component";
|
||||||
|
import {ApiComponent} from "./api/api.component";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{path: 'sus/:f', component: ViewSuspiciousScoresComponent, title: '/sus/'},
|
{path: 'sus/:f', component: ViewSuspiciousScoresComponent, title: '/sus/'},
|
||||||
@ -29,6 +30,8 @@ const routes: Routes = [
|
|||||||
{path: 'banlist', component: BanlistComponent, title: '/ban/'},
|
{path: 'banlist', component: BanlistComponent, title: '/ban/'},
|
||||||
{path: 'contribute', component: ContributeComponent, title: '/contribute/ <3'},
|
{path: 'contribute', component: ContributeComponent, title: '/contribute/ <3'},
|
||||||
|
|
||||||
|
{path: 'api', component: ApiComponent, title: '/api/ explanation'},
|
||||||
|
|
||||||
{path: '**', component: HomeComponent, title: '/nise.moe/'},
|
{path: '**', component: HomeComponent, title: '/nise.moe/'},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user