# User

## Fetches authorized user's dashboard information

<mark style="color:blue;">`GET`</mark> `https://gateway-relay.herokuapp.com/api/user/dashboardInfo`

#### Headers

| Name                                            | Type      | Description                                                                                                                                                                                                                                                                         |
| ----------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | jwt token | received via authenticating with the [auth endpoints.](https://karan-khullar.gitbook.io/gateway/documentation/api-reference/auth) **To learn more about the authentication flow, click** [**here**](https://karan-khullar.gitbook.io/gateway/architecture/authentication-flow)**.** |

{% tabs %}
{% tab title="200: OK successful operation" %}

<pre class="language-javascript" data-title="Example 200 Response"><code class="lang-javascript">{
    userInfo: {
        credits: 100,
        subscriptionAmount: 25,
        permanentExp: 1100,
        subscriptionExp: 3300,
        percentToNextPermanentBadge: 5,
        percentToNextSubscriberBadge: 7.5,
        isSubscriber: true,
        canCheckIn: true
    },
    permanentBadge: {
        exp_lower_bound: 1000,
        exp_upper_bound: 2000,
        exp_growth_rate: 100,
        bonus_creds_push_ads: .10,
        bonus_creds_video_ads: .10,
        bonus_creds_offerwall: .10,
        bonus_creds_surveys: .10,
        bonus_daily_check_in_attempts: 3,
        credits_back_percent: .05,
        acceptable_credit_debt: 500,
        related_check_in_drops: 14
    },
    subscriberBadge:{
        exp_lower_bound: 3000,
        exp_upper_bound: 4000,
        exp_growth_rate: 300,
        bonus_creds_push_ads: .30,
        bonus_creds_video_ads: .30,
        bonus_creds_offerwall: .30,
        bonus_creds_surveys: .30,
        bonus_daily_check_in_attempts: 6,
        credits_back_percent: .10,
        acceptable_credit_debt: 1500,
        related_check_in_drops: 21
    },
    modifiers: [
        {
              id: 12,
              related_user: '0x218C2BbaaBa0D66ddcD5De942Ed2980Bbfd1f004',
              modifier_type: 'BONUS_PUSH_ADS_CREDITS',
              value: .10,
              expires_at: '2022-08-19T14:55:22Z',
              created_at: '2022-08-24T14:55:22Z'
        }
    ],
    earningHistory: [
        {
              related_user: '0x218C2BbaaBa0D66ddcD5De942Ed2980Bbfd1f004',
              credit_source: 'SUBSCRIBED_PAYOUT',
              credits_earned: 476.19,
              credits_before: 0,
              credits_after: 476.19
        }
    ],
    transactionHistory: [
        {
<strong>              transaction_hash: '0xcd56ff1157e172bfed0310526ac14c135d59628eb046a62ac71ed7380585cf87',
</strong>              related_user: '0x218C2BbaaBa0D66ddcD5De942Ed2980Bbfd1f004',
              expected_cost: 32,
              real_cost: 29,
              credits_before: 476.19,
              credits_after: 447.19,
              status: 'Success'
        }
    ],
    checkInDropTable: {
          maxBonusCreditsPushAds: .30,
          minBonusCreditsPushAds: .15,
          maxBonusCreditsVideoAd: .24,
          minBonusCreditsVideoAd: .11,
          maxBonusCreditsOfferwall: .21,
          minBonusCreditsOfferwall: .09,
          maxBonusCreditsSurvey: .24,
          minBonusCreditsSurvey: .11,
          maxCreditsBackPercent: .10,
          minCreditsBackPercent: .05,
          maxExperience: 1000,
          minExperience: 300,
          maxCredits: 500,
          minCredits: 30
    }
}
</code></pre>

{% endtab %}

{% tab title="401: Unauthorized authentication error" %}
{% code title="Example 401 Response" overflow="wrap" %}

```javascript
{
    error: 'Unauthenticated call to dashboardInfo. Please re-authenticate and try again.'
}
```

{% endcode %}
{% endtab %}

{% tab title="404: Not Found user not found error" %}
{% code title="Example 404 Response" overflow="wrap" %}

```javascript
{
    error: 'No user found with provided address: 0x218C2BbaaBa0D66ddcD5De942Ed2980Bbfd1f004'
}
```

{% endcode %}
{% endtab %}

{% tab title="500: Internal Server Error internal server error" %}
{% code title="Example 500 Response" overflow="wrap" %}

```javascript
{
    error: 'An internal server error occurred. Please check the request body, ensure you are authenticated, and try again.'
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Fetches authorized user's possible check in drops

<mark style="color:blue;">`GET`</mark> `https://gateway-relay.herokuapp.com/api/user/checkInDrops`

#### Headers

| Name                                            | Type      | Description                                                                                                                                                                                                                                                                         |
| ----------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | jwt token | received via authenticating with the [auth endpoints.](https://karan-khullar.gitbook.io/gateway/documentation/api-reference/auth) **To learn more about the authentication flow, click** [**here**](https://karan-khullar.gitbook.io/gateway/architecture/authentication-flow)**.** |

{% tabs %}
{% tab title="200: OK successful operation" %}
{% code title="Example 200 Response" overflow="wrap" %}

```javascript
{
  maxBonusCreditsPushAds: .30,
  minBonusCreditsPushAds: .15,
  maxBonusCreditsVideoAd: .24,
  minBonusCreditsVideoAd: .11,
  maxBonusCreditsOfferwall: .21,
  minBonusCreditsOfferwall: .09,
  maxBonusCreditsSurvey: .24,
  minBonusCreditsSurvey: .11,
  maxCreditsBackPercent: .10,
  minCreditsBackPercent: .05,
  maxExperience: 1000,
  minExperience: 300,
  maxCredits: 500,
  minCredits: 30
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized authentication error" %}
{% code title="Example 401 Response" overflow="wrap" %}

```javascript
{
    error: 'Unauthenticated call to checkInDrops. Please re-authenticate and try again.'
}
```

{% endcode %}
{% endtab %}

{% tab title="404: Not Found check in drops not found error" %}
{% code title="" overflow="wrap" %}

```javascript
{
    error: 'No check in drop table found related to: 0x218C2BbaaBa0D66ddcD5De942Ed2980Bbfd1f004! Please try again.'
}
```

{% endcode %}
{% endtab %}

{% tab title="500: Internal Server Error internal server error" %}
{% code title="" overflow="wrap" %}

```javascript
{
    error: 'An internal server error occurred. Please check the request body, ensure you are authenticated, and try again.'
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Executes check in&#x20;

<mark style="color:blue;">`GET`</mark> `https://gateway-relay.herokuapp.com/api/user/executeCheckIn`

#### Headers

| Name                                            | Type      | Description                                                                                                                                                                                                                                                                         |
| ----------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | jwt token | received via authenticating with the [auth endpoints.](https://karan-khullar.gitbook.io/gateway/documentation/api-reference/auth) **To learn more about the authentication flow, click** [**here**](https://karan-khullar.gitbook.io/gateway/architecture/authentication-flow)**.** |

{% tabs %}
{% tab title="200: OK successful operation" %}
{% code title="Example 200 Response" overflow="wrap" %}

```javascript
{
    result: {
        type: 'BONUS_CREDITS_BACK',
        value: .15,
        effectiveTimeInMinutes: 30
    },
    possibleResults: [
        {
            type: 'EXPERIENCE',
            value: 150,
            effectiveTimeInMinutes: undefined
        },
        {
            type: 'BONUS_CREDITS_BACK',
            value: .15,
            effectiveTimeInMinutes: 30
        },
        {
            type: 'BONUS_PUSH_ADS_CREDITS',
            value: .10,
            effectiveTimeInMinutes: 60
        }
    ]
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized authentication error" %}
{% code title="Example 401 Response" overflow="wrap" %}

```javascript
{
    error: 'Unauthenticated call to executeCheckIn. Please re-authenticate and try again.'
}
```

{% endcode %}
{% endtab %}

{% tab title="403: Forbidden insufficient number of check ins error" %}
{% code title="Example 403 Response" overflow="wrap" %}

```javascript
{
    error: 'User has used all of their check ins for today! Please try again tomorrow.'
}
```

{% endcode %}
{% endtab %}

{% tab title="404: Not Found check in drops not found error" %}
{% code title="Example 404 Response" overflow="wrap" %}

```javascript
{
    error: 'No check in drop table found related to: 0x218C2BbaaBa0D66ddcD5De942Ed2980Bbfd1f004! Please try again.'
}
```

{% endcode %}
{% endtab %}

{% tab title="500: Internal Server Error internal server error " %}
{% code title="Example 500 Response" overflow="wrap" %}

```javascript
{
    error: 'An internal server error occurred. Please check the request body, ensure you are authenticated, and try again.'
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
