Integrate the Site Reputation SDK
Integrate the Site Reputation SDK into your application
Add
@sudoplatform/sudo-site-reputation
as a dependency to your project.yarn add '@sudoplatform/sudo-site-reputation'
# or
npm install --save '@sudoplatform/sudo-site-reputation'
In order to instantiate a Site Reputation client, make sure you have followed instructions for Getting Started and User SDK (see Prerequisites above).
To instantiate a client in your application, add the following:
TypeScript
import { SudoSiteReputationClient } from '@sudoplatform/sudo-site-reputation'
import { DefaultSudoUserClient } from '@sudoplatform/sudo-user'
// See User SDK docs
const sudoUserClient = new DefaultSudoUserClient()
const siteReputationClient = new SudoSiteReputationClient({
sudoUserClient,
})
pod 'SudoSiteReputation'
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 Site Reputation SDK.
In order to instantiate a Site Reputation client, make sure you have followed instructions for Getting Started and User SDK (see Prerequisites above).
To instantiate a client in your application, add the following:
Swift
import SudoUser
import SudoSiteReputation
let userClient = // ... see "Users" docs
let siteReputationClient = try DefaultSudoSiteReputationClient(
userClient: 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 Sudo Site Reputation SDK into your app as quickly and seamlessly as possible.
Add this line to the dependencies section of the app module
build.gradle
and run Gradle sync.dependencies {
api 'com.sudoplatform:sudositereputation:1.0.0'
}
In order to instantiate a Site Reputation client, make sure you have followed instructions for Getting Started and User SDK (see Prerequisites above).
To instantiate a client in your application, add the following:
Kotlin
val logger = // ... use your implemenation of logger
val userClient = // ... see "Users" docs
val sudoSiteReputationClient = SudoSiteReputationClient.builder()
.setContext(this)
.setSudoUserClient(sudoUserClient)
.setLogger(logger)
.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 Sudo Site Reputation SDK into your app as quickly and seamlessly as possible.
Last modified 1yr ago