@coasy/piece-coasy 0.1.1-dev.1 → 0.1.2-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/actions/create-event-participant.ts +25 -16
- package/src/lib/actions/create-funnel-participant.ts +17 -10
- package/src/lib/actions/create-voucher.ts +21 -13
- package/src/lib/actions/enroll-user-course.ts +29 -19
- package/src/lib/actions/find-event.ts +21 -13
- package/src/lib/triggers/cancelled-order.ts +0 -4
- package/src/lib/triggers/new-webinar-participant.ts +0 -9
- package/src/lib/common/actions.ts +0 -24
package/package.json
CHANGED
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
import { createAction, Property } from
|
|
2
|
-
import { coasyAuth } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const name = 'createEventParticipant';
|
|
1
|
+
import { createAction, Property } from "@activepieces/pieces-framework";
|
|
2
|
+
import { coasyAuth } from "../..";
|
|
3
|
+
import { CoasyClient } from "../common/coasyClient";
|
|
6
4
|
|
|
7
5
|
export const createEventParticipant = createAction({
|
|
8
6
|
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName:
|
|
11
|
-
description:
|
|
7
|
+
name: "createEventParticipant",
|
|
8
|
+
displayName: "Create Event Participant",
|
|
9
|
+
description: "Creates a new event participant",
|
|
12
10
|
props: {
|
|
13
11
|
eventId: Property.ShortText({
|
|
14
|
-
displayName:
|
|
15
|
-
description:
|
|
16
|
-
required: true
|
|
12
|
+
displayName: "Event ID",
|
|
13
|
+
description: "ID of event",
|
|
14
|
+
required: true
|
|
17
15
|
}),
|
|
18
16
|
categoryId: Property.ShortText({
|
|
19
|
-
displayName:
|
|
20
|
-
description:
|
|
21
|
-
required: false
|
|
22
|
-
})
|
|
17
|
+
displayName: "Category ID",
|
|
18
|
+
description: "ID of category",
|
|
19
|
+
required: false
|
|
20
|
+
})
|
|
23
21
|
},
|
|
24
|
-
run
|
|
22
|
+
async run(configValue) {
|
|
23
|
+
const { propsValue, auth } = configValue;
|
|
24
|
+
const client = new CoasyClient(
|
|
25
|
+
auth.baseUrl ?? "https://backend.api.prod.coasy.io",
|
|
26
|
+
auth.apiKey
|
|
27
|
+
);
|
|
28
|
+
const request = {
|
|
29
|
+
eventId: propsValue.eventId,
|
|
30
|
+
categoryId: propsValue.categoryId
|
|
31
|
+
};
|
|
32
|
+
return client.action("createEventParticipant", request);
|
|
33
|
+
}
|
|
25
34
|
});
|
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
2
|
import { coasyAuth } from '../../index';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const name = 'createFunnelParticipant';
|
|
3
|
+
import { CoasyClient } from '../common/coasyClient';
|
|
6
4
|
|
|
7
5
|
export const createFunnelParticipant = createAction({
|
|
8
6
|
auth: coasyAuth,
|
|
9
|
-
name,
|
|
7
|
+
name: 'createFunnelParticipant',
|
|
10
8
|
displayName: 'Create Funnel Participant',
|
|
11
9
|
description: 'Create a new funnel participant',
|
|
12
10
|
props: {
|
|
13
11
|
funnelId: Property.ShortText({
|
|
14
12
|
displayName: 'Funnel ID',
|
|
15
13
|
description: 'ID of funnel',
|
|
16
|
-
required: true
|
|
14
|
+
required: true
|
|
17
15
|
}),
|
|
18
16
|
firstName: Property.ShortText({
|
|
19
17
|
displayName: 'First name',
|
|
20
18
|
description: 'first name of participant',
|
|
21
|
-
required: true
|
|
19
|
+
required: true
|
|
22
20
|
}),
|
|
23
21
|
lastName: Property.ShortText({
|
|
24
22
|
displayName: 'Last name',
|
|
25
23
|
description: 'last name of participant',
|
|
26
|
-
required: false
|
|
24
|
+
required: false
|
|
27
25
|
}),
|
|
28
26
|
email: Property.ShortText({
|
|
29
27
|
displayName: 'Email',
|
|
30
28
|
description: 'email address of partipant',
|
|
31
|
-
required: true
|
|
32
|
-
})
|
|
29
|
+
required: true
|
|
30
|
+
})
|
|
33
31
|
},
|
|
34
|
-
run
|
|
32
|
+
async run(configValue) {
|
|
33
|
+
const { propsValue, auth } = configValue;
|
|
34
|
+
const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
|
|
35
|
+
const request = {
|
|
36
|
+
email: propsValue.email,
|
|
37
|
+
firstName: propsValue.firstName,
|
|
38
|
+
funnelId: propsValue.funnelId
|
|
39
|
+
};
|
|
40
|
+
return client.action('createFunnelParticipant', request);
|
|
41
|
+
}
|
|
35
42
|
});
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { createAction, Property } from
|
|
2
|
-
import { coasyAuth } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const name = 'createVoucher';
|
|
1
|
+
import { createAction, Property } from "@activepieces/pieces-framework";
|
|
2
|
+
import { coasyAuth } from "../..";
|
|
3
|
+
import { CoasyClient } from "../common/coasyClient";
|
|
6
4
|
|
|
7
5
|
export const createVoucher = createAction({
|
|
8
6
|
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName:
|
|
11
|
-
description:
|
|
7
|
+
name: "createVoucher",
|
|
8
|
+
displayName: "Create Voucher",
|
|
9
|
+
description: "Creates a new voucher",
|
|
12
10
|
props: {
|
|
13
11
|
offerId: Property.ShortText({
|
|
14
|
-
displayName:
|
|
15
|
-
description:
|
|
16
|
-
required: true
|
|
17
|
-
})
|
|
12
|
+
displayName: "Offer ID",
|
|
13
|
+
description: "ID of offer",
|
|
14
|
+
required: true
|
|
15
|
+
})
|
|
18
16
|
},
|
|
19
|
-
run
|
|
17
|
+
async run(configValue) {
|
|
18
|
+
const { propsValue, auth } = configValue;
|
|
19
|
+
const client = new CoasyClient(
|
|
20
|
+
auth.baseUrl ?? "https://backend.api.prod.coasy.io",
|
|
21
|
+
auth.apiKey
|
|
22
|
+
);
|
|
23
|
+
const request = {
|
|
24
|
+
offerId: propsValue.offerId
|
|
25
|
+
};
|
|
26
|
+
return client.action("createVoucher", request);
|
|
27
|
+
}
|
|
20
28
|
});
|
|
@@ -1,30 +1,40 @@
|
|
|
1
|
-
import { createAction, Property } from
|
|
2
|
-
import { coasyAuth } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const name = 'enrollUserCourse';
|
|
1
|
+
import { createAction, Property } from "@activepieces/pieces-framework";
|
|
2
|
+
import { coasyAuth } from "../..";
|
|
3
|
+
import { CoasyClient } from "../common/coasyClient";
|
|
6
4
|
|
|
7
5
|
export const enrollUserCourse = createAction({
|
|
8
6
|
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName:
|
|
11
|
-
description:
|
|
7
|
+
name: "enrollUserCourse",
|
|
8
|
+
displayName: "Enroll User Course",
|
|
9
|
+
description: "Enrolls user course",
|
|
12
10
|
props: {
|
|
13
11
|
userId: Property.ShortText({
|
|
14
|
-
displayName:
|
|
15
|
-
description:
|
|
16
|
-
required: true
|
|
12
|
+
displayName: "User ID",
|
|
13
|
+
description: "ID of User",
|
|
14
|
+
required: true
|
|
17
15
|
}),
|
|
18
16
|
courseId: Property.ShortText({
|
|
19
|
-
displayName:
|
|
20
|
-
description:
|
|
21
|
-
required: true
|
|
17
|
+
displayName: "Course ID",
|
|
18
|
+
description: "ID of Course",
|
|
19
|
+
required: true
|
|
22
20
|
}),
|
|
23
21
|
directGrant: Property.Checkbox({
|
|
24
|
-
displayName:
|
|
25
|
-
description:
|
|
26
|
-
required: true
|
|
27
|
-
})
|
|
22
|
+
displayName: "Direct Grant",
|
|
23
|
+
description: "Give direct grant",
|
|
24
|
+
required: true
|
|
25
|
+
})
|
|
28
26
|
},
|
|
29
|
-
run
|
|
27
|
+
async run(configValue) {
|
|
28
|
+
const { propsValue, auth } = configValue;
|
|
29
|
+
const client = new CoasyClient(
|
|
30
|
+
auth.baseUrl ?? "https://backend.api.prod.coasy.io",
|
|
31
|
+
auth.apiKey
|
|
32
|
+
);
|
|
33
|
+
const request = {
|
|
34
|
+
userId: propsValue.userId,
|
|
35
|
+
courseId: propsValue.courseId,
|
|
36
|
+
directGrant: propsValue.directGrant
|
|
37
|
+
};
|
|
38
|
+
return client.action("enrollUserCourse", request);
|
|
39
|
+
}
|
|
30
40
|
});
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { createAction, Property } from
|
|
2
|
-
import { coasyAuth } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const name = 'findEvent';
|
|
1
|
+
import { createAction, Property } from "@activepieces/pieces-framework";
|
|
2
|
+
import { coasyAuth } from "../..";
|
|
3
|
+
import { CoasyClient } from "../common/coasyClient";
|
|
6
4
|
|
|
7
5
|
export const findEvent = createAction({
|
|
8
6
|
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName:
|
|
11
|
-
description:
|
|
7
|
+
name: "findEvent",
|
|
8
|
+
displayName: "Find Event",
|
|
9
|
+
description: "Finds Event",
|
|
12
10
|
props: {
|
|
13
11
|
title: Property.ShortText({
|
|
14
|
-
displayName:
|
|
15
|
-
description:
|
|
16
|
-
required: false
|
|
17
|
-
})
|
|
12
|
+
displayName: "Title",
|
|
13
|
+
description: "Title Name",
|
|
14
|
+
required: false
|
|
15
|
+
})
|
|
18
16
|
},
|
|
19
|
-
run
|
|
17
|
+
async run(configValue) {
|
|
18
|
+
const { propsValue, auth } = configValue;
|
|
19
|
+
const client = new CoasyClient(
|
|
20
|
+
auth.baseUrl ?? "https://backend.api.prod.coasy.io",
|
|
21
|
+
auth.apiKey
|
|
22
|
+
);
|
|
23
|
+
const request = {
|
|
24
|
+
title: propsValue.title
|
|
25
|
+
};
|
|
26
|
+
return client.action("findEvent", request);
|
|
27
|
+
}
|
|
20
28
|
});
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
<<<<<<< Updated upstream
|
|
2
1
|
import {
|
|
3
2
|
createTrigger,
|
|
4
3
|
Property,
|
|
5
4
|
TriggerStrategy,
|
|
6
5
|
} from '@activepieces/pieces-framework';
|
|
7
|
-
=======
|
|
8
|
-
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
|
9
|
-
>>>>>>> Stashed changes
|
|
10
6
|
import { coasyAuth } from '../..';
|
|
11
7
|
import {
|
|
12
8
|
createCoasyTrigger,
|
|
@@ -30,7 +30,6 @@ export const newWebinarParticipant = createTrigger({
|
|
|
30
30
|
options: {
|
|
31
31
|
options: [
|
|
32
32
|
{
|
|
33
|
-
<<<<<<< Updated upstream
|
|
34
33
|
label: 'Upcoming',
|
|
35
34
|
value: 'UPCOMING',
|
|
36
35
|
},
|
|
@@ -41,14 +40,6 @@ export const newWebinarParticipant = createTrigger({
|
|
|
41
40
|
{
|
|
42
41
|
label: 'Not Attended',
|
|
43
42
|
value: 'NOT_ATTENDED',
|
|
44
|
-
=======
|
|
45
|
-
label: 'Instantly',
|
|
46
|
-
value: 'INSTANTLY',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
label: 'Later',
|
|
50
|
-
value: 'LATER',
|
|
51
|
-
>>>>>>> Stashed changes
|
|
52
43
|
},
|
|
53
44
|
],
|
|
54
45
|
},
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ActionContext,
|
|
3
|
-
InputPropertyMap,
|
|
4
|
-
} from '@activepieces/pieces-framework';
|
|
5
|
-
import { coasyAuth } from '../..';
|
|
6
|
-
import { CoasyClient } from './coasyClient';
|
|
7
|
-
|
|
8
|
-
export const runCoasyAction = async <T extends InputPropertyMap>(
|
|
9
|
-
configValue: ActionContext<typeof coasyAuth, T>,
|
|
10
|
-
action: string
|
|
11
|
-
) => {
|
|
12
|
-
const { propsValue, auth: authPayload } = configValue;
|
|
13
|
-
const client = new CoasyClient(
|
|
14
|
-
authPayload.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
15
|
-
authPayload.apiKey
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const { ...restPropsValue } = propsValue;
|
|
19
|
-
|
|
20
|
-
delete restPropsValue['auth'];
|
|
21
|
-
|
|
22
|
-
const request = { ...restPropsValue };
|
|
23
|
-
return client.action(action, request);
|
|
24
|
-
};
|