@scopieflows/app-assembled 0.1.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.
Files changed (50) hide show
  1. package/README.md +7 -0
  2. package/package.json +28 -0
  3. package/src/i18n/de.json +82 -0
  4. package/src/i18n/es.json +82 -0
  5. package/src/i18n/fr.json +82 -0
  6. package/src/i18n/ja.json +82 -0
  7. package/src/i18n/nl.json +82 -0
  8. package/src/i18n/pt.json +82 -0
  9. package/src/i18n/translation.json +82 -0
  10. package/src/i18n/zh.json +82 -0
  11. package/src/index.d.ts +1 -0
  12. package/src/index.js +38 -0
  13. package/src/index.js.map +1 -0
  14. package/src/lib/actions/add-shift.d.ts +8 -0
  15. package/src/lib/actions/add-shift.js +83 -0
  16. package/src/lib/actions/add-shift.js.map +1 -0
  17. package/src/lib/actions/custom-api-call.d.ts +12 -0
  18. package/src/lib/actions/custom-api-call.js +20 -0
  19. package/src/lib/actions/custom-api-call.js.map +1 -0
  20. package/src/lib/actions/custom-graphql.d.ts +4 -0
  21. package/src/lib/actions/custom-graphql.js +25 -0
  22. package/src/lib/actions/custom-graphql.js.map +1 -0
  23. package/src/lib/actions/delete-OOO.d.ts +3 -0
  24. package/src/lib/actions/delete-OOO.js +32 -0
  25. package/src/lib/actions/delete-OOO.js.map +1 -0
  26. package/src/lib/actions/get-user-schedule.d.ts +5 -0
  27. package/src/lib/actions/get-user-schedule.js +40 -0
  28. package/src/lib/actions/get-user-schedule.js.map +1 -0
  29. package/src/lib/actions/ooo.d.ts +9 -0
  30. package/src/lib/actions/ooo.js +95 -0
  31. package/src/lib/actions/ooo.js.map +1 -0
  32. package/src/lib/actions/update-OOO.d.ts +9 -0
  33. package/src/lib/actions/update-OOO.js +90 -0
  34. package/src/lib/actions/update-OOO.js.map +1 -0
  35. package/src/lib/common/auth.d.ts +1 -0
  36. package/src/lib/common/auth.js +10 -0
  37. package/src/lib/common/auth.js.map +1 -0
  38. package/src/lib/common/index.d.ts +10 -0
  39. package/src/lib/common/index.js +34 -0
  40. package/src/lib/common/index.js.map +1 -0
  41. package/src/lib/triggers/OOO-status-changed.d.ts +2 -0
  42. package/src/lib/triggers/OOO-status-changed.js +62 -0
  43. package/src/lib/triggers/OOO-status-changed.js.map +1 -0
  44. package/src/lib/triggers/new-OOO-request.d.ts +2 -0
  45. package/src/lib/triggers/new-OOO-request.js +50 -0
  46. package/src/lib/triggers/new-OOO-request.js.map +1 -0
  47. package/src/lib/triggers/schedule-updated.d.ts +2 -0
  48. package/src/lib/triggers/schedule-updated.js +44 -0
  49. package/src/lib/triggers/schedule-updated.js.map +1 -0
  50. package/test-endpoints.md +35 -0
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assembledAuth = void 0;
4
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
5
+ exports.assembledAuth = pieces_framework_1.PieceAuth.SecretText({
6
+ displayName: 'API Key',
7
+ description: `You can obtain API key by navigating to [Settings->API](https://app.assembledhq.com/settings/api) page.`,
8
+ required: true,
9
+ });
10
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,oEAA0D;AAE7C,QAAA,aAAa,GAAG,4BAAS,CAAC,UAAU,CAAC;IAChD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,yGAAyG;IACtH,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { HttpMethod } from '@scopieflows/pieces-common';
2
+ export declare const assembledCommon: {
3
+ baseUrl: string;
4
+ makeRequest(auth: string, method: HttpMethod, endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<import("@scopieflows/pieces-common").HttpResponse<any>>;
5
+ formatDateTime(date: string | Date): string;
6
+ formatDate(date: string | Date): string;
7
+ makeClient(auth: string): {
8
+ rawRequest: (query: string, variables?: Record<string, unknown>) => Promise<any>;
9
+ };
10
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assembledCommon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@scopieflows/pieces-common");
6
+ exports.assembledCommon = {
7
+ baseUrl: 'https://api.assembledhq.com/v0',
8
+ makeRequest(auth, method, endpoint, body, headers) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const url = endpoint.startsWith('http') ? endpoint : `${this.baseUrl}${endpoint}`;
11
+ return yield pieces_common_1.httpClient.sendRequest({
12
+ method,
13
+ url,
14
+ headers: Object.assign({ 'Authorization': `Basic ${Buffer.from(auth + ':').toString('base64')}`, 'Content-Type': 'application/json' }, headers),
15
+ body,
16
+ });
17
+ });
18
+ },
19
+ formatDateTime(date) {
20
+ return new Date(date).toISOString();
21
+ },
22
+ formatDate(date) {
23
+ return new Date(date).toISOString().split('T')[0];
24
+ },
25
+ makeClient(auth) {
26
+ return {
27
+ rawRequest: (query, variables) => tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const response = yield this.makeRequest(auth, pieces_common_1.HttpMethod.POST, '/graphql', { query, variables });
29
+ return response.body;
30
+ })
31
+ };
32
+ }
33
+ };
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,8DAAoE;AAEvD,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,gCAAgC;IAEnC,WAAW,CACf,IAAY,EACZ,MAAkB,EAClB,QAAgB,EAChB,IAAc,EACd,OAAgC;;YAEhC,MAAM,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;YAElF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAClC,MAAM;gBACN,GAAG;gBACH,OAAO,kBACL,eAAe,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EACtE,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACX;gBACD,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;IAED,cAAc,CAAC,IAAmB;QAChC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAED,UAAU,CAAC,IAAmB;QAC5B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,OAAO;YACL,UAAU,EAAE,CAAO,KAAa,EAAE,SAAmC,EAAE,EAAE;gBACvE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CACrC,IAAI,EACJ,0BAAU,CAAC,IAAI,EACf,UAAU,EACV,EAAE,KAAK,EAAE,SAAS,EAAE,CACrB,CAAC;gBACF,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC,CAAA;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const timeOffStatusChanged: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.timeOffStatusChanged = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const common_1 = require("../common");
7
+ const pieces_common_1 = require("@scopieflows/pieces-common");
8
+ const auth_1 = require("../common/auth");
9
+ exports.timeOffStatusChanged = (0, pieces_framework_1.createTrigger)({
10
+ auth: auth_1.assembledAuth,
11
+ name: 'OOO_status_changed',
12
+ displayName: 'OOO Status Changed',
13
+ description: 'Triggers on approval/rejection of OOO.',
14
+ type: pieces_framework_1.TriggerStrategy.POLLING,
15
+ props: {},
16
+ sampleData: {
17
+ id: '<uuid>',
18
+ time_off_request_id: '<uuid>',
19
+ created_at: 1546303260,
20
+ comment: 'Enjoy your vacation',
21
+ type: 'approve',
22
+ time_off_request: {
23
+ id: '<uuid>',
24
+ agent_id: '<uuid>',
25
+ start_time: 1546303260,
26
+ end_time: 1546303270,
27
+ created_at: 1546303260,
28
+ description: 'Going to the dentist',
29
+ status: 'approved',
30
+ activity_type_id: '<uuid>'
31
+ }
32
+ },
33
+ onEnable(context) {
34
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+ yield context.store.put('lastStatusCheck', Math.floor(Date.now() / 1000));
36
+ });
37
+ },
38
+ onDisable() {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ // No cleanup needed
41
+ });
42
+ },
43
+ run(context) {
44
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+ const lastCheck = (yield context.store.get('lastStatusCheck')) || Math.floor(Date.now() / 1000) - 86400; // 24 hours ago in Unix timestamp
46
+ const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.GET, `/time_off/updates?updated_since=${lastCheck}&type=approve`);
47
+ // Handle the documented response structure
48
+ const timeOffUpdates = response.body.time_off_updates || {};
49
+ const timeOffRequests = response.body.time_off_requests || {};
50
+ // Transform the response to include both update and request data
51
+ const statusChanges = Object.values(timeOffUpdates).map((update) => {
52
+ const request = timeOffRequests[update.time_off_request_id];
53
+ return Object.assign(Object.assign({}, update), { time_off_request: request });
54
+ });
55
+ if (statusChanges.length > 0) {
56
+ yield context.store.put('lastStatusCheck', Math.floor(Date.now() / 1000));
57
+ }
58
+ return statusChanges;
59
+ });
60
+ },
61
+ });
62
+ //# sourceMappingURL=OOO-status-changed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OOO-status-changed.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/triggers/OOO-status-changed.ts"],"names":[],"mappings":";;;;AAAA,oEAA+E;AAC/E,sCAA4C;AAC5C,8DAAwD;AACxD,yCAA+C;AAElC,QAAA,oBAAoB,GAAG,IAAA,gCAAa,EAAC;IAChD,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,wCAAwC;IACrD,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE,EAAE;IACT,UAAU,EAAE;QACV,EAAE,EAAE,QAAQ;QACZ,mBAAmB,EAAE,QAAQ;QAC7B,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,qBAAqB;QAC9B,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE;YAChB,EAAE,EAAE,QAAQ;YACZ,QAAQ,EAAE,QAAQ;YAClB,UAAU,EAAE,UAAU;YACtB,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,UAAU;YACtB,WAAW,EAAE,sBAAsB;YACnC,MAAM,EAAE,UAAU;YAClB,gBAAgB,EAAE,QAAQ;SAC3B;KACF;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,I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{ TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const newTimeOffRequest: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newTimeOffRequest = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const common_1 = require("../common");
7
+ const pieces_common_1 = require("@scopieflows/pieces-common");
8
+ const auth_1 = require("../common/auth");
9
+ exports.newTimeOffRequest = (0, pieces_framework_1.createTrigger)({
10
+ auth: auth_1.assembledAuth,
11
+ name: 'new_OOO_request',
12
+ displayName: 'New OOO Request',
13
+ description: 'Triggers when a new OOO request is created.',
14
+ type: pieces_framework_1.TriggerStrategy.POLLING,
15
+ props: {},
16
+ sampleData: {
17
+ id: '<uuid>',
18
+ agent_id: '<uuid>',
19
+ start_time: 1546303260,
20
+ end_time: 1546303270,
21
+ created_at: 1546303260,
22
+ description: 'Going to the dentist',
23
+ status: 'approved',
24
+ activity_type_id: '<uuid>',
25
+ },
26
+ onEnable(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ yield context.store.put('lastCheck', Math.floor(Date.now() / 1000));
29
+ });
30
+ },
31
+ onDisable() {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ // Cleanup if needed
34
+ });
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const lastCheck = (yield context.store.get('lastCheck')) || Math.floor(Date.now() / 1000) - 86400;
39
+ const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.GET, `/time_off/requests?updated_since=${lastCheck}&limit=100`);
40
+ // Handle the documented response structure
41
+ const timeOffRequests = response.body.time_off_requests || {};
42
+ const newRequests = Object.values(timeOffRequests);
43
+ if (newRequests.length > 0) {
44
+ yield context.store.put('lastCheck', Math.floor(Date.now() / 1000));
45
+ }
46
+ return newRequests;
47
+ });
48
+ },
49
+ });
50
+ //# sourceMappingURL=new-OOO-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-OOO-request.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/triggers/new-OOO-request.ts"],"names":[],"mappings":";;;;AAAA,oEAA+E;AAC/E,sCAA4C;AAC5C,8DAAwD;AACxD,yCAA+C;AAElC,QAAA,iBAAiB,GAAG,IAAA,gCAAa,EAAC;IAC7C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,6CAA6C;IAC1D,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE,EAAE;IACT,UAAU,EAAE;QACV,EAAE,EAAE,QAAQ;QACZ,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,UAAU;QACtB,WAAW,EAAE,sBAAsB;QACnC,MAAM,EAAE,UAAU;QAClB,gBAAgB,EAAE,QAAQ;KAC3B;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;QACtE,CAAC;KAAA;IACK,SAAS;;YACb,oBAAoB;QACtB,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,SAAS,GAAG,CAAA,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;YAEhG,MAAM,QAAQ,GAAG,MAAM,wBAAe,CAAC,WAAW,CAChD,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,0BAAU,CAAC,GAAG,EACd,oCAAoC,SAAS,YAAY,CAC1D,CAAC;YAEF,2CAA2C;YAC3C,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAC;YAC9D,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YAEnD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;YACtE,CAAC;YAED,OAAO,WAAW,CAAC;QACrB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const scheduleUpdated: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scheduleUpdated = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const common_1 = require("../common");
7
+ const pieces_common_1 = require("@scopieflows/pieces-common");
8
+ const auth_1 = require("../common/auth");
9
+ exports.scheduleUpdated = (0, pieces_framework_1.createTrigger)({
10
+ auth: auth_1.assembledAuth,
11
+ name: 'schedule_updated',
12
+ displayName: 'Schedule Updated',
13
+ description: 'Triggers when user schedule is modified.',
14
+ type: pieces_framework_1.TriggerStrategy.POLLING,
15
+ props: {},
16
+ sampleData: {
17
+ user_id: 'user_456',
18
+ schedule_id: 'sched_123',
19
+ changes: ['shift_added', 'shift_modified'],
20
+ updated_at: '2025-01-15T10:00:00Z',
21
+ },
22
+ onEnable(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ yield context.store.put('lastScheduleCheck', new Date().toISOString());
25
+ });
26
+ },
27
+ onDisable() {
28
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
+ // Cleanup if needed
30
+ });
31
+ },
32
+ run(context) {
33
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
+ const lastCheck = (yield context.store.get('lastScheduleCheck')) || new Date(Date.now() - 60 * 60 * 1000).toISOString();
35
+ const response = yield common_1.assembledCommon.makeRequest(context.auth.secret_text, pieces_common_1.HttpMethod.GET, `/events?type=schedule_updated&after=${lastCheck}&limit=100`);
36
+ const scheduleUpdates = response.body.data || [];
37
+ if (scheduleUpdates.length > 0) {
38
+ yield context.store.put('lastScheduleCheck', new Date().toISOString());
39
+ }
40
+ return scheduleUpdates;
41
+ });
42
+ },
43
+ });
44
+ //# sourceMappingURL=schedule-updated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-updated.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/assembled/src/lib/triggers/schedule-updated.ts"],"names":[],"mappings":";;;;AAAA,oEAA+E;AAC/E,sCA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,eAAe,CAAC;QACzB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ # Assembled API Test Endpoints
2
+
3
+ ## GET Requests (no body needed)
4
+ - `/users` - List all users
5
+ - `/teams` - List teams
6
+ - `/queues` - List queues
7
+ - `/time-off-requests` - List time off requests
8
+ - `/users/{user_id}` - Get specific user
9
+ - `/users/{user_id}/schedule` - Get user's schedule
10
+
11
+ ## POST Requests (need body)
12
+ - `/time-off-requests` - Create time off request
13
+ ```json
14
+ {
15
+ "user_id": "user123",
16
+ "start_date": "2024-01-15",
17
+ "end_date": "2024-01-16",
18
+ "reason": "Vacation"
19
+ }
20
+ ```
21
+
22
+ - `/users/{user_id}/shifts` - Add shift
23
+ ```json
24
+ {
25
+ "start_time": "2024-01-15T09:00:00Z",
26
+ "end_time": "2024-01-15T17:00:00Z",
27
+ "shift_type": "regular"
28
+ }
29
+ ```
30
+
31
+ ## Testing Steps
32
+ 1. Start with simple GET requests to `/users` or `/teams`
33
+ 2. Use your Assembled API key in the auth field
34
+ 3. Check the response to verify connectivity
35
+ 4. Try POST requests with sample data