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

To use the Email SDK in an iOS app, you need to install the SudoEmail package via Swift Package Manager

Open your project settings in XCode, and go to the Package Dependencies tab. Click on the + sign to add a dependency.

Enter the repository URL https://github.com/sudoplatform/sudo-email-ios in the top right search box and select the sudo-email-ios repository.

Select the required version and Add Package.

Sudo Platform SDKs conform to semantic versioning so in most cases you will leave the Dependency Rule as Up to Next Major Version to receive regular updates without introducing any breaking changes.

This will resolve the local package dependency 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