Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a route to share based on a configuration file #5

Open
gabrielstuff opened this issue Mar 6, 2017 · 5 comments
Open

Make a route to share based on a configuration file #5

gabrielstuff opened this issue Mar 6, 2017 · 5 comments

Comments

@gabrielstuff
Copy link
Member

Sharing should be easy as using one route.
Based on the configuration the route will handle the automatic sharing principle

@4quet
Copy link
Contributor

4quet commented Mar 20, 2017

Performing a POST request on the share route should call all concerned routes.
Example:

POST /api/v1/actions/share
{
  "twitter": { "message": "hello world !" },
  "mandrill": { "email": "[email protected]" }
}

The request above will perform:

POST /api/v1/actions/twitter
{
  "message": "hello world!"
}

and

POST /api/v1/actions/mandrill
{
  "email": "[email protected]"
}

@4quet
Copy link
Contributor

4quet commented Mar 23, 2017

Different proposition: the share route will receive an object with all kind of data:

{
  "media": "/path/to/media",
  "filename": "media.jpg",
  "thumbnail": "/path/to/thumbnail",
  "email": {
    "from": "[email protected]",
    "to": "[email protected]"
  },
  "meta": "..."
}

Then each action is configured to pick whatever it needs inside this object to share content.
Example (in settings.json):

"twitter": {
  "mediaKey": "media",
  "filenameKey": "filename"
}

@4quet
Copy link
Contributor

4quet commented Mar 24, 2017

Different proposition: All actions use the same standard set of data and use only what they need.
The share route will only dispatch this set of data among all different actions.
Example: all actions should be able to handle this object:

{
    "media": {
        "name": "...",
        "content": "..."
    },
    "thumbnail": {
        "name": "",
        "content": ""
    },
    "email": {
        "from": "",
        "to": "",
        "firstname": "",
        "lastname": "",
        "subject": "",
        "text": "",
        "html": "",
        "template": "",
        "attachments": [{
            "name": "",
            "content": ""
        }],
        "vars": ""
    },
    "title": "",
    "description": "",
    "message": "...",
    "source": "",
    "destination": "",
    "user": "",
    "password": "",
    "hostname": "",
    "target": "",
    "privacyStatus": "",
    "uploadDirectoryPath": "",
    "uploadDirectoryID": "",
    "printer": "",
    "format": "",
    "copies": "",
    "options": "",
    "bucket": "",
    "token": ""
}

@4quet
Copy link
Contributor

4quet commented Mar 27, 2017

Final JSON:

  {
    "path": "path to a file / url",
    "file": "myFile.jpg",
    "type": "image/jpg",
    "details": {
      "width": 1024,
      "height": 1024,
      "thumbnail": {
        "file": "myThumb.jpg",
        "width": 128,
        "height": 128,
        "type": "image/jpg",
        "source": "path to a file / url"
      }
    },
    "meta": {
        "email": {
            "from": "",
            "to": "",
            "firstname": "",
            "lastname": "",
            "subject": "",
            "text": "",
            "html": "",
            "template": "",
            "attachments": [{
                "name": "",
                "content": ""
            }],
            "vars": ""
        },
        "title": "",
        "description": "",
        "message": "...",
        "source": "",
        "destination": "",
        "user": "",
        "password": "",
        "hostname": "",
        "target": "",
        "privacyStatus": "",
        "uploadDirectoryPath": "",
        "uploadDirectoryID": "",
        "printer": "",
        "format": "",
        "copies": "",
        "options": "",
        "bucket": "",
        "token": ""
    }
  }

The meta field can adapt according to the called actions.

@gabrielstuff
Copy link
Member Author

In the V2 of altruist, this option seems mandatory. Recently I've been posting using : base64 and formData for sharing on:

  • mandrill
  • print
  • socialite

It is completely useless to repost the Data. This should be optional and not mandatory. It also appears to be a great option to be able to post a link to the media (image, video or sound) that we want to share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants