Integrate the Email SDK

Integrate the Email SDK into your application

Prerequisites

Get Started

Integrate the JS SDK

To use the Email SDK in a Web or Node.js project, you must add @sudoplatform/sudo-email as a dependency to your project.

yarn add '@sudoplatform/sudo-email'
# or
npm install --save '@sudoplatform/sudo-email'

In order to instantiate an Email client, make sure you have followed instructions for Getting Started, User SDK and Sudo Profiles SDK (see Prerequisites above).

To instantiate and initialize a client in your application, add the following:

import { DefaultApiClientManager } from '@sudoplatform/sudo-api-client'
import { DefaultConfigurationManager } from '@sudoplatform/sudo-common'
import { DefaultSudoEmailClient } from '@sudoplatform/sudo-email'
import { DefaultSudoProfilesClient } from '@sudoplatform/sudo-profiles'
import { DefaultSudoUserClient } from '@sudoplatform/sudo-user'

const sdkConfigJSON = /* ... refer to Users documentation ... */
DefaultConfigurationManager.getInstance().setConfig(sdkConfigJSON)

const userClient = new DefaultSudoUserClient(/* refer to Users documentation */)
const profilesClient = new DefaultSudoProfilesClient(/* refer to Sudos documentation */)
const apiClientManager = DefaultApiClientManager.getInstance().setAuthClient(userClient)

const emailClient = new SudoEmailClient(
    apiClientManager
    userClient,
    profilesClient,
)

Integrate the iOS SDK

Add this line to your Podfile:

pod 'SudoEmail'

Install pod dependencies by running the following command in your project directory:

pod install --repo-update

This will update the local CocoaPods repository and install the latest version of the Email SDK.

In order to instantiate an Email client, make sure you have followed instructions for Getting Started, User SDK and Sudo Profiles SDK (see Prerequisites above)

To instantiate a client in your application, add the following:

import SudoEmail
import SudoUser

let userClient = // ... see "Users" docs

let emailClient = try DefaultSudoEmailClient(
    keyNameSpace: "MyNameSpace",
    sudoUserClient: userClient, 
)

Integrate the Android SDK

The Android SDK is open source and compatible with Android 7 (API level 24) and above.

Add this line to the dependencies section of the app module build.gradle and synchronize your project with Android Studio.

dependencies {
    implementation 'com.sudoplatform:sudoemail:$latest_version'
}

The latest version of the SDK can be found at SDK Releases.

In order to instantiate an Email client, make sure you have followed instructions for Getting Started and User SDK and Sudo Profiles SDK (see Prerequisities above)

To instantiate a client in your application, add the following:

val userClient = // ... see "Users" docs

val emailClient = SudoEmailClient.builder()
    .setContext(appContext) 
    .setSudoUserClient(userClient)
    .build()

Last updated