Libeufin, testing scheduling API
This commit is contained in:
parent
a931d48a84
commit
dcef82d677
@ -828,6 +828,16 @@ export interface CreateNexusUserRequest {
|
|||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PostNexusTaskRequest {
|
||||||
|
name: string;
|
||||||
|
cronspec: string;
|
||||||
|
type: string; // fetch | submit
|
||||||
|
params: {
|
||||||
|
level: string; // report | statement | all
|
||||||
|
rangeType: string; // all | since-last | previous-days | latest
|
||||||
|
} | {}
|
||||||
|
}
|
||||||
|
|
||||||
export interface PostNexusPermissionRequest {
|
export interface PostNexusPermissionRequest {
|
||||||
action: "revoke" | "grant";
|
action: "revoke" | "grant";
|
||||||
permission: {
|
permission: {
|
||||||
@ -1138,6 +1148,56 @@ export namespace LibeufinNexusApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getTasks(
|
||||||
|
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||||
|
bankAccountName: string,
|
||||||
|
// When void, the request returns the list of all the
|
||||||
|
// tasks under this bank account.
|
||||||
|
taskName: string | void,
|
||||||
|
): Promise<any> {
|
||||||
|
const baseUrl = libeufinNexusService.baseUrl;
|
||||||
|
let url = new URL(`/bank-accounts/${bankAccountName}/schedule`, baseUrl);
|
||||||
|
if (taskName) url = new URL(taskName, `${url}/`);
|
||||||
|
|
||||||
|
// It's caller's responsibility to interpret the response.
|
||||||
|
return await axios.get(url.href, {
|
||||||
|
auth: {
|
||||||
|
username: "admin",
|
||||||
|
password: "test",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteTask(
|
||||||
|
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||||
|
bankAccountName: string,
|
||||||
|
taskName: string,
|
||||||
|
) {
|
||||||
|
const baseUrl = libeufinNexusService.baseUrl;
|
||||||
|
let url = new URL(`/bank-accounts/${bankAccountName}/schedule/${taskName}`, baseUrl);
|
||||||
|
await axios.delete(url.href, {
|
||||||
|
auth: {
|
||||||
|
username: "admin",
|
||||||
|
password: "test",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function postTask(
|
||||||
|
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||||
|
bankAccountName: string,
|
||||||
|
req: PostNexusTaskRequest,
|
||||||
|
): Promise<any> {
|
||||||
|
const baseUrl = libeufinNexusService.baseUrl;
|
||||||
|
let url = new URL(`/bank-accounts/${bankAccountName}/schedule`, baseUrl);
|
||||||
|
return await axios.post(url.href, req, {
|
||||||
|
auth: {
|
||||||
|
username: "admin",
|
||||||
|
password: "test",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export async function createTwgFacade(
|
export async function createTwgFacade(
|
||||||
libeufinNexusService: LibeufinNexusServiceInterface,
|
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||||
req: CreateTalerWireGatewayFacadeRequest,
|
req: CreateTalerWireGatewayFacadeRequest,
|
||||||
|
@ -59,6 +59,7 @@ import { runLibeufinRefundTest } from "./test-libeufin-refund";
|
|||||||
import { runLibeufinRefundMultipleUsersTest } from "./test-libeufin-refund-multiple-users";
|
import { runLibeufinRefundMultipleUsersTest } from "./test-libeufin-refund-multiple-users";
|
||||||
import { runLibeufinTutorialTest } from "./test-libeufin-tutorial";
|
import { runLibeufinTutorialTest } from "./test-libeufin-tutorial";
|
||||||
import { runLibeufinApiPermissionsTest } from "./test-libeufin-api-permissions";
|
import { runLibeufinApiPermissionsTest } from "./test-libeufin-api-permissions";
|
||||||
|
import { runLibeufinApiSchedulingTest } from "./test-libeufin-api-scheduling";
|
||||||
import { runLibeufinApiBankconnectionTest } from "./test-libeufin-api-bankconnection";
|
import { runLibeufinApiBankconnectionTest } from "./test-libeufin-api-bankconnection";
|
||||||
import { runLibeufinApiUsersTest } from "./test-libeufin-api-users";
|
import { runLibeufinApiUsersTest } from "./test-libeufin-api-users";
|
||||||
import { runLibeufinApiBankaccountTest } from "./test-libeufin-api-bankaccount";
|
import { runLibeufinApiBankaccountTest } from "./test-libeufin-api-bankaccount";
|
||||||
@ -94,6 +95,7 @@ const allTests: TestMainFunction[] = [
|
|||||||
runLibeufinRefundTest,
|
runLibeufinRefundTest,
|
||||||
runLibeufinRefundMultipleUsersTest,
|
runLibeufinRefundMultipleUsersTest,
|
||||||
runLibeufinApiPermissionsTest,
|
runLibeufinApiPermissionsTest,
|
||||||
|
runLibeufinApiSchedulingTest,
|
||||||
runLibeufinApiUsersTest,
|
runLibeufinApiUsersTest,
|
||||||
runLibeufinApiBankaccountTest,
|
runLibeufinApiBankaccountTest,
|
||||||
runLibeufinApiBankconnectionTest,
|
runLibeufinApiBankconnectionTest,
|
||||||
|
Loading…
Reference in New Issue
Block a user