Activity operations

Activity operations are related to user's actions. Actions can be like, dislike, add, page view and etc.

Each method that works with statistical data also converts your IDs to the desired ID provider for easier and quicker development.

The general design of the namespace follows this pattern:

val response = sdk.activity().someMethod(...)
// do something with response object

The responses are comprised of different objects you can find here.

For all following examples in tags argument our sport provider will be native.

For more information visit FansUnitedSDK integration

General operations

Add new activity for user

Method: add(action, tags, content?, campaign?)

Method creates activity for specific user. Needs authentication.

Arguments are as they follow:

  • action: enum. Options are:
    • like
    • dislike
    • page_view
    • content_consumed
    • share
    • comment
    • click_ad
    • conversion
  • tags: a list of TagsModel. Competitions, players, teams or matches that user has made an action with.
  • content: ContentModel. Optional. For example the content can be an article about a match between two teams in one competition.
  • campaign: CampaignModel. Optional. User can interact in some campaign.
val activityResult: ActivityResult? = sdk.activity().add(ActivityAction.SHARE, tags, content, campaign)

Delete specific activity

Method: delete(activityId)

Deletes specific activity owned by the user. Returns true for successful execution.

val activityResult: ActivityResult? = sdk.activity().delete('2c150d0c-9ed5-4fd1-adb4-37d1357b822d')

Profile activities

Get user's own activities

Method: getOwnActivities(action, limit?, page?, disableCache?)

Returns the activities for the current logged in user. The response is paginated.

By default the request is cached by API for 1 hour so JavaScript SDK accepts disableCache argument. It's a boolean and if provided the response will NOT be cached.

Filters argument accept the following options:

  • action. enum. All provided actions are described here.
  • page. number. The number of the page.
  • limit. number. Determines how many items per page there will be.
val response = sdk.activity().getOwnActivities("user-id", limit, page, false)
val activities = response.data

Get user's activities

Method: getUserActivities(userId, action, limit?, page?, disableCache?)

Returns the activities for the current logged in user. The response is paginated.

By default the request is cached by API for 1 hour so JavaScript SDK accepts disableCache argument. It's a boolean and if provided the response will NOT be cached.

Filters argument accept the following options:

  • action. enum. All provided actions are described here.
  • page. number. The number of the page.
  • limit. number. Determines how many items per page there will be.
val response = sdk.activity().getUserActivities("user-id", limit, page, false)
val activities = response.data