# Android SDK

# How to

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

 allprojects {
     repositories {
         maven { url 'https://jitpack.io' }

Step 2. Add the dependency

dependencies {
     implementation 'com.github.endpass:endpass-android-sdk-public:v1.0.1'

That's it! The first time you request a project JitPack checks out the code, builds it and serves the build artifacts (jar, aar).

# Initialization SDK

To use EndpassSDK you need to enter AppID

EndpassManager.init(appId: "YOUR_APPLICATION_ID", context!!)

# Get User information

EndpassManager.request(endpoint: UserEndpoint, activity: Activity)

# Get User address

EndpassManager.request(endpoint: UserAddressEndpoint, activity: Activity)

# Get User personal

EndpassManager.request(endpoint: UserPersonalInfoEndpoint, activity: Activity)

# Get App scopes

EndpassManager.request(endpoint: UserScopesEndpoint, activity: Activity)

# Get documents

EndpassManager.request(endpoint: DocumentsEndpoint, activity: Activity)

# Handle result

You need to override the following methods in your activity or fragment

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
       super.onActivityResult(requestCode, resultCode, data)

       if (resultCode == Activity.RESULT_OK) {
           if (requestCode == Constant.ENDPASS_RESULT_REQUEST_CODE) {
               val response = data?.getStringExtra(ENDPASS_RESPONSE)

# URL constants

const val UserEndpoint = "/user"
const val UserAddressEndpoint = "/user/address"
const val UserPersonalInfoEndpoint = "/user/info/personal"
const val UserScopesEndpoint = "/scopes"
const val DocumentsEndpoint = "/documents"

# Data models

# UserDataResponse

data class CodeResponse(
     val id: String
     val email: String?
     val phones: List<Phone>?

data class Phone: {
    val id: String
    val createdAt: Int
    val status: String
    val country: String
    val number: String
    val main: Bool

# UserAddressesResponse

data class UserAddressesResponseElement {
      val main: Boolean
      val createdAt: Int
      val apartmentNumber: String
      val streetNumber: String
      val street: String
      val city: String
      val stateRegion: String
      val country: String
      val postalCode: String
      val lat: Double
      val lng: Double
      val verified: Boolean


# UserPersonalDataResponse

data class UserPersonalDataResponse {
     val id: String
     val firstName: String
     val lastName: String
     val dateOfBirth: Int

# UserScopesResponse

data class UserScopesResponse {
      val scopes: List<String>

# PublicDocumentListResponse

data class PublicDocumentListResponse {
    val id: String
    val createdAt: Int
    val status: EPPublicConstants.DocumentStatusType
    val documentType: EPPublicConstants.DocumentType

# DocumentType

enum class DocumentType(val title: String) {
           DriverLicense("Driver License"),
           ProofOfAddress("Proof of address"),
           IdCard("Id Card")

# AreaType

enum class AreaType {

# DocumentStatusType

enum class DocumentStatusType(val desc: String) {
         NotReadable("Not readable"),
         NotVerified("Not verified"),
         PendingReview("Pending review")