6.5.0 • Published 3 months ago

@vendasta/task v6.5.0

Weekly downloads
642
License
ISC
Repository
-
Last release
3 months ago

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 => ...);
6.5.0

3 months ago

6.4.0

3 months ago

6.3.0

1 year ago

6.2.0

1 year ago

6.1.0

2 years ago

6.0.0

2 years ago

5.0.0

2 years ago

4.1.0

2 years ago

4.0.0

2 years ago

4.2.0

2 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.3.0

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.5.2

3 years ago

2.5.1

3 years ago

2.5.0

3 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.12.0

4 years ago

1.11.0

4 years ago

1.10.2

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

0.0.1

5 years ago