pushEvents method

Future<EventsResponse> pushEvents({
  1. required InsightsEvents insightsEvents,
  2. RequestOptions? requestOptions,
})

Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.

Parameters:

  • insightsEvents
  • requestOptions additional request configuration.

Implementation

Future<EventsResponse> pushEvents({
  required InsightsEvents insightsEvents,
  RequestOptions? requestOptions,
}) async {
  final request = ApiRequest(
    method: RequestMethod.post,
    path: r'/1/events',
    body: insightsEvents.toJson(),
  );
  final response = await _retryStrategy.execute(
    request: request,
    options: requestOptions,
  );
  return deserialize<EventsResponse, EventsResponse>(
    response,
    'EventsResponse',
    growable: true,
  );
}