< Back
 

# Packages

-  package root
  Definition Classes
    root
-  package uk
  Definition Classes
    root
-  package gov
  Definition Classes
    uk
-  package hmrc
  Definition Classes
    gov
-  package customs
  Definition Classes
    hmrc
-  package api
  Definition Classes
    customs
-  package common
  Definition Classes
    api
-  package config
  Definition Classes
    common
- ConfigValidatedNelAdaptor
- CustomsErrorHandler
- InvalidEnvironmentException
- ServiceConfig
- ServiceConfigProvider
-  package connectors
  Definition Classes
    common
-  package controllers
  Definition Classes
    common
-  package http
  Definition Classes
    common
-  package logging
  Definition Classes
    common
-  package xml
  Definition Classes
    common

p

uk.gov.hmrc.customs.api.common

# config 

#### package config

Linear Supertypes
AnyRef, Any

### Type Members

1.  class ConfigValidatedNelAdaptor extends AnyRef

   We need a wrapper for ServicesConfig as the current API rely's on throwing exceptions for signalling failure - this is fail fast behaviour.

   We need a wrapper for ServicesConfig as the current API rely's on throwing exceptions for signalling failure - this is fail fast behaviour. What we want is to aggregate errors (on application startup). The `ValidatedNel` class in the `cats` library gives a type that allows us aggregate errors OR apply valid results to a function (such as a case class constructor). It's declaration is `type ValidatedNel[+E, +A] = Validated[NonEmptyList[E], A]` `Nel` is short for `NonEmptyList` which is simply a `List` that is guaranteed to contain at least 1 item.

   Example usage:

       // you will need this import for mapN
       import cats.implicits._

       @Singleton
       class CustomsConfigService @Inject()(configValidatedNel: ConfigValidatedNelAdaptor) {
         private val root = configValidatedNel.root
         private val validatedCustomsEnrolmentConfig: ValidatedNel[String, CustomsEnrolmentConfig] = (
           root.string("customs.enrolment.name"),
           root.string("customs.enrolment.eori-identifier")
         ).mapN(CustomsEnrolmentConfig)
       ...
       }

   Note that the `ValidatedNel` behaviour is derived from it being an Applicative Functor (see https://typelevel.org/cats/typeclasses/applicative.html)

   Annotations
     @Singleton()
2.  class CustomsErrorHandler extends DefaultHttpErrorHandler with AcceptExtractors
   Annotations
     @Singleton()
3.  type CustomsValidatedNel[A] = Validated[NonEmptyList[String], A]
4.  class InvalidEnvironmentException extends RuntimeException
5.  case class ServiceConfig(url: String, bearerToken: Option[String], environment: String) extends Product with Serializable
6.  class ServiceConfigProvider extends AnyRef
   Annotations
     @Singleton()

### Inherited from AnyRef

### Inherited from Any

### Ungrouped