@vendasta/task v6.5.0
task SDK
Installation
npm i @vendasta/task
Usage
In your module file (app.module in this instance):
import { TaskModule } from '@vendasta/task';
@NgModule({
...
imports: [
...,
TaskModule,
]
}
export class AppModule {}
Then in a service:
import {TaskSdkService} from '@vendasta/task';
export class MyService {
constructor(private taskSdk: TaskSdkService) {}
}
Access
Presently (as of 2020-02-19) the only personas that can view tasks are the digital_agent
, sales_person
, partner
and smb
and the
personas that can write to tasks are digital_agent
and sales_person
(Superadmin can do both of these of course).
If further personas require access there should be some work done to genericize who can access tasks, such as setting
up an endpoint to register personas so it doesn't have to be done manually.
Unlike the Go sdk the typescript sdk handles adding access
to the Metadata field for you, this is to help with access and querying
Ex: Creating a task a digital_agent
has write access to:
import { PersonaType } from '@vendasta/core/iam';
import { GenerateTaskRequest } from '@vendasta/task';
const req: GenerateTaskRequest = {
namespace: TaskApiService.buildAccountGroupNamespace(partnerId, accountGroupId),
taskId: TaskApiService.generateTaskId(),
title: 'My Task',
status: 'Open',
taskType: 'Generic',
access: PersonaType.digital_agent,
dueDate: new Date(),
};
this.taskApiService.generate(req).subscribe();
Then to query for all tasks a digital_agent
has access to for the ABC partner:
import { PersonaType } from '@vendasta/core/iam';
import { KeyValuesInterface, RangeField, SearchTaskRequest } from '@vendasta/task';
const searchMetadata: KeyValuesInterface = {
keyValues: [
{
key: 'partner',
values: [
{
type: 'string',
stringValue: 'ABC',
},
],
},
],
};
const request: SearchTaskRequest = {
access: [PersonaType.digital_agent],
metadata: searchMetadata,
dateRangeField: RangeField.RANGE_FIELD_DUE_DATE,
deletedOnly: false,
excludeHistory: true,
sorts: [
{ field: <sortField>, direction: <sortDirection> },
{ field: 'type', direction: 1 },
{ field: 'title', direction: 1 },
],
pageSize: 25,
};
this.taskApiService.search(request).subscribe(response => ...);
3 months ago
3 months ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago