arifsetiawan / mosaic

Simple activity stream API server
0 stars 0 forks source link

Mosaic

Simple Node.js based social graph and activity stream API server

Functionalities

API

IMPORTANT

Read here first for PMJ styled Mosaic documentation

Activity Stream

Mosaic do not handle the details of the activity stream. It simply just doing insert and get on them. It defines some necessary field to make some queries easier.

Mosaic loosely follows Activity Streams definition of activity

Standard activity item

Refer to Activity Serialization for details about each fields in activity stream.

Check in Activity check for fields that required for specific activity verb and object.

  {
    "title": "Helmi post new review for movie The Hobbit",
    "actor": {
      "objectType": "user",
      "id": "user:id:123",
      "displayName": "Kang Helmi",
      "other key": "other value"
      "image": {
        "url": "http://example.org/user/thumbnail.jpg",
        "width": 250,
        "height": 250
      }
    },
    "verb": "post",
    "object" : {
      "objectType": "review",
      "id": "review:id:123",
      "content" : "Great movie!"
      "other key": "other value"
    },
    "target": {
      "objectType": "movie",
      "id": "movie:id:123",
      "title": "The Hobbit",
      "image": {
        "url": "http://example.org/album/thumbnail.jpg",
        "width": 250,
        "height": 250
      }
      "other key": "other value"
    },
    "privacy":"public"
  }
  {
    "title": "Helmi follow Andri",
    "actor": {
      "objectType": "user",
      "id": "user:id:123",
      "displayName": "Kang Helmi",
      "other key": "other value",
      "image": {
        "url": "http://example.org/user/thumbnail.jpg",
        "width": 250,
        "height": 250
      }
    },
    "verb": "follow",
    "object": {
      "objectType": "user",
      "id": "user:id:234",
      "displayName": "Andri",
      "image": {
        "url": "http://example.org/album/thumbnail.jpg",
        "width": 250,
        "height": 250
      },
      "other key": "other value"
    },
    "target" : {},
    "privacy":"public"
  }

Verb

Applications are free to use any verbs such as: post, follow, unfollow, plan, watch, etc.

Mosaic is handling specific verbs such as:

Title Example Breakdown

Helmi post new review for movie The Hobbit

Helmi follow Andri

Privacy options

Every friend is a follower but not every follower is a friend

Required Fields

Current implementation enforce some fields that should be existing in activity JSON body required for certain operations. Please refer to Activity check to make sure all required fields are provided.