Get contents

Once you have integrated Dialoguewise, you can now easily retrieve the contents and display it on your app. In order to do that, first you need to import the corresponding request object

import 'package:dialogue_wise/DTOs/get_contents_request.dart';

Next, you need to prepare the payload

  var request = new GetContentsRequest();
  request.slug = '<Provide Slug>';
  request.accessToken = '<Provide access token>';

Now that you have the payload ready, all you need to do is to call the getContents method with the payload.

  var dialogueWiseService = new DialoguewiseService();
  var response = await dialogueWiseService.getContents(request);

The response variable will now contain the response.

A sample response would look like the one below.

{
   "statusCode":200,
   "reasonPhrase":"OK",
   "response":{
      "data":{
         "contents":[
            {
               "id":"306325b42fd24b749a141fc0c365a961",
               "metadata":{
                  "countryCode":"",
                  "countrySubdivisionCode":"",
                  "languageCode":"",
                  "deviceType":"Any",
                  "sentiment":"Any",
                  "textDirection":0,
                  "isContentSourceFromAPI":false
               },
               "dish-name":"Chicken Hot Dog",
               "dish-photo":"hotdog.jpg",
               "is-available":"true",
               "long-description":"Chicken Hot Dog with mayonnaise.",
               "price":"$7",
               "short-description":"Chicken Hot Dog with mayonnaise.",
            }
         ],
         "totalRecords":1
      },
      "error":""
   }
}

Every record will contain an id and isContentSourceFromAPI field. The id field is a unique identifier that can be used to update or delete the record. The isContentSourceFromAPI field indicates if the record was added through the API or manually through the portal.

For mode details on the implementation, please have a look at the examples available on Github.