feat: add ESLint configuration, update package.json scripts, and create example files for Bun integration
This commit is contained in:
37
examples/src/index.ts
Normal file
37
examples/src/index.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user