ora/ts/ora.classes.list.ts

64 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

2020-06-21 16:06:11 +00:00
import * as plugins from './ora.plugins';
2020-06-21 16:27:02 +00:00
import { OraProject } from './ora.classes.project';
2020-06-21 18:41:04 +00:00
import { OraTask } from './ora.classes.task';
2020-06-21 16:06:11 +00:00
2020-06-21 18:41:04 +00:00
/**
* the interface for an ora list
*/
export interface IOraList {
actions: number;
archived: false;
color: string;
id: number;
list_type: number;
position: number;
project_id: number;
public: boolean;
title: string;
updated_at: string;
view_id: number;
}
export class OraList implements IOraList {
2020-06-21 16:27:02 +00:00
// ======
// STATIC
// ======
public static async getAllLists(oraProjectRef: OraProject) {
2020-06-21 18:41:04 +00:00
const response = await oraProjectRef.oraOrganizationRef.oraRef.request(
`/projects/${oraProjectRef.id}/lists`,
'GET'
);
2020-06-21 16:27:02 +00:00
const oraLists: OraList[] = [];
for (const dataObject of response.data) {
oraLists.push(new OraList(oraProjectRef, dataObject));
}
return oraLists;
}
// ========
// INSTANCE
// ========
2020-06-21 18:41:04 +00:00
public actions: number;
public archived: false;
public color: string;
public id: number;
public list_type: number;
public position: number;
public project_id: number;
public public: boolean;
public title: string;
public updated_at: string;
public view_id: number;
2020-06-21 16:27:02 +00:00
public oraProjectObjectRef: OraProject;
constructor(oraProjectRefArg: OraProject, creationObjectArg) {
this.oraProjectObjectRef = oraProjectRefArg;
Object.assign(this, creationObjectArg);
}
2020-06-21 18:41:04 +00:00
public async getTasks() {
return OraTask.getAllOraTasks(this);
}
}