src/gsuite/tasks/task.service.ts
Optional query parameters for tasks
completedMax |
completedMax: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:16
|
Upper bound for a task's completion date to filter by. Optional. The default is not to filter by completion date. |
completedMin |
completedMin: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:20
|
Lower bound for a task's completion date to filter by. Optional. The default is not to filter by completion date. |
dueMax |
dueMax: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:24
|
Upper bound for a task's due date to filter by. Optional. The default is not to filter by due date. |
dueMin |
dueMin: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:28
|
Lower bound for a task's due date to filter by. Optional. The default is not to filter by due date. |
maxResults |
maxResults: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:32
|
Maximum number of task lists returned on one page. Optional. The default is 100. |
pageToken |
pageToken: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:36
|
Token specifying the result page to return. Optional. |
showCompleted |
showCompleted: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:40
|
Flag indicating whether completed tasks are returned in the result. Optional. The default is True. |
showDeleted |
showDeleted: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:44
|
Flag indicating whether deleted tasks are returned in the result. Optional. The default is False. |
showHidden |
showHidden: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:48
|
Flag indicating whether hidden tasks are returned in the result. Optional. The default is False. |
updatedMin |
updatedMin: |
Type : void
|
Defined in src/gsuite/tasks/task.service.ts:52
|
Lower bound for a task's last modification time to filter by. Optional. The default is not to filter by last modification time. |
import {Injectable} from "@angular/core";
import {Observable} from "rxjs/Observable";
import {BaseService} from "../shared/base.service";
import {ResponseType} from "../shared/response-type.model";
import {Task} from "./task.model";
import "rxjs/add/operator/catch";
import "rxjs/add/operator/map";
/**
* Optional query parameters for tasks
*/
export interface TaskQueryOptions {
/**
* Upper bound for a task's completion date to filter by. Optional. The default is not to filter by completion date.
*/
completedMax?: string;
/**
* Lower bound for a task's completion date to filter by. Optional. The default is not to filter by completion date.
*/
completedMin?: string;
/**
* Upper bound for a task's due date to filter by. Optional. The default is not to filter by due date.
*/
dueMax?: string;
/**
* Lower bound for a task's due date to filter by. Optional. The default is not to filter by due date.
*/
dueMin?: string;
/**
* Maximum number of task lists returned on one page. Optional. The default is 100.
*/
maxResults?: number;
/**
* Token specifying the result page to return. Optional.
*/
pageToken?: string;
/**
* Flag indicating whether completed tasks are returned in the result. Optional. The default is True.
*/
showCompleted?: boolean;
/**
* Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.
*/
showDeleted?: boolean;
/**
* Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.
*/
showHidden?: boolean;
/**
* Lower bound for a task's last modification time to filter by. Optional. The default is not to filter by last modification time.
*/
updatedMin?: string;
}
@Injectable()
export class TaskService {
/**
* relative url to the tasks api
* @type {string}
*/
private api = '/tasks/v1/lists/';
/**
* Creates the TaskService
* @param service Injected internal http service for interacting with google apis
*/
constructor(private service: BaseService) {
}
/**
* Returns all tasks in the specified task list.
* @param authToken The authenticated user's token.
* @param tasklist Task list identifier.
* @return {Observable<R>} Tasks for specified Tasklist of the authenticated user.
*/
public list(authToken: string, tasklist: string, options?: TaskQueryOptions): Observable<Array<Task>> {
return this.service.get(this.api + tasklist + "/tasks", authToken)
.map(res => <ResponseType>res.json())
.map(res => <Array<Task>>res.items);
}
}