Social Media Posts

social-media/posts@1.0.1
Supported by 4 providers
F
I
L
T

Get Profile's Posts

Retrieve a paginated list of posts from a social media profile.

Input
Profile ID
Before date
After date
Page
Result
Previous page
Next page
Posts

1.Choose a provider

2.Use GetProfilePosts with mock in your code

npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('social-media/posts@1.0.1');

  // Use the profile
  const result = await profile
    .getUseCase('GetProfilePosts')
    .perform({
      profileId: '',
      beforeDate: '',
      afterDate: '',
      page: ''
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

profileId
Identifier of a profile to retrieve posts from. May be optional with some providers.
beforeDate
Filter posts that have been created before the date in ISO 8601 date and time format.
afterDate
Filter posts that have been created after the date in ISO 8601 date and time format.
page
Pagination cursor (obtained from `previousPage` or `nextPage`).

Example

{
  "profileId": "",
  "beforeDate": "",
  "afterDate": "",
  "page": ""
}

Result (object)

previousPage
Previous page cursor.
nextPage
Next page cursor.
posts
List of posts ordered by creation date. Latest posts are on the top of the list.

Example

{
  "previousPage": "",
  "nextPage": "",
  "posts": [
    {
      "id": "",
      "url": "",
      "createdAt": "",
      "text": "",
      "attachments": [
        {
          "type": "",
          "url": "",
          "preview": "",
          "title": "",
          "description": "",
          "altText": "",
          "duration": 42,
          "width": 42,
          "height": 42
        }
      ]
    }
  ]
}

Implementation details

Provider
mock
Use case
GetProfilePosts
Author
@superface
Source
Verified