37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { NosHttpClient } from "./packages/sim-consumidor-nos/infrastructure/NosHttpClient.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);
|