Skip to content

Commit

Permalink
expose limit
Browse files Browse the repository at this point in the history
  • Loading branch information
SamratSahoo committed Oct 1, 2024
1 parent 37d8bd4 commit c0e6146
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions package/src/lib/analytics-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ export default class AnalyticsViewer {
}


public async getAllClickEvents(projectName: string, afterTime?: Date) {
public async getAllClickEvents(projectName: string, afterTime?: Date, limit?: number) {
const queryParams: GetEventsQueryParams = {
projectName,
afterTime: afterTime?.toString(),
afterId: undefined,
limit,
environment: this.environment
}

Expand Down Expand Up @@ -139,11 +140,12 @@ export default class AnalyticsViewer {
}


public async getAllVisitEvents(projectName: string, afterTime?: Date) {
public async getAllVisitEvents(projectName: string, afterTime?: Date, limit?: number) {
const queryParams: GetEventsQueryParams = {
projectName,
afterTime: afterTime?.toString(),
afterId: undefined,
limit,
environment: this.environment
}

Expand Down Expand Up @@ -200,11 +202,12 @@ export default class AnalyticsViewer {
}


public async getAllInputEvents(projectName: string, afterTime?: Date) {
public async getAllInputEvents(projectName: string, afterTime?: Date, limit?: number) {
const queryParams: GetEventsQueryParams = {
projectName,
afterTime: afterTime?.toString(),
afterId: undefined,
limit,
environment: this.environment
}

Expand Down Expand Up @@ -261,14 +264,16 @@ export default class AnalyticsViewer {
}

}

public async getAllCustomEvents(projectName: string, category: string, subcategory: string, afterTime?: Date) {
// We expose limit here because some projects would like to retrieve the number of events in fewer api calls
// reduces latency for this method to complete
public async getAllCustomEvents(projectName: string, category: string, subcategory: string, afterTime?: Date, limit?: number) {
const queryParams: GetCustomEventsQueryParams = {
projectName,
afterTime: afterTime?.toString(),
afterId: undefined,
environment: this.environment,
subcategory,
limit,
category
}

Expand Down

0 comments on commit c0e6146

Please sign in to comment.