Siftsciex v0.3.1 Siftsciex.Score View Source

Functions for interacting with the Sift Science Score API.

Risk Scores are why you are using Sift Science in the first place. Sift Science provides an API to get Risk Scores for users on demand. This module provides functions for doing just that.

You will also find the Siftsciex.Score.Response.t/0 struct defined in this namespace. In the case of a successful HTTP request to the Score API the functions here will return a tuple with a Siftsciex.Score.Response.t/0 struct as the second element.

There are five different abuse scores that Sift Science can/will return:

  • Payment Abuse
  • Content Abuse
  • Promotion Abuse
  • Account Abuse
  • Legacy

The legacy score is more of a general assesment of the user, the others are fairly self-explainatory. When making a request to the Score API you must specify one or more score types to return, by default score_for/1 will request the :legacy score.

NOTE: If a synchronous request is made to the Events API then a Siftsciex.Score.Response.t/0 struct will be embedded in the resulting Siftsciex.Event.Response.t/0 struct.

Link to this section Summary

Functions

Retrieves a score for the given user

Link to this section Types

Link to this type abuse_type() View Source
abuse_type() :: :payment | :content | :promotion | :account | :legacy
Link to this type result() View Source
result() ::
  {:ok, Siftsciex.Score.Response.t()}
  | {:error, :redirected, String.t()}
  | {:error, :client_error, integer()}
  | {:error, :server_error, integer()}
  | {:error, :transport_error, any()}

Link to this section Functions

Link to this function score_for(user_id, abuse_types \\ [:legacy]) View Source
score_for(String.t(), [abuse_type()]) :: result()

Retrieves a score for the given user

Parameters

  • user_id: The user_id for which the score should be returned
  • abuse_types: A list of Siftsciex.Score.abuse_type/0 values indicating the abuse types to return, if not given the default is [:legacy]

Examples

iex> Score.score_for("bob")
{:ok, %Siftsciex.Score.Response{}}