I hereby claim:
- I am garvice on github.
- I am geakins (https://keybase.io/geakins) on keybase.
- I have a public key ASCgUShZTd-O9Ogu0h03tUxEo5su8vLXyhStgtWW-9fpwAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
deleteTodos(rowIds: Array<number>) { | |
const idsToDelete = rowIds.join(); | |
this.http.delete(SMARTSHEET_URL + '/sheets/' + SHEET_ID + '/rows?ids=' + idsToDelete, | |
{headers: this.getHeaders()}); | |
} |
updateTodo(rowId: number) { | |
const updatedTodo = { id: rowId, cells: [{ columnId: DONE_COLUMN_ID, value: true }] }; | |
this.http.put(SMARTSHEET_URL + '/sheets/' + SHEET_ID + '/rows', updatedTodo, | |
{headers: this.getHeaders()}); | |
} |
addTodo(newTodoName: string) { | |
const newTodo = { toBottom: true, cells: [{ columnId: TASK_NAME_COLUMN_ID, value: newTodoName }] }; | |
this.http.post(SMARTSHEET_URL + '/sheets/' + SHEET_ID + '/rows', newTodo, | |
{headers: this.getHeaders()}); | |
} |
const TASK_NAME_COLUMN_ID: number = 123456789; | |
const DONE_COLUMN_ID: number = 123456789; | |
private extractTodos(rows: Array<any>): Array<Todo> { | |
const todos = new Array<Todo>(); | |
rows.forEach(row => { | |
let todo = new Todo(row.id); | |
row.cells.forEach(cell => { |
"columns": [ | |
{ | |
"id": 6908186209871748, | |
"index": 0, | |
"title": "Task Name", | |
"type": "TEXT_NUMBER", | |
"primary": true, | |
"width": 230 | |
}, | |
{ |
const SMARTSHEET_URL: string = 'https://api.smartsheet.com/2.0' | |
const SHEET_ID: number = 123456789; | |
const API_TOKEN: string = 'Bearer ' + 'API Token'; | |
getTodos(): Observable<Array<Todo>> { | |
let todos = this.http | |
.get(this.SMARTSHEET_URL + '/sheets/' + this.SHEET_ID, {headers: this.getHeaders()}) | |
.map(extractTodos); | |
return todos; | |
} |