OpenApiTypesense.Analytics (OpenApiTypesense v0.6.5)

View Source

Provides API endpoints related to analytics

Summary

Functions

create_analytics_event(body)

@spec create_analytics_event(map()) ::
  {:ok, OpenApiTypesense.AnalyticsEventCreateResponse.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Create an analytics event

Sending events for analytics e.g rank search results based on popularity.

create_analytics_event(body, opts)

Either one of:

  • create_analytics_event(payload, opts)
  • create_analytics_event(%{api_key: xyz, host: ...}, payload)
  • create_analytics_event(Connection.new(), payload)

create_analytics_event(conn, body, opts)

Either one of:

  • create_analytics_event(%{api_key: xyz, host: ...}, payload, opts)
  • create_analytics_event(Connection.new(), payload, opts)

create_analytics_rule(body)

@spec create_analytics_rule(map()) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Creates an analytics rule

When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection.

create_analytics_rule(body, opts)

@spec create_analytics_rule(
  map() | OpenApiTypesense.Connection.t(),
  map() | keyword()
) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Either one of:

  • create_analytics_rule(payload, opts)
  • create_analytics_rule(%{api_key: xyz, host: ...}, payload)
  • create_analytics_rule(Connection.new(), payload)

create_analytics_rule(conn, body, opts)

@spec create_analytics_rule(map() | OpenApiTypesense.Connection.t(), map(), keyword()) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Either one of:

  • create_analytics_rule(%{api_key: xyz, host: ...}, payload, opts)
  • create_analytics_rule(Connection.new(), payload, opts)

delete_analytics_rule(ruleName)

@spec delete_analytics_rule(String.t()) ::
  {:ok, OpenApiTypesense.AnalyticsRuleDeleteResponse.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Delete an analytics rule

Permanently deletes an analytics rule, given it's name

delete_analytics_rule(ruleName, opts)

Either one of:

  • delete_analytics_rule(ruleName, opts)
  • delete_analytics_rule(%{api_key: xyz, host: ...}, ruleName)
  • delete_analytics_rule(Connection.new(), ruleName)

delete_analytics_rule(conn, ruleName, opts)

Either one of:

  • delete_analytics_rule(%{api_key: xyz, host: ...}, ruleName, opts)
  • delete_analytics_rule(Connection.new(), ruleName, opts)

retrieve_analytics_rule(ruleName)

@spec retrieve_analytics_rule(String.t()) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Retrieves an analytics rule

Retrieve the details of an analytics rule, given it's name

retrieve_analytics_rule(ruleName, opts)

@spec retrieve_analytics_rule(
  map() | OpenApiTypesense.Connection.t() | String.t(),
  String.t() | keyword()
) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Either one of:

  • retrieve_analytics_rule(ruleName, opts)
  • retrieve_analytics_rule(%{api_key: xyz, host: ...}, ruleName)
  • retrieve_analytics_rule(Connection.new(), ruleName)

retrieve_analytics_rule(conn, ruleName, opts)

@spec retrieve_analytics_rule(
  map() | OpenApiTypesense.Connection.t(),
  String.t(),
  keyword()
) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Either one of:

  • retrieve_analytics_rule(%{api_key: xyz, host: ...}, ruleName, opts)
  • retrieve_analytics_rule(Connection.new(), ruleName, opts)

retrieve_analytics_rules()

@spec retrieve_analytics_rules() ::
  {:ok, OpenApiTypesense.AnalyticsRulesRetrieveSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Retrieves all analytics rules

Retrieve the details of all analytics rules

retrieve_analytics_rules(opts)

Either one of:

  • retrieve_analytics_rules(opts)
  • retrieve_analytics_rules(%{api_key: xyz, host: ...})
  • retrieve_analytics_rules(Connection.new())

retrieve_analytics_rules(conn, opts)

Either one of:

  • retrieve_analytics_rules(%{api_key: xyz, host: ...}, opts)
  • retrieve_analytics_rules(Connection.new(), opts)

upsert_analytics_rule(ruleName, body)

@spec upsert_analytics_rule(String.t(), map()) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Upserts an analytics rule

Upserts an analytics rule with the given name.

upsert_analytics_rule(ruleName, body, opts)

@spec upsert_analytics_rule(
  map() | OpenApiTypesense.Connection.t() | String.t(),
  String.t() | map(),
  map() | keyword()
) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Either one of:

  • upsert_analytics_rule(ruleName, body, opts)
  • upsert_analytics_rule(%{api_key: xyz, host: ...}, ruleName, body)
  • upsert_analytics_rule(Connection.new(), ruleName, body)

upsert_analytics_rule(conn, ruleName, body, opts)

@spec upsert_analytics_rule(
  map() | OpenApiTypesense.Connection.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, OpenApiTypesense.AnalyticsRuleSchema.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Either one of:

  • upsert_analytics_rule(%{api_key: xyz, host: ...}, ruleName, body, opts)
  • upsert_analytics_rule(Connection.new(), ruleName, body, opts)