Integrate the Email SDK
Integrate the Email SDK into your application
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:
TypeScript
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,
)
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:
Swift
import SudoEmail
import SudoUser
let userClient = // ... see "Users" docs
let emailClient = try DefaultSudoEmailClient(
keyNameSpace: "MyNameSpace",
sudoUserClient: userClient,
)
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
See it in action. Be sure to take a look at the open source iOS sample app on GitHub that our team published as a reference for integrating the Email SDK into your app as quickly and seamlessly as possible.
The Android SDK is open source and compatible with Android 7 (API level 24) and above.
Gradle
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'
}
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:
Kotlin
val userClient = // ... see "Users" docs
val emailClient = SudoEmailClient.builder()
.setContext(appContext)
.setSudoUserClient(userClient)
.build()
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
See it in action. Be sure to take a look at the open source Android sample app on Github that our team published as a reference for integrating the Email SDK into your app as quickly and seamlessly as possible.
Last modified 4mo ago