ex_api v1.0.0-rc.2 ExApi.ValidationHelper View Source

Helper module for validating passed arguments.

Link to this section Summary

Functions

Checks if passed api or its module is found or loaded and registered. Then matches it with found api in state

Checks if passed implementation or its id is found/registered in state and matches specified api

Checks if specified module is loaded and is api

Check if feature exists in implementation

Checkes if passed implementation or its module is loaded and registered. Then checks if it and its api is found in state

Checkes if passed implementation module is loaded and is registered. Then checks if it with specified group and its api is found in state

Checks if specified module is loaded and is implementation

Checks if specified module is loaded

Link to this section Functions

Link to this function with_api_check(api, success_callback) View Source
with_api_check(ExApi.Api.t, function) ::
  term |
  {:error, ExApi.Error.ApiMismatchError.t} |
  {:error, ExApi.Error.ApiNotRegisteredError.t}
with_api_check(module, function) ::
  term |
  {:error, ExApi.Error.ApiNotFoundError.t}

Checks if passed api or its module is found or loaded and registered. Then matches it with found api in state.

Link to this function with_api_impl_check(api, impl, success_callback) View Source
with_api_impl_check(ExApi.Api.t, ExApi.Implementation.t, function) ::
  term |
  {:error, ExApi.Error.ImplementationMismatchError.t} |
  {:error, ExApi.Error.ImplementationNotRegisteredError.t} |
  {:error, ExApi.Error.WrongApiError.t}
with_api_impl_check(ExApi.Api.t, {group :: atom, id :: atom} | id :: atom, function) ::
  term |
  {:error, ExApi.Error.ImplementationNotFoundError.t}

Checks if passed implementation or its id is found/registered in state and matches specified api.

Link to this function with_api_module_check(api, success_callback) View Source
with_api_module_check(ExApi.Api.t | module, function) ::
  term |
  {:error, ExApi.Error.ModuleNotLoadedError.t} |
  {:error, ExApi.Error.NotApiError.t}

Checks if specified module is loaded and is api.

Link to this function with_feature_check(impl, arg, success_callback) View Source
with_feature_check(ExApi.Implementation.t, {name :: atom, arity :: non_neg_integer}, function) ::
  term |
  {:error, ExApi.Error.FeatureNotFoundError.t}

Check if feature exists in implementation.

Link to this function with_impl_check(impl_or_id, for_register \\ false, success_callback) View Source
with_impl_check(ExApi.Implementation.t, boolean, function) ::
  term |
  {:error, ExApi.Error.ApiNotFoundError.t} |
  {:error, ExApi.Error.ImplementationNotFoundError.t}
with_impl_check(module, boolean, function) ::
  term |
  {:error, ExApi.Error.ApiNotFoundError.t} |
  {:error, ExApi.Error.ImplementationNotFoundError.t} |
  {:error, ExApi.Error.ModuleNotLoadedError.t} |
  {:error, ExApi.Error.NotImplementationError.t}

Checkes if passed implementation or its module is loaded and registered. Then checks if it and its api is found in state.

Link to this function with_impl_check(module, group, for_register, success_callback) View Source
with_impl_check(ExApi.Implementation.t, atom, boolean, function) ::
  term |
  {:error, ExApi.Error.ApiNotFoundError.t} |
  {:error, ExApi.Error.ImplementationNotFoundError.t}
with_impl_check(module, atom, boolean, function) ::
  term |
  {:error, ExApi.Error.ApiNotFoundError.t} |
  {:error, ExApi.Error.ImplementationNotFoundError.t} |
  {:error, ExApi.Error.ModuleNotLoadedError.t} |
  {:error, ExApi.Error.NotImplementationError.t}

Checkes if passed implementation module is loaded and is registered. Then checks if it with specified group and its api is found in state.

Link to this function with_impl_module_check(impl, success_callback) View Source
with_impl_module_check(ExApi.Implementation.t | module, function) ::
  term |
  {:error, ExApi.Error.ModuleNotLoadedError.t} |
  {:error, ExApi.Error.NotImplementationError.t}

Checks if specified module is loaded and is implementation.

Link to this function with_module_check(module, success_callback) View Source
with_module_check(module, function) ::
  term |
  {:error, ExApi.Error.ModuleNotLoadedError.t}

Checks if specified module is loaded.