@sapphire/plugin-api Methods Error

🆘 Hi, here's the problem I'm having. 📌 Can you help me solve this problem ? #️⃣ My code :
import { ApplyOptions } from '@sapphire/decorators';
import { Route, methods, type ApiRequest, type ApiResponse } from '@sapphire/plugin-api';

@ApplyOptions<Route.Options>({ route: 'hello-world' })
export class UserRoute extends Route {
public override [methods.GET](_request: ApiRequest, response: ApiResponse) {
response.json({ message: 'Hello World' });
}

public override [methods.POST](_request: ApiRequest, response: ApiResponse) {
response.json({ message: 'Hello World' });
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { Route, methods, type ApiRequest, type ApiResponse } from '@sapphire/plugin-api';

@ApplyOptions<Route.Options>({ route: 'hello-world' })
export class UserRoute extends Route {
public override [methods.GET](_request: ApiRequest, response: ApiResponse) {
response.json({ message: 'Hello World' });
}

public override [methods.POST](_request: ApiRequest, response: ApiResponse) {
response.json({ message: 'Hello World' });
}
}
🛑 Error :
[{
“resource": ‘/E:/Test/dev_bot/src/routes/hello-world.ts’,
“owner": ‘typescript’,
“code": ‘2305’,
“severity": 8,
“message“: ‘The module ’\”@sapphire/plugin-api\“‘ has no exported member ’methods'.”,
“source": ‘ts’,
“startLineNumber": 2,
“startColumn": 17,
“endLineNumber": 2,
“endColumn": 24
},{
“resource": ‘/E:/Test/dev_bot/src/routes/hello-world.ts’,
“owner": ‘typescript’,
“code": ‘2515’,
“severity": 8,
“message“: ‘The non-abstract class ’UserRoute” does not implement the abstract member “run” inherited from the class “Route<RouteOptions>”.”,
“source": ‘ts’,
“startLineNumber": 5,
“startColumn": 14,
“endLineNumber": 5,
“endColumn": 23
}]
[{
“resource": ‘/E:/Test/dev_bot/src/routes/hello-world.ts’,
“owner": ‘typescript’,
“code": ‘2305’,
“severity": 8,
“message“: ‘The module ’\”@sapphire/plugin-api\“‘ has no exported member ’methods'.”,
“source": ‘ts’,
“startLineNumber": 2,
“startColumn": 17,
“endLineNumber": 2,
“endColumn": 24
},{
“resource": ‘/E:/Test/dev_bot/src/routes/hello-world.ts’,
“owner": ‘typescript’,
“code": ‘2515’,
“severity": 8,
“message“: ‘The non-abstract class ’UserRoute” does not implement the abstract member “run” inherited from the class “Route<RouteOptions>”.”,
“source": ‘ts’,
“startLineNumber": 5,
“startColumn": 14,
“endLineNumber": 5,
“endColumn": 23
}]
5 Replies
kyra
kyra2w ago
This was completely changed with @sapphire/plugin-api@v7
GitHub
Release @sapphire/[email protected] · sapphiredev/plugins
@sapphire/[email protected] - (2024-11-02) 🏠 Refactor Remove media parsers (56b0ad1) (#616 by @kyranet) 💥 BREAKING CHANGE: Removed MediaParser 💥 BREAKING CHANGE: Removed MediaParserStore 💥 BREAKIN...
Sheiylanie
SheiylanieOP2w ago
thank
kyra
kyra2w ago
The guides in the website still need to be updated to reflect the changes, I'll update them tomorrow when I get some time It's a very new release after all 😅
Sheiylanie
SheiylanieOP2w ago
thanks a lot I'll have a look 🙂
Want results from more Discord servers?
Add your server