37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import PCastApi from "../../src/index";
|
|
|
|
const pacstUri = "https://pcast-stg.phenixrts.com"
|
|
const application = {
|
|
id: "phenixrts.com-alex.zinn",
|
|
secret: "AMAsDzr.dIuGMZ.Zu52Dt~MQvP!DZwYg"
|
|
}
|
|
const pcastApi = new PCastApi(pacstUri, application);
|
|
|
|
const channelsList = await pcastApi.channels.list();
|
|
|
|
// const start = hrtime.bigint();
|
|
// const publishingReportCsv = await pcastApi.reporting.generateReport(ReportKind.Publishing, {
|
|
// start: moment().subtract(1, 'day').toISOString(),
|
|
// end: moment().toISOString(),
|
|
// applicationIds: [application.id]
|
|
// });
|
|
// const endPublishing = hrtime.bigint();
|
|
// console.log(publishingReportCsv);
|
|
// console.log(`Time taken: ${Number(endPublishing - start) / 1_000_000_000} seconds`);
|
|
|
|
|
|
// const viewingReportCsv = await pcastApi.reporting.generateReport(ReportKind.Viewing, {
|
|
// kind: ViewingReportKind.HLS,
|
|
// start: moment().subtract(1, 'day').toISOString(),
|
|
// end: moment().toISOString(),
|
|
// applicationIds: [application.id]
|
|
// });
|
|
// const endViewing = hrtime.bigint();
|
|
// console.log(`Time taken: ${Number(endViewing - endPublishing) / 1_000_000_000} seconds`);
|
|
// // const viewingReport = await CsvParser.parse(viewingReportCsv);
|
|
|
|
// console.log(viewingReportCsv);
|
|
|
|
const channelMembers = await pcastApi.channels.getMembers(channelsList[1].channelId);
|
|
console.log('[%o]', channelMembers);
|
|
console.log('[%o]', channelMembers.streams); |