# Nonstop Javascript SDK

## Complete Content

Complete Content allows the client app to query for information regarding the current stream, as well as record a Complete Content task internally.

Generally this is used to integrate Nonstop information into End Card scenarios for Episodes and Movies.

`completeContent` should be called when the client app needs to present information on completing a piece of content to the logged in user:

* Reaches the end card of a movie
* Reaches the end card of an episode
* Reaches the end card of a VPPO clip
* Reaches the end card of a ShowMS clip
* Note: there are no end cards on Live so no `completeContent` should be called

Parameters:

* **contentId** - Pass the Partner API Id

Syntax:

```javascript
    Nonstop.default.completeContent('VDKA4220171')
        .then((report) => {
            // Report contains details of the user's activity
        })
        .catch(() => {

        });
```

### Report object

The report object contains the following properties:

* ```contentTitle``` - The title of the Content the points were earned on - for Movies the Movie title for Shows the name of the Show
* ```contentId``` - The ID of the Content the points were earned on
* ```episodeTitle``` - If the content was an Episode, the title of the Episode
* ```episodeNumber``` - If the content was an Episode, the title of the Episode
* ```amplitudeEpisodeNumber``` - If the content was an Episode, the correctly formatted episode number for passing to Amplitude
* ```seasonNumber``` - If the content was an Episode, the title of the Episode
* ```logoImageUrl``` - The logo for the content, if available
* ```backgroundImageUrl``` - The background image for the content, if available
* ```previousPoints``` - The points the user had when they started this Watch & Earn stream
* ```previousPointsDisplay``` - The points the user had when they started this Watch & Earn stream, correctly formatted for display to the user
* ```newPoints``` - The points the user has now
* ```newPointsDisplay``` - The points the user has now, correctly formatted for display to the user
* ```pointsEarned``` - The points the user earned for this stream
* ```pointsEarnedDisplay``` - The points the user earned for this stream, correctly formatted for display to the user
* ```minutesWatched``` - The number of minutes the user watched
* ```minutesWatchedDisplay``` - The number of minutes the user watched, correctly formatted for display to the user
* ```animationName``` - The name of the animation which should be displayed to the user
* ```animationView``` - Configuration which can be passed to lottie to render an animation to show the user how many points they have earned.

If `pointsEarned` equals 0 then the client app should not present anything Nonstop related to the user.