Test orders
This commit is contained in:
37
test_api.ts
Normal file
37
test_api.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { NosHttpClient } from "./packages/sim-consumidor-nos/infrastructure/NosHttpClient.js";
|
||||
import { NosRepository } from "./packages/sim-consumidor-nos/infrastructure/NosRepository.js";
|
||||
import { env } from "./packages/sim-consumidor-nos/config/env/env.js";
|
||||
|
||||
async function main() {
|
||||
console.log("NOS_BASE_URL", env.NOS_BASE_URL);
|
||||
const client = new NosHttpClient(env.NOS_BASE_URL);
|
||||
|
||||
// Try to get a subscriber
|
||||
const res = await client.get("/subscribers", { params: { limit: 1 } });
|
||||
console.log("SUBSCRIBER:", res.data.content[0].physicalId);
|
||||
|
||||
const iccid = res.data.content[0].physicalId;
|
||||
|
||||
try {
|
||||
const history = await client.get(`/subscribers/${iccid}/history`);
|
||||
console.log("HISTORY:", history.data);
|
||||
} catch(e) {
|
||||
console.error("HISTORY ERROR");
|
||||
}
|
||||
|
||||
try {
|
||||
const audit = await client.get(`/subscribers/${iccid}/audit`);
|
||||
console.log("AUDIT:", audit.data);
|
||||
} catch(e) {
|
||||
console.error("AUDIT ERROR");
|
||||
}
|
||||
|
||||
try {
|
||||
const actions = await client.get(`/subscribers/${iccid}/actions`);
|
||||
console.log("ACTIONS:", actions.data);
|
||||
} catch(e) {
|
||||
console.error("ACTIONS ERROR");
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
Reference in New Issue
Block a user