# Integrate the Site Reputation SDK

## Prerequisites

1. [Complete the Getting Started Guide](https://docs.sudoplatform.com/guides/getting-started)
2. [Integrate the User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk)

## Get Started

* [Integrate the JS SDK](#integrate-the-js-sdk)
* [Integrate the iOS SDK](#integrate-the-ios-sdk)
* [Integrate the Android SDK](#integrate-the-android-sdk)

## Integrate the JS SDK

Add `@sudoplatform/sudo-site-reputation` as a dependency to your project.

```bash
yarn add '@sudoplatform/sudo-site-reputation'
# or
npm install --save '@sudoplatform/sudo-site-reputation'
```

{% hint style="info" %}
In order to instantiate a Site Reputation client, make sure you have followed instructions for [Getting Started](https://docs.sudoplatform.com/guides/getting-started) and [User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk) (see [Prerequisites](#prerequisites) above).
{% endhint %}

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

{% tabs %}
{% tab title="TypeScript" %}

```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, 
})
```

{% endtab %}
{% endtabs %}

## Integrate the iOS SDK

Add this line to your [Podfile](https://docs.sudoplatform.com/getting-started#ios-only-setup-cocoapods-in-a-project):

```swift
pod 'SudoSiteReputation'
```

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

```swift
pod install --repo-update
```

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

{% hint style="info" %}
In order to instantiate a Site Reputation client, make sure you have followed instructions for [Getting Started](https://docs.sudoplatform.com/guides/getting-started) and [User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk) (see [Prerequisites](#prerequisites) above).
{% endhint %}

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

{% tabs %}
{% tab title="Swift" %}

```swift
import SudoUser
import SudoSiteReputation

let userClient: SudoUserClient = // ... see "Users" docs
let siteReputationClient = try DefaultSudoSiteReputationClient(
    userClient: userClient
)
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
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.
{% endhint %}

{% hint style="success" %}
**See it in action.** Be sure to take a look at the [open-source iOS sample app](https://github.com/sudoplatform/samples-ios/tree/master/site-reputation) 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.
{% endhint %}

## Integrate the Android SDK

Add this line to the dependencies section of the app module `build.gradle` and run Gradle sync.

```kotlin
dependencies {
    api 'com.sudoplatform:sudositereputation:2.0.0'
}
```

{% hint style="info" %}
In order to instantiate a Site Reputation client, make sure you have followed instructions for [Getting Started](https://docs.sudoplatform.com/guides/getting-started) and [User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk) (see [Prerequisites](#prerequisites) above).
{% endhint %}

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

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
val userClient: SudoUserClient = // ... see "Users" docs

val sudoSiteReputationClient = SudoSiteReputationClient.builder()
            .setContext(this)
            .setSudoUserClient(sudoUserClient)
            .build()
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
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.
{% endhint %}

{% hint style="success" %}
**See it in action.** Be sure to take a look at the [open source Android sample app](https://github.com/sudoplatform/samples-android/tree/master/site-reputation) 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.
{% endhint %}
