Lti_1p3.ToolDataProvider behaviour (Lti 1p3 v0.6.0)

Link to this section Summary

Callbacks

Gets the deployment associated with the given registration and deployment_id.

Gets the jwk associated with the given Registration.

Gets the registration associated with the given issuer and client_id.

Gets the registration and deployment associated with the given issuer, client_id and deployment_id.

Link to this section Callbacks

Link to this callback

create_deployment(%Lti_1p3.Tool.Deployment{})

@callback create_deployment(%Lti_1p3.Tool.Deployment{
  deployment_id: term(),
  id: term(),
  registration_id: term()
}) ::
  {:ok,
   %Lti_1p3.Tool.Deployment{
     deployment_id: term(),
     id: term(),
     registration_id: term()
   }}
  | {:error, DataProviderError.t()}

Creates a new deployment.

examples

Examples

iex> create_deployment(%Deployment{})
{:ok, %Deployment{}}
iex> create_deployment(%Deployment{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback

create_registration(%Lti_1p3.Tool.Registration{})

@callback create_registration(%Lti_1p3.Tool.Registration{
  auth_login_url: term(),
  auth_server: term(),
  auth_token_url: term(),
  client_id: term(),
  id: term(),
  issuer: term(),
  key_set_url: term(),
  tool_jwk_id: term()
}) ::
  {:ok,
   %Lti_1p3.Tool.Registration{
     auth_login_url: term(),
     auth_server: term(),
     auth_token_url: term(),
     client_id: term(),
     id: term(),
     issuer: term(),
     key_set_url: term(),
     tool_jwk_id: term()
   }}
  | {:error, DataProviderError.t()}

Creates a new registration.

examples

Examples

iex> create_registration(%Registration{})
{:ok, %Registration{}}
iex> create_registration(%Registration{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback

get_deployment(%Lti_1p3.Tool.Registration{}, t)

@callback get_deployment(
  %Lti_1p3.Tool.Registration{
    auth_login_url: term(),
    auth_server: term(),
    auth_token_url: term(),
    client_id: term(),
    id: term(),
    issuer: term(),
    key_set_url: term(),
    tool_jwk_id: term()
  },
  String.t()
) ::
  %Lti_1p3.Tool.Deployment{
    deployment_id: term(),
    id: term(),
    registration_id: term()
  }
  | nil

Gets the deployment associated with the given registration and deployment_id.

examples

Examples

iex> get_deployment(%Registration{}, deployment_id)
%Deployment{}
iex> get_deployment(%Registration{}, deployment_id)
nil
Link to this callback

get_jwk_by_registration(%Lti_1p3.Tool.Registration{})

@callback get_jwk_by_registration(%Lti_1p3.Tool.Registration{
  auth_login_url: term(),
  auth_server: term(),
  auth_token_url: term(),
  client_id: term(),
  id: term(),
  issuer: term(),
  key_set_url: term(),
  tool_jwk_id: term()
}) ::
  {:ok,
   %Lti_1p3.Jwk{
     active: term(),
     alg: term(),
     id: term(),
     kid: term(),
     pem: term(),
     typ: term()
   }}
  | {:error, DataProviderError.t()}

Gets the jwk associated with the given Registration.

examples

Examples

iex> get_jwk_by_registration(%Registration{})
{:ok, %Jwk{}}
iex> get_jwk_by_registration(%Registration{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback

get_registration_by_issuer_client_id(t, t)

@callback get_registration_by_issuer_client_id(String.t(), String.t()) ::
  %Lti_1p3.Tool.Registration{
    auth_login_url: term(),
    auth_server: term(),
    auth_token_url: term(),
    client_id: term(),
    id: term(),
    issuer: term(),
    key_set_url: term(),
    tool_jwk_id: term()
  }
  | nil

Gets the registration associated with the given issuer and client_id.

examples

Examples

iex> get_registration_by_issuer_client_id(issuer, client_id)
%Registration{}
iex> get_registration_by_issuer_client_id(issuer, client_id)
nil
Link to this callback

get_registration_deployment(t, t, t)

@callback get_registration_deployment(String.t(), String.t(), String.t()) ::
  {%Lti_1p3.Tool.Registration{
     auth_login_url: term(),
     auth_server: term(),
     auth_token_url: term(),
     client_id: term(),
     id: term(),
     issuer: term(),
     key_set_url: term(),
     tool_jwk_id: term()
   },
   %Lti_1p3.Tool.Deployment{
     deployment_id: term(),
     id: term(),
     registration_id: term()
   }}
  | nil

Gets the registration and deployment associated with the given issuer, client_id and deployment_id.

examples

Examples

iex> get_registration_deployment(issuer, client_id, deployment_id)
{%Registration{}, %Deployment{}}
iex> get_rd_by_deployment_id(issuer, client_id, deployment_id)
{nil, nil}