From 2b1f673386ff043a255b619f87139179eddbde36 Mon Sep 17 00:00:00 2001 From: Aleksandr Molchagin <47938394+AleksandrMolchagin@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:55:13 -0500 Subject: [PATCH 1/4] Add `GET tasks` and `GET tasks\(taskId)\tags` --- ...alesforce Data API.postman_collection.json | 93 +++++++++++- src/main/mule/tasks.xml | 143 ++++++++++++++++++ src/main/resources/api/datatypes.raml | 32 +++- .../resources/api/salesforce-data-api.raml | 64 +++++++- 4 files changed, 329 insertions(+), 3 deletions(-) create mode 100644 src/main/mule/tasks.xml diff --git a/docs/Scores - Salesforce Data API.postman_collection.json b/docs/Scores - Salesforce Data API.postman_collection.json index dbc0147..3908e27 100644 --- a/docs/Scores - Salesforce Data API.postman_collection.json +++ b/docs/Scores - Salesforce Data API.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "efa5ea10-0550-4f96-a0f9-9a20028f5524", + "_postman_id": "3b1bae7a-292c-438d-8084-814f04f11545", "name": "Scores - Salesforce Data API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "34720049" @@ -1589,6 +1589,97 @@ "response": [] } ] + }, + { + "name": "tasks", + "item": [ + { + "name": "/tasks", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "client_id", + "value": "{{sandbox_client_id}}" + }, + { + "key": "client_secret", + "value": "{{sandbox_client_secret}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{base_url}}/tasks?contactId=003cX000008IZnXQAW", + "host": [ + "{{base_url}}" + ], + "path": [ + "tasks" + ], + "query": [ + { + "key": "contactId", + "value": "003cX000008IZnXQAW" + } + ] + }, + "description": "BODY/JSON:\n\n{ \n\"TeamSeasonName\": \"\", \n\"TeamId\": \"\", \n\"SeasonId\": \"\", \n\"SchoolSite\": \"\", \n\"Partnership\": \"\", \n\"TotalNoOfPlayers\": 0, \n\"TotalNoOfSessions\": 0, \n\"SeasonStartDate\": \"\", \n\"SeasonEndDate\": \"\", \n\"CoachSoccer\": \"\", \n\"CoachWriting\": \"\", \n\"ProgramCoordinator\": \"\", \n\"ProgramManager\": \"\" \n}" + }, + "response": [] + }, + { + "name": "/tasks/{taskId}/tags", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "client_id", + "value": "{{sandbox_client_id}}" + }, + { + "key": "client_secret", + "value": "{{sandbox_client_secret}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"contactId\": \"003U8000008Mz3RIAS\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{base_url}}/tasks/003cX000008IZnXQAW/tags", + "host": [ + "{{base_url}}" + ], + "path": [ + "tasks", + "003cX000008IZnXQAW", + "tags" + ] + }, + "description": "BODY/JSON:\n\n{ \n\"TeamSeasonName\": \"\", \n\"TeamId\": \"\", \n\"SeasonId\": \"\", \n\"SchoolSite\": \"\", \n\"Partnership\": \"\", \n\"TotalNoOfPlayers\": 0, \n\"TotalNoOfSessions\": 0, \n\"SeasonStartDate\": \"\", \n\"SeasonEndDate\": \"\", \n\"CoachSoccer\": \"\", \n\"CoachWriting\": \"\", \n\"ProgramCoordinator\": \"\", \n\"ProgramManager\": \"\" \n}" + }, + "response": [] + } + ] } ], "event": [ diff --git a/src/main/mule/tasks.xml b/src/main/mule/tasks.xml new file mode 100644 index 0000000..8384b6d --- /dev/null +++ b/src/main/mule/tasks.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + { + "Id": payload01.Id, + "AssignedBy": payload01.Assigned_By__c as String default "", + "AssignedTo": payload01.Assigned_To__c as String default "", + "CreatedBy": payload01.CreatedById as String default "", + "CreatedContact": payload01.Created_By_Contact__c as String default "", + "Description": payload01.Description__c as String default "", + "DueDate": payload01.Due_Date__c as String default "", + "LastModifiedBy": payload01.LastModifiedById as String default "", + "LastModifiedContact": payload01.Last_Modified_By_Contact__c as String default "", + "OwnerId": payload01.OwnerId as String default "", + "Priority": payload01.Priority__c as String default "", + "PriorityIcon": payload01.Priority_Icon__c as String default "", + "ResourceLink": payload01.Resource_Link__c as String default "", + "Session": payload01.Session__c as String default "", + "Name": payload01.Name as String default "", + "TaskStatus": payload01.Task_Status__c as String default "", + "TaskType": payload01.Task_Type__c as String default "" + }]]> + + + + + + + + + + + + + + + + + + + + + + + + + + { + "Id": payload01.Id, + "TaskId": payload01.SCORES_Task__c as String default "", + "TaskName": payload01.SCORES_Task__r.Name as String default "", + "TagId": payload01.SCORES_Tag__c as String default "", + "TagName": payload01.SCORES_Tag__r.Name as String default "", + "TagColor": payload01.SCORES_Tag__r.Tag_Color__c as String default "", + "Description": payload01.SCORES_Tag__r.Description__c as String default "", + "TaskTagName": payload01.Name as String default "" + + }]]> + + + + + diff --git a/src/main/resources/api/datatypes.raml b/src/main/resources/api/datatypes.raml index fc61eda..14805a5 100644 --- a/src/main/resources/api/datatypes.raml +++ b/src/main/resources/api/datatypes.raml @@ -804,4 +804,34 @@ types: type: date-only WaiverCreatedDate: type: date-only - \ No newline at end of file + SCORES_Task: + type: object + properties: + Id: string + AssignedBy: string + AssignedTo: string + CreatedBy: string + CreatedContact: string + Description: string + DueDate: date-only + LastModifiedBy: string + LastModifiedContact: string + OwnerId: string + Priority: string + PriorityIcon: string + ResourceLink: string + Session: string + Name: string + TaskStatus: string + TaskType: string + SCORES_Tag: + type: object + properties: + Id: string + TaskId: string + TaskName: string + TagId: string + TagName: string + TagColor: string + Description: string + TaskTagName: string diff --git a/src/main/resources/api/salesforce-data-api.raml b/src/main/resources/api/salesforce-data-api.raml index a451c52..42c2d88 100644 --- a/src/main/resources/api/salesforce-data-api.raml +++ b/src/main/resources/api/salesforce-data-api.raml @@ -1071,4 +1071,66 @@ uses: 200: body: application/json: - type: types.UserAccount \ No newline at end of file + type: types.UserAccount +/tasks: + get: + description: Retrieve SCORES tasks assigned to a specific contact + queryParameters: + contactId: + description: The ID of the contact to retrieve tasks for + type: string + required: true + responses: + 200: + body: + application/json: + type: types.SCORES_Task[] + example: | + [ + { + "Id": "a01ABC123456789", + "AssignedBy": "a012345678901234", + "AssignedTo": "a098765432109876", + "CreatedBy": "a056789012345678", + "CreatedContact": "a034567890123456", + "Description": "Task description here", + "DueDate": "2024-11-30", + "LastModifiedBy": "a078901234567890", + "LastModifiedContact": "a098765432109876", + "OwnerId": "a076543210987654", + "Priority": "High", + "PriorityIcon": "https://example.com/icon.png", + "ResourceLink": "https://example.com/resource", + "Session": "a054321098765432", + "Name": "Task Name", + "TaskStatus": "In Progress", + "TaskType": "General" + } + ] + /{taskId}: + uriParameters: + taskId: + description: The ID of the SCORES task to retrieve tags for + type: string + required: true + /tags: + get: + description: Retrieve tags associated with a specific SCORES task + responses: + 200: + body: + application/json: + type: types.SCORES_Tag[] + example: | + [ + { + "Id": "a09ABC123456789", + "TaskId": "a01ABC123456789", + "TaskName": "Task Name", + "TagId": "a04ABC123456789", + "TagName": "Urgent", + "TagColor": "#FF0000", + "Description": "This task is urgent.", + "TaskTagName": "Urgency Tag" + } + ] \ No newline at end of file From f7735a6207fec94aa5225a3119a93344b86f627e Mon Sep 17 00:00:00 2001 From: Aleksandr Molchagin <47938394+AleksandrMolchagin@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:33:09 -0500 Subject: [PATCH 2/4] POST /tasks --- src/main/mule/tasks.xml | 197 ++++++++++++------ src/main/resources/api/datatypes.raml | 39 ++++ .../resources/api/salesforce-data-api.raml | 11 + 3 files changed, 185 insertions(+), 62 deletions(-) diff --git a/src/main/mule/tasks.xml b/src/main/mule/tasks.xml index 8384b6d..b97f6ee 100644 --- a/src/main/mule/tasks.xml +++ b/src/main/mule/tasks.xml @@ -1,25 +1,16 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - + + - - - - - - + + + + + + { @@ -78,23 +69,22 @@ "TaskStatus": payload01.Task_Status__c as String default "", "TaskType": payload01.Task_Type__c as String default "" }]]> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + - - - - - - + + + + + + { @@ -136,8 +126,91 @@ "TaskTagName": payload01.Name as String default "" }]]> - - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/api/datatypes.raml b/src/main/resources/api/datatypes.raml index 14805a5..103bd60 100644 --- a/src/main/resources/api/datatypes.raml +++ b/src/main/resources/api/datatypes.raml @@ -824,6 +824,45 @@ types: Name: string TaskStatus: string TaskType: string + SCORES_Task_Create: + type: object + properties: + AssignedBy: + type: string + required: false + AssignedTo: + type: string + required: true + CreatedByContact: + type: string + required: false + Description: + type: string + required: false + DueDate: + type: date-only + required: false + LastModifiedBy: + type: string + required: false + Name: + type: string + required: false + OwnerId: + type: string + required: false + Priority: + type: string + required: false + ResourceLink: + type: string + required: false + Session: + type: string + required: false + TaskType: + type: string + required: false SCORES_Tag: type: object properties: diff --git a/src/main/resources/api/salesforce-data-api.raml b/src/main/resources/api/salesforce-data-api.raml index 42c2d88..dee09ed 100644 --- a/src/main/resources/api/salesforce-data-api.raml +++ b/src/main/resources/api/salesforce-data-api.raml @@ -1107,6 +1107,17 @@ uses: "TaskType": "General" } ] + post: + description: Create a new SCORES task + body: + application/json: + type: types.SCORES_Task_Create + responses: + 200: + body: + application/json: + example: + message: Task created /{taskId}: uriParameters: taskId: From ee77a5ffde3e898e3f01d38bf14c9084ccdcae4a Mon Sep 17 00:00:00 2001 From: Aleksandr Molchagin <47938394+AleksandrMolchagin@users.noreply.github.com> Date: Tue, 26 Nov 2024 00:22:33 -0500 Subject: [PATCH 3/4] Add PATCH method for /tasks --- src/main/mule/tasks.xml | 86 ++++++++++++++++++- src/main/resources/api/datatypes.raml | 4 +- .../resources/api/salesforce-data-api.raml | 21 +++-- 3 files changed, 102 insertions(+), 9 deletions(-) diff --git a/src/main/mule/tasks.xml b/src/main/mule/tasks.xml index b97f6ee..d7b4242 100644 --- a/src/main/mule/tasks.xml +++ b/src/main/mule/tasks.xml @@ -130,7 +130,7 @@ - + @@ -209,8 +209,90 @@ doc:id="ffed222e-011b-42f6-a9a1-2f3cb065c6e44" name="exit-flow" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/api/datatypes.raml b/src/main/resources/api/datatypes.raml index 103bd60..d8b8f3f 100644 --- a/src/main/resources/api/datatypes.raml +++ b/src/main/resources/api/datatypes.raml @@ -817,7 +817,7 @@ types: LastModifiedBy: string LastModifiedContact: string OwnerId: string - Priority: string + Priority: number PriorityIcon: string ResourceLink: string Session: string @@ -852,7 +852,7 @@ types: type: string required: false Priority: - type: string + type: number required: false ResourceLink: type: string diff --git a/src/main/resources/api/salesforce-data-api.raml b/src/main/resources/api/salesforce-data-api.raml index dee09ed..0c7c923 100644 --- a/src/main/resources/api/salesforce-data-api.raml +++ b/src/main/resources/api/salesforce-data-api.raml @@ -1087,7 +1087,7 @@ uses: type: types.SCORES_Task[] example: | [ - { + { "Id": "a01ABC123456789", "AssignedBy": "a012345678901234", "AssignedTo": "a098765432109876", @@ -1098,13 +1098,13 @@ uses: "LastModifiedBy": "a078901234567890", "LastModifiedContact": "a098765432109876", "OwnerId": "a076543210987654", - "Priority": "High", - "PriorityIcon": "https://example.com/icon.png", + "Priority": 100.00, + "PriorityIcon": "🔴", "ResourceLink": "https://example.com/resource", "Session": "a054321098765432", "Name": "Task Name", - "TaskStatus": "In Progress", - "TaskType": "General" + "TaskStatus": "Complete", + "TaskType": "HR Requirement" } ] post: @@ -1124,6 +1124,17 @@ uses: description: The ID of the SCORES task to retrieve tags for type: string required: true + patch: + description: Update a SCORES task + body: + application/json: + type: types.SCORES_Task_Create + responses: + 200: + body: + application/json: + example: + message: Task updated /tags: get: description: Retrieve tags associated with a specific SCORES task From 4ed39f5b9b480c7987b433bbf6b0d6f02ece56ce Mon Sep 17 00:00:00 2001 From: Aleksandr Molchagin <47938394+AleksandrMolchagin@users.noreply.github.com> Date: Tue, 26 Nov 2024 00:36:37 -0500 Subject: [PATCH 4/4] Update Scores - Salesforce Data API.postman_collection.json --- ...alesforce Data API.postman_collection.json | 109 ++++++++++++++++-- 1 file changed, 102 insertions(+), 7 deletions(-) diff --git a/docs/Scores - Salesforce Data API.postman_collection.json b/docs/Scores - Salesforce Data API.postman_collection.json index 3908e27..e74c166 100644 --- a/docs/Scores - Salesforce Data API.postman_collection.json +++ b/docs/Scores - Salesforce Data API.postman_collection.json @@ -558,6 +558,9 @@ }, { "name": "/contacts", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [ @@ -570,13 +573,32 @@ "value": "{{sandbox_client_secret}}" } ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{base_url}}/contacts", + "raw": "{{base_url_s}}/contacts?firstName=A&lastName=3", "host": [ - "{{base_url}}" + "{{base_url_s}}" ], "path": [ "contacts" + ], + "query": [ + { + "key": "firstName", + "value": "A" + }, + { + "key": "lastName", + "value": "3" + } ] }, "description": "BODY/JSON:\n\n{ \n\"TeamSeasonName\": \"\", \n\"TeamId\": \"\", \n\"SeasonId\": \"\", \n\"SchoolSite\": \"\", \n\"Partnership\": \"\", \n\"TotalNoOfPlayers\": 0, \n\"TotalNoOfSessions\": 0, \n\"SeasonStartDate\": \"\", \n\"SeasonEndDate\": \"\", \n\"CoachSoccer\": \"\", \n\"CoachWriting\": \"\", \n\"ProgramCoordinator\": \"\", \n\"ProgramManager\": \"\" \n}" @@ -632,9 +654,9 @@ } ], "url": { - "raw": "{{base_url}}/contacts/searchByPhoneNumber?phoneNumber=269", + "raw": "{{base_url_s}}/contacts/searchByPhoneNumber?phoneNumber=65032071320", "host": [ - "{{base_url}}" + "{{base_url_s}}" ], "path": [ "contacts", @@ -643,7 +665,7 @@ "query": [ { "key": "phoneNumber", - "value": "269" + "value": "65032071320" } ] }, @@ -1638,6 +1660,79 @@ }, "response": [] }, + { + "name": "/tasks", + "request": { + "method": "POST", + "header": [ + { + "key": "client_id", + "value": "{{sandbox_client_id}}" + }, + { + "key": "client_secret", + "value": "{{sandbox_client_secret}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"AssignedBy\": \"\",\n \"AssignedTo\": \"003cX000008IZnXQAW\",\n \"CreatedByContact\": \"0051T000009eHfvQAE\",\n \"CreatedContact\": \"\",\n \"Description\": \"This is a test of the POST method #2.\",\n \"DueDate\": \"2020-11-03\",\n \"LastModifiedBy\": \"0051T000009eHfvQAE\",\n \"LastModifiedContact\": \"\",\n \"OwnerId\": \"0051T000009eHfvQAE\",\n \"Priority\": 90.2,\n \"ResourceLink\": \"\",\n \"Session\": \"\",\n \"Name\": \"Third task to do!\",\n \"TaskStatus\": \"Complete\",\n \"TaskType\": \"HR Requirement\" \n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{base_url}}/tasks", + "host": [ + "{{base_url}}" + ], + "path": [ + "tasks" + ] + }, + "description": "BODY/JSON:\n\n{ \n\"TeamSeasonName\": \"\", \n\"TeamId\": \"\", \n\"SeasonId\": \"\", \n\"SchoolSite\": \"\", \n\"Partnership\": \"\", \n\"TotalNoOfPlayers\": 0, \n\"TotalNoOfSessions\": 0, \n\"SeasonStartDate\": \"\", \n\"SeasonEndDate\": \"\", \n\"CoachSoccer\": \"\", \n\"CoachWriting\": \"\", \n\"ProgramCoordinator\": \"\", \n\"ProgramManager\": \"\" \n}" + }, + "response": [] + }, + { + "name": "/tasks/{taskId}", + "request": { + "method": "PATCH", + "header": [ + { + "key": "client_id", + "value": "{{sandbox_client_id}}" + }, + { + "key": "client_secret", + "value": "{{sandbox_client_secret}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"AssignedBy\": \"\",\n \"AssignedTo\": \"003cX000008IZnXQAW\",\n \"CreatedByContact\": \"0051T000009eHfvQAE\",\n \"CreatedContact\": \"\",\n \"Description\": \"This is a test of the POST method #2.\",\n \"DueDate\": \"2020-11-03\",\n \"LastModifiedBy\": \"0051T000009eHfvQAE\",\n \"LastModifiedContact\": \"\",\n \"OwnerId\": \"0051T000009eHfvQAE\",\n \"Priority\": 90.2,\n \"ResourceLink\": \"\",\n \"Session\": \"\",\n \"Name\": \"Third task to do!!\",\n \"TaskStatus\": \"Complete\",\n \"TaskType\": \"HR Requirement\" \n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{base_url}}/tasks/a40cX000000GcR7QAK", + "host": [ + "{{base_url}}" + ], + "path": [ + "tasks", + "a40cX000000GcR7QAK" + ] + }, + "description": "BODY/JSON:\n\n{ \n\"TeamSeasonName\": \"\", \n\"TeamId\": \"\", \n\"SeasonId\": \"\", \n\"SchoolSite\": \"\", \n\"Partnership\": \"\", \n\"TotalNoOfPlayers\": 0, \n\"TotalNoOfSessions\": 0, \n\"SeasonStartDate\": \"\", \n\"SeasonEndDate\": \"\", \n\"CoachSoccer\": \"\", \n\"CoachWriting\": \"\", \n\"ProgramCoordinator\": \"\", \n\"ProgramManager\": \"\" \n}" + }, + "response": [] + }, { "name": "/tasks/{taskId}/tags", "protocolProfileBehavior": { @@ -1665,13 +1760,13 @@ } }, "url": { - "raw": "{{base_url}}/tasks/003cX000008IZnXQAW/tags", + "raw": "{{base_url}}/tasks/a40cX000000GVRFQA4/tags", "host": [ "{{base_url}}" ], "path": [ "tasks", - "003cX000008IZnXQAW", + "a40cX000000GVRFQA4", "tags" ] },