/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import { webAnalyticsAggregateEvents } from "../funcs/webAnalyticsAggregateEvents.js";
import { webAnalyticsAggregatePageviews } from "../funcs/webAnalyticsAggregatePageviews.js";
import { webAnalyticsCountEvents } from "../funcs/webAnalyticsCountEvents.js";
import { webAnalyticsCountPageviews } from "../funcs/webAnalyticsCountPageviews.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import {
  AggregateEventsRequest,
  AggregateEventsResponseBody,
} from "../models/aggregateeventsop.js";
import {
  AggregatePageviewsRequest,
  AggregatePageviewsResponseBody,
} from "../models/aggregatepageviewsop.js";
import {
  CountEventsRequest,
  CountEventsResponseBody,
} from "../models/counteventsop.js";
import {
  CountPageviewsRequest,
  CountPageviewsResponseBody,
} from "../models/countpageviewsop.js";
import { unwrapAsync } from "../types/fp.js";

export class WebAnalytics extends ClientSDK {
  /**
   * Aggregates page views
   *
   * @remarks
   * Counts pageviews on a project, within the requested date range. Results are either aggregated or broken down over time. Results can additionally be broken down by one dimension, and filtered by multiple dimensions.
   */
  async aggregatePageviews(
    request: AggregatePageviewsRequest,
    options?: RequestOptions,
  ): Promise<AggregatePageviewsResponseBody> {
    return unwrapAsync(webAnalyticsAggregatePageviews(
      this,
      request,
      options,
    ));
  }

  /**
   * Aggregates custom events
   *
   * @remarks
   * Counts custom events on a project, within the requested date range. Results are either aggregated or broken down over time. Results can additionally be broken down by one dimension, and filtered by multiple dimensions.
   */
  async aggregateEvents(
    request: AggregateEventsRequest,
    options?: RequestOptions,
  ): Promise<AggregateEventsResponseBody> {
    return unwrapAsync(webAnalyticsAggregateEvents(
      this,
      request,
      options,
    ));
  }

  /**
   * Counts page views
   *
   * @remarks
   * Counts the number of page views on a project (production only), since Web Analytics was enabled. Results can be filtered on supported dimensions.
   */
  async countPageviews(
    request: CountPageviewsRequest,
    options?: RequestOptions,
  ): Promise<CountPageviewsResponseBody> {
    return unwrapAsync(webAnalyticsCountPageviews(
      this,
      request,
      options,
    ));
  }

  /**
   * Counts custom events
   *
   * @remarks
   * Counts the number of custom events on a project (production only), since Web Analytics was enabled. Results can be filtered on supported dimensions.
   */
  async countEvents(
    request: CountEventsRequest,
    options?: RequestOptions,
  ): Promise<CountEventsResponseBody> {
    return unwrapAsync(webAnalyticsCountEvents(
      this,
      request,
      options,
    ));
  }
}
