Skip to content

Commit 061d0cf

Browse files
Working hours
1 parent f0447f3 commit 061d0cf

7 files changed

Lines changed: 24 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@linkedapi/node",
3-
"version": "2.3.5",
3+
"version": "2.3.6",
44
"description": "Control your LinkedIn accounts and retrieve real-time data, all through this Node.js SDK.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/core/operation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export abstract class Operation<TParams, TResult> {
107107
workflowId,
108108
workflowStatus: workflowResult.workflowStatus,
109109
message: workflowResult.message,
110+
pendingReason: workflowResult.pendingReason ?? null,
110111
};
111112
}
112113

src/types/errors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export const LINKED_API_ERROR = {
7979
linkedinAccountSignedOut: 'linkedinAccountSignedOut',
8080
languageNotSupported: 'languageNotSupported',
8181
workflowTimeout: 'workflowTimeout',
82+
outsideWorkingHours: 'outsideWorkingHours',
83+
workingHoursWaitExpired: 'workingHoursWaitExpired',
8284
httpError: 'httpError',
8385
tooManyRequests: 'tooManyRequests',
8486
accountNotFound: 'accountNotFound',

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export * from './errors';
33
export * from './params';
44
export * from './responses';
55
export * from './workflow-in-progress-response.type';
6+
export * from './workflow-pending-reason.type';
67
export * from './workflow-started-response.type';
78
export * from './workflows';
89
export * from './webhooks';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Why a workflow is still pending rather than running.
3+
*
4+
* - `queued` — waiting its turn behind other work on the same LinkedIn account.
5+
* - `outsideWorkingHours` — the account has working hours configured with the `pending` off-hours
6+
* policy, and the workflow starts automatically once the window reopens.
7+
*/
8+
export const LINKED_API_WORKFLOW_PENDING_REASON = {
9+
queued: 'queued',
10+
outsideWorkingHours: 'outsideWorkingHours',
11+
} as const;
12+
13+
export type TWorkflowPendingReason =
14+
(typeof LINKED_API_WORKFLOW_PENDING_REASON)[keyof typeof LINKED_API_WORKFLOW_PENDING_REASON];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import { TWorkflowPendingReason } from './workflow-pending-reason.type';
12
import { TWorkflowInProgressStatus } from './workflows';
23

34
export interface TWorkflowStartedResponse {
45
workflowId: string;
56
workflowStatus: TWorkflowInProgressStatus;
67
message?: string;
8+
pendingReason?: TWorkflowPendingReason | null;
79
}

src/types/workflows.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { TLinkedApiActionError } from '../types/errors';
22

3+
import { TWorkflowPendingReason } from './workflow-pending-reason.type';
4+
35
export interface TSingleActionWorkflowDefinition {
46
actionType: string;
57
[key: string]: unknown;
@@ -42,6 +44,7 @@ export interface TWorkflowStatusResponse {
4244
workflowId: string;
4345
workflowStatus: TWorkflowStatus;
4446
message?: string;
47+
pendingReason?: TWorkflowPendingReason | null;
4548
}
4649

4750
export interface TWorkflowResponse<

0 commit comments

Comments
 (0)