An open API service indexing awesome lists of open source software.

https://github.com/albertfdp/podio-assign

A podio-js wrapper for iterating quickly from Podio model to your data model
https://github.com/albertfdp/podio-assign

Last synced: 11 months ago
JSON representation

A podio-js wrapper for iterating quickly from Podio model to your data model

Awesome Lists containing this project

README

          

# podio-assign

A wrapper for [podio-js](https://github.com/podio/podio-js) which cleans up the returned data from `Podio API` so you can start working on the actual data model, and forget about how `podio` stores it.

## Disclaimer

This library still is in work in progress.

## The problem

Imagine you have a Podio item which looks like this:

```
title: TEXT_FIELD,
description: TEXT_FIELD,
image: IMAGE_FIELD,
date: DATE_FIELD,
type: CATEGORY_FIELD,
...
```

Then, you query the API using `podio-js`, and you get something like this:

```
{"filtered":2,"total":2,"items":[{"ratings":{"like":{"average":null,"counts":{"1":{"total":0,"users":[]}}}},"last_event_on":"2015-07-12 00:53:59","rights":["comment","view","update","add_task","add_conversation","delete","subscribe","grant","rate"],"app_item_id":2,"fields":[{"type":"text","field_id":98473069,"label":"Name","values":[{"value":"Something here"}],"config":{"settings":{"format":"plain","size":"small"},"mapping":null,"label":"Name"},"external_id":"title"},{"type":"text","field_id":98473145,"label":"Description","values":[{"value":"## dnadjnja\n\n* dnjad\n* dnajd"}],"config":{"settings":{"format":"markdown","size":"large"},"mapping":null,"label":"Description"},"external_id":"description"},{"type":"category","field_id":98473157,"label":"Type","values":[{"value":{"status":"active","text":"Something else","id":2,"color":"DCEBD8"}}],"config":{"settings":{"multiple":false,"options":[{"status":"active","text":"Something here","id":2,"color":"DCEBD8"},{"status":"active","text":"Work","id":1,"color":"DCEBD8"}],"display":"inline"},"mapping":null,"label":"Type"},"external_id":"type"},{"type":"date","field_id":98473070,"label":"Date","values":[{"start_date_utc":"2015-07-01","end":"2015-07-14 00:00:00","end_date":"2015-07-14","end_date_utc":"2015-07-14","start_time_utc":null,"start_time":null,"start_date":"2015-07-01","start":"2015-07-01
...
```

> (shortened for simplicity, it more then 400 lines!!)

![](http://i.giphy.com/jg8ZYsmN3ywJq.gif)

When, you actually want something like that, right?

```js
{
title: String,
description: String,
image: Object,
date: Object,
type: String,
...
}
```

## How it works

You can use `podio-assigns` to fetch the data from Podio, and get back a hash with the `external_id` from each Podio field as a key.

To simplify this library, some corners have been cut, for instance what is the data that should be returned. Only the value? also the last modification? This is a `WIP` library, so expect breaking changes on the API when decisions on the previous issue are taken.