Class MetricsApi

java.lang.Object
ai.shipeasy.admin.api.MetricsApi

public class MetricsApi extends Object
  • Constructor Details

    • MetricsApi

      public MetricsApi()
    • MetricsApi

      public MetricsApi(ApiClient apiClient)
  • Method Details

    • getApiClient

      public ApiClient getApiClient()
    • setApiClient

      public void setApiClient(ApiClient apiClient)
    • getHostIndex

      public int getHostIndex()
    • setHostIndex

      public void setHostIndex(int hostIndex)
    • getCustomBaseUrl

      public String getCustomBaseUrl()
    • setCustomBaseUrl

      public void setCustomBaseUrl(String customBaseUrl)
    • createMetricCall

      public okhttp3.Call createMetricCall(@Nonnull CreateMetricRequest createMetricRequest, @Nullable String xProjectId, ApiCallback _callback) throws ApiException
      Build call for createMetric
      Parameters:
      createMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - Callback for upload/download progress
      Returns:
      Call to execute
      Throws:
      ApiException - If fail to serialize the request body object
    • createMetric

      public CreateMetricResponse createMetric(@Nonnull CreateMetricRequest createMetricRequest, @Nullable String xProjectId) throws ApiException
      Create a metric Creates an event-backed metric. Pass the query as the DSL string (`query`) **or** the typed IR (`query_ir`) — exactly one. `event_name` must equal the event the query references. Returns `409` if a metric with the same `name` already exists, and `422` if the query is invalid or references an unregistered event / label. **Use cases** - **Track an event** — `count_users(<event>)` for unique-user counts. - **Sum a value** — `sum(<event>, <label>)` for revenue / quantity metrics. - **Experiment success metric** — create the metric, then attach its id to an experiment.
      Parameters:
      createMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      CreateMetricResponse
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • createMetricWithHttpInfo

      public ApiResponse<CreateMetricResponse> createMetricWithHttpInfo(@Nonnull CreateMetricRequest createMetricRequest, @Nullable String xProjectId) throws ApiException
      Create a metric Creates an event-backed metric. Pass the query as the DSL string (`query`) **or** the typed IR (`query_ir`) — exactly one. `event_name` must equal the event the query references. Returns `409` if a metric with the same `name` already exists, and `422` if the query is invalid or references an unregistered event / label. **Use cases** - **Track an event** — `count_users(<event>)` for unique-user counts. - **Sum a value** — `sum(<event>, <label>)` for revenue / quantity metrics. - **Experiment success metric** — create the metric, then attach its id to an experiment.
      Parameters:
      createMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      ApiResponse<CreateMetricResponse>
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • createMetricAsync

      public okhttp3.Call createMetricAsync(@Nonnull CreateMetricRequest createMetricRequest, @Nullable String xProjectId, ApiCallback<CreateMetricResponse> _callback) throws ApiException
      Create a metric (asynchronously) Creates an event-backed metric. Pass the query as the DSL string (`query`) **or** the typed IR (`query_ir`) — exactly one. `event_name` must equal the event the query references. Returns `409` if a metric with the same `name` already exists, and `422` if the query is invalid or references an unregistered event / label. **Use cases** - **Track an event** — `count_users(<event>)` for unique-user counts. - **Sum a value** — `sum(<event>, <label>)` for revenue / quantity metrics. - **Experiment success metric** — create the metric, then attach its id to an experiment.
      Parameters:
      createMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - The callback to be executed when the API call finishes
      Returns:
      The request call
      Throws:
      ApiException - If fail to process the API call, e.g. serializing the request body object
    • deleteMetricCall

      public okhttp3.Call deleteMetricCall(@Nonnull String id, @Nullable String xProjectId, ApiCallback _callback) throws ApiException
      Build call for deleteMetric
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - Callback for upload/download progress
      Returns:
      Call to execute
      Throws:
      ApiException - If fail to serialize the request body object
    • deleteMetric

      public DeleteMetricResponse deleteMetric(@Nonnull String id, @Nullable String xProjectId) throws ApiException
      Archive a metric Soft-deletes (archives) the metric. Returns `409` if it is attached to a running experiment — stop those experiments first. **Use case:** Retire a metric once no running experiment depends on it (the user-facing verb is `archive`).
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      DeleteMetricResponse
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • deleteMetricWithHttpInfo

      public ApiResponse<DeleteMetricResponse> deleteMetricWithHttpInfo(@Nonnull String id, @Nullable String xProjectId) throws ApiException
      Archive a metric Soft-deletes (archives) the metric. Returns `409` if it is attached to a running experiment — stop those experiments first. **Use case:** Retire a metric once no running experiment depends on it (the user-facing verb is `archive`).
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      ApiResponse<DeleteMetricResponse>
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • deleteMetricAsync

      public okhttp3.Call deleteMetricAsync(@Nonnull String id, @Nullable String xProjectId, ApiCallback<DeleteMetricResponse> _callback) throws ApiException
      Archive a metric (asynchronously) Soft-deletes (archives) the metric. Returns `409` if it is attached to a running experiment — stop those experiments first. **Use case:** Retire a metric once no running experiment depends on it (the user-facing verb is `archive`).
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - The callback to be executed when the API call finishes
      Returns:
      The request call
      Throws:
      ApiException - If fail to process the API call, e.g. serializing the request body object
    • getMetricCall

      public okhttp3.Call getMetricCall(@Nonnull String id, @Nullable String xProjectId, ApiCallback _callback) throws ApiException
      Build call for getMetric
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - Callback for upload/download progress
      Returns:
      Call to execute
      Throws:
      ApiException - If fail to serialize the request body object
    • getMetric

      public GetMetricResponse getMetric(@Nonnull String id, @Nullable String xProjectId) throws ApiException
      Get a metric Fetch one metric by its id or name, including the rendered DSL query and the typed IR. **Use case:** Inspect a single metric's full definition before reusing it in an experiment or alert rule.
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      GetMetricResponse
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • getMetricWithHttpInfo

      public ApiResponse<GetMetricResponse> getMetricWithHttpInfo(@Nonnull String id, @Nullable String xProjectId) throws ApiException
      Get a metric Fetch one metric by its id or name, including the rendered DSL query and the typed IR. **Use case:** Inspect a single metric's full definition before reusing it in an experiment or alert rule.
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      ApiResponse<GetMetricResponse>
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • getMetricAsync

      public okhttp3.Call getMetricAsync(@Nonnull String id, @Nullable String xProjectId, ApiCallback<GetMetricResponse> _callback) throws ApiException
      Get a metric (asynchronously) Fetch one metric by its id or name, including the rendered DSL query and the typed IR. **Use case:** Inspect a single metric's full definition before reusing it in an experiment or alert rule.
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - The callback to be executed when the API call finishes
      Returns:
      The request call
      Throws:
      ApiException - If fail to process the API call, e.g. serializing the request body object
    • listMetricsCall

      public okhttp3.Call listMetricsCall(@Nullable String xProjectId, @Nullable String q, ApiCallback _callback) throws ApiException
      Build call for listMetrics
      Parameters:
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      q - Case-insensitive substring filter across the resource's human-readable text columns (e.g. `name`, `title`, `description`). OR-matched across those columns; omit to return everything. (optional)
      _callback - Callback for upload/download progress
      Returns:
      Call to execute
      Throws:
      ApiException - If fail to serialize the request body object
    • listMetrics

      public List<ListMetricsResponseInner> listMetrics(@Nullable String xProjectId, @Nullable String q) throws ApiException
      List metrics Returns every metric in the project (not paginated) — name, folder, source event, the typed `queryIr`, and the rendered query. **Use case:** Audit every metric defined in the project — for example to find the metric id to attach as an experiment's success metric.
      Parameters:
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      q - Case-insensitive substring filter across the resource's human-readable text columns (e.g. `name`, `title`, `description`). OR-matched across those columns; omit to return everything. (optional)
      Returns:
      List<ListMetricsResponseInner>
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • listMetricsWithHttpInfo

      public ApiResponse<List<ListMetricsResponseInner>> listMetricsWithHttpInfo(@Nullable String xProjectId, @Nullable String q) throws ApiException
      List metrics Returns every metric in the project (not paginated) — name, folder, source event, the typed `queryIr`, and the rendered query. **Use case:** Audit every metric defined in the project — for example to find the metric id to attach as an experiment's success metric.
      Parameters:
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      q - Case-insensitive substring filter across the resource's human-readable text columns (e.g. `name`, `title`, `description`). OR-matched across those columns; omit to return everything. (optional)
      Returns:
      ApiResponse<List<ListMetricsResponseInner>>
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • listMetricsAsync

      public okhttp3.Call listMetricsAsync(@Nullable String xProjectId, @Nullable String q, ApiCallback<List<ListMetricsResponseInner>> _callback) throws ApiException
      List metrics (asynchronously) Returns every metric in the project (not paginated) — name, folder, source event, the typed `queryIr`, and the rendered query. **Use case:** Audit every metric defined in the project — for example to find the metric id to attach as an experiment's success metric.
      Parameters:
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      q - Case-insensitive substring filter across the resource's human-readable text columns (e.g. `name`, `title`, `description`). OR-matched across those columns; omit to return everything. (optional)
      _callback - The callback to be executed when the API call finishes
      Returns:
      The request call
      Throws:
      ApiException - If fail to process the API call, e.g. serializing the request body object
    • updateMetricCall

      public okhttp3.Call updateMetricCall(@Nonnull String id, @Nonnull UpdateMetricRequest updateMetricRequest, @Nullable String xProjectId, ApiCallback _callback) throws ApiException
      Build call for updateMetric
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      updateMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - Callback for upload/download progress
      Returns:
      Call to execute
      Throws:
      ApiException - If fail to serialize the request body object
    • updateMetric

      public GetMetricResponse updateMetric(@Nonnull String id, @Nonnull UpdateMetricRequest updateMetricRequest, @Nullable String xProjectId) throws ApiException
      Update a metric Update a metric's definition — folder, source event, query (`query` DSL or typed `query_ir`), winsorisation, minimum detectable effect, or direction. `name` is immutable. Provide at most one of `query` / `query_ir`. **Use case:** Refine a metric's query or guardrail direction without recreating it.
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      updateMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      GetMetricResponse
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • updateMetricWithHttpInfo

      public ApiResponse<GetMetricResponse> updateMetricWithHttpInfo(@Nonnull String id, @Nonnull UpdateMetricRequest updateMetricRequest, @Nullable String xProjectId) throws ApiException
      Update a metric Update a metric's definition — folder, source event, query (`query` DSL or typed `query_ir`), winsorisation, minimum detectable effect, or direction. `name` is immutable. Provide at most one of `query` / `query_ir`. **Use case:** Refine a metric's query or guardrail direction without recreating it.
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      updateMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      Returns:
      ApiResponse<GetMetricResponse>
      Throws:
      ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
    • updateMetricAsync

      public okhttp3.Call updateMetricAsync(@Nonnull String id, @Nonnull UpdateMetricRequest updateMetricRequest, @Nullable String xProjectId, ApiCallback<GetMetricResponse> _callback) throws ApiException
      Update a metric (asynchronously) Update a metric's definition — folder, source event, query (`query` DSL or typed `query_ir`), winsorisation, minimum detectable effect, or direction. `name` is immutable. Provide at most one of `query` / `query_ir`. **Use case:** Refine a metric's query or guardrail direction without recreating it.
      Parameters:
      id - Stable opaque metric id (`met_…`) or the metric's `name`. (required)
      updateMetricRequest - (required)
      xProjectId - Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it). (optional)
      _callback - The callback to be executed when the API call finishes
      Returns:
      The request call
      Throws:
      ApiException - If fail to process the API call, e.g. serializing the request body object