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