mirror of
https://github.com/versia-pub/api.git
synced 2025-12-06 08:28:19 +01:00
fix(client): 🐛 Fix incorrectly cased function parameters breaking API calls
This commit is contained in:
parent
503f4396ef
commit
9c4bc08e2f
|
|
@ -54,6 +54,13 @@
|
||||||
"scope": "any"
|
"scope": "any"
|
||||||
},
|
},
|
||||||
"formats": ["camelCase", "PascalCase"]
|
"formats": ["camelCase", "PascalCase"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": {
|
||||||
|
"kind": "functionParameter",
|
||||||
|
"scope": "any"
|
||||||
|
},
|
||||||
|
"formats": ["snake_case", "camelCase"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,12 @@ export class LysandClient extends BaseClient {
|
||||||
*/
|
*/
|
||||||
public addAccountToList(
|
public addAccountToList(
|
||||||
id: string,
|
id: string,
|
||||||
accountIds: string[],
|
account_ids: string[],
|
||||||
extra?: RequestInit,
|
extra?: RequestInit,
|
||||||
): Promise<Output<void>> {
|
): Promise<Output<void>> {
|
||||||
return this.post<void>(
|
return this.post<void>(
|
||||||
`/api/v1/lists/${id}/accounts`,
|
`/api/v1/lists/${id}/accounts`,
|
||||||
{ accountIds },
|
{ account_ids },
|
||||||
extra,
|
extra,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -108,8 +108,11 @@ export class LysandClient extends BaseClient {
|
||||||
* Lysand API only.
|
* Lysand API only.
|
||||||
* @param roleId ID of the role to add to the requesting account.
|
* @param roleId ID of the role to add to the requesting account.
|
||||||
*/
|
*/
|
||||||
public addRole(roleId: string, extra?: RequestInit): Promise<Output<void>> {
|
public addRole(
|
||||||
return this.post<void>(`/api/v1/roles/${roleId}`, undefined, extra);
|
role_id: string,
|
||||||
|
extra?: RequestInit,
|
||||||
|
): Promise<Output<void>> {
|
||||||
|
return this.post<void>(`/api/v1/roles/${role_id}`, undefined, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -178,7 +181,7 @@ export class LysandClient extends BaseClient {
|
||||||
* @param options.website URL to the application's website.
|
* @param options.website URL to the application's website.
|
||||||
*/
|
*/
|
||||||
public createApp(
|
public createApp(
|
||||||
clientName: string,
|
client_name: string,
|
||||||
options?: Partial<{
|
options?: Partial<{
|
||||||
redirect_uris: string;
|
redirect_uris: string;
|
||||||
scopes: string[];
|
scopes: string[];
|
||||||
|
|
@ -186,7 +189,7 @@ export class LysandClient extends BaseClient {
|
||||||
}>,
|
}>,
|
||||||
): Promise<Output<ApplicationData>> {
|
): Promise<Output<ApplicationData>> {
|
||||||
return this.postForm<ApplicationData>("/api/v1/apps", {
|
return this.postForm<ApplicationData>("/api/v1/apps", {
|
||||||
clientName,
|
client_name,
|
||||||
...options,
|
...options,
|
||||||
scopes: options?.scopes?.join(" ") || DEFAULT_SCOPE.join(" "),
|
scopes: options?.scopes?.join(" ") || DEFAULT_SCOPE.join(" "),
|
||||||
redirect_uris: options?.redirect_uris || NO_REDIRECT,
|
redirect_uris: options?.redirect_uris || NO_REDIRECT,
|
||||||
|
|
@ -246,12 +249,12 @@ export class LysandClient extends BaseClient {
|
||||||
*/
|
*/
|
||||||
public deleteAccountsFromList(
|
public deleteAccountsFromList(
|
||||||
id: string,
|
id: string,
|
||||||
accountIds: string[],
|
account_ids: string[],
|
||||||
extra?: RequestInit,
|
extra?: RequestInit,
|
||||||
): Promise<Output<void>> {
|
): Promise<Output<void>> {
|
||||||
return this.delete<void>(
|
return this.delete<void>(
|
||||||
`/api/v1/lists/${id}/accounts`,
|
`/api/v1/lists/${id}/accounts`,
|
||||||
{ accountIds },
|
{ account_ids },
|
||||||
extra,
|
extra,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -444,19 +447,19 @@ export class LysandClient extends BaseClient {
|
||||||
* @param redirect_uri Must be the same URI as the time when you register your OAuth2 application
|
* @param redirect_uri Must be the same URI as the time when you register your OAuth2 application
|
||||||
*/
|
*/
|
||||||
public fetchAccessToken(
|
public fetchAccessToken(
|
||||||
clientId: string,
|
client_id: string,
|
||||||
clientSecret: string,
|
client_secret: string,
|
||||||
code?: string,
|
code?: string,
|
||||||
redirectUri: string = NO_REDIRECT,
|
redirect_uri: string = NO_REDIRECT,
|
||||||
extra?: RequestInit,
|
extra?: RequestInit,
|
||||||
): Promise<Output<Token>> {
|
): Promise<Output<Token>> {
|
||||||
return this.postForm<Token>(
|
return this.postForm<Token>(
|
||||||
"/oauth/token",
|
"/oauth/token",
|
||||||
{
|
{
|
||||||
clientId,
|
client_id,
|
||||||
clientSecret,
|
client_secret,
|
||||||
code,
|
code,
|
||||||
redirectUri,
|
redirect_uri,
|
||||||
grant_type: "authorization_code",
|
grant_type: "authorization_code",
|
||||||
},
|
},
|
||||||
extra,
|
extra,
|
||||||
|
|
@ -508,8 +511,8 @@ export class LysandClient extends BaseClient {
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
public generateAuthUrl(
|
public generateAuthUrl(
|
||||||
clientId: string,
|
client_id: string,
|
||||||
clientSecret: string,
|
client_secret: string,
|
||||||
options: Partial<{
|
options: Partial<{
|
||||||
redirect_uri: string;
|
redirect_uri: string;
|
||||||
scopes: string[];
|
scopes: string[];
|
||||||
|
|
@ -517,8 +520,8 @@ export class LysandClient extends BaseClient {
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const oauthClient = new OAuth2Client({
|
const oauthClient = new OAuth2Client({
|
||||||
server: this.baseUrl.toString(),
|
server: this.baseUrl.toString(),
|
||||||
clientId: clientId,
|
clientId: client_id,
|
||||||
clientSecret: clientSecret,
|
clientSecret: client_secret,
|
||||||
tokenEndpoint: "/oauth/token",
|
tokenEndpoint: "/oauth/token",
|
||||||
authorizationEndpoint: "/oauth/authorize",
|
authorizationEndpoint: "/oauth/authorize",
|
||||||
});
|
});
|
||||||
|
|
@ -2034,18 +2037,18 @@ export class LysandClient extends BaseClient {
|
||||||
* @param token will be get #fetchAccessToken
|
* @param token will be get #fetchAccessToken
|
||||||
*/
|
*/
|
||||||
public refreshToken(
|
public refreshToken(
|
||||||
clientId: string,
|
client_id: string,
|
||||||
clientSecret: string,
|
client_secret: string,
|
||||||
refreshToken: string,
|
refresh_token: string,
|
||||||
extra?: RequestInit,
|
extra?: RequestInit,
|
||||||
): Promise<Output<Token>> {
|
): Promise<Output<Token>> {
|
||||||
return this.post<Token>(
|
return this.post<Token>(
|
||||||
"/oauth/token",
|
"/oauth/token",
|
||||||
{
|
{
|
||||||
clientId,
|
client_id,
|
||||||
clientSecret,
|
client_secret,
|
||||||
grant_type: "refresh_token",
|
grant_type: "refresh_token",
|
||||||
refreshToken,
|
refresh_token,
|
||||||
},
|
},
|
||||||
extra,
|
extra,
|
||||||
);
|
);
|
||||||
|
|
@ -2086,7 +2089,7 @@ export class LysandClient extends BaseClient {
|
||||||
* @param options Form Data
|
* @param options Form Data
|
||||||
*/
|
*/
|
||||||
public registerApp(
|
public registerApp(
|
||||||
clientName: string,
|
client_name: string,
|
||||||
options: {
|
options: {
|
||||||
redirect_uris: string;
|
redirect_uris: string;
|
||||||
scopes?: string;
|
scopes?: string;
|
||||||
|
|
@ -2096,7 +2099,7 @@ export class LysandClient extends BaseClient {
|
||||||
): Promise<Output<ApplicationData>> {
|
): Promise<Output<ApplicationData>> {
|
||||||
return this.post<ApplicationData>(
|
return this.post<ApplicationData>(
|
||||||
"/api/v1/apps",
|
"/api/v1/apps",
|
||||||
{ clientName, ...options },
|
{ client_name, ...options },
|
||||||
extra,
|
extra,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -2144,10 +2147,10 @@ export class LysandClient extends BaseClient {
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
public removeRole(
|
public removeRole(
|
||||||
roleId: string,
|
role_id: string,
|
||||||
extra?: RequestInit,
|
extra?: RequestInit,
|
||||||
): Promise<Output<void>> {
|
): Promise<Output<void>> {
|
||||||
return this.delete<void>(`/api/v1/roles/${roleId}`, undefined, extra);
|
return this.delete<void>(`/api/v1/roles/${role_id}`, undefined, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2162,7 +2165,7 @@ export class LysandClient extends BaseClient {
|
||||||
* @return Report.
|
* @return Report.
|
||||||
*/
|
*/
|
||||||
public report(
|
public report(
|
||||||
accountId: string,
|
account_id: string,
|
||||||
options: {
|
options: {
|
||||||
status_ids?: string[];
|
status_ids?: string[];
|
||||||
rule_ids?: string[];
|
rule_ids?: string[];
|
||||||
|
|
@ -2174,7 +2177,7 @@ export class LysandClient extends BaseClient {
|
||||||
): Promise<Output<Report>> {
|
): Promise<Output<Report>> {
|
||||||
return this.post<Report>(
|
return this.post<Report>(
|
||||||
"/api/v1/reports",
|
"/api/v1/reports",
|
||||||
{ accountId, ...options },
|
{ account_id, ...options },
|
||||||
extra,
|
extra,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -2188,14 +2191,14 @@ export class LysandClient extends BaseClient {
|
||||||
* @param token will be get #fetchAccessToken
|
* @param token will be get #fetchAccessToken
|
||||||
*/
|
*/
|
||||||
public revokeToken(
|
public revokeToken(
|
||||||
clientId: string,
|
client_id: string,
|
||||||
clientSecret: string,
|
client_secret: string,
|
||||||
token: string,
|
token: string,
|
||||||
extra?: RequestInit,
|
extra?: RequestInit,
|
||||||
): Promise<Output<void>> {
|
): Promise<Output<void>> {
|
||||||
return this.post<void>(
|
return this.post<void>(
|
||||||
"/oauth/revoke",
|
"/oauth/revoke",
|
||||||
{ clientId, clientSecret, token },
|
{ client_id, client_secret, token },
|
||||||
extra,
|
extra,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -2230,12 +2233,12 @@ export class LysandClient extends BaseClient {
|
||||||
*/
|
*/
|
||||||
public scheduleStatus(
|
public scheduleStatus(
|
||||||
id: string,
|
id: string,
|
||||||
scheduledAt?: Date,
|
scheduled_at?: Date,
|
||||||
extra?: RequestInit,
|
extra?: RequestInit,
|
||||||
): Promise<Output<ScheduledStatus>> {
|
): Promise<Output<ScheduledStatus>> {
|
||||||
return this.put<ScheduledStatus>(
|
return this.put<ScheduledStatus>(
|
||||||
`/api/v1/scheduled_statuses/${id}`,
|
`/api/v1/scheduled_statuses/${id}`,
|
||||||
{ scheduled_at: scheduledAt?.toISOString() },
|
{ scheduled_at: scheduled_at?.toISOString() },
|
||||||
extra,
|
extra,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue