diff --git a/independent-publisher-connectors/Ironclad CLM/README.md b/independent-publisher-connectors/Ironclad CLM/README.md new file mode 100644 index 0000000000..629305b719 --- /dev/null +++ b/independent-publisher-connectors/Ironclad CLM/README.md @@ -0,0 +1,152 @@ +# Ironclad CLM +A powerful custom connector to [Ironclad CLM](https://ironcladapp.com/), enabling users to interact with workflows, records, users, and groups within Ironclad. The connector and its actions are available in Power Automate, Copilot Studio and PowerApps, with the latter two having some limitations. A custom C# script transforms API traffic, making the non-OpenAPI compatible Ironclad API work seamlessly with OpenAPI standards and Microsoft PowerPlatform. + +## Publisher: Independent Publisher +Maximilian Henkensiefken (Amadeus IT Group, S.A.) in collaboration with Ironclad + +## Prerequisites +- An Ironclad CLM account with APIs enabled (additional charges may apply) +- Credential (client id and secret) from a registered application for the custom connector in the Ironclad Admin panel with correct scopes registered (see below) +- Licensed access to Microsoft Power Platform (Power Automate, Power Apps, or Copilot Studio) + +## Supported Operations + +Almost all Ironclad api operations are available in the custom connector. For a list of all api operations, visit the [Ironcald Developer Center](https://developer.ironcladapp.com/docs/getting-started) + +### Workflow Operations +- **List all Workflow Schemas**: Returns a list of workflow schemas +- **Retrieve a Workflow Schema**: Returns the fields used in the workflow's launch form +- **List all Workflows**: List all workflows in your Ironclad account +- **Create a Workflow Synchronously**: Launch a new workflow synchronously +- **Create a Workflow Asynchronously**: Launch a new workflow asynchronously +- **Retrieve a Workflow**: View the data associated with a specific workflow +- **Update Workflow Metadata**: Update the attributes on a workflow in the Review step +- **Retrieve the Status of an Async Workflow Create Job**: Check the status of an asynchronously created workflow +- **List all Workflow Approvals**: Returns a list of approvals for the workflow +- **Update Approval on a Workflow**: Updates an approval to the specified status +- **Cancel Workflow**: Cancel a workflow +- **Pause Workflow**: Pause a workflow +- **Resume Workflow**: Resume a workflow +- **Revert a Workflow to the Review Step**: Reverts a workflow to the Review step +- **List All Workflow Signers**: Returns a list of workflow signers and their signature status +- **Retrieve the Approval Requests on a Workflow**: Returns a list of workflow approval requests +- **List all Comments on a Workflow**: Return a list of comments on a workflow +- **Create a Comment on a Workflow**: Creates a comment in the workflow's activity feed +- **Retrieve a Comment from a Specified Workflow**: Return a single comment for a specified workflow +- **Retrieve a Workflow Document**: Download a document associated with a specific workflow +- **Create a Workflow Document**: Create a document in the specified workflow attribute +- **Retrieve Email Threads from a Workflow**: List all email threads in the specified workflow +- **Retrieve an Email Thread from a Workflow**: List a single email thread for a specified workflow +- **Retrieve an Attachment from an Email Thread**: Retrieve an attachment from the specified email thread +- **List all Workflow Participants**: Returns a list of workflow participants +- **Retrieve the Turn History on a Workflow**: An array of objects for each turn on a workflow +- **Create a Signed Document on a Workflow**: Upload a fully or partially signed document to a workflow in sign step + +### Record Operations +- **List All Records**: View all records in the company, with filtering available +- **Create a Record**: Create a contract record with specified metadata properties +- **Retrieve XLSX Export File of Records**: Export a records report with filtering options +- **Retrieve Record Schemas**: View the schema associated with contract records +- **Retrieve Predictions**: Get status of predictions for smart import records +- **Create a Smart Import Record**: Upload a file to create a record with smart import +- **Upload a Smart Import Record to an existing Import**: Add a file to an existing import +- **Retrieve Record**: View a specific record and its associated data +- **Replace a Record**: Update an existing record with new metadata +- **Update Record Metadata**: Update specific fields on a record +- **Delete a Record**: Delete an existing record +- **Retrieve Record Signed Copy**: View the signed copy of a specific record +- **Create Record Signed Copy**: Create a signed copy for a specific record +- **Remove Record Signed Copy**: Remove the signed copy from a specific record +- **Retrieve an Attachment on a Record**: View an attachment on a specific record +- **Create an Attachment on a Record**: Create an attachment for a specific record +- **Delete an Attachment on a Record**: Remove an attachment from a specific record + +### User Operations +- **List all Users**: List all Users via SCIM +- **Create a User**: Create a User via SCIM +- **Retrieve a User**: Retrieve a User via SCIM +- **Replace a User**: Replace a User via SCIM +- **Update a User**: Update a User via SCIM +- **Delete a User**: Delete a User via SCIM + +### Group Operations +- **List all Groups**: List all Groups via SCIM +- **Create a Group**: Create a Group via SCIM +- **Retrieve a Group**: Retrieve a Group via SCIM +- **Replace a Group**: Replace a Group via SCIM +- **Update a Group**: Update a Group via SCIM +- **Delete a Group**: Delete a Group via SCIM + +## Obtaining Credentials +The Ironclad CLM Custom Connector uses OAuth 2.0 for authentication. To obtain credentials: + +1. Log in to your Ironclad account +2. Navigate to Company Settings > API tab +3. Click "Create new app" +4. Enter app name and configure: + - Title and Description + - Display Image + - Grant Types (select "Authorization Code") + - Redirect URIs + - Required Resource Scopes +5. Save the client ID and secret securely + +Visit the [Ironclad Developer Hub pages on API Authentication](https://developer.ironcladapp.com/reference/authentication-api) for more details. + +## Getting Started + +### Environments +Ironclad operates in multiple environments: +- Production: ironcladapp.com (majority of customers) +- EU Production: eu1.ironcladapp.com (EU customers) +- Demo: demo.ironcladapp.com + +Each environment is supported, but requires registration of separate client applications. + +### Connecting the Custom Connector +1. Select your Ironclad instance (Demo, EU1, or Global) +2. Enter your client ID and secret +3. Authorize the connection through Ironclad's login page + +## Known Issues and Limitations + +### Complex Data Types in Change Operations +When updating workflow or record metadata through change operations (such as Update Workflow Metadata and Update Record Metadata), you must provide values in their complex data type format rather than natural representation. For example: +- Monetary Amount: Use `{"currency": "EUR", "amount": "1598.12"}` instead of "EUR 1,598.12" +- Date: Use "2024-01-31:00:00:00Z" instead of "31st January 2024" +- Address: Use newline characters (\n) to separate address lines +This limitation only applies to change operations and does not affect read operations. + +### Synchronous Workflow Creation Limitations +The Create Workflow Synchronously operation has significant limitations: +- Only reliable for simple workflows with basic approver configurations +- Often fails for complex workflows due to the 5-second timeout limit imposed by custom scripts +- For complex workflows, users should instead: + 1. Use the Create Workflow Asynchronously operation + 2. Add a delay action of 10 seconds or more + 3. Check the async job status using Retrieve the Status of an Async Workflow Create Job + 4. Use Retrieve a Workflow to get the created workflow details + 5. Add any workflow documents using Create a Workflow Document + +### Dynamic Schema Parsing Limitations +Dynamic schema parsing is not fully supported across all actions: +- For operations involving approver lists, the workflow must be explicit for the script to retrieve the approver list +- When using dynamic values for workflow IDs, schema cannot be fetched as it doesn't exist at runtime +- This particularly affects operations like Update Approval on a Workflow, where the schema must be known in advance + +## Frequently Asked Questions + +### How do I create a workflow with multiple documents? +For workflows requiring multiple documents, use the asynchronous workflow creation pattern: +1. Create the workflow asynchronously +2. Wait for completion (minimum 10 seconds) +3. Add documents using separate Create Workflow Document operations + +### What should I do if my workflow creation times out? +Always use the asynchronous workflow creation pattern for complex workflows or when attaching documents. The synchronous operation is only suitable for simple approval workflows. + +## Deployment Instructions +This connector is available as a custom connector in the Microsoft Power Platform. For custom deployment: +1. Ensure you have the necessary Ironclad API credentials +2. Configure the connector with the appropriate environment URL +3. Set up the OAuth 2.0 authentication with your client credentials diff --git a/independent-publisher-connectors/Ironclad CLM/apiDefinition.swagger.json b/independent-publisher-connectors/Ironclad CLM/apiDefinition.swagger.json new file mode 100644 index 0000000000..c05283da8e --- /dev/null +++ b/independent-publisher-connectors/Ironclad CLM/apiDefinition.swagger.json @@ -0,0 +1,7937 @@ +{ + "swagger": "2.0", + "info": { + "contact": { + "email": "LEGTechOps@amadeus.com", + "name": "Amadeus IT Group, S.A. - LEG TechOps", + "url": "https://www.amadeus.com" + }, + "description": "Using this connector allows admins and user to connect to their Ironclad CLM demo, preview and production instances and perform various operations such as creating, updating, deleting and retrieving records, workflows, comments, approvals, signatures, attachments, and more. Follow https://developer.ironcladapp.com/reference/register-oauth-client and register a client to get the client ID and client secret.", + "title": "Ironclad CLM", + "version": "1.0" + }, + "x-ms-connector-metadata": [ + { + "propertyName": "Website", + "propertyValue": "https://ironcladapp.com/" + }, + { + "propertyName": "Privacy Policy", + "propertyValue": "https://legal.ironcladapp.com/privacy-policy" + }, + { + "propertyName": "Categories", + "propertyValue": "Commerce" + } + ], + "schemes": [ + "https" + ], + "host": "ironcladapp.com", + "basePath": "/", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/public/api/v1/records": { + "get": { + "description": "View all records in the company, with filtering available via query parameters.", + "operationId": "ListAllRecords", + "parameters": [ + { + "$ref": "#/parameters/page_query" + }, + { + "$ref": "#/parameters/recordProperties_query" + }, + { + "$ref": "#/parameters/pageSize_query" + }, + { + "$ref": "#/parameters/recordTypes_query" + }, + { + "$ref": "#/parameters/recordLastUpdated_query" + }, + { + "$ref": "#/parameters/sortField_query" + }, + { + "$ref": "#/parameters/sortDirection_query" + }, + { + "$ref": "#/parameters/recordFilter_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Records Retrieved", + "schema": { + "properties": { + "count": { + "$ref": "#/definitions/count_integer" + }, + "list": { + "$ref": "#/definitions/recordsGetFormatted_array" + }, + "page": { + "$ref": "#/definitions/page_integer" + }, + "pageSize": { + "$ref": "#/definitions/pageSize_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List All Records", + "x-ms-visibility": "important" + }, + "post": { + "description": "Create a contract record by specifying its intended metadata properties.", + "operationId": "CreateRecord", + "parameters": [ + { + "$ref": "#/parameters/recordPost_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Record Created", + "schema": { + "$ref": "#/definitions/recordGetStatic_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Record", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/records/export": { + "get": { + "description": "Export a records report with filtering available via query parameters.", + "operationId": "ExportRecords", + "parameters": [ + { + "$ref": "#/parameters/recordExportProperties_query" + }, + { + "$ref": "#/parameters/recordTypes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Reecords Exported", + "schema": { + "description": "The XLSX file of the records report.", + "title": "Records Report", + "type": "file", + "x-ms-visibility": "important" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve XLSX Export File of Records", + "x-ms-visibility": "advanced" + } + }, + "/public/api/v1/records/metadata": { + "get": { + "description": "View the schema associated with contract records, including available record types and metadata properties.", + "operationId": "RetrieveRecordSchemas", + "parameters": [ + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "$ref": "#/parameters/recordProperties_query" + } + ], + "responses": { + "200": { + "description": "Record Schema Retrieved", + "schema": { + "properties": { + "properties": { + "$ref": "#/definitions/recordSchemaPropertiesGet_object" + }, + "recordTypes": { + "$ref": "#/definitions/recordTypesDictionary_object" + }, + "formattedRecordTypes": { + "$ref": "#/definitions/recordTypesFormatted_array" + }, + "formattedProperties": { + "$ref": "#/definitions/recordPropertiesFormatted_array" + }, + "formattedClauses": { + "$ref": "#/definitions/recordPropertiesFormatted_array" + }, + "formattedAttachments": { + "$ref": "#/definitions/recordAttachmentsFormatted_array" + }, + "requestedProperties": { + "$ref": "#/definitions/requestedProperties_string" + }, + "formattedSchema": { + "$ref": "#/definitions/recordSchemaFormatted_object" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve Record Schemas", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/records/smart-import": { + "get": { + "description": "Retrieve status of predictions of specific smart import record or all records in an import, one of Record Id or Import Id is required.", + "operationId": "RerievePredictions", + "parameters": [ + { + "$ref": "#/parameters/recordId_query" + }, + { + "$ref": "#/parameters/recordImportId_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Predictions Retrieved", + "schema": { + "$ref": "#/definitions/predictions_array" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve Predictions", + "x-ms-visibility": "important" + }, + "post": { + "consumes": [ + "multipart/form-data" + ], + "description": "Upload a file to create a record with smart import and predictions. Provide none of recordType, newRecordTypeId, or newRecordTypeDisplayName to default to Imported type.", + "operationId": "CreateSmartImportRecord", + "parameters": [ + { + "$ref": "#/parameters/recordType_formData" + }, + { + "$ref": "#/parameters/recordNewRecordTypeId_formData" + }, + { + "$ref": "#/parameters/recordNewRecordTypeDisplayName_formData" + }, + { + "$ref": "#/parameters/attachment_formData" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Smart Import Record Created", + "schema": { + "properties": { + "importId": { + "$ref": "#/definitions/importId_string" + }, + "recordId": { + "$ref": "#/definitions/recordId_string" + }, + "remainingCredits": { + "$ref": "#/definitions/remainingCredits_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Smart Import Record", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/records/smart-import/{Import}/": { + "post": { + "consumes": [ + "multipart/form-data" + ], + "description": "Upload a file to an existing import and create a record with smart import and predictions. Provide none of recordType, newRecordTypeId, or newRecordTypeDisplayName to default to Imported type.", + "operationId": "ExistingSmartImportRecord", + "parameters": [ + { + "$ref": "#/parameters/recordSmartImport_path" + }, + { + "$ref": "#/parameters/recordType_formData" + }, + { + "$ref": "#/parameters/recordNewRecordTypeId_formData" + }, + { + "$ref": "#/parameters/recordNewRecordTypeDisplayName_formData" + }, + { + "$ref": "#/parameters/attachment_formData" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Data Added to Existing Smart Record Import", + "schema": { + "properties": { + "importId": { + "$ref": "#/definitions/importId_string" + }, + "recordId": { + "$ref": "#/definitions/recordId_string" + }, + "remainingCredits": { + "$ref": "#/definitions/remainingCredits_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Upload a Smart Import Record to an existing Import", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/records/{Record}": { + "delete": { + "description": "Delete an existing record.", + "operationId": "DeleteRecord", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/returnRepresentation_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Record Deleted" + }, + "204": { + "description": "Record Deleted" + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Delete a Record", + "x-ms-visibility": "important" + }, + "get": { + "description": "View a specific record and its associated data.", + "operationId": "RetrieveRecord", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Record Retrieved", + "schema": { + "$ref": "#/definitions/recordGetDynamic_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve Record", + "x-ms-visibility": "important" + }, + "patch": { + "description": "Update specific fields on a record.", + "operationId": "UpdateRecordMetadata", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/recordPatch_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Record Metadata Updated", + "schema": { + "$ref": "#/definitions/recordGetDynamic_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Update Record Metadata" + }, + "put": { + "description": "Update an existing record with a new set of metadata.", + "operationId": "ReplaceRecord", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/recordPost_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Record Replaced", + "schema": { + "$ref": "#/definitions/recordGetDynamic_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Replace a Record" + } + }, + "/public/api/v1/records/{Record}/attachments/signedCopy": { + "delete": { + "description": "Remove the signed copy associated with a specific record.", + "operationId": "RemoveSignedCopyDocument", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Signed Copy Removed", + "schema": { + + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Remove Record Signed Copy", + "x-ms-visibility": "important" + }, + "get": { + "description": "View the signed copy associated with a specific record.", + "operationId": "RetrieveSignedCopyDocument", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Signed Copy Retrieved", + "schema": { + + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve Record Signed Copy", + "x-ms-visibility": "important" + }, + "post": { + "consumes": [ + "multipart/form-data", + "application/json" + ], + "description": "Create a signed copy associated with a specific record.", + "operationId": "CreateSignedCopyAttachment", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "attachment": { + "$ref": "#/definitions/attachment_byte" + }, + "metadata": { + "$ref": "#/definitions/attachmentMetadata_object" + } + }, + "type": "object", + "required": [ + "attachment", + "metadata" + ] + } + } + ], + "responses": { + "200": { + "description": "Signed Copy Created", + "schema": { + + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create Record Signed Copy", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/records/{Record}/attachments/{Key}": { + "delete": { + "description": "Remove an attachment associated with a specific record.", + "operationId": "RemoveAttachment", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/recordDocumentKeyFromSchema_path" + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Attachment Removed", + "schema": { + + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Remove an Attachment on a Record", + "x-ms-visibility": "important" + }, + "get": { + "description": "View an attachment associated with a specific record.", + "operationId": "RetrieveAttachment", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/recordDocumentKeyFromSchema_path" + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Attachment Retrieved", + "schema": { + "$ref": "#/definitions/attachment_binary" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve an Attachment on a Record", + "x-ms-visibility": "important" + }, + "post": { + "description": "Create an attachment associated with a specific record.", + "operationId": "CreateAttachment", + "parameters": [ + { + "$ref": "#/parameters/recordId_path" + }, + { + "$ref": "#/parameters/recordDocumentKeyFromSchema_path" + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "attachment": { + "$ref": "#/definitions/attachment_byte" + }, + "metadata": { + "$ref": "#/definitions/attachmentMetadata_object" + } + }, + "type": "object", + "required": [ + "attachment", + "metadata" + ] + } + } + ], + "responses": { + "200": { + "description": "Attachment Created", + "schema": { + + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create an Attachment on a Record", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/webhooks": { + "post": { + "description": "Creates a webhook for the specified events. Send separate requests if you need to create webhooks for multiple target URLs. Each target URL may only have one active registration.", + "operationId": "CreateWebhook", + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "events": { + "$ref": "#/definitions/webhookEvents_array" + }, + "targetURL": { + "$ref": "#/definitions/webhookTargetUrlPost_string" + } + }, + "required": [ + "targetURL", + "events" + ], + "type": "object", + "x-ms-visibility": "important" + }, + "x-ms-visibility": "important" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "201": { + "description": "Webhook Created", + "schema": { + "properties": { + "company": { + "$ref": "#/definitions/companyId_string" + }, + "events": { + "$ref": "#/definitions/webhookEvents_array" + }, + "id": { + "$ref": "#/definitions/webhookId_string" + }, + "targetURL": { + "$ref": "#/definitions/webhookTargetUrlGet_string" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create Webhook", + "x-ms-trigger": "single", + "x-ms-visibility": "important" + }, + "x-ms-notification-content": { + "description": "Ironclad Event", + "schema": { + "$ref": "#/definitions/webhookNotificationContent_object" + } + } + }, + "/public/api/v1/webhooks/{Webhook}": { + "delete": { + "description": "Delete a specific webhook.", + "operationId": "DeleteWebhook", + "parameters": [ + { + "$ref": "#/parameters/webhookID_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Webhook Deleted" + }, + "201": { + "description": "Webhook Deleted" + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Delete a Webhook", + "x-ms-visibility": "advanced" + }, + "get": { + "description": "View the data associated with a specific webhook.", + "operationId": "RetrieveWebhook", + "parameters": [ + { + "$ref": "#/parameters/webhookID_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Webhook Retrieved", + "schema": { + "$ref": "#/definitions/webhookConfiguration_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve a Webhook", + "x-ms-visibility": "advanced" + }, + "patch": { + "description": "Update the data associated with a specific webhook.", + "operationId": "UpdateWebhook", + "parameters": [ + { + "$ref": "#/parameters/webhookID_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Webhook Updated", + "schema": { + "$ref": "#/definitions/webhookConfiguration_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Update a Webhook", + "x-ms-visibility": "advanced" + } + }, + "/public/api/v1/workflow-schemas": { + "get": { + "description": "Returns a list of workflow schemas. Each schema specifies the fields used in the workflow's launch form.", + "operationId": "ListWorkflowSchemas", + "parameters": [ + { + "$ref": "#/parameters/workflowForm_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "List of Workflow Schemas Retrieved", + "schema": { + "properties": { + "list": { + "$ref": "#/definitions/workflowSchemas_array" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List all Workflow Schemas", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflow-schemas/{Schema}": { + "get": { + "description": "Returns the fields used in the workflow's launch form..", + "operationId": "RetrieveWorkflowSchema", + "parameters": [ + { + "$ref": "#/parameters/workflowSchemaID_path" + }, + { + "$ref": "#/parameters/workflowForm_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Schema Retrieved", + "schema": { + "$ref": "#/definitions/workflowSchema_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve a Workflow Schema" + } + }, + "/public/api/v1/workflows": { + "get": { + "description": "List all workflows in your Ironclad account.", + "operationId": "ListAllWorkflows", + "parameters": [ + { + "$ref": "#/parameters/page_query" + }, + { + "$ref": "#/parameters/pageSize_query" + }, + { + "$ref": "#/parameters/sortField_query" + }, + { + "$ref": "#/parameters/sortDirection_query" + }, + { + "$ref": "#/parameters/workflowStatus_query" + }, + { + "$ref": "#/parameters/workflowTemplateID_query" + }, + { + "$ref": "#/parameters/workflowLastUpdated_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "List of Workflows Retrieved", + "schema": { + "properties": { + "count": { + "$ref": "#/definitions/count_integer" + }, + "list": { + "$ref": "#/definitions/workflowsGet_array" + }, + "page": { + "$ref": "#/definitions/page_integer" + }, + "pageSize": { + "$ref": "#/definitions/pageSize_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List all Workflows" + }, + "post": { + "description": "Launch a new workflow synchronously.", + "operationId": "CreateWorkflow", + "parameters": [ + { + "$ref": "#/parameters/workflowForm_query" + }, + { + "$ref": "#/parameters/workflow_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Created", + "schema": { + "$ref": "#/definitions/workflowSchemaFromTemplateGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Workflow Synchronously", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/async": { + "post": { + "description": "Launch a new workflow asynchronously for non-blocking performance, which is helpful when/if you provide files to the workflow.", + "operationId": "CreateWorkflowAsync", + "parameters": [ + { + "$ref": "#/parameters/workflowForm_query" + }, + { + "$ref": "#/parameters/workflow_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Created", + "schema": { + "properties": { + "asyncJobId": { + "$ref": "#/definitions/asyncJobId_string" + }, + "asyncJobStatusUrl": { + "$ref": "#/definitions/asyncJobStatusUrl_string" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Workflow Asynchronously", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/async/{AsyncJob}": { + "get": { + "description": "Check the status of a Workflow you created while using the Create a Workflow Async route.", + "operationId": "RetrieveAsyncJobStatus", + "parameters": [ + { + "$ref": "#/parameters/workflowAsyncJob_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Status Retrieved", + "schema": { + "properties": { + "status": { + "$ref": "#/definitions/workflowAsyncLaunchStatus_string" + }, + "workflow": { + "$ref": "#/definitions/workflowAsync_object" + } + } + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve the Status of an Async Workflow Create Job", + "x-ms-visibility": "advanced" + } + }, + "/public/api/v1/workflows/{Workflow}": { + "get": { + "description": "View the data associated with a specific workflow.", + "operationId": "RetrieveWorkflow", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Retrieved", + "schema": { + "$ref": "#/definitions/workflowSchemaFromWorkflowGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve a Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/approval-requests": { + "get": { + "description": "Returns a list of approval requests that have taken place on the workflow.", + "operationId": "ListApprovalRequests", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/page_query" + }, + { + "$ref": "#/parameters/pageSize_query" + }, + { + "$ref": "#/parameters/workflowActionDetails_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Approval Requests Retrieved", + "schema": { + "properties": { + "count": { + "$ref": "#/definitions/count_integer" + }, + "list": { + "$ref": "#/definitions/approvalRequestsList_array" + }, + "page": { + "$ref": "#/definitions/page_integer" + }, + "pageSize": { + "$ref": "#/definitions/pageSize_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve the Approval Requests on a Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/approvals": { + "get": { + "description": "Returns a list of approvals for the workflow. The approvalGroups property will display only triggered approvals (i.e. conditional approvals that have not been triggered will not appear).", + "operationId": "ListWorkflowApprovals", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Approvals Retrieved", + "schema": { + "$ref": "#/definitions/workflowsApprovalsGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List all Workflow Approvals", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/approvals/{Role}": { + "patch": { + "description": "Updates an approval to the specified status. Approvals can only be updated during the Review step.", + "operationId": "UpdateWorkflowApprovals", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowRoleID_path" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "status": { + "$ref": "#/definitions/approvalStatusPost_string" + }, + "user": { + "$ref": "#/definitions/userPost_object" + } + }, + "required": [ + "user", + "status" + ], + "type": "object" + } + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Approval Updated", + "schema": { + "$ref": "#/definitions/approvalUpdated_boolean" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Update Approval on a Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/attributes": { + "patch": { + "description": "Update the attributes on a workflow in the Review step. Select a configuration below to load a list up paths in that configuration.", + "operationId": "UpdateWorkflowMetadata", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowConfiguration_dummy" + }, + { + "$ref": "#/parameters/workflowUpdateActions_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Metadata Updated", + "schema": { + "$ref": "#/definitions/workflowSchemaFromWorkflowGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Update Workflow Metadata", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/cancel": { + "post": { + "description": "Cancel a workflow.", + "operationId": "CancelWorkflow", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "in": "body", + "name": "user", + "required": true, + "schema": { + "properties": { + "comment": { + "$ref": "#/definitions/commentSimplePost_object" + }, + "notifyCounterparty": { + "$ref": "#/definitions/notifyCounterparty_boolean" + } + }, + "required": [ + "notifyCounterparty", + "comment" + ], + "type": "object" + } + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "204": { + "description": "Workflow Canceled", + "schema": { + "type": "object", + "x-ms-visibility": "internal" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Cancel Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/comments": { + "get": { + "description": "Return a list of comments on a workflow.", + "operationId": "ListWorkflowComments", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/page_query" + }, + { + "$ref": "#/parameters/pageSize_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Comments Retrieved", + "schema": { + "properties": { + "count": { + "$ref": "#/definitions/count_integer" + }, + "list": { + "$ref": "#/definitions/commentsGet_array" + }, + "page": { + "$ref": "#/definitions/page_integer" + }, + "pageSize": { + "$ref": "#/definitions/pageSize_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List all Comments on a Workflow" + }, + "post": { + "description": "Creates a comment in the specified workflow's activity feed.", + "operationId": "CreateComment", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowCommentPost_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Comment Created", + "schema": { + "$ref": "#/definitions/commentGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Comment on a Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/comments/{Comment}": { + "get": { + "description": "Return a single comment for a specified workflow.", + "operationId": "RetrieveComment", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowCommentID_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Comment Retrieved", + "schema": { + "$ref": "#/definitions/commentGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve a Comment from a Specified Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/document/{Key}/download": { + "get": { + "description": "Download a document associated with a specific workflow via a reference to its document key.", + "operationId": "RetrieveWorkflowDocument", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowDocumentKey_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Document Retrieved", + "schema": { + "description": "The document as a file.", + "title": "Document", + "type": "file", + "x-ms-visibility": "important" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve a Workflow Document" + } + }, + "/public/api/v1/workflows/{Workflow}/documents/{Attribute}": { + "post": { + "description": "Create a document in the specified workflow attribute. This will only create new documents. It does not support document versioning. Select a configuration below to load a list of supported documents in that configuration.", + "operationId": "CreateWorkflowDocument", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowConfiguration_dummy" + }, + { + "$ref": "#/parameters/workflowDocumentAttribute_path" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "attachment": { + "$ref": "#/definitions/attachment_byte" + }, + "metadata": { + "$ref": "#/definitions/documentMetadata_object" + } + }, + "type": "object", + "required": [ + "attachment", + "metadata" + ] + } + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Document Created", + "schema": { + "description": "The document as a file.", + "title": "Document", + "type": "file", + "x-ms-visibility": "important" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Workflow Document" + } + }, + "/public/api/v1/workflows/{Workflow}/emails": { + "get": { + "description": "List all email threads in the specified workflow.", + "operationId": "RetrieveEmailThreads", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/page_query" + }, + { + "$ref": "#/parameters/pageSize_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Email Threads Retrieved", + "schema": { + "properties": { + "count": { + "$ref": "#/definitions/count_integer" + }, + "list": { + "$ref": "#/definitions/workflowEmailsGet_array" + }, + "page": { + "$ref": "#/definitions/page_integer" + }, + "pageSize": { + "$ref": "#/definitions/pageSize_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve Email Threads from a Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/emails/{Email}": { + "get": { + "description": "List a single email thread for a specified workflow.", + "operationId": "RetrieveEmailThread", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowEmailID_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Email Thread Retrieved", + "schema": { + "$ref": "#/definitions/workflowEmailGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve an Email Thread from a Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/participants": { + "get": { + "description": "Returns a list of workflow participants.", + "operationId": "ListWorkflowParticipants", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/page_query" + }, + { + "$ref": "#/parameters/pageSize_query" + }, + { + "$ref": "#/parameters/workflowUserEmail_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Participants Retrieved", + "schema": { + "$ref": "#/definitions/workflowParticipantsGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List all Workflow Participants", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/pause": { + "post": { + "description": "Pause a workflow.", + "operationId": "PauseWorkflow", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "comment": { + "$ref": "#/definitions/commentSimplePost_object" + }, + "notifyCounterparty": { + "$ref": "#/definitions/notifyCounterparty_boolean" + } + }, + "required": [ + "comment", + "notifyCounterparty" + ], + "type": "object", + "x-ms-visibility": "important" + } + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "204": { + "description": "Workflow Paused", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Pause Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/resume": { + "post": { + "description": "Resume a workflow.", + "operationId": "ResumeWorkflow", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "comment": { + "$ref": "#/definitions/commentSimplePost_object" + }, + "notifyCounterparty": { + "$ref": "#/definitions/notifyCounterparty_boolean" + } + }, + "required": [ + "comment", + "notifyCounterparty" + ], + "type": "object", + "x-ms-visibility": "important" + } + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "204": { + "description": "Workflow Resumed", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Resume Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/revert-to-review": { + "patch": { + "description": "Reverts a workflow to the Review step. Only workflows sourced from workflow Designer and in the Sign step can be reverted.", + "operationId": "RevertToReview", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowRevertingUser_body" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "204": { + "description": "Workflow Reverted to Review" + }, + "201": { + "description": "Workflow Reverted to Review" + }, + "200": { + "description": "Workflow Reverted to Review" + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Revert a Workflow to the Review Step", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/signatures": { + "get": { + "description": "Returns a list of workflow signers and the status of their signature.", + "operationId": "ListWorkflowSignatures", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Workflow Signatures Retrieved", + "schema": { + "properties": { + "signers": { + "$ref": "#/definitions/workflowSigners_array" + }, + "title": { + "$ref": "#/definitions/workflowTitle_string" + }, + "workflowId": { + "$ref": "#/definitions/uniqueId_string" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "403": { + "description": "Forbidden" + } + }, + "summary": "List All Workflow Signers", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/turn-history": { + "get": { + "description": "An array of objects for each turn on a workflow.", + "operationId": "ListTurnHistory", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/page_query" + }, + { + "$ref": "#/parameters/pageSize_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Turn History Retrieved", + "schema": { + "properties": { + "count": { + "$ref": "#/definitions/count_integer" + }, + "list": { + "$ref": "#/definitions/turnHistory_array" + }, + "page": { + "$ref": "#/definitions/page_integer" + }, + "pageSize": { + "$ref": "#/definitions/pageSize_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve the Turn History on a Workflow", + "x-ms-visibility": "important" + } + }, + "/public/api/v1/workflows/{Workflow}/upload-signed": { + "post": { + "description": "Upload a fully or partially signed document to a specified workflow that is in sign step.", + "operationId": "CreateSignedDocument", + "parameters": [ + { + "$ref": "#/parameters/workflowId_path" + }, + { + "$ref": "#/parameters/workflowDocument_formData" + }, + { + "$ref": "#/parameters/json_header" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Signed Document Uploaded", + "schema": { + "$ref": "#/definitions/uploadSignedGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Signed Document on a Workflow", + "x-ms-visibility": "important" + } + }, + "/scim/v2/Groups": { + "get": { + "description": "List all Groups via SCIM.", + "operationId": "ListGroups", + "parameters": [ + { + "$ref": "#/parameters/scimCount_query" + }, + { + "$ref": "#/parameters/scimStartIndex_query" + }, + { + "$ref": "#/parameters/scimRecordFilter_query" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "List of Groups Retrieved", + "schema": { + "properties": { + "itemsPerPage": { + "$ref": "#/definitions/itemsPerPage_integer" + }, + "Resources": { + "$ref": "#/definitions/scimGroupResourcesGet_array" + }, + "schemas": { + "$ref": "#/definitions/scimSchemasGet_array" + }, + "startIndex": { + "$ref": "#/definitions/startIndex_integer" + }, + "totalResults": { + "$ref": "#/definitions/totalResults_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List all Groups", + "x-ms-visibility": "important" + }, + "post": { + "description": "Create a Group via SCIM.", + "operationId": "CreateGroup", + "parameters": [ + { + "$ref": "#/parameters/scimGroup_body" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "201": { + "description": "Group Created", + "schema": { + "$ref": "#/definitions/scimGroupGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a Group", + "x-ms-visibility": "important" + } + }, + "/scim/v2/Groups/{Group}": { + "delete": { + "description": "Delete a Group via SCIM.", + "operationId": "DeleteGroup", + "parameters": [ + { + "$ref": "#/parameters/scimGroupID_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "$ref": "#/parameters/json_header" + } + ], + "responses": { + "200": { + "description": "Group Deleted" + }, + "204": { + "description": "Group Deleted" + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Delete a Group", + "x-ms-visibility": "important" + }, + "get": { + "description": "Retrieve a Group via SCIM.", + "operationId": "RetrieveGroup", + "parameters": [ + { + "$ref": "#/parameters/scimGroupID_path" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "Group Retrieved", + "schema": { + "$ref": "#/definitions/scimGroupGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve a Group", + "x-ms-visibility": "important" + }, + "patch": { + "description": "Update a Group via SCIM.", + "operationId": "UpdateGroup", + "parameters": [ + { + "$ref": "#/parameters/scimGroupID_path" + }, + { + "$ref": "#/parameters/scimGroupOperations_body" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "$ref": "#/parameters/json_header" + } + ], + "responses": { + "200": { + "description": "Group Updated", + "schema": { + "$ref": "#/definitions/scimGroupGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Update a Group", + "x-ms-visibility": "important" + }, + "put": { + "description": "Replace a Group via SCIM.", + "operationId": "ReplaceGroup", + "parameters": [ + { + "$ref": "#/parameters/scimGroupID_path" + }, + { + "$ref": "#/parameters/scimGroup_body" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "$ref": "#/parameters/json_header" + } + ], + "responses": { + "200": { + "description": "Group Replaced", + "schema": { + "$ref": "#/definitions/scimGroupGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Replace a Group", + "x-ms-visibility": "important" + } + }, + "/scim/v2/Users": { + "get": { + "description": "List all Users via SCIM.", + "operationId": "ListUsers", + "parameters": [ + { + "$ref": "#/parameters/scimCount_query" + }, + { + "$ref": "#/parameters/scimStartIndex_query" + }, + { + "$ref": "#/parameters/scimRecordFilter_query" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "List of Users Retrieved", + "schema": { + "properties": { + "itemsPerPage": { + "$ref": "#/definitions/itemsPerPage_integer" + }, + "Resources": { + "$ref": "#/definitions/scimUserResourcesGet_array" + }, + "schemas": { + "$ref": "#/definitions/scimSchemasGet_array" + }, + "startIndex": { + "$ref": "#/definitions/startIndex_integer" + }, + "totalResults": { + "$ref": "#/definitions/totalResults_integer" + } + }, + "type": "object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "List all Users", + "x-ms-visibility": "important" + }, + "post": { + "description": "Create a User via SCIM.", + "operationId": "CreateUser", + "parameters": [ + { + "$ref": "#/parameters/scimUser_body" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "201": { + "description": "User Created", + "schema": { + "$ref": "#/definitions/scimUserGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Create a User", + "x-ms-visibility": "important" + } + }, + "/scim/v2/Users/{User}": { + "delete": { + "description": "Delete a User via SCIM.", + "operationId": "DeleteUser", + "parameters": [ + { + "$ref": "#/parameters/scimUserID_path" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "$ref": "#/parameters/json_header" + } + ], + "responses": { + "204": { + "description": "User Deleted" + }, + "201": { + "description": "User Deleted" + }, + "200": { + "description": "User Deleted" + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Delete a User", + "x-ms-visibility": "important" + }, + "get": { + "description": "Retrieve a User via SCIM.", + "operationId": "RetrieveUser", + "parameters": [ + { + "$ref": "#/parameters/scimUserID_path" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + } + ], + "responses": { + "200": { + "description": "User Retrieved", + "schema": { + "$ref": "#/definitions/scimUserGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Retrieve a User", + "x-ms-visibility": "important" + }, + "patch": { + "description": "Update a User via SCIM.", + "operationId": "UpdateUser", + "parameters": [ + { + "$ref": "#/parameters/scimUserID_path" + }, + { + "$ref": "#/parameters/scimUserOperations_body" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "$ref": "#/parameters/json_header" + } + ], + "responses": { + "200": { + "description": "User Updated", + "schema": { + "$ref": "#/definitions/scimUserGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Update a User", + "x-ms-visibility": "important" + }, + "put": { + "description": "Replace a User via SCIM.", + "operationId": "ReplaceUser", + "parameters": [ + { + "$ref": "#/parameters/scimUserID_path" + }, + { + "$ref": "#/parameters/scimUser_body" + }, + { + "$ref": "#/parameters/scimExcludedAttributes_query" + }, + { + "$ref": "#/parameters/x-as-user-email_header" + }, + { + "$ref": "#/parameters/x-as-user-id_header" + }, + { + "$ref": "#/parameters/json_header" + } + ], + "responses": { + "200": { + "description": "User Replaced", + "schema": { + "$ref": "#/definitions/scimUserGet_object" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + }, + "default": { + "description": "Operation Failed." + } + }, + "summary": "Replace a User", + "x-ms-visibility": "important" + } + } + }, + "definitions": { + "actorDetails_object": { + "description": "Details of the actor.", + "properties": { + "userEmail": { + "$ref": "#/definitions/userEmail_string" + }, + "userName": { + "$ref": "#/definitions/userUsername_string" + } + }, + "title": "Actor Details", + "type": "object", + "x-ms-visibility": "important" + }, + "actorId_string": { + "description": "The identifier of the actor.", + "title": "Actor ID", + "type": "string", + "x-ms-visibility": "important" + }, + "actorType_string": { + "description": "The type of actor.", + "title": "Actor Type", + "type": "string", + "x-ms-visibility": "important" + }, + "addedParticipants_array": { + "description": "Users added to the conversation.", + "items": { + "$ref": "#/definitions/addedParticipant_string" + }, + "title": "Added Participants", + "type": "array", + "x-ms-visibility": "advanced" + }, + "addedParticipant_string": { + "description": "User added to the conversation.", + "title": "Name", + "type": "string", + "x-ms-visibility": "advanced" + }, + "addUsersToWorkflow_boolean": { + "default": true, + "description": "Set to true to add mentioned users to the workflow", + "title": "Add to Workflow", + "type": "boolean", + "x-ms-visibility": "important" + }, + "approvalEndTime_string": { + "description": "The date and time the approval ended.", + "format": "date-time", + "title": "End Time", + "type": "string", + "x-ms-visibility": "important" + }, + "approvalRequest_object": { + "description": "An approval request for the workflow.", + "properties": { + "actorDetails": { + "$ref": "#/definitions/actorDetails_object" + }, + "actorId": { + "$ref": "#/definitions/actorId_string" + }, + "actorType": { + "$ref": "#/definitions/actorType_string" + }, + "approvalType": { + "$ref": "#/definitions/approvalType_string" + }, + "duration": { + "$ref": "#/definitions/duration_integer" + }, + "endTime": { + "$ref": "#/definitions/approvalEndTime_string" + }, + "role": { + "$ref": "#/definitions/workflowRoleId_string" + }, + "roleName": { + "$ref": "#/definitions/workflowRoleDisplayName_string" + }, + "startTime": { + "$ref": "#/definitions/approvalStartTime_string" + }, + "status": { + "$ref": "#/definitions/approvalStatusGet_string" + } + }, + "title": "Approval Request", + "type": "object", + "x-ms-visibility": "important" + }, + "approvalRequestsList_array": { + "description": "The approval requests for the workflow.", + "items": { + "$ref": "#/definitions/approvalRequest_object" + }, + "title": "Approval Requests", + "type": "array", + "x-ms-visibility": "important" + }, + "approvalStartTime_string": { + "description": "The date and time the approval started.", + "format": "date-time", + "title": "Start Time", + "type": "string", + "x-ms-visibility": "important" + }, + "approvalStatusGet_string": { + "description": "The status of the approval.", + "title": "Status", + "type": "string", + "x-ms-visibility": "important" + }, + "approvalStatusPost_string": { + "description": "The new approval status.", + "enum": [ + "approved", + "pending" + ], + "title": "Status", + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "Approved", + "value": "approved" + }, + { + "displayName": "Pending", + "value": "pending" + } + ], + "x-ms-visibility": "important" + }, + "approvalType_string": { + "description": "The type of approval.", + "title": "Approval Type", + "type": "string", + "x-ms-visibility": "important" + }, + "approvalUpdated_boolean": { + "description": "True if the approval was successfully updated, false otherwise.", + "title": "Approval Updated", + "type": "boolean", + "x-ms-visibility": "important" + }, + "assignee_object": { + "description": "A user assigned to the workflow.", + "properties": { + "email": { + "$ref": "#/definitions/userEmail_string" + }, + "userId": { + "$ref": "#/definitions/userId_string" + }, + "userName": { + "$ref": "#/definitions/userUsername_string" + } + }, + "title": "Assignee", + "type": "object", + "x-ms-visibility": "important" + }, + "assignees_array": { + "description": "The assigned users", + "items": { + "$ref": "#/definitions/assignee_object" + }, + "title": "Assignees", + "type": "array", + "x-ms-visibility": "important" + }, + "asyncJobId_string": { + "description": "The ID of the asynchronous job", + "title": "Async Job ID", + "type": "string", + "x-ms-visibility": "important" + }, + "asyncJobStatusUrl_string": { + "description": "The URL to check the status of the asynchronous job", + "title": "Async Job Status URL", + "type": "string", + "x-ms-visibility": "important" + }, + "attachmentDisplayName_string": { + "description": "The display name of the attachment.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "attachmentFilename_string": { + "description": "Name of the file to be uploaded.", + "title": "Filename", + "type": "string", + "x-ms-visibility": "important" + }, + "attachmentMetadata_object": { + "description": "Metadata associated with the attachment.", + "properties": { + "filename": { + "$ref": "#/definitions/attachmentFilename_string" + } + }, + "title": "Metadata", + "type": "object", + "x-ms-visibility": "important", + "required": [ + "filename" + ] + }, + "attachmentName_string": { + "description": "The internal name of the attachment.", + "title": "System Name", + "type": "string", + "x-ms-visibility": "important" + }, + "attachment_binary": { + "description": "The content of the attachment.", + "format": "binary", + "title": "File", + "type": "string", + "x-ms-visibility": "important" + }, + "attachment_byte": { + "description": "The content of the attachment.", + "format": "byte", + "title": "File", + "type": "string", + "x-ms-visibility": "important" + }, + "authorGet_object": { + "description": "Information about the author of the original comment.", + "properties": { + "companyName": { + "$ref": "#/definitions/userCompanyName_string" + }, + "displayName": { + "$ref": "#/definitions/userDisplayName_string" + }, + "email": { + "$ref": "#/definitions/userEmail_string" + }, + "type": { + "$ref": "#/definitions/userType_string" + }, + "userId": { + "$ref": "#/definitions/userId_string" + } + }, + "title": "Author", + "type": "object", + "x-ms-visibility": "important" + }, + "commentGet_object": { + "description": "A comment on the workflow.", + "properties": { + "author": { + "$ref": "#/definitions/authorGet_object" + }, + "id": { + "$ref": "#/definitions/commentId_string" + }, + "commentMessage": { + "$ref": "#/definitions/commentText_string" + }, + "reactions": { + "$ref": "#/definitions/reactions_array" + }, + "timeStamp": { + "$ref": "#/definitions/created_string" + }, + "mentionedUserDetails": { + "$ref": "#/definitions/commentMentionedUserDetails" + }, + "addedParticipants": { + "$ref": "#/definitions/addedParticipants_array" + }, + "isExternal": { + "$ref": "#/definitions/isExternal_boolean" + } + }, + "title": "Comment", + "type": "object", + "x-ms-visibility": "important" + }, + "commentId_string": { + "description": "Identifier of the comment.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "commentMentionedUserDisplayName_string": { + "description": "Name of the mentioned user.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "commentMentionedUserEmail_string": { + "description": "Email of the mentioned user.", + "title": "Email", + "type": "string", + "x-ms-visibility": "important" + }, + "commentMentionedUserUserId_string": { + "description": "Unique identifier of the mentioned user.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "commentMentionedUserDetails": { + "description": "Details of users mentioned in the comment.", + "items": { + "properties": { + "displayName": { + "$ref": "#/definitions/commentMentionedUserDisplayName_string" + }, + "email": { + "$ref": "#/definitions/commentMentionedUserEmail_string" + }, + "id": { + "$ref": "#/definitions/commentMentionedUserUserId_string" + } + }, + "type": "object" + }, + "title": "Mentioned Users", + "type": "array", + "x-ms-visibility": "advanced" + }, + "commentPost_object": { + "description": "The comment object.", + "properties": { + "addUsersToWorkflow": { + "$ref": "#/definitions/addUsersToWorkflow_boolean" + }, + "creator": { + "$ref": "#/definitions/creatorPost_object" + }, + "comment": { + "$ref": "#/definitions/commentText_string" + }, + "repliedToActivityFeedMessageId": { + "$ref": "#/definitions/repliedToActivityFeedMessageId_string" + } + }, + "required": [ + "comment", + "creator", + "addUsersToWorkflow" + ], + "title": "Comment", + "type": "object", + "x-ms-visibility": "important" + }, + "commentsGet_array": { + "description": "The list of comments.", + "items": { + "$ref": "#/definitions/commentGet_object" + }, + "title": "Comments", + "type": "array", + "x-ms-visibility": "advanced" + }, + "commentSimplePost_object": { + "description": "The comment object.", + "properties": { + "addUsersToWorkflow": { + "$ref": "#/definitions/addUsersToWorkflow_boolean" + }, + "message": { + "$ref": "#/definitions/commentText_string" + } + }, + "required": [ + "message", + "addUsersToWorkflow" + ], + "title": "Comment", + "type": "object", + "x-ms-visibility": "important" + }, + "commentText_string": { + "description": "The text of the comment.", + "title": "Message", + "type": "string", + "x-ms-visibility": "important" + }, + "count_integer": { + "default": 25, + "description": "The number of records matching your criteria.", + "format": "int32", + "title": "Count", + "type": "integer", + "x-ms-visibility": "advanced" + }, + "counterpartyNameGet_string": { + "description": "The name of the counterparty.", + "title": "Counterparty Name", + "type": "string", + "x-ms-visibility": "important" + }, + "companyId_string": { + "description": "The identifier of the company.", + "title": "Company ID", + "type": "string", + "x-ms-visibility": "important" + }, + "created_string": { + "description": "The date and time of creation.", + "title": "Created Date Time", + "type": "string", + "x-ms-visibility": "important" + }, + "creatorGet_object": { + "description": "The Ironclad user that launched the workflow.", + "properties": { + "contactNumber": { + "$ref": "#/definitions/userContactNumber_string" + }, + "department": { + "$ref": "#/definitions/userDepartment_string" + }, + "displayName": { + "$ref": "#/definitions/userDisplayName_string" + }, + "email": { + "$ref": "#/definitions/userEmail_string" + }, + "id": { + "$ref": "#/definitions/userId_string" + }, + "lastUsageTrack": { + "$ref": "#/definitions/userLastUsageTrack_string" + }, + "pronoun": { + "$ref": "#/definitions/userPronoun_string" + }, + "title": { + "$ref": "#/definitions/userTitle_string" + }, + "username": { + "$ref": "#/definitions/userUsername_string" + } + }, + "title": "Creator", + "type": "object", + "x-ms-visibility": "important" + }, + "creatorPost_object": { + "description": "The Ironclad user (must be a user in your Ironclad account) to be used for launching the workflow.", + "properties": { + "email": { + "$ref": "#/definitions/userEmail_string" + }, + "id": { + "$ref": "#/definitions/userId_string" + }, + "type": { + "$ref": "#/definitions/userIdentificationAttribute_string" + } + }, + "required": [ + "type" + ], + "title": "Creator", + "type": "object", + "x-ms-visibility": "important" + }, + "documentContentType_string": { + "description": "The content type of the document.", + "title": "Content Type", + "type": "string", + "x-ms-visibility": "important" + }, + "documentDisplayName_string": { + "description": "The display name of the document.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "documentDownloadPath_string": { + "description": "The path to the current version of the document.", + "title": "Download Path", + "type": "string", + "x-ms-visibility": "important" + }, + "documentFileName_string": { + "description": "The file name of the document.", + "title": "File Name", + "type": "string", + "x-ms-visibility": "important" + }, + "documentKey_string": { + "description": "The key of the document.", + "title": "Key", + "type": "string", + "x-ms-visibility": "important" + }, + "documentLastModified_object": { + "description": "Information when and by whom the document was last modified.", + "properties": { + "author": { + "$ref": "#/definitions/authorGet_object" + }, + "timestamp": { + "$ref": "#/definitions/timestamp_string" + } + }, + "title": "Last Modified", + "type": "object", + "x-ms-visibility": "advanced" + }, + "documentMetadata_object": { + "description": "Metadata associated with the workflow document.", + "properties": { + "filename": { + "$ref": "#/definitions/attachmentFilename_string" + }, + "comment": { + "$ref": "#/definitions/documentMetadataComment_object" + } + }, + "title": "Metadata", + "type": "object", + "x-ms-visibility": "important", + "required": [ + "comment", + "filename" + ] + }, + "documentMetadataComment_object": { + "description": "The comment associated with creating the workflow document.", + "properties": { + "message": { + "$ref": "#/definitions/commentText_string" + } + }, + "required": [ + "message" + ], + "title": "Comment", + "type": "object", + "x-ms-visibility": "important" + }, + "documentSystemName_string": { + "description": "The system name of the document.", + "title": "System Name", + "type": "string", + "x-ms-visibility": "important" + }, + "documentVersion_string": { + "description": "The version identifier of the workflow document.", + "title": "ID", + "type": "string", + "x-ms-visibility": "advanced" + }, + "documentVersionNumber_number": { + "description": "Version number of the document.", + "title": "Number", + "type": "number", + "x-ms-visibility": "important" + }, + "duration_integer": { + "description": "The duration of the approval request.", + "title": "Duration", + "type": "number", + "x-ms-visibility": "important" + }, + "emojiId_string": { + "description": "Identifier of the emoji used in the reaction.", + "title": "Emoji ID", + "type": "string", + "x-ms-visibility": "important" + }, + "event_string": { + "description": "The type of the event.", + "title": "Type", + "type": "string", + "x-ms-visibility": "important" + }, + "familyName_string": { + "description": "The family name of the user.", + "title": "Family Name", + "type": "string", + "x-ms-visibility": "important" + }, + "givenName_string": { + "description": "The given name of the user.", + "title": "Given Name", + "type": "string", + "x-ms-visibility": "important" + }, + "groupExternalId_string": { + "description": "The external identifier of the group.", + "title": "External ID", + "type": "string", + "x-ms-visibility": "important" + }, + "groupId_string": { + "description": "The identifier of the group.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "groupMemberType_string": { + "description": "Type of the member.", + "title": "Type", + "type": "string", + "x-ms-visibility": "advanced" + }, + "importId_string": { + "description": "The unique identifier of the import operation.", + "title": "Import ID", + "type": "string", + "x-ms-visibility": "important" + }, + "instanceId_string": { + "description": "The identifier of the Ironclad instance.", + "title": "Instance ID", + "type": "string", + "x-ms-visibility": "advanced" + }, + "isCancelled_boolean": { + "description": "If true, the workflow was cancelled.", + "title": "Cancelled", + "type": "boolean", + "x-ms-visibility": "important" + }, + "isComplete_boolean": { + "description": "If true, the workflow was completed.", + "title": "Complete", + "type": "boolean", + "x-ms-visibility": "important" + }, + "isExternal_boolean": { + "description": "Indicates if the comment is from an external user.", + "title": "Is External", + "type": "boolean", + "x-ms-visibility": "advanced" + }, + "isRevertibleToReview_boolean": { + "description": "If true, the workflow can be reverted to review.", + "title": "Revertible to Review", + "type": "boolean", + "x-ms-visibility": "advanced" + }, + "isWetSigned_boolean": { + "description": "If true, the signer signed in wet ink.", + "title": "Wet Signed", + "type": "boolean", + "x-ms-visibility": "important" + }, + "itemsPerPage_integer": { + "description": "The number of resources returned in a list response page.", + "example": 1, + "title": "Items Per Page", + "type": "integer", + "x-ms-visibility": "important" + }, + "lastUpdated_string": { + "description": "The date and time of the last updated.", + "title": "Last Updated Date Time", + "type": "string", + "x-ms-visibility": "advanced" + }, + "notifyCounterparty_boolean": { + "description": "Set to true to notify the counterparty of the cancellation.", + "title": "Notify Counterparty", + "type": "boolean", + "x-ms-visibility": "important" + }, + "page_integer": { + "description": "The index of the page.", + "format": "int32", + "title": "Page", + "type": "integer", + "x-ms-visibility": "advanced" + }, + "pageSize_integer": { + "description": "A limit of the number of results.", + "format": "int32", + "title": "Page Size", + "type": "integer", + "x-ms-visibility": "advanced" + }, + "paperSourceGet_string": { + "description": "The source of the workflow documents.", + "title": "Paper Source", + "type": "string", + "x-ms-visibility": "important" + }, + "prediction_object": { + "description": "The prediction status for a record in the smart import.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordId_string" + }, + "status": { + "$ref": "#/definitions/predictionStatus_string" + } + }, + "title": "Prediction", + "type": "object", + "x-ms-visibility": "important" + }, + "predictions_array": { + "description": "The prediction statuses for the smart import.", + "items": { + "$ref": "#/definitions/prediction_object" + }, + "title": "Predictions", + "type": "array", + "x-ms-visibility": "important" + }, + "predictionStatus_string": { + "description": "The status of the prediction.", + "title": "Status", + "type": "string", + "x-ms-visibility": "important" + }, + "propertyDataType_string": { + "description": "The data type of the property.", + "title": "Data Type", + "type": "string", + "x-ms-visibility": "important" + }, + "propertyDisplayName_string": { + "description": "The display name of the property.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "propertyReadOnly_boolean": { + "description": "If true, the property is read-only.", + "title": "Read-Only", + "type": "boolean", + "x-ms-visibility": "internal" + }, + "propertyToAddSystemName_string": { + "description": "The system name of the property to add to the record.", + "title": "to add Name", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "RetrieveRecordSchemas", + "value-collection": "formattedProperties", + "value-path": "systemName", + "value-title": "label" + }, + "x-ms-visibility": "important" + }, + "propertySystemName_string": { + "description": "The system name of the property.", + "title": "Name", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "RetrieveRecordSchemas", + "value-collection": "formattedProperties", + "value-path": "systemName", + "value-title": "label" + }, + "x-ms-visibility": "important" + }, + "propertyType_string": { + "description": "The data type of the property.", + "enum": [ + "string", + "number", + "boolean", + "date", + "monetary_amount", + "email", + "clause", + "address", + "duration" + ], + "title": "Type", + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "Text", + "value": "string" + }, + { + "displayName": "Number", + "value": "number" + }, + { + "displayName": "Yes/No", + "value": "boolean" + }, + { + "displayName": "Date", + "value": "date" + }, + { + "displayName": "Monetary Amount", + "value": "monetary_amount" + }, + { + "displayName": "Email", + "value": "email" + }, + { + "displayName": "Clause", + "value": "clause" + }, + { + "displayName": "Address", + "value": "address" + }, + { + "displayName": "Duration", + "value": "duration" + } + ], + "x-ms-visibility": "important" + }, + "propertyValue_dynamic": { + "description": "The value of the property.", + "title": "Value", + "x-ms-visibility": "important" + }, + "reactions_array": { + "description": "Reactions to the comment.", + "items": { + "$ref": "#/definitions/reactions_object" + }, + "title": "Reactions", + "type": "array", + "x-ms-visibility": "advanced" + }, + "reactions_object": { + "description": "A reaction to the comment.", + "properties": { + "emojiId": { + "$ref": "#/definitions/emojiId_string" + }, + "reactors": { + "$ref": "#/definitions/reactors_array" + } + }, + "title": "Reaction", + "type": "object", + "x-ms-visibility": "advanced" + }, + "reactor_object": { + "description": "A user who reacted to the comment.", + "properties": { + "displayName": { + "$ref": "#/definitions/userDisplayName_string" + }, + "id": { + "$ref": "#/definitions/userId_string" + } + }, + "title": "Reactor", + "type": "object", + "x-ms-visibility": "advanced" + }, + "reactors_array": { + "description": "Users who reacted to the comment.", + "items": { + "$ref": "#/definitions/reactor_object" + }, + "title": "Reactors", + "type": "array", + "x-ms-visibility": "advanced" + }, + "recordAddChildren_array": { + "description": "List of objects containing the Record IDs or Ironclad IDs of the records to be set as child records of the current record.", + "items": { + "$ref": "#/definitions/recordAddChildrenPost_object" + }, + "title": "Add Children", + "type": "array", + "x-ms-visibility": "important" + }, + "recordAddChildrenPost_object": { + "description": "Object containing the Record IDs or Ironclad IDs of the records to be set as child records of the current record.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordAddChildrenPostRecordID_string" + } + }, + "title": "Add Child Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordAddChildrenPostRecordID_string": { + "description": "The Record ID or Ironclad ID of the record to be set as a child record of the current record.", + "title": "ID", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListAllRecords", + "parameters": { + "page": 0, + "pageSize": 100, + "sortDirection": "DESC", + "sortField": "lastUpdated" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "ironcladId" + }, + "x-ms-visibility": "important" + }, + "recordAddLinkRecordPost_object": { + "description": "Object containing the Record IDs or Ironclad IDs of the records to link.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordAddLinksPostRecordID_string" + } + }, + "title": "Add Link Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordAddLinks_array": { + "description": "List of objects containing the Record IDs or Ironclad IDs of the records to link.", + "items": { + "$ref": "#/definitions/recordAddLinkRecordPost_object" + }, + "title": "Add Links", + "type": "array", + "x-ms-visibility": "important" + }, + "recordAddLinksPostRecordID_string": { + "description": "The Record ID or Ironclad ID of the record to link.", + "title": "ID", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListAllRecords", + "parameters": { + "page": 0, + "pageSize": 100, + "sortDirection": "DESC", + "sortField": "lastUpdated" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "ironcladId" + }, + "x-ms-visibility": "important" + }, + "recordAttachmentsAsArrayScriptGet_array": { + "description": "The attachments of the record.", + "items": { + "properties": { + "displayName": { + "$ref": "#/definitions/attachmentDisplayName_string" + }, + "key": { + "$ref": "#/definitions/documentKey_string" + }, + "name": { + "$ref": "#/definitions/attachmentName_string" + } + }, + "title": "Attachment", + "type": "object", + "x-ms-visibility": "internal" + }, + "title": "Attachments as Array", + "type": "array" + }, + "recordAttachmentsGet_object": { + "description": "The attachments on this record.", + "title": "Attachments", + "type": "object", + "x-ms-visibility": "internal" + }, + "recordAttachmentsFormatted_object": { + "type": "object", + "title": "Attachment", + "description": "An attachment of the record schema.", + "x-ms-visibility": "important", + "properties": { + "systemName": { + "$ref": "#/definitions/attachmentDisplayName_string" + }, + "displayName": { + "$ref": "#/definitions/attachmentName_string" + } + } + }, + "recordAttachmentsFormatted_array": { + "title": "Formatted Attachments", + "description": "The formatted attachments of the record schema.", + "type": "array", + "x-ms-visibility": "important", + "items": { + "$ref": "#/definitions/recordAttachmentsFormatted_object" + } + }, + "recordAttachmentsInternalGet_object": { + "description": "The attachments on this record.", + "title": "Attachments", + "type": "object", + "x-ms-visibility": "internal" + }, + "recordChildIdGet_string": { + "description": "The identifier of the child record.", + "title": "Child Record ID", + "type": "string", + "x-ms-visibility": "important" + }, + "recordChildIdsGet_array": { + "description": "Child records in the repository.", + "items": { + "$ref": "#/definitions/recordChildIdGet_string" + }, + "title": "Child Records", + "type": "array", + "x-ms-visibility": "advanced" + }, + "recordChildrenPost_array": { + "description": "List of objects containing the Record IDs or Ironclad IDs of the records to be set as child records of the current record.", + "items": { + "$ref": "#/definitions/recordAddChildrenPost_object" + }, + "title": "Children", + "type": "array", + "x-ms-visibility": "important" + }, + "recordGetDynamic_object": { + "description": "A record and its associated data.", + "properties": { + "attachments": { + "$ref": "#/definitions/recordAttachmentsInternalGet_object" + }, + "attachmentsAsArray": { + "$ref": "#/definitions/recordAttachmentsAsArrayScriptGet_array" + }, + "childIds": { + "$ref": "#/definitions/recordChildIdsGet_array" + }, + "formattedProperties": { + "description": "The OpenAPI formatted properties of the record.", + "title": "Formatted Properties", + "type": "object", + "x-ms-dynamic-properties": { + "itemValuePath": "formattedSchema", + "operationId": "RetrieveRecord", + "parameters": { + "Record": { + "parameterReference": "Record" + } + } + }, + "x-ms-dynamic-schema": { + "operationId": "RetrieveRecord", + "parameters": { + "Record": { + "parameter": "Record" + } + }, + "value-path": "formattedSchema" + }, + "x-ms-visibility": "important" + }, + "formattedSchema": { + "$ref": "#/definitions/recordSchemaFormatted_object" + }, + "id": { + "$ref": "#/definitions/recordId_string" + }, + "ironcladId": { + "$ref": "#/definitions/recordIroncladId_string" + }, + "lastUpdated": { + "$ref": "#/definitions/lastUpdated_string" + }, + "links": { + "$ref": "#/definitions/recordLinksGet_array" + }, + "name": { + "$ref": "#/definitions/recordName_string" + }, + "parentId": { + "$ref": "#/definitions/recordParentGet_string" + }, + "propertiesAsArray": { + "$ref": "#/definitions/recordPropertiesAsArrayGet_array" + }, + "recordType": { + "$ref": "#/definitions/recordTypeGet_string" + }, + "source": { + "$ref": "#/definitions/recordSource_object" + } + }, + "title": "Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordGetStatic_object": { + "description": "A record and its associated data.", + "properties": { + "counterpartyName": { + "$ref": "#/definitions/counterpartyNameGet_string" + }, + "attachments": { + "$ref": "#/definitions/recordAttachmentsGet_object" + }, + "childIds": { + "$ref": "#/definitions/recordChildIdsGet_array" + }, + "id": { + "$ref": "#/definitions/recordId_string" + }, + "ironcladId": { + "$ref": "#/definitions/recordIroncladId_string" + }, + "lastUpdated": { + "$ref": "#/definitions/lastUpdated_string" + }, + "links": { + "$ref": "#/definitions/recordLinksGet_array" + }, + "name": { + "$ref": "#/definitions/recordName_string" + }, + "parentId": { + "$ref": "#/definitions/recordParentGet_string" + }, + "properties": { + "$ref": "#/definitions/recordPropertiesGet_object" + }, + "recordType": { + "$ref": "#/definitions/recordTypeGet_string" + }, + "source": { + "$ref": "#/definitions/recordSource_object" + }, + "label": { + "$ref": "#/definitions/recordLabelGet_string" + } + }, + "title": "Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordGetFormatted_object": { + "description": "A record and its associated data.", + "properties": { + "counterpartyName": { + "$ref": "#/definitions/counterpartyNameGet_string" + }, + "attachments": { + "$ref": "#/definitions/recordAttachmentsGet_object" + }, + "childIds": { + "$ref": "#/definitions/recordChildIdsGet_array" + }, + "id": { + "$ref": "#/definitions/recordId_string" + }, + "ironcladId": { + "$ref": "#/definitions/recordIroncladId_string" + }, + "lastUpdated": { + "$ref": "#/definitions/lastUpdated_string" + }, + "links": { + "$ref": "#/definitions/recordLinksGet_array" + }, + "name": { + "$ref": "#/definitions/recordName_string" + }, + "parentId": { + "$ref": "#/definitions/recordParentGet_string" + }, + "formattedProperties": { + "description": "The OpenAPI formatted properties of the record.", + "title": "Formatted Properties", + "type": "object", + "x-ms-dynamic-properties": { + "itemValuePath": "formattedSchema", + "operationId": "RetrieveRecordSchemas", + "parameters": { + "recordPorperties": { + "parameterReference": "recordPorperties" + } + } + }, + "x-ms-dynamic-schema": { + "operationId": "RetrieveRecordSchemas", + "parameters": { + "recordPorperties": { + "parameter": "recordPorperties" + } + }, + "value-path": "formattedSchema" + }, + "x-ms-visibility": "important" + }, + "recordType": { + "$ref": "#/definitions/recordTypeGet_string" + }, + "source": { + "$ref": "#/definitions/recordSource_object" + }, + "label": { + "$ref": "#/definitions/recordLabelGet_string" + } + }, + "title": "Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordIroncladId_string": { + "description": "The Ironclad ID of the record.", + "title": "Ironclad ID", + "type": "string", + "x-ms-visibility": "important" + }, + "recordId_string": { + "description": "The identifier of the repository record.", + "title": "ID", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListAllRecords", + "parameters": { + "page": 0, + "pageSize": 100, + "sortDirection": "DESC", + "sortField": "lastUpdated" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "ironcladId" + }, + "x-ms-visibility": "important" + }, + "recordLabelGet_string": { + "description": "The display label of the record.", + "title": "Label", + "type": "string", + "x-ms-visibility": "important" + }, + "recordLinkGet_object": { + "description": "An object containing the Record ID of a record related of the current record.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordLinkIdGet_string" + } + }, + "title": "Related Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordLinkIdGet_string": { + "description": "The identifier of the related record.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "recordLinkPost_object": { + "description": "An object containing the Record ID or Ironclad ID of the record to be set as related of the current record.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordAddLinksPostRecordID_string" + } + }, + "title": "Related Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordLinksGet_array": { + "description": "List of objects containing the Record IDs of the records related of the current record.", + "items": { + "$ref": "#/definitions/recordLinkGet_object" + }, + "title": "Related Records", + "type": "array", + "x-ms-visibility": "important" + }, + "recordLinksPost_array": { + "description": "List of objects containing the Record IDs or Ironclad IDs of the records to be set as related of the current record.", + "items": { + "$ref": "#/definitions/recordLinkPost_object" + }, + "title": "Related Records", + "type": "array", + "x-ms-visibility": "important" + }, + "recordName_string": { + "description": "The name of the repository record.", + "title": "Name", + "type": "string", + "x-ms-visibility": "important" + }, + "recordParentGet_string": { + "description": "The parent record in the repository.", + "title": "Parent Record ID", + "type": "string", + "x-ms-visibility": "advanced" + }, + "recordParentPost_object": { + "description": "Object containing the Record ID or Ironclad ID of the record to be set as the parent of the current record.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordId_string" + } + }, + "required": [ + "recordId" + ], + "title": "Parent Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordPost_object": { + "description": "A record and its associated data.", + "properties": { + "name": { + "$ref": "#/definitions/recordName_string" + }, + "type": { + "$ref": "#/definitions/recordTypePost_string" + }, + "propertiesAsArray": { + "$ref": "#/definitions/recordPropertiesAsArrayPost_array" + }, + "children": { + "$ref": "#/definitions/recordChildrenPost_array" + }, + "links": { + "$ref": "#/definitions/recordLinksPost_array" + }, + "parent": { + "$ref": "#/definitions/recordParentPost_object" + } + }, + "required": [ + "name", + "type", + "propertiesAsArray" + ], + "title": "Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordPropertiesAsArrayAttributesGet_object": { + "description": "The attributes of the property.", + "properties": { + "type": { + "$ref": "#/definitions/propertyDataType_string" + }, + "value": { + "$ref": "#/definitions/propertyValue_dynamic" + } + }, + "title": "Property Attributes", + "type": "object", + "x-ms-visibility": "important" + }, + "recordPropertiesAsArrayGet_array": { + "description": "The properties of the record as an array.", + "items": { + "$ref": "#/definitions/recordPropertiesAsArrayGet_object" + }, + "title": "Properties as Array", + "type": "array", + "x-ms-visibility": "important" + }, + "recordPropertiesAsArrayGet_object": { + "description": "A record property.", + "properties": { + "propertyAttributes": { + "$ref": "#/definitions/recordPropertiesAsArrayAttributesGet_object" + }, + "propertySystemName": { + "$ref": "#/definitions/propertySystemName_string" + } + }, + "title": "Record Property", + "type": "object", + "x-ms-visibility": "internal" + }, + "recordPropertiesToAddAsArrayPost_array": { + "description": "The properties of the record.", + "items": { + "$ref": "#/definitions/recordPropertiesToAddPostAsArray_object" + }, + "title": "Add Properties", + "type": "array", + "x-ms-visibility": "important" + }, + "recordPropertiesAsArrayPost_array": { + "description": "The properties of the record.", + "items": { + "$ref": "#/definitions/recordPropertiesPostAsArray_object" + }, + "title": "Properties", + "type": "array", + "x-ms-visibility": "important" + }, + "recordPropertiesFormatted_array": { + "title": "Formatted Properties", + "description": "The formatted properties of the record schema.", + "type": "array", + "x-ms-visibility": "important", + "items": { + "type": "object", + "title": "Formatted Property", + "description": "A property of the record schema.", + "x-ms-visibility": "important", + "properties": { + "systemName": { + "$ref": "#/definitions/propertySystemName_string" + }, + "displayName": { + "$ref": "#/definitions/recordPropertyDisplayName_string" + }, + "type": { + "$ref": "#/definitions/recordPropertyType_string" + }, + "visible": { + "$ref": "#/definitions/recordPropertyvisible_boolean" + }, + "resolvesTo": { + "$ref": "#/definitions/recordPropertyResolvesTo_string" + }, + "label": { + "$ref": "#/definitions/recordPropertyLabel_string" + } + } + } + }, + "recordPropertiesGet_object": { + "description": "The properties of the record.", + "title": "Properties", + "type": "object", + "x-ms-visibility": "internal" + }, + "recordPropertiesToAddPostAsArray_object": { + "description": "A record property to add.", + "properties": { + "propertySystemName": { + "$ref": "#/definitions/propertyToAddSystemName_string" + }, + "value": { + "$ref": "#/definitions/propertyValue_dynamic" + } + }, + "required": [ + "propertySystemName", + "value" + ], + "title": "Property", + "type": "object", + "x-ms-visibility": "important" + }, + "recordPropertiesPostAsArray_object": { + "description": "A record property.", + "properties": { + "propertySystemName": { + "$ref": "#/definitions/propertySystemName_string" + }, + "value": { + "$ref": "#/definitions/propertyValue_dynamic" + } + }, + "required": [ + "propertySystemName", + "value" + ], + "title": "Property", + "type": "object", + "x-ms-visibility": "important" + }, + "recordPropertyDisplayName_string": { + "description": "The display name of the property.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "recordPropertyType_string": { + "description": "The type of the property.", + "title": "Type", + "type": "string", + "x-ms-visibility": "important" + }, + "recordPropertyvisible_boolean": { + "description": "Whether the property is visible.", + "title": "Visible", + "type": "boolean", + "x-ms-visibility": "important" + }, + "recordPropertyResolvesTo_string": { + "description": "The resolves to of the property.", + "title": "Resolves To", + "type": "string", + "x-ms-visibility": "important" + }, + "recordPropertyLabel_string": { + "description": "The label of the property.", + "title": "Label", + "type": "string", + "x-ms-visibility": "important" + }, + "recordRemoveChildren_array": { + "description": "List of objects containing the Record IDs or Ironclad IDs of the child records to remove.", + "items": { + "$ref": "#/definitions/recordRemoveChildrenPost_object" + }, + "title": "Remove Children", + "type": "array", + "x-ms-visibility": "important" + }, + "recordRemoveChildrenPost_object": { + "description": "Object containing the Record IDs or Ironclad IDs of the child records to remove.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordRemoveChildrenPostRecordID_string" + } + }, + "title": "Remove Child Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordRemoveChildrenPostRecordID_string": { + "description": "The Record ID or Ironclad ID of the child record to be removed from the current record.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "recordRemoveLinks_array": { + "description": "List of objects containing the Record IDs or Ironclad IDs of the record links to remove.", + "items": { + "$ref": "#/definitions/recordRemoveLinksPost_object" + }, + "title": "Remove Links", + "type": "array", + "x-ms-visibility": "important" + }, + "recordRemoveLinksPost_object": { + "description": "Object containing the Record IDs or Ironclad IDs of the record links to remove.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordRemoveLinksPostRecordID_string" + } + }, + "title": "Remove Link Record", + "type": "object", + "x-ms-visibility": "important" + }, + "recordRemoveLinksPostRecordID_string": { + "description": "The Record ID or Ironclad ID of the record links to remove.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "recordRemoveParent_boolean": { + "description": "If true, the parent id should be removed for the current record.", + "title": "Remove Parent", + "type": "boolean", + "x-ms-visibility": "important" + }, + "recordRemoveProperties_array": { + "description": "An array of properties to remove", + "items": { + "$ref": "#/definitions/recordRemoveProperty_string" + }, + "title": "Remove Properties", + "type": "array", + "x-ms-visibility": "important" + }, + "recordRemoveProperty_string": { + "description": "The name of the property to remove", + "title": "Property to remove Name", + "type": "string", + "x-ms-visibility": "important", + "x-ms-dynamic-values": { + "operationId": "RetrieveRecordSchemas", + "value-collection": "formattedProperties", + "value-path": "systemName", + "value-title": "label" + } + }, + "recordSchemaFormatted_object": { + "title": "Formatted Schema", + "type": "object", + "x-ms-visibility": "advanced", + "description": "The formatted schema (if requested by adding a properties query)." + }, + "recordSchemaPropertiesGet_object": { + "description": "The schema properties as a dictionary.", + "title": "Properties Dictionary", + "type": "object", + "x-ms-visibility": "advanced" + }, + "recordSetParent_object": { + "description": "Object containing Record IDs or Ironclad IDs to be set as the parent of the current record.", + "properties": { + "recordId": { + "$ref": "#/definitions/recordId_string" + } + }, + "title": "Parent", + "type": "object", + "x-ms-visibility": "important" + }, + "recordsGetFormatted_array": { + "description": "The records matching the query.", + "items": { + "$ref": "#/definitions/recordGetFormatted_object" + }, + "title": "Records", + "type": "array", + "x-ms-visibility": "advanced" + }, + "recordSource_object": { + "description": "The source of the record.", + "title": "Source", + "properties": { + "type": { + "$ref": "#/definitions/recordSourceType_string" + }, + "workflowId": { + "$ref": "#/definitions/uniqueId_string" + } + }, + "type": "object", + "x-ms-visibility": "advanced" + }, + "recordSourceType_string": { + "description": "The type of the source.", + "title": "Type", + "type": "string", + "x-ms-visibility": "important" + }, + "recordTypeDescription_string": { + "description": "The description of the record type.", + "title": "Description", + "type": "string", + "x-ms-visibility": "important" + }, + "recordTypeDisplayName_string": { + "description": "The display name of the record type.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "recordTypeGet_string": { + "description": "The system name of the record type.", + "title": "Type", + "type": "string", + "x-ms-visibility": "important" + }, + "recordTypePost_string": { + "description": "The type of the record.", + "title": "Type", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "RetrieveRecordSchemas", + "value-collection": "formattedRecordTypes", + "value-path": "systemName", + "value-title": "displayName" + }, + "x-ms-visibility": "important" + }, + "recordTypesDictionary_object": { + "description": "A dictionary of record types available in this instance.", + "title": "Record Types Dictionary", + "type": "object", + "x-ms-visibility": "advanced" + }, + "recordTypesFormatted_array": { + "title": "Record Types", + "description": "The formatted record types of the record schema.", + "type": "array", + "x-ms-visibility": "important", + "items": { + "$ref": "#/definitions/recordTypesFormatted_object" + } + }, + "recordTypesFormatted_object": { + "title": "Record Type", + "description": "A record type of the record schema.", + "type": "object", + "x-ms-visibility": "important", + "properties": { + "systemName": { + "$ref": "#/definitions/recordTypeGet_string" + }, + "displayName": { + "$ref": "#/definitions/recordTypeDisplayName_string" + }, + "description": { + "$ref": "#/definitions/recordTypeDescription_string" + } + } + }, + "remainingCredits_integer": { + "description": "The number of credits remaining after the operation.", + "title": "Remaining Credits", + "type": "integer", + "x-ms-visibility": "important" + }, + "repliedToActivityFeedMessageId_string": { + "description": "The identifier of the activity feed message that this message is a reply to.", + "title": "Replied To Activity Feed Message ID", + "type": "string", + "x-ms-visibility": "important" + }, + "requestedProperties_string": { + "title": "Requested Properties", + "type": "string", + "x-ms-visibility": "advanced", + "description": "The properties requested in the query." + }, + "reviewRollbacked_boolean": { + "description": "If true, the workflow was reverted to review.", + "title": "Reverted to Review", + "type": "boolean", + "x-ms-visibility": "advanced" + }, + "routingOrder_integer": { + "description": "The routing order of the signer.", + "format": "int32", + "title": "Routing Order", + "type": "integer", + "x-ms-visibility": "important" + }, + "schemaProperties_object": { + "description": "The properties of the schema.", + "title": "Properties", + "type": "object", + "x-ms-visibility": "important" + }, + "scimActive_boolean": { + "description": "If true, the user's account is active.", + "title": "Active", + "type": "boolean", + "x-ms-visibility": "important" + }, + "scimEmail_object": { + "description": "An email object of the user.", + "properties": { + "primary": { + "$ref": "#/definitions/scimEmailPrimaryGet_boolean" + }, + "type": { + "$ref": "#/definitions/scimEmailTypeGet_string" + }, + "value": { + "$ref": "#/definitions/userEmail_string" + } + }, + "title": "Email Object", + "type": "object", + "x-ms-visibility": "important" + }, + "scimEmailPrimaryGet_boolean": { + "description": "If true, this is the preferred email of the user.", + "title": "Primary", + "type": "boolean", + "x-ms-visibility": "important" + }, + "scimEmails_array": { + "description": "The emails of the user.", + "items": { + "$ref": "#/definitions/scimEmail_object" + }, + "title": "Emails", + "type": "array", + "x-ms-visibility": "important" + }, + "scimEmailTypeGet_string": { + "description": "The type of email.", + "title": "Type", + "type": "string", + "x-ms-visibility": "important" + }, + "scimGroupDisplayName_string": { + "description": "The display name of the group.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "scimGroupGet_object": { + "description": "A group resource in SCIM format.", + "properties": { + "displayName": { + "$ref": "#/definitions/scimGroupDisplayName_string" + }, + "externalId": { + "$ref": "#/definitions/groupExternalId_string" + }, + "id": { + "$ref": "#/definitions/groupId_string" + }, + "members": { + "$ref": "#/definitions/scimGroupMembersGet_array" + }, + "schemas": { + "$ref": "#/definitions/scimSchemasGet_array" + } + }, + "title": "Group", + "type": "object", + "x-ms-visibility": "important" + }, + "scimGroupMemberGet_object": { + "description": "A member of the group.", + "properties": { + "type": { + "$ref": "#/definitions/groupMemberType_string" + }, + "value": { + "$ref": "#/definitions/userId_string" + } + }, + "title": "Member", + "type": "object", + "x-ms-visibility": "important" + }, + "scimGroupMemberPost_object": { + "description": "The member of the group to be added.", + "properties": { + "value": { + "$ref": "#/definitions/userId_string" + } + }, + "title": "Member", + "type": "object", + "x-ms-visibility": "important" + }, + "scimGroupMembersGet_array": { + "description": "The members of the group.", + "items": { + "$ref": "#/definitions/scimGroupMemberGet_object" + }, + "title": "Members", + "type": "array", + "x-ms-visibility": "important" + }, + "scimGroupMembersPost_array": { + "description": "The members to be added to the group.", + "items": { + "$ref": "#/definitions/scimGroupMemberPost_object" + }, + "title": "Members", + "type": "array", + "x-ms-visibility": "important" + }, + "scimGroupOperations_array": { + "items": { + "properties": { + "op": { + "$ref": "#/definitions/scimOp_string" + }, + "path": { + "$ref": "#/definitions/scimGroupPath_string" + }, + "value": { + "$ref": "#/definitions/scimGroupPatchOpValue_dynamic" + } + }, + "required": [ + "op", + "path", + "value" + ], + "type": "object" + }, + "title": "Operations", + "type": "array" + }, + "scimGroupPatchOpValue_dynamic": { + "description": "The value you wish to use for 'add' or 'replace' operations. The 'remove' operation does not take the 'value' parameter. To add or remove a user from a group, use the users identifier in an object with a key called 'value'.", + "title": "Value", + "x-ms-visibility": "important" + }, + "scimGroupPath_string": { + "description": "The path of the attribute that you wish to change.", + "enum": [ + "members", + "displayName", + "externalId" + ], + "x-ms-enum-values": [ + { + "displayName": "Members", + "value": "members" + }, + { + "displayName": "Display Name", + "value": "displayName" + }, + { + "displayName": "External ID", + "value": "externalId" + } + ], + "title": "Path", + "type": "string", + "x-ms-visibility": "important" + }, + "scimGroupResourcesGet_array": { + "description": "The list of resources returned by the list or query operation.", + "items": { + "$ref": "#/definitions/scimGroupGet_object" + }, + "title": "Resources", + "type": "array", + "x-ms-visibility": "important" + }, + "scimGroupSchemasPost_array": { + "description": "The lists of schemas to be applied.", + "items": { + "$ref": "#/definitions/scimGroupSchemaPost_string" + }, + "title": "SCIM Schemas", + "type": "array", + "x-ms-visibility": "internal" + }, + "scimGroupSchemaPost_string": { + "default": "urn:ietf:params:scim:schemas:core:2.0:Group", + "description": "The SCIM schema for groups.", + "title": "Schema", + "type": "string", + "x-ms-visibility": "internal" + }, + "scimName_object": { + "description": "The components of the user's real name.", + "properties": { + "familyName": { + "$ref": "#/definitions/familyName_string" + }, + "givenName": { + "$ref": "#/definitions/givenName_string" + } + }, + "required": [ + "familyName", + "givenName" + ], + "type": "object", + "x-ms-visibility": "important" + }, + "scimOp_string": { + "description": "The operation to perform on the user.", + "enum": [ + "add", + "remove", + "replace" + ], + "title": "Operation", + "type": "string", + "x-ms-visibility": "important" + }, + "scimPassword_string": { + "description": "The password of the user.", + "title": "Password", + "type": "string", + "x-ms-visibility": "important" + }, + "scimPatchOpSchemaPost_string": { + "default": "urn:ietf:params:scim:api:messages:2.0:PatchOp", + "description": "The SCIM schema for patchops.", + "title": "Schema", + "type": "string", + "x-ms-visibility": "internal" + }, + "scimPatchOpSchemasPost_array": { + "description": "The lists of schemas to be applied.", + "items": { + "$ref": "#/definitions/scimPatchOpSchemaPost_string" + }, + "title": "internal", + "type": "array", + "x-ms-visibility": "internal" + }, + "scimSchemaGet_object": { + "description": "A schema supported by the response.", + "title": "internal", + "type": "string", + "x-ms-visibility": "important" + }, + "scimSchemasGet_array": { + "description": "The list of supported schemas.", + "items": { + "$ref": "#/definitions/scimSchemaGet_object" + }, + "title": "internal", + "type": "array", + "x-ms-visibility": "important" + }, + "scimTitle_string": { + "description": "The title of the user.", + "title": "Title", + "type": "string", + "x-ms-visibility": "important" + }, + "scimUserGet_object": { + "description": "A user resource in SCIM format.", + "properties": { + "active": { + "$ref": "#/definitions/scimActive_boolean" + }, + "displayName": { + "$ref": "#/definitions/userDisplayName_string" + }, + "emails": { + "$ref": "#/definitions/scimEmails_array" + }, + "id": { + "$ref": "#/definitions/userId_string" + }, + "name": { + "$ref": "#/definitions/scimName_object" + }, + "schemas": { + "$ref": "#/definitions/scimSchemasGet_array" + }, + "title": { + "$ref": "#/definitions/scimTitle_string" + }, + "username": { + "$ref": "#/definitions/username_string" + }, + "combinedLabel": { + "$ref": "#/definitions/userLabel_string" + } + }, + "title": "User", + "type": "object", + "x-ms-visibility": "important" + }, + "scimUserOperations_array": { + "items": { + "properties": { + "op": { + "$ref": "#/definitions/scimOp_string" + }, + "path": { + "$ref": "#/definitions/scimUserPath_string" + }, + "value": { + "$ref": "#/definitions/scimUserValue_string" + } + }, + "required": [ + "op", + "path" + ], + "type": "object" + }, + "title": "Operations", + "type": "array" + }, + "scimUserPath_string": { + "description": "The path of the attribute that you wish to change.", + "enum": [ + "userName", + "name.givenName", + "name.familyName", + "title", + "emails" + ], + "title": "Path", + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "Username", + "value": "userName" + }, + { + "displayName": "Given Name", + "value": "name.givenName" + }, + { + "displayName": "Family Name", + "value": "name.familyName" + }, + { + "displayName": "Title", + "value": "title" + }, + { + "displayName": "Emails", + "value": "emails" + } + ], + "x-ms-visibility": "important" + }, + "scimUserResourcesGet_array": { + "description": "The list of resources returned by the list or query operation.", + "items": { + "$ref": "#/definitions/scimUserGet_object" + }, + "title": "Resources", + "type": "array", + "x-ms-visibility": "important" + }, + "scimUserSchemaPost_string": { + "default": "urn:ietf:params:scim:schemas:core:2.0:User", + "description": "The SCIM schema for users.", + "title": "Schema", + "type": "string", + "x-ms-visibility": "internal" + }, + "scimUserSchemasPost_array": { + "description": "The lists of schemas to be applied.", + "items": { + "$ref": "#/definitions/scimUserSchemaPost_string" + }, + "title": "SCIM Schemas", + "type": "array", + "x-ms-visibility": "internal" + }, + "scimUserValue_string": { + "description": "The value you wish to use for 'add' or 'replace' operations. The 'remove' operation does not take the 'value' parameter.", + "title": "Value", + "type": "string", + "x-ms-visibility": "important" + }, + "sentSignaturePacket_array": { + "description": "If available, the documents sent in the signature packet.", + "items": { + "$ref": "#/definitions/workflowDocument_object" + }, + "title": "Signature Packet", + "type": "array", + "x-ms-visibility": "advanced" + }, + "startIndex_integer": { + "default": 1, + "description": "The starting index for retrieving this resource. Resources are indexed based on when they were first added to Ironclad.", + "example": 1, + "title": "Start Index", + "type": "integer", + "x-ms-visibility": "important" + }, + "state_string": { + "description": "", + "title": "State", + "type": "string", + "x-ms-visibility": "important" + }, + "templateId_string": { + "description": "The identifier of the workflow template.", + "title": "Template", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListWorkflowSchemas", + "parameters": { + "form": "launch" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "name" + }, + "x-ms-visibility": "important" + }, + "templateTitle_string": { + "description": "The title of the workflow template.", + "title": "Template Title", + "type": "string", + "x-ms-visibility": "important" + }, + "timestamp_string": { + "description": "The date and time of the event.", + "title": "Timestamp", + "type": "string", + "x-ms-visibility": "important" + }, + "totalResults_integer": { + "description": "The total number of results returned by the list or query operation.", + "example": 1, + "title": "Total Results", + "type": "integer", + "x-ms-visibility": "important" + }, + "triggerPayload_object": { + "description": "The contents of the trigger payload.", + "properties": { + "event": { + "$ref": "#/definitions/event_string" + }, + "templateID": { + "$ref": "#/definitions/templateId_string" + }, + "workflowID": { + "$ref": "#/definitions/uniqueId_string" + } + }, + "title": "Trigger Payload", + "type": "object", + "x-ms-visibility": "advanced" + }, + "turnEndTime_string": { + "description": "The date and time the turn ended.", + "title": "Turn End Time", + "type": "string", + "x-ms-visibility": "important" + }, + "turnHistory_array": { + "description": "The turn history of the workflow", + "items": { + "description": "A turn in the workflow history.", + "properties": { + "turnEndTime": { + "$ref": "#/definitions/turnEndTime_string" + }, + "turnLocation": { + "$ref": "#/definitions/turnLocation_string" + }, + "turnNumber": { + "$ref": "#/definitions/turnNumber_integer" + }, + "turnParty": { + "$ref": "#/definitions/turnParty_string" + }, + "turnStartTime": { + "$ref": "#/definitions/turnStartTime_string" + }, + "turnUser": { + "$ref": "#/definitions/userId_string" + }, + "turnUserEmail": { + "$ref": "#/definitions/userEmail_string" + } + }, + "title": "Turn", + "type": "object", + "x-ms-visibility": "important" + }, + "title": "Turn History", + "type": "array" + }, + "turnLocation_string": { + "description": "The location of the turn.", + "title": "Turn Location", + "type": "string", + "x-ms-visibility": "important" + }, + "turnNumber_integer": { + "description": "The number of the turn.", + "title": "Turn Number", + "type": "integer", + "x-ms-visibility": "important" + }, + "turnParty_string": { + "description": "The party that took the turn.", + "title": "Turn Party", + "type": "string", + "x-ms-visibility": "important" + }, + "turnStartTime_string": { + "description": "The date and time the turn started.", + "title": "Turn Start Time", + "type": "string", + "x-ms-visibility": "important" + }, + "uniqueId_string": { + "description": "The unique identifier.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "uploadSignedGet_object": { + "description": "The signed document.", + "properties": { + "signed": { + "$ref": "#/definitions/workflowDocument_object" + }, + "title": { + "$ref": "#/definitions/workflowTitle_string" + }, + "workflowId": { + "$ref": "#/definitions/uniqueId_string" + } + }, + "title": "Upload Signed", + "type": "object", + "x-ms-visibility": "important" + }, + "userCompanyName_string": { + "description": "Company name of the author.", + "title": "Company Name", + "type": "string", + "x-ms-visibility": "advanced" + }, + "userContactNumber_string": { + "description": "The listed contact number of the user.", + "title": "Contact Number", + "type": "string", + "x-ms-visibility": "advanced" + }, + "userDepartment_string": { + "description": "The listed department of the user.", + "title": "Department", + "type": "string", + "x-ms-visibility": "advanced" + }, + "userDisplayName_string": { + "description": "The display name of the user.", + "title": "Display Name", + "type": "string", + "x-ms-visibility": "important" + }, + "userEmail_string": { + "description": "An email address of the Ironclad user.", + "title": "Email", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListUsers", + "parameters": { + "count": 100, + "startIndex": 1 + }, + "value-collection": "Resources", + "value-path": "username", + "value-title": "combinedLabel" + }, + "x-ms-visibility": "important" + }, + "userId_string": { + "description": "The user ID of the Ironclad user.", + "title": "ID", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListUsers", + "parameters": { + "count": 100, + "startIndex": 1 + }, + "value-collection": "Resources", + "value-path": "id", + "value-title": "combinedLabel" + }, + "x-ms-visibility": "important" + }, + "userLabel_string": { + "title": "Combined Label", + "type": "string", + "x-ms-visibility": "advanced", + "description": "A label combining the user's full name and email address." + }, + "userIdentificationAttribute_string": { + "default": "email", + "description": "The type of value used to identify the user.", + "enum": [ + "email", + "id" + ], + "title": "Attribute", + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "User Email", + "value": "email" + }, + { + "displayName": "User ID", + "value": "id" + } + ], + "x-ms-visibility": "important" + }, + "userLastUsageTrack_string": { + "description": "The date and time the user was last seen.", + "title": "Last User Track", + "type": "string", + "x-ms-visibility": "advanced" + }, + "username_string": { + "description": "The email of the user during account creation.", + "title": "Username", + "type": "string", + "x-ms-visibility": "important" + }, + "userPost_object": { + "description": "An Ironclad user.", + "properties": { + "email": { + "$ref": "#/definitions/userEmail_string" + }, + "id": { + "$ref": "#/definitions/userId_string" + }, + "type": { + "$ref": "#/definitions/userIdentificationAttribute_string" + } + }, + "title": "User", + "type": "object", + "x-ms-visibility": "important" + }, + "userPronoun_string": { + "description": "The listed pronoun(s) of the user.", + "title": "Pronoun(s)", + "type": "string", + "x-ms-visibility": "advanced" + }, + "userTitle_string": { + "description": "The job title of the user.", + "title": "Title", + "type": "string", + "x-ms-visibility": "advanced" + }, + "userType_string": { + "description": "Type of the user.", + "title": "Type", + "type": "string", + "x-ms-visibility": "advanced" + }, + "userUsername_string": { + "description": "The username of the user.", + "title": "Username", + "type": "string", + "x-ms-visibility": "important" + }, + "webhookConfiguration_object": { + "description": "A webhook configuration.", + "properties": { + "company": { + "$ref": "#/definitions/companyId_string" + }, + "events": { + "$ref": "#/definitions/webhookEvents_array" + }, + "id": { + "$ref": "#/definitions/webhookId_string" + }, + "targetURL": { + "$ref": "#/definitions/webhookTargetUrlGet_string" + } + }, + "title": "Webhook Configuration", + "type": "object", + "x-ms-visibility": "important" + }, + "webhookEvent_string": { + "default": "workflow_updated", + "enum": [ + "workflow_updated", + "workflow_launched", + "workflow_cancelled", + "workflow_completed", + "workflow_approval_status_changed", + "workflow_attribute_updated", + "workflow_comment_reaction_added", + "workflow_comment_reaction_removed", + "workflow_comment_added", + "workflow_comment_removed", + "workflow_comment_updated", + "workflow_counterparty_invite_sent", + "workflow_counterparty_invite_revoked", + "workflow_documents_added", + "workflow_documents_removed", + "workflow_documents_updated", + "workflow_documents_renamed", + "workflow_document_edited", + "workflow_paused", + "workflow_resumed", + "workflow_signature_packet_sent", + "workflow_signature_packet_uploaded", + "workflow_signature_packet_cancelled" + ], + "title": "Trigger Event", + "description": "The event that triggers the webhook.", + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "Workflow Updated", + "value": "workflow_updated" + }, + { + "displayName": "Workflow Launched", + "value": "workflow_launched" + }, + { + "displayName": "Workflow Cancelled", + "value": "workflow_cancelled" + }, + { + "displayName": "Workflow Completed", + "value": "workflow_completed" + }, + { + "displayName": "Approval Status Changed", + "value": "workflow_approval_status_changed" + }, + { + "displayName": "Workflow Attributes Updated", + "value": "workflow_attribute_updated" + }, + { + "displayName": "Comment Reaction Added", + "value": "workflow_comment_reaction_added" + }, + { + "displayName": "Comment Reaction Removed", + "value": "workflow_comment_reaction_removed" + }, + { + "displayName": "Comment Added", + "value": "workflow_comment_added" + }, + { + "displayName": "Comment Removed", + "value": "workflow_comment_removed" + }, + { + "displayName": "Comment Updated", + "value": "workflow_comment_updated" + }, + { + "displayName": "Counterparty Invite Sent", + "value": "workflow_counterparty_invite_sent" + }, + { + "displayName": "Counterparty Invite Revoked", + "value": "workflow_counterparty_invite_revoked" + }, + { + "displayName": "Workflow Document Added", + "value": "workflow_documents_added" + }, + { + "displayName": "Workflow Document Removed", + "value": "workflow_documents_removed" + }, + { + "displayName": "Workflow Document Updated", + "value": "workflow_documents_updated" + }, + { + "displayName": "Workflow Document Edited", + "value": "workflow_document_edited" + }, + { + "displayName": "Workflow Paused", + "value": "workflow_paused" + }, + { + "displayName": "Workflow Resumed", + "value": "workflow_resumed" + }, + { + "displayName": "Signature Packet Sent", + "value": "workflow_signature_packet_sent" + }, + { + "displayName": "Signature Packet Uploaded", + "value": "workflow_signature_packet_uploaded" + }, + { + "displayName": "Signature Packet Cancelled", + "value": "workflow_signature_packet_cancelled" + } + ], + "x-ms-visibility": "important" + }, + "webhookEvents_array": { + "description": "The trigger events for the Workflow.", + "items": { + "$ref": "#/definitions/webhookEvent_string" + }, + "title": "Events", + "type": "array", + "x-ms-visibility": "important" + }, + "webhookId_string": { + "description": "The identifier of the registered webhook.", + "title": "Webhook ID", + "type": "string", + "x-ms-visibility": "advanced" + }, + "webhookNotificationContent_object": { + "description": "The webhook data received from the event.", + "properties": { + "companyID": { + "$ref": "#/definitions/instanceId_string" + }, + "payload": { + "$ref": "#/definitions/triggerPayload_object" + }, + "timestamp": { + "$ref": "#/definitions/timestamp_string" + }, + "webhookID": { + "$ref": "#/definitions/webhookId_string" + } + }, + "title": "Event Data", + "type": "object" + }, + "webhookTargetUrlGet_string": { + "description": "targetURL", + "title": "Target URL", + "type": "string", + "x-ms-visibility": "important" + }, + "webhookTargetUrlPost_string": { + "description": "targetURL", + "title": "Target URL", + "type": "string", + "x-ms-notification-url": true, + "x-ms-visibility": "internal" + }, + "workflowApproval_object": { + "description": "The approval state of the workflow.", + "properties": { + "state": { + "$ref": "#/definitions/state_string" + } + }, + "title": "Approvals", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowApprovalGroup_array": { + "description": "An approval group in this workflow.", + "items": { + "$ref": "#/definitions/workflowApprovalGroup_object" + }, + "title": "Approval Groups", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowApprovalGroup_object": { + "description": "An approval group in this workflow.", + "properties": { + "reviewers": { + "$ref": "#/definitions/workflowReviewers_array" + } + }, + "title": "Approval Group", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowAsyncLaunchStatus_string": { + "description": "The status of the asynchronous job", + "title": "Status", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowAttributeAction_object": { + "description": "An update to an existing workflow attributes.", + "properties": { + "action": { + "$ref": "#/definitions/workflowAttributeAction_string" + }, + "path": { + "$ref": "#/definitions/workflowAttributePath_string" + }, + "value": { + "$ref": "#/definitions/workflowAttributeValue_dynamic" + } + }, + "required": [ + "action", + "path" + ], + "title": "Update", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowAttributeAction_string": { + "description": "The type of action you'd like to take on an existing attribute (read-only fields cannot be updated). Use the remove action to clear values. If using the remove action, the attribute cannot be required by the workflow.", + "enum": [ + "set", + "remove" + ], + "title": "Action", + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "Set", + "value": "set" + }, + { + "displayName": "Remove", + "value": "remove" + } + ], + "x-ms-visibility": "important" + }, + "workflowAttributeActions_array": { + "description": "The actions to take on the workflow attributes.", + "items": { + "$ref": "#/definitions/workflowAttributeAction_object" + }, + "title": "Actions", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowAttributeActions_object": { + "description": "The object describing the workflow metadata update.", + "properties": { + "comment": { + "$ref": "#/definitions/commentText_string" + }, + "updates": { + "$ref": "#/definitions/workflowAttributeActions_array" + } + }, + "title": "Metadata Update", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowAttributePath_string": { + "description": "The workflow attribute id that you'd like to make a change to.", + "title": "Path", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "RetrieveWorkflowSchema", + "parameters": { + "Schema": { + "parameter": "configuration" + }, + "form": "launch" + }, + "value-collection": "schemaAsArray", + "value-path": "systemName", + "value-title": "displayName" + }, + "x-ms-visibility": "important" + }, + "workflowAttributesAsArrayGet_array": { + "description": "A list of workflow attributes as an array.", + "items": { + "$ref": "#/definitions/workflowAttributesAsArrayObjectGet_object" + }, + "title": "Workflow Attributes as Array", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowAttributesAsArrayObjectAttributesGet_dynamic": { + "description": "The attributes of the workflow property.", + "title": "Attributes", + "x-ms-visibility": "important" + }, + "workflowAttributesAsArrayObjectGet_object": { + "description": "A workflow property.", + "properties": { + "propertyAttributes": { + "$ref": "#/definitions/workflowAttributesAsArrayObjectAttributesGet_dynamic" + }, + "propertySystemName": { + "$ref": "#/definitions/propertySystemName_string" + } + }, + "title": "Workflow Property", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowAttributesGet_object": { + "description": "The attributes of the workflow.", + "properties": { + "counterpartyName": { + "$ref": "#/definitions/counterpartyNameGet_string" + }, + "currentTurnParty": { + "$ref": "#/definitions/turnParty_string" + }, + "draft": { + "$ref": "#/definitions/workflowDraftDocumentsGet_array" + }, + "paperSource": { + "$ref": "#/definitions/paperSourceGet_string" + }, + "readableId": { + "$ref": "#/definitions/workflowIroncladId_string" + }, + "reviewRollbacked": { + "$ref": "#/definitions/reviewRollbacked_boolean" + }, + "sentSignaturePacket": { + "$ref": "#/definitions/sentSignaturePacket_array" + }, + "signed": { + "$ref": "#/definitions/workflowSignedDocuments_object" + } + }, + "title": "Attributes", + "type": "object", + "x-ms-visibility": "internal" + }, + "workflowAttributeValue_dynamic": { + "description": "The value you'd like to set the attribute to.", + "title": "Value", + "x-ms-visibility": "important" + }, + "workflowAsync_object": { + "type": "object", + "title": "Workflow", + "description": "The workflow that was created asynchronously.", + "x-ms-visibility": "important", + "properties": { + "id": { + "$ref": "#/definitions/uniqueId_string" + }, + "ironcladId": { + "$ref": "#/definitions/workflowIroncladId_string" + } + } + }, + "workflowDocument_object": { + "description": "A draft document in the workflow.", + "properties": { + "documentVersion": { + "$ref": "#/definitions/documentVersion_string" + }, + "documentVersionNumber_number": { + "$ref": "#/definitions/documentVersionNumber_number" + }, + "download": { + "$ref": "#/definitions/documentDownloadPath_string" + }, + "filename": { + "$ref": "#/definitions/documentFileName_string" + }, + "key": { + "$ref": "#/definitions/documentKey_string" + }, + "lastModified": { + "$ref": "#/definitions/documentLastModified_object" + } + }, + "title": "Document", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowDocumentsAsArrayGet_array": { + "description": "The workflow documents as an array.", + "items": { + "$ref": "#/definitions/workflowDocumentsAsArrayObject_object" + }, + "title": "Document Array", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowDocumentSchemaAsArrayGet_array": { + "description": "The workflow document schema as an array.", + "items": { + "$ref": "#/definitions/workflowDocumentSchemaAsArrayObject_object" + }, + "title": "Document Array", + "type": "array", + "x-ms-visibility": "internal" + }, + "workflowDocumentsAsArrayObject_object": { + "description": "A document in the workflow.", + "properties": { + "displayName": { + "$ref": "#/definitions/documentDisplayName_string" + }, + "readOnly": { + "$ref": "#/definitions/propertyReadOnly_boolean" + }, + "systemName": { + "$ref": "#/definitions/documentSystemName_string" + }, + "versions": { + "$ref": "#/definitions/workflowDocumentVersions_array" + } + }, + "title": "Document", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowDocumentSchemaAsArrayObject_object": { + "description": "A document in the workflow.", + "properties": { + "displayName": { + "$ref": "#/definitions/documentDisplayName_string" + }, + "readOnly": { + "$ref": "#/definitions/propertyReadOnly_boolean" + }, + "systemName": { + "$ref": "#/definitions/documentSystemName_string" + } + }, + "title": "Document", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowDocumentVersion_object": { + "description": "A version of the document.", + "properties": { + "filename": { + "$ref": "#/definitions/documentFileName_string" + }, + "version": { + "$ref": "#/definitions/documentVersion_string" + }, + "versionNumber": { + "$ref": "#/definitions/documentVersionNumber_number" + }, + "key": { + "$ref": "#/definitions/documentKey_string" + }, + "download": { + "$ref": "#/definitions/documentDownloadPath_string" + }, + "lastModified": { + "$ref": "#/definitions/documentLastModified_object" + } + }, + "title": "Version", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowDocumentVersions_array": { + "description": "The versions of the document.", + "items": { + "$ref": "#/definitions/workflowDocumentVersion_object" + }, + "title": "Versions", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowDraftDocumentsGet_array": { + "description": "If available, the draft documents in the workflow.", + "items": { + "$ref": "#/definitions/workflowDocument_object" + }, + "title": "Document Drafts", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowEmailAttachment_object": { + "description": "An attachment in the email.", + "properties": { + "contentType": { + "$ref": "#/definitions/documentContentType_string" + }, + "download": { + "$ref": "#/definitions/documentDownloadPath_string" + }, + "filename": { + "$ref": "#/definitions/documentFileName_string" + }, + "key": { + "$ref": "#/definitions/documentKey_string" + } + }, + "title": "Attachment", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowEmailAttachments_array": { + "description": "The attachments of the email.", + "items": { + "$ref": "#/definitions/workflowEmailAttachment_object" + }, + "title": "Attachments", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowEmailBody_string": { + "description": "The body of the email.", + "title": "Body", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailCcRecipient_object": { + "description": "The CC recipients of the email.", + "items": { + "$ref": "#/definitions/workflowEmailCcRecipientEmail_string" + }, + "title": "CC", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowEmailCcRecipientEmail_string": { + "description": "The email of the CC recipient.", + "format": "email", + "title": "CC Recipient", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailGet_object": { + "description": "An email thread in the specified workflow.", + "properties": { + "attachments": { + "$ref": "#/definitions/workflowEmailAttachments_array" + }, + "author": { + "$ref": "#/definitions/authorGet_object" + }, + "body": { + "$ref": "#/definitions/workflowEmailBody_string" + }, + "cc": { + "$ref": "#/definitions/workflowEmailCcRecipient_object" + }, + "emailOpenedTimestamps": { + "$ref": "#/definitions/workflowEmailStatus_object" + }, + "id": { + "$ref": "#/definitions/workflowEmailId_string" + }, + "recipients": { + "$ref": "#/definitions/workflowEmailRecipients_array" + }, + "subject": { + "$ref": "#/definitions/workflowEmailSubject" + }, + "timestamp": { + "$ref": "#/definitions/workflowEmailSentTimestamp" + }, + "type": { + "$ref": "#/definitions/workflowEmailType_string" + } + }, + "title": "Email Thread", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowEmailId_string": { + "description": "The unique identifier of the email.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailRecipientEmail_string": { + "description": "The email of the recipient.", + "format": "email", + "title": "Email", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailRecipients_array": { + "description": "The recipients of the email.", + "items": { + "$ref": "#/definitions/workflowEmailRecipientEmail_string" + }, + "title": "Recipients", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowEmailSentTimestamp": { + "description": "The date and time the email was sent.", + "title": "Timestamp", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailsGet_array": { + "description": "The email threads in the specified workflow.", + "items": { + "$ref": "#/definitions/workflowEmailGet_object" + }, + "title": "Email Threads", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowEmailStatus_object": { + "description": "Delivery details for this email.", + "items": { + "$ref": "#/definitions/workflowEmailStatusRecipient_object" + }, + "title": "Email Status", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowEmailStatusEmail_string": { + "description": "The email of the recipient", + "title": "Email", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailStatusOpened_boolean": { + "description": "If true, the email was opened.", + "title": "Opened", + "type": "boolean", + "x-ms-visibility": "important" + }, + "workflowEmailStatusRecipient_object": { + "description": "A recipient of the email.", + "properties": { + "email": { + "$ref": "#/definitions/workflowEmailStatusEmail_string" + }, + "opened": { + "$ref": "#/definitions/workflowEmailStatusOpened_boolean" + }, + "timestamp": { + "$ref": "#/definitions/workflowEmailStatusTimestamp_string" + } + }, + "title": "Recipient", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowEmailStatusTimestamp_string": { + "description": "The date and time the email was opened.", + "format": "date-time", + "title": "Timestamp", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailSubject": { + "description": "The subject of the email.", + "title": "Subject", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowEmailType_string": { + "description": "The type of the email.", + "title": "Type", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowFormattedSchema_object": { + "title": "Formatted Schema", + "description": "The Ironclad formatted schema of the workflow.", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowParticipantGet_object": { + "description": "A participant in the workflow.", + "properties": { + "email": { + "$ref": "#/definitions/userEmail_string" + }, + "userId": { + "$ref": "#/definitions/userId_string" + } + }, + "title": "Participant", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowIroncladId_string": { + "description": "The Ironclad ID of the workflow.", + "title": "Ironclad ID", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowLabel_string": { + "description": "The display label of the workflow.", + "title": "Label", + "type": "string", + "x-ms-visibility": "advanced" + }, + "workflowLaunchSchema_object": { + "title": "Launch Schema", + "description": "The OpenAPI formatted schema of the workflow.", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowParticipantsGet_object": { + "properties": { + "count": { + "$ref": "#/definitions/count_integer" + }, + "list": { + "$ref": "#/definitions/workflowParticipantsListGet_array" + }, + "page": { + "$ref": "#/definitions/page_integer" + }, + "pageSize": { + "$ref": "#/definitions/pageSize_integer" + } + }, + "type": "object" + }, + "workflowParticipantsListGet_array": { + "description": "The list of workflow participants.", + "items": { + "$ref": "#/definitions/workflowParticipantGet_object" + }, + "title": "Participants", + "type": "array" + }, + "workflowReviewer_object": { + "description": "A reviewer for this workflow", + "properties": { + "displayName": { + "$ref": "#/definitions/workflowRoleDisplayName_string" + }, + "reviewerType": { + "$ref": "#/definitions/workflowReviewerType_string" + }, + "role": { + "$ref": "#/definitions/workflowRoleId_string" + }, + "status": { + "$ref": "#/definitions/workflowReviewerStatus_string" + } + }, + "title": "Reviewer", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowReviewers_array": { + "description": "The reviewers in this approval group.", + "items": { + "$ref": "#/definitions/workflowReviewer_object" + }, + "title": "Reviewers", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowReviewerStatus_string": { + "description": "The status of the review task", + "title": "Status", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowReviewerType_string": { + "description": "The reviewer type", + "title": "Type", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowRoleDisplayName_string": { + "description": "The display name of the role.", + "title": "Role Name", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowRoleId_string": { + "description": "The identifier of the role.", + "title": "ID", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowRoles_array": { + "description": "The roles in this workflow.", + "items": { + "properties": { + "assignees": { + "$ref": "#/definitions/assignees_array" + }, + "displayName": { + "$ref": "#/definitions/workflowRoleDisplayName_string" + }, + "id": { + "$ref": "#/definitions/workflowRoleId_string" + } + }, + "type": "object" + }, + "title": "Roles", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowsApprovalsGet_object": { + "description": "Approvals for the workflow.", + "properties": { + "approvalGroups": { + "$ref": "#/definitions/workflowApprovalGroup_array" + }, + "roles": { + "$ref": "#/definitions/workflowRoles_array" + }, + "title": { + "$ref": "#/definitions/workflowTitle_string" + }, + "workflowId": { + "$ref": "#/definitions/uniqueId_string" + } + }, + "title": "Approvals", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowSchema_object": { + "description": "A workflow schema.", + "properties": { + "documentSchemaAsArray": { + "$ref": "#/definitions/workflowDocumentSchemaAsArrayGet_array" + }, + "formattedSchema": { + "$ref": "#/definitions/workflowFormattedSchema_object" + }, + "launchSchema": { + "$ref": "#/definitions/workflowLaunchSchema_object" + }, + "id": { + "$ref": "#/definitions/templateId_string" + }, + "name": { + "$ref": "#/definitions/templateTitle_string" + }, + "schema": { + "$ref": "#/definitions/schemaProperties_object" + }, + "schemaAsArray": { + "$ref": "#/definitions/workflowSchemaPropertiesAsArray_array" + } + }, + "title": "Workflow Schema", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowSchemaAsArrayGet_array": { + "description": "The schema of the workflow as an array.", + "items": { + "$ref": "#/definitions/workflowSchemaPropertiesAsArrayObject_object" + }, + "title": "Schemas as Array", + "type": "array", + "x-ms-visibility": "advanced" + }, + "workflowSchemaFromTemplateGet_object": { + "description": "An Ironclad workflow.", + "properties": { + "approvals": { + "$ref": "#/definitions/workflowApproval_object" + }, + "attributes": { + "description": "The attributes of the workflow.", + "type": "object", + "x-ms-dynamic-properties": { + "itemValuePath": "formattedSchema", + "operationId": "RetrieveWorkflowSchema", + "parameters": { + "form": { + "parameterReference": "form" + }, + "Schema": { + "parameterReference": "body/template" + } + } + }, + "x-ms-dynamic-schema": { + "operationId": "RetrieveWorkflowSchema", + "parameters": { + "form": "launch", + "Schema": { + "parameter": "template" + } + }, + "value-path": "formattedSchema" + } + }, + "created": { + "$ref": "#/definitions/created_string" + }, + "creator": { + "$ref": "#/definitions/creatorGet_object" + }, + "id": { + "$ref": "#/definitions/uniqueId_string" + }, + "ironcladId": { + "$ref": "#/definitions/workflowIroncladId_string" + }, + "isCancelled": { + "$ref": "#/definitions/isCancelled_boolean" + }, + "isComplete": { + "$ref": "#/definitions/isComplete_boolean" + }, + "isRevertibleToReview": { + "$ref": "#/definitions/isRevertibleToReview_boolean" + }, + "lastUpdated": { + "$ref": "#/definitions/lastUpdated_string" + }, + "roles": { + "$ref": "#/definitions/workflowRoles_array" + }, + "schema": { + "$ref": "#/definitions/workflowSchemaGet_object" + }, + "signatures": { + "$ref": "#/definitions/workflowSignatures_object" + }, + "status": { + "$ref": "#/definitions/workflowStatus_string" + }, + "step": { + "$ref": "#/definitions/workflowStep_string" + }, + "template": { + "$ref": "#/definitions/templateTitle_string" + }, + "title": { + "$ref": "#/definitions/workflowTitle_string" + } + }, + "title": "Workflow", + "type": "object" + }, + "workflowSchemaFromWorkflowGet_object": { + "description": "An Ironclad workflow.", + "properties": { + "approvals": { + "$ref": "#/definitions/workflowApproval_object" + }, + "attributes": { + "$ref": "#/definitions/workflowAttributesGet_object" + }, + "created": { + "$ref": "#/definitions/created_string" + }, + "creator": { + "$ref": "#/definitions/creatorGet_object" + }, + "documentsAsArray": { + "$ref": "#/definitions/workflowDocumentsAsArrayGet_array" + }, + "formattedAttributes": { + "description": "The attributes of the workflow.", + "title": "Formatted Attributes", + "type": "object", + "x-ms-dynamic-properties": { + "itemValuePath": "formattedSchema", + "operationId": "RetrieveWorkflow", + "parameters": { + "Workflow": { + "parameterReference": "Workflow" + } + } + }, + "x-ms-dynamic-schema": { + "operationId": "RetrieveWorkflow", + "parameters": { + "Workflow": { + "parameter": "Workflow" + } + }, + "value-path": "formattedSchema" + }, + "x-ms-visibility": "important" + }, + "formattedSchema": { + "description": "The formatted schema of the workflow.", + "title": "Formatted Schema", + "type": "object", + "x-ms-visibility": "important" + }, + "id": { + "$ref": "#/definitions/uniqueId_string" + }, + "ironcladId": { + "$ref": "#/definitions/workflowIroncladId_string" + }, + "isCancelled": { + "$ref": "#/definitions/isCancelled_boolean" + }, + "isComplete": { + "$ref": "#/definitions/isComplete_boolean" + }, + "isRevertibleToReview": { + "$ref": "#/definitions/isRevertibleToReview_boolean" + }, + "lastUpdated": { + "$ref": "#/definitions/lastUpdated_string" + }, + "roles": { + "$ref": "#/definitions/workflowRoles_array" + }, + "schema": { + "$ref": "#/definitions/workflowSchemaGet_object" + }, + "schemaAsArray": { + "$ref": "#/definitions/workflowSchemaAsArrayGet_array" + }, + "signatures": { + "$ref": "#/definitions/workflowSignatures_object" + }, + "status": { + "$ref": "#/definitions/workflowStatus_string" + }, + "step": { + "$ref": "#/definitions/workflowStep_string" + }, + "template": { + "$ref": "#/definitions/templateId_string" + }, + "title": { + "$ref": "#/definitions/workflowTitle_string" + } + }, + "title": "Workflow", + "type": "object" + }, + "workflowSchemaGet_object": { + "description": "The schema of the workflow.", + "title": "Workflow Schema", + "type": "object", + "x-ms-visibility": "internal" + }, + "workflowSchemaPropertiesAsArray_array": { + "description": "The schema properties as an Array.", + "items": { + "$ref": "#/definitions/workflowSchemaPropertiesAsArrayObject_object" + }, + "title": "Schema Properties as Array", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowSchemaPropertiesAsArrayObject_object": { + "description": "A schema property.", + "properties": { + "displayName": { + "$ref": "#/definitions/propertyDisplayName_string" + }, + "readOnly": { + "$ref": "#/definitions/propertyReadOnly_boolean" + }, + "systemName": { + "$ref": "#/definitions/propertySystemName_string" + }, + "type": { + "$ref": "#/definitions/propertyType_string" + } + }, + "title": "Schema Property", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowSchemas_array": { + "description": "The list of workflow schemas", + "items": { + "$ref": "#/definitions/workflowSchema_object" + }, + "title": "Workflow Schemas", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowsGet_array": { + "description": "A list of Ironclad workflows.", + "items": { + "$ref": "#/definitions/workflowStaticGet_object" + }, + "title": "Workflows", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowSignatures_object": { + "description": "The signatures state of the workflow.", + "properties": { + "state": { + "$ref": "#/definitions/state_string" + } + }, + "title": "Signatures", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowSignatureStatus_object": { + "description": "The details for this signature.", + "properties": { + "isWetSigned": { + "$ref": "#/definitions/isWetSigned_boolean" + }, + "status": { + "$ref": "#/definitions/workflowSignatureStatus_string" + } + }, + "title": "Signature", + "type": "object", + "x-ms-visibility": "internal" + }, + "workflowSignatureStatus_string": { + "description": "The status of the signature.", + "title": "Status", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowSignedDocuments_object": { + "description": "If available, the signed documents in the workflow.", + "properties": { + "documentVersion": { + "$ref": "#/definitions/documentVersion_string" + }, + "download": { + "$ref": "#/definitions/documentDownloadPath_string" + }, + "filename": { + "$ref": "#/definitions/documentFileName_string" + }, + "key": { + "$ref": "#/definitions/documentKey_string" + }, + "lastModified": { + "$ref": "#/definitions/documentLastModified_object" + } + }, + "title": "Signed Document", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowSigner_object": { + "description": "A signer in this workflow.", + "properties": { + "email": { + "$ref": "#/definitions/userEmail_string" + }, + "name": { + "$ref": "#/definitions/userDisplayName_string" + }, + "roleName": { + "$ref": "#/definitions/workflowRoleDisplayName_string" + }, + "routingOrder": { + "$ref": "#/definitions/routingOrder_integer" + }, + "signatureStatus": { + "$ref": "#/definitions/workflowSignatureStatus_object" + } + }, + "title": "Signer", + "type": "object", + "x-ms-visibility": "important" + }, + "workflowSigners_array": { + "description": "The signers in this workflow.", + "items": { + "$ref": "#/definitions/workflowSigner_object" + }, + "title": "Signers", + "type": "array", + "x-ms-visibility": "important" + }, + "workflowStaticGet_object": { + "description": "An Ironclad workflow.", + "properties": { + "approvals": { + "$ref": "#/definitions/workflowApproval_object" + }, + "attributes": { + "$ref": "#/definitions/workflowAttributesGet_object" + }, + "attributesAsArray": { + "$ref": "#/definitions/workflowAttributesAsArrayGet_array" + }, + "created": { + "$ref": "#/definitions/created_string" + }, + "creator": { + "$ref": "#/definitions/creatorGet_object" + }, + "id": { + "$ref": "#/definitions/uniqueId_string" + }, + "ironcladId": { + "$ref": "#/definitions/workflowIroncladId_string" + }, + "isCancelled": { + "$ref": "#/definitions/isCancelled_boolean" + }, + "isComplete": { + "$ref": "#/definitions/isComplete_boolean" + }, + "isRevertibleToReview": { + "$ref": "#/definitions/isRevertibleToReview_boolean" + }, + "lastUpdated": { + "$ref": "#/definitions/lastUpdated_string" + }, + "roles": { + "$ref": "#/definitions/workflowRoles_array" + }, + "schema": { + "$ref": "#/definitions/workflowSchemaGet_object" + }, + "schemaAsArray": { + "$ref": "#/definitions/workflowSchemaAsArrayGet_array" + }, + "signatures": { + "$ref": "#/definitions/workflowSignatures_object" + }, + "status": { + "$ref": "#/definitions/workflowStatus_string" + }, + "step": { + "$ref": "#/definitions/workflowStep_string" + }, + "template": { + "$ref": "#/definitions/templateTitle_string" + }, + "title": { + "$ref": "#/definitions/workflowTitle_string" + }, + "label": { + "$ref": "#/definitions/workflowLabel_string" + } + }, + "title": "Workflow", + "type": "object" + }, + "workflowStatus_string": { + "description": "The current status of the workflow.", + "title": "Workflow Status", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowStep_string": { + "description": "The current step of the workflow.", + "title": "Step", + "type": "string", + "x-ms-visibility": "important" + }, + "workflowTitle_string": { + "description": "The title used for the launched workflow.", + "title": "Workflow Title", + "type": "string", + "x-ms-visibility": "important" + } + }, + "parameters": { + "workflowActionDetails_query": { + "description": "An optional boolean parameter that adds additional information about the actor to each item in the response. Defaults to false.", + "in": "query", + "name": "actorDetails", + "type": "boolean", + "x-ms-summary": "Actor Details", + "x-ms-visibility": "important" + }, + "workflowAsyncJob_path": { + "description": "The identifier provided in the response of creating a workflow asynchronously.", + "in": "path", + "name": "AsyncJob", + "required": true, + "type": "string", + "x-ms-summary": "Job", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "attachment_formData": { + "description": "The file to upload.", + "in": "formData", + "name": "attachment", + "required": true, + "type": "file", + "x-ms-summary": "Attachment", + "x-ms-visibility": "important" + }, + "workflowEmailAttachmentID_path": { + "description": "The unique identifier of the attachment.", + "in": "path", + "name": "Attachment", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "RetrieveEmailThread", + "parameters": { + "Email": { + "parameter": "Email" + }, + "Workflow": { + "parameter": "Workflow" + } + }, + "value-collection": "attachments", + "value-path": "key", + "value-title": "filename" + }, + "x-ms-summary": "Attachment", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "workflowCommentID_path": { + "description": "The unique identifier of a comment.", + "in": "path", + "name": "Comment", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListWorkflowComments", + "parameters": { + "page": 0, + "pageSize": 100, + "Workflow": { + "parameter": "Workflow" + } + }, + "value-collection": "list", + "value-path": "id", + "value-title": "metadata/message" + }, + "x-ms-summary": "Comment", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "workflowCommentPost_body": { + "description": "The comment object.", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/commentPost_object" + }, + "x-ms-visibility": "important" + }, + "workflowConfiguration_dummy": { + "description": "Select the configuration of the workflow you would like to update to load available properties or enter them manually by selecting \"Enter custom value\".", + "name": "configuration", + "required": true, + "in": "header", + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListWorkflowSchemas", + "parameters": { + "form": "launch" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "name" + }, + "x-ms-visibility": "important", + "x-ms-summary": "Configuration" + }, + "workflowDocumentAttribute_path": { + "description": "The file attribute.", + "in": "path", + "name": "Attribute", + "required": true, + "type": "string", + "x-ms-summary": "Document Attribute", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important", + "x-ms-dynamic-values": { + "operationId": "RetrieveWorkflowSchema", + "parameters": { + "Schema": { + "parameter": "configuration" + }, + "form": "launch" + }, + "value-collection": "documentSchemaAsArray", + "value-path": "systemName", + "value-title": "displayName" + } + }, + "workflowDocument_formData": { + "description": "The document to upload.", + "in": "formData", + "name": "attachment", + "required": true, + "type": "file", + "x-ms-summary": "Document", + "x-ms-visibility": "important" + }, + "workflowEmailID_path": { + "description": "The unique identifier of the email.", + "in": "path", + "name": "Email", + "required": true, + "type": "string", + "x-ms-summary": "Email", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "recordFilter_query": { + "description": "Filter records for those that contain (1) the specified property with (2) the specified value. The record property ID should be enclosed in brackets [ ] and the value should be enclosed in single quotes.", + "in": "query", + "name": "filter", + "required": false, + "type": "string", + "x-ms-summary": "Filter", + "x-ms-visibility": "important" + }, + "workflowForm_query": { + "default": "launch", + "description": "The launch form is the only form supported at this time.", + "enum": [ + "launch" + ], + "in": "query", + "name": "form", + "required": true, + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "Launch Form", + "value": "launch" + } + ], + "x-ms-summary": "Form", + "x-ms-visibility": "important" + }, + "scimGroupID_path": { + "description": "The unique identifier of the group.", + "in": "path", + "name": "Group", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListGroups", + "value-collection": "Resources", + "value-path": "id", + "value-title": "displayName" + }, + "x-ms-summary": "Group", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "recordImportId_query": { + "description": "The ID of the Import for prediction statuses.", + "in": "query", + "name": "importId", + "required": false, + "type": "string", + "x-ms-summary": "Import ID", + "x-ms-visibility": "important" + }, + "json_header": { + "default": "application/json", + "in": "header", + "name": "Accept", + "required": true, + "type": "string", + "x-ms-visibility": "internal" + }, + "workflowLastUpdated_query": { + "description": "Get workflows updated since (UTC).", + "in": "query", + "name": "lastUpdated", + "required": false, + "type": "string", + "x-ms-summary": "Last Updated", + "x-ms-visibility": "important" + }, + "recordLastUpdated_query": { + "description": "Get records updated since (UTC).", + "in": "query", + "name": "lastUpdated", + "required": false, + "type": "string", + "x-ms-summary": "Last Updated", + "x-ms-visibility": "important" + }, + "recordNewRecordTypeDisplayName_formData": { + "description": "The display name of the new record type to create.", + "in": "formData", + "name": "newRecordTypeDisplayName", + "required": false, + "type": "string", + "x-ms-summary": "New Record Type Display Name", + "x-ms-visibility": "important" + }, + "recordNewRecordTypeId_formData": { + "description": "The record type ID for a not-yet-existing record type. Must be provided along with New Record Type Display Name.", + "in": "formData", + "name": "newRecordTypeId", + "required": false, + "type": "string", + "x-ms-summary": "New Record Type ID", + "x-ms-visibility": "important" + }, + "page_query": { + "default": 0, + "description": "The page number used when paginating through a list of results.", + "in": "query", + "name": "page", + "required": true, + "type": "integer", + "x-ms-summary": "Page", + "x-ms-visibility": "important" + }, + "pageSize_query": { + "default": 100, + "description": "A limit of the number of results to return.", + "in": "query", + "name": "pageSize", + "required": true, + "type": "integer", + "x-ms-summary": "Page Size", + "x-ms-visibility": "important" + }, + "recordExportProperties_query": { + "name": "properties", + "in": "query", + "description": "A comma separated list of properties, clauses and attachments to include in the retrieved records.", + "required": false, + "type": "string", + "x-ms-summary": "Record Properties", + "x-ms-visibility": "important" + }, + "recordProperties_query": { + "name": "recordPorperties", + "in": "query", + "description": "A comma separated list of properties, clauses and attachments to include in the retrieved records.", + "required": false, + "type": "string", + "x-ms-summary": "Record Properties", + "x-ms-visibility": "important" + }, + "recordDocumentKeyFromSchema_path": { + "description": "The unique identifier for the attachment. This key can be located using the Retrieve a workflow endpoint. In the response, locate the file attribute (e.g., draft) and look at its download parameter. The download parameter includes the key at the end of the URL .../document/{ATTACHMENT_KEY}/download.", + "in": "path", + "name": "Key", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "RetrieveRecordSchemas", + "parameters": { + + }, + "value-collection": "formattedAttachments", + "value-path": "systemName", + "value-title": "displayName" + }, + "x-ms-summary": "Key", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "recordId_path": { + "description": "The ID or Ironclad ID of the Record.", + "in": "path", + "name": "Record", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListAllRecords", + "parameters": { + "page": 0, + "pageSize": 100, + "sortDirection": "DESC", + "sortField": "lastUpdated" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "label" + }, + "x-ms-summary": "Record", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "recordId_query": { + "description": "The ID of the Record for prediction status.", + "in": "query", + "name": "recordId", + "required": false, + "type": "string", + "x-ms-summary": "Record ID", + "x-ms-visibility": "important" + }, + "recordPatch_body": { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "name": { + "$ref": "#/definitions/recordName_string" + }, + "type": { + "$ref": "#/definitions/recordTypePost_string" + }, + "addProperties": { + "$ref": "#/definitions/recordPropertiesToAddAsArrayPost_array" + }, + "removeProperties": { + "$ref": "#/definitions/recordRemoveProperties_array" + }, + "addChildren": { + "$ref": "#/definitions/recordAddChildren_array" + }, + "addLinks": { + "$ref": "#/definitions/recordAddLinks_array" + }, + "removeChildren": { + "$ref": "#/definitions/recordRemoveChildren_array" + }, + "removeLinks": { + "$ref": "#/definitions/recordRemoveLinks_array" + }, + "removeParent": { + "$ref": "#/definitions/recordRemoveParent_boolean" + }, + "setParent": { + "$ref": "#/definitions/recordSetParent_object" + } + }, + "type": "object" + }, + "x-ms-visibility": "important" + }, + "recordPost_body": { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/recordPost_object" + }, + "x-ms-visibility": "important" + }, + "recordType_formData": { + "description": "Upload a smart import record as an existing record type.", + "in": "formData", + "name": "recordType", + "required": false, + "type": "string", + "x-ms-summary": "Record Type", + "x-ms-visibility": "important", + "x-ms-dynamic-values": { + "operationId": "RetrieveRecordSchemas", + "value-collection": "formattedRecordTypes", + "value-path": "systemName", + "value-title": "displayName" + } + }, + "recordTypes_query": { + "description": "Comma separated list of record types to export. Example: mutualNDA,NDA", + "in": "query", + "name": "types", + "required": false, + "type": "string", + "x-ms-summary": "Types" + }, + "representation_header": { + "default": "return=representation", + "in": "header", + "name": "Prefer", + "required": true, + "type": "string", + "x-ms-visibility": "internal" + }, + "returnRepresentation_header": { + "default": "return=representation", + "in": "header", + "name": "Prefer", + "required": true, + "type": "string", + "x-ms-visibility": "internal" + }, + "workflowRevertingUser_body": { + "description": "The Ironclad user reverting the workflow to the Review step. The user must be a participant on the workflow.", + "in": "body", + "name": "user", + "required": true, + "schema": { + "$ref": "#/definitions/userPost_object" + }, + "x-ms-summary": "Reverting User", + "x-ms-visibility": "important" + }, + "workflowRoleID_path": { + "description": "The unique identifier of the approver role whose status should be changed.", + "in": "path", + "name": "Role", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListWorkflowApprovals", + "parameters": { + "Workflow": { + "parameter": "Workflow" + } + }, + "value-collection": "roles", + "value-path": "id", + "value-title": "displayName" + }, + "x-ms-summary": "Role", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "workflowSchemaID_path": { + "description": "The identifier of the workflow template.", + "in": "path", + "name": "Schema", + "required": true, + "type": "string", + "x-ms-dynamic-list": { + "itemsPath": "list", + "itemTitlePath": "name", + "itemValuePath": "id", + "operationId": "ListWorkflowSchemas", + "parameters": { + "form": { + "parameterReference": "form" + } + } + }, + "x-ms-dynamic-values": { + "operationId": "ListWorkflowSchemas", + "parameters": { + "form": "launch" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "name" + }, + "x-ms-summary": "Ironclad Workflow Template", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "scimCount_query": { + "description": "The number of resources returned in a list response page. Defaults to 25.", + "in": "query", + "name": "count", + "required": false, + "type": "integer", + "x-ms-summary": "Count", + "x-ms-visibility": "important" + }, + "scimExcludedAttributes_query": { + "description": "A comma-separated list of attributes to exclude from the resources in the response.", + "in": "query", + "name": "excludedAttributes", + "required": false, + "type": "string", + "x-ms-summary": "Excluded Attributes", + "x-ms-visibility": "important" + }, + "scimRecordFilter_query": { + "description": "Filters for identifying subsets of records. Filters must comply with the SCIM protocol's convention.", + "in": "query", + "name": "filter", + "required": false, + "type": "string", + "x-ms-summary": "Filter", + "x-ms-visibility": "important" + }, + "scimGroup_body": { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "displayName": { + "$ref": "#/definitions/scimGroupDisplayName_string" + }, + "externalId": { + "$ref": "#/definitions/groupExternalId_string" + }, + "members": { + "$ref": "#/definitions/scimGroupMembersPost_array" + }, + "schemas": { + "$ref": "#/definitions/scimGroupSchemasPost_array" + } + }, + "required": [ + "displayName", + "schemas" + ], + "type": "object" + } + }, + "scimGroupOperations_body": { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "Operations": { + "$ref": "#/definitions/scimGroupOperations_array" + }, + "schemas": { + "$ref": "#/definitions/scimPatchOpSchemasPost_array" + } + }, + "required": [ + "schemas", + "Operations" + ], + "type": "object" + } + }, + "scimStartIndex_query": { + "description": "The starting index for retrieving this resource. Resources are indexed based on when they were first added to Ironclad. Defaults to 1.", + "in": "query", + "name": "startIndex", + "required": false, + "type": "integer", + "x-ms-summary": "Start Index", + "x-ms-visibility": "important" + }, + "scimUser_body": { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "name": { + "$ref": "#/definitions/scimName_object" + }, + "password": { + "$ref": "#/definitions/scimPassword_string" + }, + "schemas": { + "$ref": "#/definitions/scimUserSchemasPost_array" + }, + "title": { + "$ref": "#/definitions/scimTitle_string" + }, + "userName": { + "$ref": "#/definitions/username_string" + } + }, + "required": [ + "schemas", + "userName", + "name", + "password" + ], + "type": "object" + } + }, + "scimUserOperations_body": { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "Operations": { + "$ref": "#/definitions/scimUserOperations_array" + }, + "schemas": { + "$ref": "#/definitions/scimPatchOpSchemasPost_array" + } + }, + "required": [ + "schemas", + "Operations" + ], + "type": "object" + } + }, + "recordSmartImport_path": { + "description": "The Import Id. You can upload a record to an existing import in the repository.", + "in": "path", + "name": "Import", + "required": true, + "type": "string", + "x-ms-summary": "Smart Import", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "sortDirection_query": { + "default": "DESC", + "description": "The direction the results are sorted by in correlation with the sortField.", + "enum": [ + "DESC", + "ASC" + ], + "in": "query", + "name": "sortDirection", + "required": true, + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "descending", + "value": "DESC" + }, + { + "displayName": "ascending", + "value": "ASC" + } + ], + "x-ms-summary": "Sort Direction", + "x-ms-visibility": "important" + }, + "sortField_query": { + "default": "lastUpdated", + "description": "The field to sort the results by. Only one field is supported in the sort operation.", + "enum": [ + "lastUpdated", + "agreementDate", + "name" + ], + "in": "query", + "name": "sortField", + "required": true, + "type": "string", + "x-ms-enum-values": [ + { + "displayName": "Last Updated", + "value": "lastUpdated" + }, + { + "displayName": "Agreement Date", + "value": "agreementDate" + }, + { + "displayName": "Name", + "value": "name" + } + ], + "x-ms-summary": "Sort Field", + "x-ms-visibility": "important" + }, + "workflowUserEmail_query": { + "description": "The Ironclad user's email address you want to filter by.", + "in": "query", + "name": "email", + "required": false, + "type": "string", + "x-ms-summary": "Email", + "x-ms-visibility": "important" + }, + "scimUserID_path": { + "description": "The unique identifier of the user.", + "in": "path", + "name": "User", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListUsers", + "value-collection": "Resources", + "value-path": "id", + "value-title": "username" + }, + "x-ms-summary": "User", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "webhookBody_body": { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "events": { + "$ref": "#/definitions/webhookEvents_array" + }, + "targetURL": { + "$ref": "#/definitions/webhookTargetUrlGet_string" + } + }, + "required": [ + "targetURL", + "events" + ], + "type": "object", + "x-ms-visibility": "important" + }, + "x-ms-visibility": "important" + }, + "webhookID_path": { + "description": "The identifier of the registered webhook.", + "in": "path", + "name": "Webhook", + "required": true, + "type": "string", + "x-ms-summary": "Webhook ID", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "workflow_body": { + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "attributes": { + "description": "The attributes of the workflow.", + "type": "object", + "x-ms-dynamic-properties": { + "itemValuePath": "launchSchema", + "operationId": "RetrieveWorkflowSchema", + "parameters": { + "form": { + "parameterReference": "form" + }, + "Schema": { + "parameterReference": "body/template" + } + } + }, + "x-ms-dynamic-schema": { + "operationId": "RetrieveWorkflowSchema", + "parameters": { + "form": "launch", + "Schema": { + "parameter": "template" + } + }, + "value-path": "launchSchema" + } + }, + "creator": { + "$ref": "#/definitions/creatorPost_object" + }, + "template": { + "description": "The identifier of the workflow template.", + "title": "Template", + "type": "string", + "x-ms-dynamic-list": { + "itemsPath": "list", + "itemTitlePath": "name", + "itemValuePath": "id", + "operationId": "ListWorkflowSchemas", + "parameters": { + "form": { + "parameterReference": "form" + } + } + }, + "x-ms-dynamic-values": { + "operationId": "ListWorkflowSchemas", + "parameters": { + "form": "launch" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "name" + }, + "x-ms-summary": "Template", + "x-ms-visibility": "important" + } + }, + "required": [ + "creator", + "template", + "attributes" + ], + "type": "object" + } + }, + "workflowUpdateActions_body": { + "description": "The actions to take on the workflow attributes.", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/workflowAttributeActions_object" + }, + "x-ms-visibility": "important" + }, + "workflowDocumentKey_path": { + "description": "The unique identifier for the attachment. This key can be located using the Retrieve a workflow endpoint. In the response, locate the file attribute (e.g., draft) and look at its download parameter. The download parameter includes the key at the end of the URL .../document/{ATTACHMENT_KEY}/download.", + "in": "path", + "name": "Key", + "required": true, + "type": "string", + "x-ms-summary": "Document Key", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "workflowId_path": { + "description": "The identifier or Ironclad ID of a workflow.", + "in": "path", + "name": "Workflow", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListAllWorkflows", + "parameters": { + "page": 0, + "pageSize": 100, + "sortDirection": "DESC", + "sortField": "lastUpdated" + }, + "value-collection": "list", + "value-path": "id", + "value-title": "label" + }, + "x-ms-summary": "Workflow", + "x-ms-url-encoding": "single", + "x-ms-visibility": "important" + }, + "workflowStatus_query": { + "description": "The status of the workflow.", + "enum": [ + "active", + "paused", + "completed", + "cancelled" + ], + "in": "query", + "name": "status", + "required": false, + "type": "string", + "x-ms-summary": "Workflow Status", + "x-ms-visibility": "important" + }, + "workflowTemplateID_query": { + "description": "The identifier of the workflow template.", + "in": "query", + "name": "template", + "required": false, + "type": "string", + "x-ms-summary": "Template ID", + "x-ms-visibility": "important", + "x-ms-dynamic-list": { + "itemsPath": "list", + "itemTitlePath": "name", + "itemValuePath": "id", + "operationId": "ListWorkflowSchemas", + "parameters": { + "form": { + "value": "launchForm" + } + } + } + }, + "x-as-user-email_header": { + "description": "Denotes the actor of the request. When used, the API will take into account this user's permissions and access. This or x-as-user-id is required when the associated token was produced from the Client Credentials grant or with legacy bearer tokens on select endpoints.", + "in": "header", + "name": "x-as-user-email", + "required": false, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListUsers", + "parameters": { + "count": 100, + "startIndex": 1 + }, + "value-collection": "Resources", + "value-path": "username", + "value-title": "combinedLabel" + }, + "x-ms-summary": "Actor Email Address", + "x-ms-visibility": "advanced" + }, + "x-as-user-id_header": { + "description": "Denotes the actor of the request. When used, the API will take into account this user's permissions and access. This or x-as-user-email is required when the associated token was produced from the Client Credentials grant or with legacy bearer tokens on select endpoints.", + "in": "header", + "name": "x-as-id-email", + "required": false, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "ListUsers", + "parameters": { + "count": 100, + "startIndex": 1 + }, + "value-collection": "Resources", + "value-path": "id", + "value-title": "combinedLabel" + }, + "x-ms-summary": "Actor ID", + "x-ms-visibility": "advanced" + } + }, + "responses": { + + }, + "security": [ + + ], + "securityDefinitions": { + + }, + "tags": [ + + ] +} diff --git a/independent-publisher-connectors/Ironclad CLM/apiProperties.json b/independent-publisher-connectors/Ironclad CLM/apiProperties.json new file mode 100644 index 0000000000..839f6260d2 --- /dev/null +++ b/independent-publisher-connectors/Ironclad CLM/apiProperties.json @@ -0,0 +1,891 @@ +{ + "properties": { + "publisher": "Amadeus IT Group, S.A. - LEG TechOps", + "stackOwner": "Amadeus IT Group, S.A. - LEG TechOps", + "description": "Multi-tenant security definitions for Ironclad CLM (Independent Publisher) custom connector (v1).", + "iconBrandColor": "#da3b01", + "connectionParameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2", + "clientId": "dummy", + "scopes": [ + "public.records.createRecords", + "public.records.readRecords", + "public.records.updateRecords", + "public.records.deleteRecords", + "public.records.readSchemas", + "public.records.createAttachments", + "public.records.readAttachments", + "public.records.deleteAttachments", + "public.records.createSmartImportRecords", + "public.records.readSmartImportRecords", + "public.webhooks.createWebhooks", + "public.webhooks.readWebhooks", + "public.webhooks.updateWebhooks", + "public.webhooks.deleteWebhooks", + "public.workflows.createWorkflows", + "public.workflows.readWorkflows", + "public.workflows.updateWorkflows", + "public.workflows.readApprovals", + "public.workflows.updateApprovals", + "public.workflows.readSignatures", + "public.workflows.uploadSignedDocuments", + "public.workflows.readParticipants", + "public.workflows.revertToReview", + "public.workflows.cancel", + "public.workflows.pauseAndResume", + "public.workflows.createComments", + "public.workflows.readComments", + "public.workflows.createDocuments", + "public.workflows.readDocuments", + "public.workflows.readSchemas", + "public.workflows.readTurnHistory", + "public.workflows.readEmailCommunications", + "scim.groups.createGroups", + "scim.groups.readGroups", + "scim.groups.updateGroups", + "scim.groups.deleteGroups", + "scim.users.createUsers", + "scim.users.readUsers", + "scim.users.updateUsers", + "scim.users.deleteUsers", + "scim.schemas.readSchemas" + ], + "redirectMode": "GlobalPerConnector", + "redirectUrl": "https://global.consent.azure-apim.net/redirect/ironcladclm", + "properties": { + "IsFirstParty": "False", + "IsOnbehalfofLoginSupported": false + }, + "customParameters": { + "authorizationUrl": { + "value": "https://demo.ironcladapp.com/oauth/authorize" + }, + "tokenUrl": { + "value": "https://demo.ironcladapp.com/oauth/token" + }, + "refreshUrl": { + "value": "https://demo.ironcladapp.com/oauth/token" + } + } + }, + "uiDefinition": { + "displayName": "Login to Ironclad", + "description": "Login to Ironclad", + "tooltip": "Login to Ironclad", + "constraints": { + "required": "true" + } + } + }, + "token:clientId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 4, + "required": "true" + }, + "description": "Enter Ironclad Client Id", + "displayName": "Ironclad Client Id", + "tooltip": "Ironclad Client Id" + } + }, + "token:clientSecret": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "tabIndex": 5, + "required": "true" + }, + "description": "Enter Ironclad Client Secret", + "displayName": "Ironclad Client Secret", + "tooltip": "Ironclad Client Secret" + } + }, + "token:customHost": { + "type": "string", + "uiDefinition": { + "constraints": { + "required": "true", + "tabIndex": 3, + "allowedValues": [ + { + "text": "Default", + "value": "demo.ironcladapp.com" + } + ] + }, + "displayName": "Version", + "description": "Select default to continue" + } + } + }, + "connectionParameterSets": { + "uiDefinition": { + "displayName": "Ironclad Instance", + "description": "Select the Ironclad instance you with to connect to. If you are unsure, check with your Ironclad administrator." + }, + "values": [ + { + "name": "oauthDEMO", + "uiDefinition": { + "displayName": "Demo", + "description": "demo.ironcladapp.com" + }, + "parameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2", + "clientId": "dummy", + "scopes": [ + "public.records.createRecords", + "public.records.readRecords", + "public.records.updateRecords", + "public.records.deleteRecords", + "public.records.readSchemas", + "public.records.createAttachments", + "public.records.readAttachments", + "public.records.deleteAttachments", + "public.records.createSmartImportRecords", + "public.records.readSmartImportRecords", + "public.webhooks.createWebhooks", + "public.webhooks.readWebhooks", + "public.webhooks.updateWebhooks", + "public.webhooks.deleteWebhooks", + "public.workflows.createWorkflows", + "public.workflows.readWorkflows", + "public.workflows.updateWorkflows", + "public.workflows.readApprovals", + "public.workflows.updateApprovals", + "public.workflows.readSignatures", + "public.workflows.uploadSignedDocuments", + "public.workflows.readParticipants", + "public.workflows.revertToReview", + "public.workflows.cancel", + "public.workflows.pauseAndResume", + "public.workflows.createComments", + "public.workflows.readComments", + "public.workflows.createDocuments", + "public.workflows.readDocuments", + "public.workflows.readSchemas", + "public.workflows.readTurnHistory", + "public.workflows.readEmailCommunications", + "scim.groups.createGroups", + "scim.groups.readGroups", + "scim.groups.updateGroups", + "scim.groups.deleteGroups", + "scim.users.createUsers", + "scim.users.readUsers", + "scim.users.updateUsers", + "scim.users.deleteUsers", + "scim.schemas.readSchemas" + ], + "redirectMode": "GlobalPerConnector", + "redirectUrl": "https://global.consent.azure-apim.net/redirect/ironcladclm", + "properties": { + "IsFirstParty": "False", + "IsOnbehalfofLoginSupported": false + }, + "customParameters": { + "authorizationUrl": { + "value": "https://demo.ironcladapp.com/oauth/authorize" + }, + "tokenUrl": { + "value": "https://demo.ironcladapp.com/oauth/token" + }, + "refreshUrl": { + "value": "https://demo.ironcladapp.com/oauth/token" + } + } + }, + "uiDefinition": { + "displayName": "Login to Ironclad", + "description": "Login to Ironclad", + "tooltip": "Login to Ironclad", + "constraints": { + "required": "true" + } + } + }, + "token:clientId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 4, + "required": "true" + }, + "description": "Enter Ironclad Client Id", + "displayName": "Ironclad Client Id", + "tooltip": "Ironclad Client Id" + } + }, + "token:clientSecret": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "tabIndex": 5, + "required": "true" + }, + "description": "Enter Ironclad Client Secret", + "displayName": "Ironclad Client Secret", + "tooltip": "Ironclad Client Secret" + } + }, + "token:customHost": { + "type": "string", + "uiDefinition": { + "constraints": { + "required": "true", + "tabIndex": 3, + "allowedValues": [ + { + "text": "Default", + "value": "demo.ironcladapp.com" + } + ] + }, + "displayName": "Version", + "description": "Select default to continue" + } + } + }, + "metadata": { + "allowSharing": false + } + }, + { + "name": "oauthEU1", + "uiDefinition": { + "displayName": "EU1", + "description": "eu1.ironcladapp.com" + }, + "parameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2", + "clientId": "dummy", + "scopes": [ + "public.records.createRecords", + "public.records.readRecords", + "public.records.updateRecords", + "public.records.deleteRecords", + "public.records.readSchemas", + "public.records.createAttachments", + "public.records.readAttachments", + "public.records.deleteAttachments", + "public.records.createSmartImportRecords", + "public.records.readSmartImportRecords", + "public.webhooks.createWebhooks", + "public.webhooks.readWebhooks", + "public.webhooks.updateWebhooks", + "public.webhooks.deleteWebhooks", + "public.workflows.createWorkflows", + "public.workflows.readWorkflows", + "public.workflows.updateWorkflows", + "public.workflows.readApprovals", + "public.workflows.updateApprovals", + "public.workflows.readSignatures", + "public.workflows.uploadSignedDocuments", + "public.workflows.readParticipants", + "public.workflows.revertToReview", + "public.workflows.cancel", + "public.workflows.pauseAndResume", + "public.workflows.createComments", + "public.workflows.readComments", + "public.workflows.createDocuments", + "public.workflows.readDocuments", + "public.workflows.readSchemas", + "public.workflows.readTurnHistory", + "public.workflows.readEmailCommunications", + "scim.groups.createGroups", + "scim.groups.readGroups", + "scim.groups.updateGroups", + "scim.groups.deleteGroups", + "scim.users.createUsers", + "scim.users.readUsers", + "scim.users.updateUsers", + "scim.users.deleteUsers", + "scim.schemas.readSchemas" + ], + "redirectMode": "GlobalPerConnector", + "redirectUrl": "https://global.consent.azure-apim.net/redirect/ironcladclm", + "properties": { + "IsFirstParty": "False", + "IsOnbehalfofLoginSupported": false + }, + "customParameters": { + "authorizationUrl": { + "value": "https://eu1.ironcladapp.com/oauth/authorize" + }, + "tokenUrl": { + "value": "https://eu1.ironcladapp.com/oauth/token" + }, + "refreshUrl": { + "value": "https://eu1.ironcladapp.com/oauth/token" + } + } + }, + "uiDefinition": { + "displayName": "Login to Ironclad", + "description": "Login to Ironclad", + "tooltip": "Login to Ironclad", + "constraints": { + "required": "true" + } + } + }, + "token:clientId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 4, + "required": "true" + }, + "description": "Enter Ironclad Client Id", + "displayName": "Ironclad Client Id", + "tooltip": "Ironclad Client Id" + } + }, + "token:clientSecret": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "tabIndex": 5, + "required": "true" + }, + "description": "Enter Ironclad Client Secret", + "displayName": "Ironclad Client Secret", + "tooltip": "Ironclad Client Secret" + } + }, + "token:customHost": { + "type": "string", + "uiDefinition": { + "constraints": { + "required": "true", + "tabIndex": 3, + "allowedValues": [ + { + "text": "Default", + "value": "eu1.ironcladapp.com" + } + ] + }, + "displayName": "Version", + "description": "Select default to continue" + } + } + }, + "metadata": { + "allowSharing": false + } + }, + { + "name": "oauthUS", + "uiDefinition": { + "displayName": "Global", + "description": "ironcladapp.com" + }, + "parameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2", + "clientId": "dummy", + "scopes": [ + "public.records.createRecords", + "public.records.readRecords", + "public.records.updateRecords", + "public.records.deleteRecords", + "public.records.readSchemas", + "public.records.createAttachments", + "public.records.readAttachments", + "public.records.deleteAttachments", + "public.records.createSmartImportRecords", + "public.records.readSmartImportRecords", + "public.webhooks.createWebhooks", + "public.webhooks.readWebhooks", + "public.webhooks.updateWebhooks", + "public.webhooks.deleteWebhooks", + "public.workflows.createWorkflows", + "public.workflows.readWorkflows", + "public.workflows.updateWorkflows", + "public.workflows.readApprovals", + "public.workflows.updateApprovals", + "public.workflows.readSignatures", + "public.workflows.uploadSignedDocuments", + "public.workflows.readParticipants", + "public.workflows.revertToReview", + "public.workflows.cancel", + "public.workflows.pauseAndResume", + "public.workflows.createComments", + "public.workflows.readComments", + "public.workflows.createDocuments", + "public.workflows.readDocuments", + "public.workflows.readSchemas", + "public.workflows.readTurnHistory", + "public.workflows.readEmailCommunications", + "scim.groups.createGroups", + "scim.groups.readGroups", + "scim.groups.updateGroups", + "scim.groups.deleteGroups", + "scim.users.createUsers", + "scim.users.readUsers", + "scim.users.updateUsers", + "scim.users.deleteUsers", + "scim.schemas.readSchemas" + ], + "redirectMode": "GlobalPerConnector", + "redirectUrl": "https://global.consent.azure-apim.net/redirect/ironcladclm", + "properties": { + "IsFirstParty": "False", + "IsOnbehalfofLoginSupported": false + }, + "customParameters": { + "authorizationUrl": { + "value": "https://ironcladapp.com/oauth/authorize" + }, + "tokenUrl": { + "value": "https://ironcladapp.com/oauth/token" + }, + "refreshUrl": { + "value": "https://ironcladapp.com/oauth/token" + } + } + }, + "uiDefinition": { + "displayName": "Login to Ironclad", + "description": "Login to Ironclad", + "tooltip": "Login to Ironclad", + "constraints": { + "required": "true" + } + } + }, + "token:clientId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 4, + "required": "true" + }, + "description": "Enter Ironclad Client Id", + "displayName": "Ironclad Client Id", + "tooltip": "Ironclad Client Id" + } + }, + "token:clientSecret": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "tabIndex": 5, + "required": "true" + }, + "description": "Enter Ironclad Client Secret", + "displayName": "Ironclad Client Secret", + "tooltip": "Ironclad Client Secret" + } + }, + "token:customHost": { + "type": "string", + "uiDefinition": { + "constraints": { + "required": "true", + "tabIndex": 3, + "allowedValues": [ + { + "text": "Default", + "value": "ironcladapp.com" + } + ] + }, + "displayName": "Version", + "description": "Select default to continue" + } + } + }, + "metadata": { + "allowSharing": false + } + }, + { + "name": "oauthPREVIEW", + "uiDefinition": { + "displayName": "Preview", + "description": "preview.ironcladapp.com" + }, + "parameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2", + "clientId": "dummy", + "scopes": [ + "public.records.createRecords", + "public.records.readRecords", + "public.records.updateRecords", + "public.records.deleteRecords", + "public.records.readSchemas", + "public.records.createAttachments", + "public.records.readAttachments", + "public.records.deleteAttachments", + "public.records.createSmartImportRecords", + "public.records.readSmartImportRecords", + "public.webhooks.createWebhooks", + "public.webhooks.readWebhooks", + "public.webhooks.updateWebhooks", + "public.webhooks.deleteWebhooks", + "public.workflows.createWorkflows", + "public.workflows.readWorkflows", + "public.workflows.updateWorkflows", + "public.workflows.readApprovals", + "public.workflows.updateApprovals", + "public.workflows.readSignatures", + "public.workflows.uploadSignedDocuments", + "public.workflows.readParticipants", + "public.workflows.revertToReview", + "public.workflows.cancel", + "public.workflows.pauseAndResume", + "public.workflows.createComments", + "public.workflows.readComments", + "public.workflows.createDocuments", + "public.workflows.readDocuments", + "public.workflows.readSchemas", + "public.workflows.readTurnHistory", + "public.workflows.readEmailCommunications", + "scim.groups.createGroups", + "scim.groups.readGroups", + "scim.groups.updateGroups", + "scim.groups.deleteGroups", + "scim.users.createUsers", + "scim.users.readUsers", + "scim.users.updateUsers", + "scim.users.deleteUsers", + "scim.schemas.readSchemas" + ], + "redirectMode": "GlobalPerConnector", + "redirectUrl": "https://global.consent.azure-apim.net/redirect/ironcladclm", + "properties": { + "IsFirstParty": "False", + "IsOnbehalfofLoginSupported": false + }, + "customParameters": { + "authorizationUrl": { + "value": "https://preview.ironcladapp.com/oauth/authorize" + }, + "tokenUrl": { + "value": "https://preview.ironcladapp.com/oauth/token" + }, + "refreshUrl": { + "value": "https://preview.ironcladapp.com/oauth/token" + } + } + }, + "uiDefinition": { + "displayName": "Login to Ironclad", + "description": "Login to Ironclad", + "tooltip": "Login to Ironclad", + "constraints": { + "required": "true" + } + } + }, + "token:clientId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 4, + "required": "true" + }, + "description": "Enter Ironclad Client Id", + "displayName": "Ironclad Client Id", + "tooltip": "Ironclad Client Id" + } + }, + "token:clientSecret": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "tabIndex": 5, + "required": "true" + }, + "description": "Enter Ironclad Client Secret", + "displayName": "Ironclad Client Secret", + "tooltip": "Ironclad Client Secret" + } + }, + "token:customHost": { + "type": "string", + "uiDefinition": { + "constraints": { + "required": "true", + "tabIndex": 3, + "allowedValues": [ + { + "text": "Default", + "value": "preview.ironcladapp.com" + } + ] + }, + "displayName": "Version", + "description": "Select default to continue" + } + } + }, + "metadata": { + "allowSharing": false + } + }, + { + "name": "ClientCredentials", + "uiDefinition": { + "displayName": "Client Credentials", + "description": "Connect using client credentials" + }, + "parameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2generic", + "clientId": "{clientId}", + "scopes": [ + "public.records.readRecords" + ], + "redirectMode": "Global", + "redirectUrl": "https://global.consent.azure-apim.net/redirect", + "properties": { + "IsFirstParty": "False" + }, + "customParameters": { + "authorizationUrlTemplate": { + "value": "https://{customHost}/oauth/authorize" + }, + "refreshBodyTemplate": { + "value": "client_id={clientId}&grant_type=client_credentials&client_secret={clientSecret}&scope=public.records.readRecords" + }, + "refreshUrlTemplate": { + "value": "https://{customHost}/oauth/token" + }, + "scopeListDelimiter": { + "value": " " + }, + "tokenBodyTemplate": { + "value": "client_id={clientId}&grant_type=client_credentials&client_secret={clientSecret}&scope=public.records.readRecords" + }, + "tokenUrlTemplate": { + "value": "https://{customHost}/oauth/token" + } + } + } + }, + "token:customHost": { + "type": "string", + "uiDefinition": { + "constraints": { + "allowedValues": [ + { + "text": "Demo", + "value": "demo.ironcladapp.com" + }, + { + "text": "EU1", + "value": "eu1.ironcladapp.com" + }, + { + "text": "Global", + "value": "ironcladapp.com" + }, + { + "text": "Preview", + "value": "preview.ironcladapp.com" + } + ], + "tabIndex": 2, + "required": "true" + }, + "displayName": "Ironclad Instance", + "description": "Select the Ironclad instance you wish to connect to. If you are unsure, check with your Ironclad administrator.", + "tooltip": "Select the Ironclad instance you wish to connect to. If you are unsure, check with your Ironclad administrator." + } + }, + "token:clientId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 3, + "required": "true" + }, + "description": "Enter Ironclad Client Id", + "displayName": "Ironclad Client Id", + "tooltip": "Ironclad Client Id" + } + }, + "token:clientSecret": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "tabIndex": 4, + "required": "true" + }, + "description": "Enter Ironclad Client Secret", + "displayName": "Ironclad Client Secret", + "tooltip": "Ironclad Client Secret" + } + } + }, + "metadata": { + "allowSharing": false + } + }, + { + "name": "Debug", + "uiDefinition": { + "displayName": "Debug", + "description": "Debug" + }, + "parameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2", + "clientId": "dummy", + "scopes": [ + "public.records.createRecords", + "public.records.readRecords", + "public.records.updateRecords", + "public.records.deleteRecords", + "public.records.readSchemas", + "public.records.createAttachments", + "public.records.readAttachments", + "public.records.deleteAttachments", + "public.records.createSmartImportRecords", + "public.records.readSmartImportRecords", + "public.webhooks.createWebhooks", + "public.webhooks.readWebhooks", + "public.webhooks.updateWebhooks", + "public.webhooks.deleteWebhooks", + "public.workflows.createWorkflows", + "public.workflows.readWorkflows", + "public.workflows.updateWorkflows", + "public.workflows.readApprovals", + "public.workflows.updateApprovals", + "public.workflows.readSignatures", + "public.workflows.uploadSignedDocuments", + "public.workflows.readParticipants", + "public.workflows.revertToReview", + "public.workflows.cancel", + "public.workflows.pauseAndResume", + "public.workflows.createComments", + "public.workflows.readComments", + "public.workflows.createDocuments", + "public.workflows.readDocuments", + "public.workflows.readSchemas", + "public.workflows.readTurnHistory", + "public.workflows.readEmailCommunications", + "scim.groups.createGroups", + "scim.groups.readGroups", + "scim.groups.updateGroups", + "scim.groups.deleteGroups", + "scim.users.createUsers", + "scim.users.readUsers", + "scim.users.updateUsers", + "scim.users.deleteUsers", + "scim.schemas.readSchemas" + ], + "redirectMode": "GlobalPerConnector", + "redirectUrl": "https://global.consent.azure-apim.net/redirect/ironcladclm", + "properties": { + "IsFirstParty": "False", + "IsOnbehalfofLoginSupported": false + }, + "customParameters": { + "authorizationUrl": { + "value": "https://demo.ironcladapp.com/oauth/authorize" + }, + "tokenUrl": { + "value": "https://demo.ironcladapp.com/oauth/token" + }, + "refreshUrl": { + "value": "https://demo.ironcladapp.com/oauth/token" + } + } + }, + "uiDefinition": { + "displayName": "Login to Ironclad", + "description": "Login to Ironclad", + "tooltip": "Login to Ironclad", + "constraints": { + "required": "true" + } + } + }, + "token:clientId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 4, + "required": "true" + }, + "description": "Enter Ironclad Client Id", + "displayName": "Ironclad Client Id", + "tooltip": "Ironclad Client Id" + } + }, + "token:clientSecret": { + "type": "securestring", + "uiDefinition": { + "constraints": { + "tabIndex": 5, + "required": "true" + }, + "description": "Enter Ironclad Client Secret", + "displayName": "Ironclad Client Secret", + "tooltip": "Ironclad Client Secret" + } + }, + "token:customHost": { + "type": "string", + "uiDefinition": { + "constraints": { + "required": "true", + "tabIndex": 3 + }, + "displayName": "Target Server", + "description": "Enter the endpoint of the listening server." + } + } + }, + "metadata": { + "allowSharing": false + } + } + ] + }, + "capabilities": [ + "actions" + ], + "policyTemplateInstances": [ + { + "templateId": "dynamichosturl", + "title": "Set host for connection", + "parameters": { + "x-ms-apimTemplateParameter.urlTemplate": "https://@connectionParameters('token:customHost')" + } + }, + { + "templateId": "setheader", + "title": "Accept", + "parameters": { + "x-ms-apimTemplateParameter.name": "Accept", + "x-ms-apimTemplateParameter.value": "application/json", + "x-ms-apimTemplateParameter.existsAction": "override", + "x-ms-apimTemplate-policySection": "Request" + } + } + ] + } +} diff --git a/independent-publisher-connectors/Ironclad CLM/script.csx b/independent-publisher-connectors/Ironclad CLM/script.csx new file mode 100644 index 0000000000..ff04412b87 --- /dev/null +++ b/independent-publisher-connectors/Ironclad CLM/script.csx @@ -0,0 +1,3457 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; +using System.Linq; +using System.Text.RegularExpressions; +using System.Collections.Generic; +using System.Net.Http.Headers; +using System.Text; +using System.IO; +using System.Web; + +public class Script : ScriptBase +{ + private JObject recordSchemaInfo; + + public override async Task ExecuteAsync() + { + if ("RetrieveRecord".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase)) + { + await rtrRcd_RetrieveRecordSchemaInformation().ConfigureAwait(false); + } + + await this.UpdateRequest().ConfigureAwait(false); + var response = await this.Context + .SendAsync(this.Context.Request, this.CancellationToken) + .ConfigureAwait(false); + if (response.IsSuccessStatusCode) + { + await this.UpdateResponse(response).ConfigureAwait(false); + } + return response; + } + + private async Task UpdateRequest() + { + switch (this.Context.OperationId) + { + case "CreateSignedCopyAttachment": + case "CreateAttachment": + await crtAtt_TransformToMultipartRequestForRecords().ConfigureAwait(false); + break; + case "CreateWorkflow": + await crtWfl_TransformToMultipartRequestForWorkflows().ConfigureAwait(false); + break; + case "CreateWorkflowAsync": + await crtAsyncWfl_TransformRequestJson().ConfigureAwait(false); + break; + case "CreateRecord": + case "ReplaceRecord": + await crtRcd_TransformCreateRecordRequest().ConfigureAwait(false); + break; + case "UpdateRecordMetadata": + await updRcd_TransformUpdateRecordMetadataRequest().ConfigureAwait(false); + break; + case "CreateWorkflowDocument": + await crtWflDoc_TransformToMultipartRequest().ConfigureAwait(false); + break; + case "UpdateGroup": + await updGrp_TransformUpdateGroupRequest().ConfigureAwait(false); + break; + case "UpdateUser": + await updUsr_TransformUpdateUserRequest().ConfigureAwait(false); + break; + } + } + + private async Task UpdateResponse(HttpResponseMessage response) + { + switch (this.Context.OperationId) + { + case "ListUsers": + await this.TransformResponseJsonBody(this.lstUsr_TransformUsersList, response) + .ConfigureAwait(false); + break; + case "RetrieveWorkflowSchema": + await this.TransformResponseJsonBody( + this.rtrWflSch_TransformRetrieveWorkflowSchema, + response + ) + .ConfigureAwait(false); + break; + case "RetrieveWorkflow": + await this.TransformResponseJsonBody( + this.rtrWfl_TransformRetrieveWorkflow, + response + ) + .ConfigureAwait(false); + break; + case "RetrieveRecord": + await this.TransformResponseJsonBody(this.rtrRcd_TransformRetrieveRecord, response) + .ConfigureAwait(false); + break; + case "RetrieveEmailThread": + await this.TransformResponseJsonBody( + this.rtrEml_TransformRetrieveEmailThread, + response + ) + .ConfigureAwait(false); + break; + case "CreateRecord": + case "ReplaceRecord": + case "UpdateRecordMetadata": + await this.TransformResponseJsonBody( + this.crtRcd_TransformCreateRecordResponse, + response + ) + .ConfigureAwait(false); + break; + case "ListAllRecords": + // Get query parameter for properties + var listAllRecordsQuery = + HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query)[ + "recordPorperties" + ] ?? string.Empty; + await this.TransformResponseJsonBody( + body => + lstAllRcd_TransformListAllRecordsResponse(body, listAllRecordsQuery), + response + ) + .ConfigureAwait(false); + break; + case "RetrieveRecordSchemas": + // Get query parameter for properties + var retrieveRecordSchemasQuery = + HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query)[ + "recordPorperties" + ] ?? string.Empty; + await this.TransformResponseJsonBody( + body => + rtrRcdSch_TransformRetrieveRecordSchemas( + body, + retrieveRecordSchemasQuery + ), + response + ) + .ConfigureAwait(false); + break; + case "ListAllWorkflows": + await this.TransformResponseJsonBody( + this.lstAllWfl_TransformListAllWorkflowsResponse, + response + ) + .ConfigureAwait(false); + break; + } + } + + private async Task TransformResponseJsonBody( + Func transformationFunction, + HttpResponseMessage response + ) + { + var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + if (!String.IsNullOrWhiteSpace(content)) + { + var body = JObject.Parse(content); + body = transformationFunction(body); + response.Content = CreateJsonContent(body.ToString()); + } + } + + // ################################################################################ + // Create Attachment / Create Signed Copy Attachment operations ################### + // ################################################################################ + + private async Task crtAtt_TransformToMultipartRequestForRecords() + { + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + var multipartContent = new MultipartFormDataContent(); + + string filename = "document.pdf"; + if ( + jsonBody.TryGetValue("metadata", out var metadataToken) + && metadataToken is JObject metadata + ) + { + filename = metadata["filename"]?.ToString() ?? filename; + } + + if (jsonBody.TryGetValue("attachment", out var attachmentToken)) + { + var attachmentBytes = Convert.FromBase64String(attachmentToken.ToString()); + var fileContent = new ByteArrayContent(attachmentBytes); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + multipartContent.Add(fileContent, "attachment", filename); + } + + if (metadataToken != null) + { + var metadataJson = metadataToken.ToString(); + var metadataContent = new StringContent( + metadataJson, + Encoding.UTF8, + "application/json" + ); + multipartContent.Add(metadataContent, "metadata"); + } + + this.Context.Request.Content = multipartContent; + } + + // ################################################################################ + // Create Record ################################################################## + // Replace Record ################################################################# + // ################################################################################ + + private async Task crtRcd_FetchRecordMetadata() + { + var baseUrl = this.Context.Request.RequestUri.GetLeftPart(UriPartial.Authority); + var metadataUrl = new Uri(new Uri(baseUrl), "/public/api/v1/records/metadata"); + + var request = new HttpRequestMessage(HttpMethod.Get, metadataUrl); + + foreach (var header in this.Context.Request.Headers) + { + request.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + + var response = await this.Context + .SendAsync(request, this.CancellationToken) + .ConfigureAwait(false); + + if (response.IsSuccessStatusCode) + { + var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + return JObject.Parse(content); + } + else + { + throw new Exception( + $"Failed to retrieve record metadata. Status code: {response.StatusCode}" + ); + } + } + + private async Task crtRcd_TransformCreateRecordRequest() + { + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + if (jsonBody.TryGetValue("propertiesAsArray", out var propertiesAsArray)) + { + var metadata = await crtRcd_FetchRecordMetadata(); + var metadataProperties = metadata["properties"] as JObject; + + var properties = new JObject(); + + foreach (var prop in propertiesAsArray) + { + var systemPropertyName = prop["propertySystemName"].ToString(); + var value = prop["value"]; + + string type = "unknown"; + if ( + metadataProperties != null + && metadataProperties.TryGetValue(systemPropertyName, out var propertyInfo) + ) + { + type = propertyInfo["type"]?.ToString() ?? "unknown"; + } + + properties[systemPropertyName] = new JObject { ["value"] = value, ["type"] = type }; + } + + jsonBody["properties"] = properties; + jsonBody.Remove("propertiesAsArray"); + + this.Context.Request.Content = CreateJsonContent(jsonBody.ToString()); + } + } + + // Add counterpartyName property to the response + private JObject crtRcd_TransformCreateRecordResponse(JObject body) + { + if (body.ContainsKey("properties") && body["properties"] is JObject properties) + { + if (properties.ContainsKey("counterpartyName")) + { + body["counterpartyName"] = properties["counterpartyName"]["value"]; + } + else + { + body["counterpartyName"] = null; + } + } + else + { + body["counterpartyName"] = null; + } + + return body; + } + + // ################################################################################ + // Update Record Metadata ######################################################### + // ################################################################################ + + private async Task updRcd_FetchRecordMetadata() + { + var baseUrl = this.Context.Request.RequestUri.GetLeftPart(UriPartial.Authority); + var metadataUrl = new Uri(new Uri(baseUrl), "/public/api/v1/records/metadata"); + + var metadataRequest = new HttpRequestMessage(HttpMethod.Get, metadataUrl); + + foreach (var header in this.Context.Request.Headers) + { + metadataRequest.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + + var metadataResponse = await this.Context + .SendAsync(metadataRequest, this.CancellationToken) + .ConfigureAwait(false); + + if (!metadataResponse.IsSuccessStatusCode) + { + throw new Exception( + $"Failed to retrieve record metadata. Status code: {metadataResponse.StatusCode}" + ); + } + + var metadataContent = await metadataResponse.Content + .ReadAsStringAsync() + .ConfigureAwait(false); + return JObject.Parse(metadataContent); + } + + private async Task updRcd_TransformUpdateRecordMetadataRequest() + { + var metadata = await updRcd_FetchRecordMetadata(); + var metadataProperties = metadata["properties"] as JObject; + + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + if ( + jsonBody.TryGetValue("addProperties", out var addPropertiesToken) + && addPropertiesToken is JArray addPropertiesArray + ) + { + var transformedProperties = new JObject(); + + foreach (var prop in addPropertiesArray) + { + if ( + prop is JObject propObject + && propObject.TryGetValue("propertySystemName", out var propertySystemNameToken) + && propObject.TryGetValue("value", out var valueToken) + ) + { + string propertySystemName = propertySystemNameToken.ToString(); + JToken value = valueToken; + + string type = "unknown"; + if ( + metadataProperties != null + && metadataProperties.TryGetValue(propertySystemName, out var propertyInfo) + ) + { + type = propertyInfo["type"]?.ToString() ?? "unknown"; + } + + transformedProperties[propertySystemName] = new JObject + { + ["value"] = value, + ["type"] = type + }; + } + } + + jsonBody["addProperties"] = transformedProperties; + this.Context.Request.Content = CreateJsonContent(jsonBody.ToString()); + } + } + + // ################################################################################ + // Create Workflow Asynchronously ################################################# + // ################################################################################ + + private async Task crtAsyncWfl_TransformRequestJson() + { + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + // Unflatten the JSON structure + jsonBody = crtAsyncWfl_UnflattenJson(jsonBody); + + // Update the request content with transformed JSON + this.Context.Request.Content = CreateJsonContent(jsonBody.ToString()); + } + + private JObject crtAsyncWfl_UnflattenJson(JObject flatJson) + { + var result = new JObject(); + + foreach (var prop in flatJson.Properties()) + { + if (prop.Value is JArray array) + { + var unflattened = new JArray(); + foreach (var item in array) + { + if (item is JObject objItem) + { + var unflattenedItem = new JObject(); + var groupedProperties = objItem + .Properties() + .GroupBy(p => p.Name.Split('/')[0]) + .ToDictionary(g => g.Key, g => g.ToList()); + + foreach (var group in groupedProperties) + { + if (group.Value.Count == 1 && !group.Value[0].Name.Contains("/")) + { + // Simple property + unflattenedItem[group.Key] = group.Value[0].Value; + } + else + { + // Complex property + var complexObj = new JObject(); + foreach (var complexProp in group.Value) + { + var parts = complexProp.Name.Split('/'); + if (parts.Length == 1) + { + complexObj[parts[0]] = complexProp.Value; + } + else + { + var currentObj = complexObj; + for (int i = 1; i < parts.Length - 1; i++) + { + if (!currentObj.ContainsKey(parts[i])) + { + currentObj[parts[i]] = new JObject(); + } + currentObj = (JObject)currentObj[parts[i]]; + } + currentObj[parts.Last()] = complexProp.Value; + } + } + unflattenedItem[group.Key] = complexObj; + } + } + unflattened.Add(unflattenedItem); + } + else + { + // Handle primitive types (e.g., strings, numbers) by adding them directly + unflattened.Add(item); + } + } + result[prop.Name] = unflattened; + } + else if (prop.Value is JObject obj) + { + result[prop.Name] = crtWfl_UnflattenJson(obj); + } + else if (prop.Name.Contains("/")) + { + var parts = prop.Name.Split('/'); + var currentObj = result; + for (int i = 0; i < parts.Length - 1; i++) + { + if (!currentObj.ContainsKey(parts[i])) + { + currentObj[parts[i]] = new JObject(); + } + currentObj = (JObject)currentObj[parts[i]]; + } + currentObj[parts.Last()] = prop.Value; + } + else + { + result[prop.Name] = prop.Value; + } + } + + return result; + } + + // ################################################################################ + // Create Workflow Synchronously ################################################## + // ################################################################################ + + private async Task crtWfl_TransformToMultipartRequestForWorkflows() + { + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + // Unflatten the entire JSON body + jsonBody = crtWfl_UnflattenJson(jsonBody); + + var multipartContent = new MultipartFormDataContent(); + + if ( + jsonBody.TryGetValue("attributes", out var attributesToken) + && attributesToken is JObject attributes + ) + { + crtWfl_ProcessWorkflowAttributes(attributes, multipartContent, jsonBody); + } + + var dataContent = new StringContent(jsonBody.ToString(), Encoding.UTF8, "application/json"); + multipartContent.Add(dataContent, "data"); + + this.Context.Request.Content = multipartContent; + } + + private JObject crtWfl_UnflattenJson(JObject flatJson) + { + var result = new JObject(); + + foreach (var prop in flatJson.Properties()) + { + if (prop.Value is JArray array) + { + var unflattened = new JArray(); + foreach (var item in array) + { + if (item is JObject objItem) + { + var unflattenedItem = new JObject(); + var groupedProperties = objItem + .Properties() + .GroupBy(p => p.Name.Split('/')[0]) + .ToDictionary(g => g.Key, g => g.ToList()); + + foreach (var group in groupedProperties) + { + if (group.Value.Count == 1 && !group.Value[0].Name.Contains("/")) + { + // Simple property + unflattenedItem[group.Key] = group.Value[0].Value; + } + else + { + // Complex property + var complexObj = new JObject(); + foreach (var complexProp in group.Value) + { + var parts = complexProp.Name.Split('/'); + if (parts.Length == 1) + { + complexObj[parts[0]] = complexProp.Value; + } + else + { + var currentObj = complexObj; + for (int i = 1; i < parts.Length - 1; i++) + { + if (!currentObj.ContainsKey(parts[i])) + { + currentObj[parts[i]] = new JObject(); + } + currentObj = (JObject)currentObj[parts[i]]; + } + currentObj[parts.Last()] = complexProp.Value; + } + } + unflattenedItem[group.Key] = complexObj; + } + } + unflattened.Add(unflattenedItem); + } + else + { + // Handle primitive types (e.g., strings, numbers) by adding them directly + unflattened.Add(item); + } + } + result[prop.Name] = unflattened; + } + else if (prop.Value is JObject obj) + { + result[prop.Name] = crtWfl_UnflattenJson(obj); + } + else if (prop.Name.Contains("/")) + { + var parts = prop.Name.Split('/'); + var currentObj = result; + for (int i = 0; i < parts.Length - 1; i++) + { + if (!currentObj.ContainsKey(parts[i])) + { + currentObj[parts[i]] = new JObject(); + } + currentObj = (JObject)currentObj[parts[i]]; + } + currentObj[parts.Last()] = prop.Value; + } + else + { + result[prop.Name] = prop.Value; + } + } + + return result; + } + + private void crtWfl_ProcessWorkflowAttributes( + JObject attributes, + MultipartFormDataContent multipartContent, + JObject jsonBody + ) + { + foreach (var attribute in attributes.Properties()) + { + if ( + attribute.Value is JArray arrayValue + && arrayValue.Any(item => item is JObject obj && obj.ContainsKey("fileContent")) + ) + { + crtWfl_ProcessFileArrayAttribute( + attribute.Name, + arrayValue, + multipartContent, + jsonBody + ); + } + } + } + + private void crtWfl_ProcessFileArrayAttribute( + string attributeName, + JArray arrayValue, + MultipartFormDataContent multipartContent, + JObject jsonBody + ) + { + var updatedArray = new JArray(); + + foreach (var item in arrayValue) + { + if ( + item is JObject fileObject + && fileObject.TryGetValue("fileName", out var fileNameToken) + && fileObject.TryGetValue("fileContent", out var fileContentToken) + ) + { + string fileName = fileNameToken.ToString(); + string fileContent = fileContentToken.ToString(); + + if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(fileContent)) + { + string fileKey = $"{attributeName}_{Guid.NewGuid().ToString("N")}"; + + var fileBytes = Convert.FromBase64String(fileContent); + var fileContentPart = new ByteArrayContent(fileBytes); + fileContentPart.Headers.ContentType = new MediaTypeHeaderValue( + "application/octet-stream" + ); + multipartContent.Add(fileContentPart, fileKey, fileName); + + updatedArray.Add(new JObject { ["file"] = fileKey }); + } + } + } + + jsonBody["attributes"][attributeName] = updatedArray; + } + + // ################################################################################ + // Create Workflow Document operations ############################################ + // ################################################################################ + + private async Task crtWflDoc_TransformToMultipartRequest() + { + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + var multipartContent = new MultipartFormDataContent(); + + string filename = "document.pdf"; // Default filename as fallback + if ( + jsonBody.TryGetValue("metadata", out var metadataToken) + && metadataToken is JObject metadata + ) + { + filename = metadata["filename"]?.ToString() ?? filename; + } + + if (jsonBody.TryGetValue("attachment", out var attachmentToken)) + { + var attachmentBytes = Convert.FromBase64String(attachmentToken.ToString()); + var fileContent = new ByteArrayContent(attachmentBytes); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + multipartContent.Add(fileContent, "attachment", filename); + } + + if (metadataToken != null) + { + var metadataJson = metadataToken.ToString(); + var metadataContent = new StringContent( + metadataJson, + Encoding.UTF8, + "application/json" + ); + multipartContent.Add(metadataContent, "metadata"); + } + + this.Context.Request.Content = multipartContent; + } + + // ################################################################################ + // List Users ##################################################################### + // ################################################################################ + + private JObject lstUsr_TransformUsersList(JObject body) + { + var resources = body["Resources"] as JArray; + if (resources != null) + { + var transformedResources = new JArray( + resources.Select( + user => + { + var givenName = user["name"]?["givenName"]?.ToString() ?? ""; + var familyName = user["name"]?["familyName"]?.ToString() ?? ""; + var displayName = $"{givenName} {familyName}".Trim(); + + var email = + user["emails"]?.FirstOrDefault()?["value"]?.ToString().ToLower() ?? ""; + + user["displayName"] = displayName; + user["combinedLabel"] = $"{displayName} ({email})"; + + return user; + } + ) + ); + + body["Resources"] = transformedResources; + } + return body; + } + + // ################################################################################ + // Update Group ################################################################### + // ################################################################################ + + private async Task updGrp_TransformUpdateGroupRequest() + { + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + // Ensure the "schemas" property exists and has the correct value + if (!jsonBody.ContainsKey("schemas") || !(jsonBody["schemas"] is JArray)) + { + jsonBody["schemas"] = new JArray(); + } + + var schemas = (JArray)jsonBody["schemas"]; + if ( + !schemas.Any( + s => + s.Type == JTokenType.String + && s.Value() == "urn:ietf:params:scim:api:messages:2.0:PatchOp" + ) + ) + { + schemas.Clear(); // Remove any existing values + schemas.Add("urn:ietf:params:scim:api:messages:2.0:PatchOp"); + } + + // Update the request content with the modified body + this.Context.Request.Content = CreateJsonContent(jsonBody.ToString()); + } + + // ################################################################################ + // Update User #################################################################### + // ################################################################################ + + private async Task updUsr_TransformUpdateUserRequest() + { + var content = await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false); + var jsonBody = JObject.Parse(content); + + // Ensure the "schemas" property exists and has the correct value + if (!jsonBody.ContainsKey("schemas") || !(jsonBody["schemas"] is JArray)) + { + jsonBody["schemas"] = new JArray(); + } + + var schemas = (JArray)jsonBody["schemas"]; + if ( + !schemas.Any( + s => + s.Type == JTokenType.String + && s.Value() == "urn:ietf:params:scim:api:messages:2.0:PatchOp" + ) + ) + { + schemas.Clear(); // Remove any existing values + schemas.Add("urn:ietf:params:scim:api:messages:2.0:PatchOp"); + } + + // Update the request content with the modified body + this.Context.Request.Content = CreateJsonContent(jsonBody.ToString()); + } + + // ################################################################################ + // Retrieve Workflow Schema ####################################################### + // ################################################################################ + + private JObject rtrWflSch_TransformRetrieveWorkflowSchema(JObject body) + { + var schema = body["schema"] as JObject; + if (schema != null) + { + var launchSchema = new JObject(); + var formattedSchema = new JObject(); + var schemaAsArray = new JArray(); + var documentSchemaAsArray = new JArray(); + + foreach (var property in schema.Properties()) + { + string propertyName = property.Name; + var propertyValue = property.Value as JObject; + if (propertyValue != null) + { + string displayName = propertyValue["displayName"]?.ToString() ?? propertyName; + string propertyType = propertyValue["type"]?.ToString().ToLower(); + bool isReadOnly = propertyValue["readOnly"]?.ToObject() ?? false; + + // Fix: Use the correct property type for special cases + string effectivePropertyType = propertyType; + if (propertyType == "object") + { + var objectType = propertyValue["objectType"]?.ToString().ToLower(); + if ( + objectType == "address" + || objectType == "monetaryamount" + || objectType == "duration" + ) + { + effectivePropertyType = objectType; + } + } + + var formattedLaunchProperty = rtrWflSch_FormatLaunchProperty( + effectivePropertyType, + displayName, + propertyName, + propertyValue + ); + launchSchema[propertyName] = formattedLaunchProperty; + + var formattedProperty = rtrWflSch_FormatProperty( + effectivePropertyType, + displayName, + propertyName, + propertyValue + ); + formattedSchema[propertyName] = formattedProperty; + + var schemaArrayItem = rtrWflSch_ParseSchemaArrayItem( + propertyName, + displayName, + effectivePropertyType, + isReadOnly + ); + schemaAsArray.Add(schemaArrayItem); + + if ( + propertyType == "array" + && propertyValue["elementType"] is JObject arrayElementType + && arrayElementType["type"]?.ToString().ToLower() == "document" + ) + { + documentSchemaAsArray.Add( + rtrWflSch_ParseDocumentSchemaItem(propertyName, displayName, isReadOnly) + ); + } + } + } + + body["launchSchema"] = new JObject + { + ["type"] = "object", + ["properties"] = launchSchema, + ["required"] = new JArray { "counterpartyName" } // Add the required property here + }; + body["formattedSchema"] = new JObject + { + ["type"] = "object", + ["properties"] = formattedSchema + }; + body["schemaAsArray"] = schemaAsArray; + body["documentSchemaAsArray"] = documentSchemaAsArray; + } + + return body; + } + + private JObject rtrWflSch_FormatLaunchProperty( + string propertyType, + string displayName, + string propertyName, + JObject propertyValue + ) + { + switch (propertyType) + { + case "array": + return rtrWflSch_FormatArrayLaunchProperty( + displayName, + propertyName, + propertyValue + ); + case "address": + return rtrWflSch_FormatAddressProperty(displayName, propertyName); + case "monetaryamount": + return rtrWflSch_FormatMonetaryAmountProperty(displayName, propertyName); + case "duration": + return rtrWflSch_FormatDurationProperty(displayName, propertyName); + default: + return rtrWflSch_FormatBasicProperty(propertyType, displayName, propertyName); + } + } + + private JObject rtrWflSch_FormatArrayLaunchProperty( + string displayName, + string propertyName, + JObject propertyValue + ) + { + var elementType = propertyValue["elementType"] as JObject; + if (elementType != null) + { + string elementTypeString = elementType["type"].ToString().ToLower(); + if (elementTypeString == "document") + { + return rtrWflSch_FormatDocumentArrayLaunchProperty(displayName, propertyName); + } + else if (elementTypeString == "object") + { + return rtrWflSch_FormatTableProperty(displayName, propertyName, propertyValue); + } + else + { + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["items"] = rtrWflSch_FormatBasicProperty( + elementTypeString, + $"{displayName} Item", + $"{propertyName} Item" + ) + }; + } + } + return new JObject(); + } + + private JObject rtrWflSch_FormatDocumentArrayLaunchProperty( + string displayName, + string propertyName + ) + { + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName} files.", + ["x-ms-visibility"] = "important", + ["items"] = new JObject + { + ["type"] = "object", + ["required"] = new JArray { "fileName", "fileContent" }, + ["properties"] = new JObject + { + ["fileName"] = new JObject + { + ["type"] = "string", + ["title"] = "File Name", + ["description"] = "The name of the file.", + ["x-ms-visibility"] = "important" + }, + ["fileContent"] = new JObject + { + ["type"] = "string", + ["format"] = "byte", + ["title"] = "File Content", + ["description"] = "The content of the file (base64 encoded).", + ["x-ms-visibility"] = "important" + } + } + } + }; + } + + private JObject rtrWflSch_FormatTableProperty( + string displayName, + string propertyName, + JObject propertyValue + ) + { + var elementTypeSchema = propertyValue["elementType"]["schema"] as JObject; + var itemsObject = new JObject(); + + foreach (var column in elementTypeSchema.Properties()) + { + var columnSchema = column.Value as JObject; + if (columnSchema != null) + { + string columnDisplayName = columnSchema["displayName"].ToString(); + string columnType = columnSchema["type"].ToString().ToLower(); + + // Handle special types + if (columnType == "monetaryamount") + { + itemsObject[column.Name] = rtrWflSch_FormatMonetaryAmountProperty( + columnDisplayName, + column.Name + ); + } + else if (columnType == "duration") + { + itemsObject[column.Name] = rtrWflSch_FormatDurationProperty( + columnDisplayName, + column.Name + ); + } + else if (columnType == "address") + { + itemsObject[column.Name] = rtrWflSch_FormatAddressProperty( + columnDisplayName, + column.Name + ); + } + else + { + JObject formattedColumn = rtrWflSch_FormatBasicProperty( + columnType, + columnDisplayName, + column.Name + ); + itemsObject[column.Name] = formattedColumn; + } + } + } + + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["items"] = new JObject { ["type"] = "object", ["properties"] = itemsObject } + }; + } + + private JObject rtrWflSch_FormatAddressProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["lines"] = new JObject + { + ["type"] = "array", + ["items"] = new JObject + { + ["type"] = "string", + ["title"] = $"{displayName} Line", + ["x-ms-visibility"] = "important", + ["description"] = $"An address line of {displayName}." + } + }, + ["locality"] = new JObject + { + ["type"] = "string", + ["title"] = "Locality", + ["x-ms-visibility"] = "important", + ["description"] = $"The locality of {displayName}." + }, + ["region"] = new JObject + { + ["type"] = "string", + ["title"] = "Region", + ["x-ms-visibility"] = "important", + ["description"] = $"The region of {displayName}." + }, + ["postcode"] = new JObject + { + ["type"] = "string", + ["title"] = "Postcode", + ["x-ms-visibility"] = "important", + ["description"] = $"The postcode of {displayName}." + }, + ["country"] = new JObject + { + ["type"] = "string", + ["title"] = "Country", + ["x-ms-visibility"] = "important", + ["description"] = $"The country of {displayName}." + } + } + }; + } + + private JObject rtrWflSch_FormatMonetaryAmountProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["amount"] = new JObject + { + ["type"] = "number", + ["title"] = "Amount", + ["x-ms-visibility"] = "important", + ["description"] = $"The amount of {displayName}." + }, + ["currency"] = new JObject + { + ["type"] = "string", + ["title"] = "Currency", + ["x-ms-visibility"] = "important", + ["description"] = $"The currency of {displayName}." + } + } + }; + } + + private JObject rtrWflSch_FormatDurationProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["years"] = new JObject + { + ["type"] = "number", + ["title"] = "Years", + ["x-ms-visibility"] = "important", + ["description"] = $"The years of {displayName}." + }, + ["months"] = new JObject + { + ["type"] = "number", + ["title"] = "Months", + ["x-ms-visibility"] = "important", + ["description"] = $"The months of {displayName}." + }, + ["weeks"] = new JObject + { + ["type"] = "number", + ["title"] = "Weeks", + ["x-ms-visibility"] = "important", + ["description"] = $"The weeks of {displayName}." + }, + ["days"] = new JObject + { + ["type"] = "number", + ["title"] = "Days", + ["x-ms-visibility"] = "important", + ["description"] = $"The days of {displayName}." + } + } + }; + } + + private JObject rtrWflSch_FormatBasicProperty( + string propertyType, + string displayName, + string propertyName + ) + { + var formattedLaunchProperty = new JObject + { + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + }; + + switch (propertyType) + { + case "string": + formattedLaunchProperty["type"] = "string"; + break; + case "number": + case "integer": + formattedLaunchProperty["type"] = "number"; + break; + case "boolean": + formattedLaunchProperty["type"] = "boolean"; + break; + case "date": + formattedLaunchProperty["type"] = "string"; + formattedLaunchProperty["format"] = "date-time"; + break; + default: + formattedLaunchProperty["type"] = "string"; + break; + } + + return formattedLaunchProperty; + } + + private JObject rtrWflSch_ParseSchemaArrayItem( + string systemName, + string displayName, + string type, + bool isReadOnly + ) + { + return new JObject + { + ["systemName"] = systemName, + ["displayName"] = displayName, + ["type"] = type, + ["readOnly"] = isReadOnly + }; + } + + private JObject rtrWflSch_ParseDocumentSchemaItem( + string systemName, + string displayName, + bool isReadOnly + ) + { + return new JObject + { + ["systemName"] = systemName, + ["displayName"] = displayName, + ["readOnly"] = isReadOnly + }; + } + + private JObject rtrWflSch_FormatProperty( + string propertyType, + string displayName, + string propertyName, + JObject propertyValue + ) + { + switch (propertyType) + { + case "array": + return rtrWflSch_FormatArrayProperty(displayName, propertyName, propertyValue); + case "address": + return rtrWflSch_FormatAddressProperty(displayName, propertyName); + case "monetaryamount": + return rtrWflSch_FormatMonetaryAmountProperty(displayName, propertyName); + case "duration": + return rtrWflSch_FormatDurationProperty(displayName, propertyName); + default: + return rtrWflSch_FormatBasicProperty(propertyType, displayName, propertyName); + } + } + + private JObject rtrWflSch_FormatArrayProperty( + string displayName, + string propertyName, + JObject propertyValue + ) + { + var elementType = propertyValue["elementType"] as JObject; + if (elementType != null) + { + string elementTypeString = elementType["type"].ToString().ToLower(); + if (elementTypeString == "document") + { + return rtrWflSch_FormatDocumentArrayProperty(displayName, propertyName); + } + else if (elementTypeString == "object") + { + return rtrWflSch_FormatTableProperty(displayName, propertyName, propertyValue); + } + else + { + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["items"] = rtrWflSch_FormatBasicProperty( + elementTypeString, + $"{displayName} Item", + $"{propertyName} Item" + ) + }; + } + } + return new JObject(); + } + + private JObject rtrWflSch_FormatDocumentArrayProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName} files.", + ["x-ms-visibility"] = "important", + ["items"] = new JObject + { + ["type"] = "object", + ["properties"] = new JObject + { + ["filename"] = new JObject + { + ["type"] = "string", + ["title"] = "File Name", + ["x-ms-visibility"] = "important", + ["description"] = "The name of the file." + }, + ["download"] = new JObject + { + ["type"] = "string", + ["title"] = "Download Link", + ["x-ms-visibility"] = "important", + ["description"] = "The download link of the file." + }, + ["key"] = new JObject + { + ["type"] = "string", + ["title"] = "Key", + ["x-ms-visibility"] = "important", + ["description"] = "The key of the file." + } + } + } + }; + } + + // ################################################################################ + // List All Workflow ############################################################## + // ################################################################################ + + private JObject lstAllWfl_TransformListAllWorkflowsResponse(JObject body) + { + if (body.ContainsKey("list") && body["list"] is JArray list) + { + for (int i = 0; i < list.Count; i++) + { + if (list[i] is JObject workflowObject) + { + string ironcladId = workflowObject["ironcladId"]?.ToString() ?? ""; + string title = workflowObject["title"]?.ToString() ?? ""; + workflowObject["label"] = $"{ironcladId}: {title}"; + } + } + } + + return body; + } + + // ################################################################################ + // Retrieve Workflow ############################################################## + // ################################################################################ + private JObject rtrWfl_TransformRetrieveWorkflow(JObject body) + { + var schema = body["schema"] as JObject; + if (schema != null) + { + var formattedSchema = new JObject(); + var schemaAsArray = new JArray(); + var documentsAsArray = new JArray(); + + foreach (var property in schema.Properties()) + { + rtrWfl_ProcessSchemaProperty(property, formattedSchema, schemaAsArray); + } + + body["formattedSchema"] = new JObject + { + ["type"] = "object", + ["properties"] = formattedSchema + }; + body["schemaAsArray"] = schemaAsArray; + + // Transform documents from the existing workflow documents + if (body["attributes"] is JObject attributes) + { + // Handle draft documents + if (attributes["draft"] is JArray draftDocs && draftDocs.Any()) + { + var draftDocObject = new JObject + { + ["systemName"] = "draft", + ["displayName"] = "Draft Document", + ["readOnly"] = true, + ["versions"] = draftDocs + }; + documentsAsArray.Add(draftDocObject); + } + + // Handle signed documents + if (attributes["signed"] is JObject signedDoc) + { + var signedDocObject = new JObject + { + ["systemName"] = "signed", + ["displayName"] = "Signed Document", + ["readOnly"] = true, + ["versions"] = new JArray(signedDoc) + }; + documentsAsArray.Add(signedDocObject); + } + + // Handle sentSignaturePacket documents + if ( + attributes["sentSignaturePacket"] is JArray signaturePacketDocs + && signaturePacketDocs.Any() + ) + { + var signaturePacketObject = new JObject + { + ["systemName"] = "signaturePacket", + ["displayName"] = "Signature Packet", + ["readOnly"] = true, + ["versions"] = signaturePacketDocs + }; + documentsAsArray.Add(signaturePacketObject); + } + } + + body["documentsAsArray"] = documentsAsArray; + body["formattedAttributes"] = rtrWfl_FormatWorkflowAttributes( + body["attributes"] as JObject, + formattedSchema + ); + } + + return body; + } + + private void rtrWfl_ProcessSchemaProperty( + JProperty property, + JObject formattedSchema, + JArray schemaAsArray + ) + { + var propertySchema = property.Value as JObject; + if (propertySchema != null) + { + string displayName = propertySchema["displayName"]?.ToString() ?? property.Name; + string propertyType = propertySchema["type"]?.ToString().ToLower(); + bool isReadOnly = propertySchema["readOnly"]?.ToObject() ?? false; + + if (isReadOnly) + { + displayName += " (read only)"; + } + + JObject formattedProperty = rtrWfl_FormatPropertyByType( + propertyType, + displayName, + property.Name, + propertySchema + ); + formattedProperty["readOnly"] = isReadOnly; + formattedSchema[property.Name] = formattedProperty; + + schemaAsArray.Add( + new JObject + { + ["systemName"] = property.Name, + ["displayName"] = displayName, + ["type"] = propertyType, + ["readOnly"] = isReadOnly + } + ); + } + } + + private JObject rtrWfl_FormatPropertyByType( + string propertyType, + string displayName, + string propertyName, + JObject propertySchema + ) + { + switch (propertyType) + { + case "array": + return rtrWfl_FormatArrayProperty(displayName, propertyName, propertySchema); + case "address": + return rtrWfl_FormatAddressProperty(displayName, propertyName); + case "monetaryamount": + return rtrWfl_FormatMonetaryAmountProperty(displayName, propertyName); + case "duration": + return rtrWfl_FormatDurationProperty(displayName, propertyName); + default: + return rtrWfl_FormatBasicProperty(propertyType, displayName, propertyName); + } + } + + private JObject rtrWfl_FormatArrayProperty( + string displayName, + string propertyName, + JObject propertySchema + ) + { + var elementType = propertySchema["elementType"] as JObject; + if (elementType != null) + { + string elementTypeString = elementType["type"].ToString().ToLower(); + if (elementTypeString == "document") + { + return rtrWfl_FormatDocumentArrayProperty(displayName, propertyName); + } + else if (elementTypeString == "object") + { + return rtrWfl_FormatTableProperty(displayName, propertyName, propertySchema); + } + else + { + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["items"] = rtrWfl_FormatBasicProperty( + elementTypeString, + $"{displayName} Item", + $"{propertyName} Item" + ) + }; + } + } + return new JObject(); + } + + private JObject rtrWfl_FormatDocumentArrayProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName} files.", + ["x-ms-visibility"] = "important", + ["items"] = new JObject + { + ["type"] = "object", + ["properties"] = new JObject + { + ["filename"] = new JObject + { + ["type"] = "string", + ["title"] = "File Name", + ["x-ms-visibility"] = "important", + ["description"] = "The name of the file." + }, + ["version"] = new JObject + { + ["type"] = "string", + ["title"] = "Version", + ["x-ms-visibility"] = "important", + ["description"] = "The version of the file." + }, + ["versionNumber"] = new JObject + { + ["type"] = "number", + ["title"] = "Version Number", + ["x-ms-visibility"] = "important", + ["description"] = "The version number of the file." + }, + ["download"] = new JObject + { + ["type"] = "string", + ["title"] = "Download Link", + ["x-ms-visibility"] = "important", + ["description"] = "The download link of the file." + }, + ["key"] = new JObject + { + ["type"] = "string", + ["title"] = "Key", + ["x-ms-visibility"] = "important", + ["description"] = "The key of the file." + }, + ["lastModified"] = new JObject + { + ["type"] = "object", + ["title"] = "Last Modified", + ["x-ms-visibility"] = "important", + ["description"] = "Information on when the file was last modified.", + ["properties"] = new JObject + { + ["timestamp"] = new JObject + { + ["type"] = "string", + ["format"] = "date-time", + ["title"] = "Timestamp", + ["x-ms-visibility"] = "important", + ["description"] = "The date when the file was last modified." + }, + ["author"] = new JObject + { + ["type"] = "object", + ["title"] = "Author", + ["x-ms-visibility"] = "important", + ["description"] = "The author of the last modification.", + ["properties"] = new JObject + { + ["displayName"] = new JObject + { + ["type"] = "string", + ["title"] = "Display Name", + ["x-ms-visibility"] = "important", + ["description"] = "The display name of the author." + }, + ["email"] = new JObject + { + ["type"] = "string", + ["title"] = "Email", + ["x-ms-visibility"] = "important", + ["description"] = "The email of the author." + }, + ["userId"] = + new JObject + { + ["type"] = "string", + ["title"] = "User ID", + ["x-ms-visibility"] = "important", + ["description"] = "The user ID of the author." + }["type"] = + new JObject + { + ["type"] = "string", + ["title"] = "Type", + ["x-ms-visibility"] = "important", + ["description"] = "The type of the file." + }["companyName"] = + new JObject + { + ["type"] = "string", + ["title"] = "Company Name", + ["x-ms-visibility"] = "important", + ["description"] = "The company name of the author." + } + } + } + } + } + } + } + }; + } + + private JObject rtrWfl_FormatTableProperty( + string displayName, + string propertyName, + JObject propertySchema + ) + { + var elementTypeSchema = propertySchema["elementType"]["schema"] as JObject; + var itemsObject = new JObject(); + + foreach (var column in elementTypeSchema.Properties()) + { + var columnSchema = column.Value as JObject; + if (columnSchema != null) + { + string columnDisplayName = columnSchema["displayName"].ToString(); + string columnType = columnSchema["type"].ToString().ToLower(); + + JObject formattedColumn = rtrWfl_FormatBasicProperty( + columnType, + columnDisplayName, + column.Name + ); + itemsObject[column.Name] = formattedColumn; + } + } + + return new JObject + { + ["type"] = "array", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["items"] = new JObject { ["type"] = "object", ["properties"] = itemsObject } + }; + } + + private JObject rtrWfl_FormatAddressProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["lines"] = new JObject + { + ["type"] = "array", + ["items"] = new JObject + { + ["type"] = "string", + ["title"] = $"{displayName} Line", + ["x-ms-visibility"] = "important", + ["description"] = $"An address line of {displayName}." + } + }, + ["locality"] = new JObject + { + ["type"] = "string", + ["title"] = "Locality", + ["x-ms-visibility"] = "important", + ["description"] = $"The locality of {displayName}." + }, + ["region"] = new JObject + { + ["type"] = "string", + ["title"] = "Region", + ["x-ms-visibility"] = "important", + ["description"] = $"The region of {displayName}." + }, + ["postcode"] = new JObject + { + ["type"] = "string", + ["title"] = "Postcode", + ["x-ms-visibility"] = "important", + ["description"] = $"The postcode of {displayName}." + }, + ["country"] = new JObject + { + ["type"] = "string", + ["title"] = "Country", + ["x-ms-visibility"] = "important", + ["description"] = $"The country of {displayName}." + } + } + }; + } + + private JObject rtrWfl_FormatMonetaryAmountProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["amount"] = new JObject + { + ["type"] = "number", + ["title"] = "Amount", + ["x-ms-visibility"] = "important", + ["description"] = $"The amount of {displayName}." + }, + ["currency"] = new JObject + { + ["type"] = "string", + ["title"] = "Currency", + ["x-ms-visibility"] = "important", + ["description"] = $"The currency of {displayName}." + } + } + }; + } + + private JObject rtrWfl_FormatDurationProperty(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["years"] = new JObject + { + ["type"] = "number", + ["title"] = "Years", + ["x-ms-visibility"] = "important", + ["description"] = $"The years of {displayName}." + }, + ["months"] = new JObject + { + ["type"] = "number", + ["title"] = "Months", + ["x-ms-visibility"] = "important", + ["description"] = $"The months of {displayName}." + }, + ["weeks"] = new JObject + { + ["type"] = "number", + ["title"] = "Weeks", + ["x-ms-visibility"] = "important", + ["description"] = $"The weeks of {displayName}." + }, + ["days"] = new JObject + { + ["type"] = "number", + ["title"] = "Days", + ["x-ms-visibility"] = "important", + ["description"] = $"The days of {displayName}." + } + } + }; + } + + private JObject rtrWfl_FormatBasicProperty( + string propertyType, + string displayName, + string propertyName + ) + { + var formattedProperty = new JObject + { + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important" + }; + + switch (propertyType) + { + case "string": + formattedProperty["type"] = "string"; + break; + case "number": + case "integer": + formattedProperty["type"] = "number"; + break; + case "boolean": + formattedProperty["type"] = "boolean"; + break; + case "date": + formattedProperty["type"] = "string"; + formattedProperty["format"] = "date-time"; + break; + default: + formattedProperty["type"] = "string"; + break; + } + + return formattedProperty; + } + + private JObject rtrWfl_CreateSchemaArrayItem( + string systemName, + string displayName, + string type, + bool isReadOnly + ) + { + return new JObject + { + ["systemName"] = systemName, + ["displayName"] = displayName, + ["type"] = type, + ["readOnly"] = isReadOnly + }; + } + + private JObject rtrWfl_CreateDocumentSchemaItem( + string systemName, + string displayName, + bool isReadOnly + ) + { + return new JObject + { + ["systemName"] = systemName, + ["displayName"] = displayName, + ["readOnly"] = isReadOnly + }; + } + + private JObject rtrWfl_FormatWorkflowAttributes(JObject attributes, JObject formattedSchema) + { + if (attributes == null || formattedSchema == null) + { + return new JObject(); + } + + var formattedAttributes = new JObject(); + + foreach (var property in formattedSchema.Properties()) + { + var propertySchema = property.Value as JObject; + if (propertySchema != null && attributes.ContainsKey(property.Name)) + { + var attributeValue = attributes[property.Name]; + formattedAttributes[property.Name] = rtrWfl_FormatAttributeValue( + attributeValue, + propertySchema + ); + } + } + + return formattedAttributes; + } + + private JToken rtrWfl_FormatAttributeValue(JToken value, JObject schema) + { + string propertyType = schema["type"]?.ToString().ToLower(); + + switch (propertyType) + { + case "array": + return rtrWfl_FormatArrayAttributeValue(value, schema); + case "object": + return rtrWfl_FormatObjectAttributeValue(value, schema); + default: + return value; + } + } + + private JArray rtrWfl_FormatArrayAttributeValue(JToken value, JObject schema) + { + var formattedArray = new JArray(); + var items = value as JArray; + + if (items != null) + { + var elementType = schema["items"] as JObject; + string itemType = elementType?["type"]?.ToString().ToLower(); + + foreach (var item in items) + { + if (itemType == "object") + { + formattedArray.Add(rtrWfl_FormatObjectAttributeValue(item, elementType)); + } + else + { + formattedArray.Add(item); + } + } + } + + return formattedArray; + } + + private JObject rtrWfl_FormatObjectAttributeValue(JToken value, JObject schema) + { + var formattedObject = new JObject(); + var objectValue = value as JObject; + + if (objectValue != null && schema["properties"] is JObject propertiesSchema) + { + foreach (var property in propertiesSchema.Properties()) + { + if (objectValue.ContainsKey(property.Name)) + { + formattedObject[property.Name] = rtrWfl_FormatAttributeValue( + objectValue[property.Name], + property.Value as JObject + ); + } + } + } + + return formattedObject; + } + + // ################################################################################ + // Retrieve Record Schema ######################################################### + // ################################################################################ + + private async Task rtrRcdSch_HandleRequest() + { + try + { + // Get the query parameter + var uri = this.Context.Request.RequestUri; + var queryParams = HttpUtility.ParseQueryString(uri.Query); + var propertiesQuery = queryParams["recordPorperties"] ?? string.Empty; + + // Get the content + var content = await this.Context.Request.Content + .ReadAsStringAsync() + .ConfigureAwait(false); + var metadata = JObject.Parse(content); + + // If we have a query, validate all properties exist + if (!string.IsNullOrWhiteSpace(propertiesQuery)) + { + var requestedItems = propertiesQuery.Split(',').Select(p => p.Trim()).ToList(); + var properties = metadata["properties"] as JObject; + var attachments = metadata["attachments"] as JObject; + + foreach (var item in requestedItems) + { + bool exists = false; + + // Check in properties (including clauses) + if (properties != null && properties.ContainsKey(item)) + { + var propObj = properties[item] as JObject; + if (propObj != null) + { + exists = + propObj["type"] != null + && ( + propObj["resolvesTo"] == null + || propObj["resolvesTo"].Type == JTokenType.Null + ); + } + } + // Check in attachments + else if (attachments != null && attachments.ContainsKey(item)) + { + var attachmentObj = attachments[item] as JObject; + exists = attachmentObj != null; + } + + if (!exists) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent( + new JObject + { + ["error"] = new JObject + { + ["message"] = $"Property '{item}' not found" + } + }.ToString() + ) + }; + } + } + } + + // Transform the metadata + var transformedData = rtrRcdSch_TransformRetrieveRecordSchemas( + metadata, + propertiesQuery + ); + + // Create response + return new HttpResponseMessage(HttpStatusCode.OK) + { + Content = CreateJsonContent(transformedData.ToString()) + }; + } + catch (Exception ex) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent( + new JObject { ["error"] = new JObject { ["message"] = ex.Message } }.ToString() + ) + }; + } + } + private JObject rtrRcdSch_TransformRetrieveRecordSchemas(JObject body, string propertiesQuery) + { + var properties = body["properties"] as JObject; + if (properties != null) + { + var formattedProperties = new JArray(); + var formattedClauses = new JArray(); + + // Add the requested properties to the response + body["requestedProperties"] = propertiesQuery; + + // Get requested items if filtering is needed + var requestedItems = !string.IsNullOrWhiteSpace(propertiesQuery) + ? propertiesQuery.Split(',').Select(p => p.Trim()).ToList() + : new List(); + + foreach (var prop in properties.Properties()) + { + var propObj = prop.Value as JObject; + if ( + propObj != null + && ( + propObj["resolvesTo"] == null + || propObj["resolvesTo"].Type == JTokenType.Null + ) + ) + { + bool isVisible = propObj["visible"]?.ToObject() ?? true; + + if (isVisible) + { + string originalType = propObj["type"]?.ToString().ToLower() ?? "unknown"; + string effectiveType = originalType == "address" ? "string" : originalType; + string displayName = propObj["displayName"]?.ToString() ?? prop.Name; + + var newObj = new JObject + { + ["systemName"] = prop.Name, + ["type"] = effectiveType, + ["displayName"] = displayName, + ["description"] = $"The {displayName}.", + ["ironcladType"] = propObj["type"] + }; + + string formattedType = effectiveType.Replace("_", " "); + newObj["label"] = $"{displayName} ({formattedType})"; + newObj["typedPropertyName"] = $"{prop.Name}?{effectiveType}"; + + foreach (var subProp in propObj.Properties()) + { + if (!newObj.ContainsKey(subProp.Name)) + { + newObj[subProp.Name] = subProp.Value; + } + } + + // Only add if no filter or if property is in filter + if (!requestedItems.Any() || requestedItems.Contains(prop.Name)) + { + if (effectiveType == "clause") + { + formattedClauses.Add(newObj); + } + else if (effectiveType != "document") + { + formattedProperties.Add(newObj); + } + } + } + } + } + + // Handle record types + var recordTypes = body["recordTypes"] as JObject; + if (recordTypes != null) + { + var formattedRecordTypes = new JArray(); + foreach (var rt in recordTypes.Properties()) + { + var rtObj = rt.Value as JObject; + if (rtObj != null) + { + var displayName = rtObj["displayName"]?.ToString() ?? rt.Name; + var newObj = new JObject(rtObj) + { + ["systemName"] = rt.Name, + ["displayName"] = displayName, + ["description"] = $"The {displayName} record type." + }; + formattedRecordTypes.Add(newObj); + } + } + body["formattedRecordTypes"] = formattedRecordTypes; + } + + // Handle attachments + var attachments = body["attachments"] as JObject; + var formattedAttachments = new JArray(); + if (attachments != null) + { + foreach (var attachment in attachments.Properties()) + { + var attachmentObj = attachment.Value as JObject; + if (attachmentObj != null) + { + var displayName = + attachmentObj["displayName"]?.ToString() ?? attachment.Name; + var newObj = new JObject + { + ["systemName"] = attachment.Name, + ["displayName"] = displayName, + ["description"] = $"The {displayName} attachment." + }; + if (!requestedItems.Any() || requestedItems.Contains(attachment.Name)) + { + formattedAttachments.Add(newObj); + } + } + } + } + + body["formattedProperties"] = formattedProperties; + body["formattedClauses"] = formattedClauses; + body["formattedAttachments"] = formattedAttachments; + + // If properties were requested, create the formatted schema + if (!string.IsNullOrWhiteSpace(propertiesQuery)) + { + var propertiesSchema = new JObject(); + + foreach (var prop in formattedProperties) + { + var propertyObj = prop as JObject; + var propertyName = propertyObj["systemName"].ToString(); + var propertyType = propertyObj["type"].ToString().ToLower(); + var displayName = propertyObj["displayName"].ToString(); + var description = + propertyObj["description"]?.ToString() ?? $"The {displayName}."; + + JObject schemaProperty; + + switch (propertyType) + { + case "monetary_amount": + schemaProperty = new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["amount"] = new JObject + { + ["type"] = "number", + ["title"] = "Amount", + ["description"] = + $"The monetary amount value for {displayName}." + }, + ["currency"] = new JObject + { + ["type"] = "string", + ["title"] = "Currency", + ["description"] = $"The currency code for {displayName}." + } + } + }; + break; + case "duration": + schemaProperty = new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["isoDuration"] = new JObject + { + ["type"] = "string", + ["title"] = "ISO Duration", + ["description"] = + $"The ISO 8601 duration representation for {displayName}." + }, + ["years"] = new JObject + { + ["type"] = "number", + ["title"] = "Years", + ["description"] = $"The number of years in {displayName}." + }, + ["months"] = new JObject + { + ["type"] = "number", + ["title"] = "Months", + ["description"] = $"The number of months in {displayName}." + }, + ["weeks"] = new JObject + { + ["type"] = "number", + ["title"] = "Weeks", + ["description"] = $"The number of weeks in {displayName}." + }, + ["days"] = new JObject + { + ["type"] = "number", + ["title"] = "Days", + ["description"] = $"The number of days in {displayName}." + } + } + }; + break; + case "boolean": + schemaProperty = new JObject + { + ["type"] = "boolean", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important" + }; + break; + case "number": + case "integer": + schemaProperty = new JObject + { + ["type"] = "number", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important" + }; + break; + case "date": + schemaProperty = new JObject + { + ["type"] = "string", + ["format"] = "date-time", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important" + }; + break; + default: + schemaProperty = new JObject + { + ["type"] = "string", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important" + }; + break; + } + + propertiesSchema[propertyName] = schemaProperty; + } + + body["formattedSchema"] = new JObject + { + ["type"] = "object", + ["description"] = + "The record schema formatted for compatibility with the OpenAPI standard.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["recordProperties"] = new JObject + { + ["type"] = "object", + ["title"] = "Properties", + ["description"] = "The properties of the record.", + ["x-ms-visibility"] = "important", + ["properties"] = propertiesSchema + }, + ["recordClauses"] = rtrRcdSch_FormatRecordClausesSchema(formattedClauses), + ["recordAttachments"] = rtrRcdSch_CreateAttachmentSchema( + formattedAttachments + ) + } + }; + } + else + { + body["formattedSchema"] = new JObject + { + ["type"] = "object", + ["description"] = + "The record schema formatted for compatibility with the OpenAPI standard.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject() + }; + } + } + + return body; + } + + private JObject rtrRcdSch_FormatRecordClausesSchema(JArray clauses) + { + var clausesSchema = new JObject(); + foreach (var clause in clauses) + { + var clauseObj = clause as JObject; + var clauseName = clauseObj["systemName"].ToString(); + var displayName = clauseObj["displayName"].ToString(); + + clausesSchema[clauseName] = new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName} clause.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["displayName"] = new JObject + { + ["type"] = "string", + ["title"] = "Display Name", + ["description"] = $"The display name of the {displayName} clause." + }, + ["description"] = new JObject + { + ["type"] = "string", + ["title"] = "Description", + ["description"] = $"The description of the {displayName} clause." + }, + ["clauseText"] = new JObject + { + ["type"] = "string", + ["title"] = "Clause Text", + ["description"] = $"The text content of the {displayName} clause." + }, + ["source"] = new JObject + { + ["type"] = "string", + ["title"] = "Source", + ["description"] = $"The source of the {displayName} clause." + }, + ["clauseType"] = new JObject + { + ["type"] = "string", + ["title"] = "Clause Type", + ["description"] = $"The type of the {displayName} clause." + }, + ["languagePosition"] = new JObject + { + ["type"] = "object", + ["properties"] = new JObject + { + ["type"] = new JObject + { + ["type"] = "string", + ["title"] = "Type", + ["description"] = + $"The language position type of the {displayName} clause." + } + } + } + } + }; + } + + return new JObject + { + ["type"] = "object", + ["title"] = "Clauses", + ["description"] = "The clauses of the record.", + ["x-ms-visibility"] = "important", + ["properties"] = clausesSchema + }; + } + + private JObject rtrRcdSch_CreateAttachmentSchema(JArray attachments) + { + var attachmentsSchema = new JObject(); + foreach (var attachment in attachments) + { + var attachmentObj = attachment as JObject; + var attachmentName = attachmentObj["systemName"].ToString(); + var displayName = attachmentObj["displayName"].ToString(); + + attachmentsSchema[attachmentName] = new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName} attachment.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["filename"] = new JObject + { + ["type"] = "string", + ["title"] = "Filename", + ["description"] = $"The filename of the {displayName} attachment." + }, + ["contentType"] = new JObject + { + ["type"] = "string", + ["title"] = "Content Type", + ["description"] = $"The content type of the {displayName} attachment." + }, + ["href"] = new JObject + { + ["type"] = "string", + ["title"] = "Download URL", + ["description"] = $"The download URL for the {displayName} attachment." + }, + ["key"] = new JObject + { + ["type"] = "string", + ["title"] = "Key", + ["description"] = + $"The unique key identifier for the {displayName} attachment." + } + } + }; + } + + return new JObject + { + ["type"] = "object", + ["title"] = "Attachments", + ["description"] = "The attachments associated with the record.", + ["x-ms-visibility"] = "important", + ["properties"] = attachmentsSchema + }; + } + + // ################################################################################ + // Retrieve All Records ########################################################### + // ################################################################################ + + private async Task lstAllRcd_HandleRequest() + { + try + { + // Get the query parameter + var uri = this.Context.Request.RequestUri; + var queryParams = HttpUtility.ParseQueryString(uri.Query); + var propertiesQuery = queryParams["recordPorperties"] ?? string.Empty; + + // Get the content + var content = await this.Context.Request.Content + .ReadAsStringAsync() + .ConfigureAwait(false); + var metadata = JObject.Parse(content); + + // If we have a query, validate all properties exist + if (!string.IsNullOrWhiteSpace(propertiesQuery)) + { + var requestedItems = propertiesQuery.Split(',').Select(p => p.Trim()).ToList(); + var properties = metadata["properties"] as JObject; + var attachments = metadata["attachments"] as JObject; + + foreach (var item in requestedItems) + { + bool exists = false; + + // Check in properties (including clauses) + if (properties != null && properties.ContainsKey(item)) + { + var propObj = properties[item] as JObject; + if (propObj != null) + { + exists = + propObj["type"] != null + && ( + propObj["resolvesTo"] == null + || propObj["resolvesTo"].Type == JTokenType.Null + ); + } + } + // Check in attachments + else if (attachments != null && attachments.ContainsKey(item)) + { + var attachmentObj = attachments[item] as JObject; + exists = attachmentObj != null; + } + + if (!exists) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent( + new JObject + { + ["error"] = new JObject + { + ["message"] = $"Property '{item}' not found" + } + }.ToString() + ) + }; + } + } + } + + var responseBody = metadata; + var transformedBody = lstAllRcd_TransformListAllRecordsResponse( + responseBody, + propertiesQuery + ); + + return new HttpResponseMessage(HttpStatusCode.OK) + { + Content = CreateJsonContent(transformedBody.ToString()) + }; + } + catch (Exception ex) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent( + new JObject { ["error"] = new JObject { ["message"] = ex.Message } }.ToString() + ) + }; + } + } + private JObject lstAllRcd_TransformListAllRecordsResponse(JObject body, string propertiesQuery) + { + // Add the properties query to the response + body["requestedProperties"] = propertiesQuery; + + var requestedProperties = !string.IsNullOrWhiteSpace(propertiesQuery) + ? propertiesQuery.Split(',').Select(p => p.Trim()).ToList() + : new List(); + + if (body.ContainsKey("list") && body["list"] is JArray list) + { + foreach (var record in list.Children()) + { + // Do not transform the properties property - keep it as is + var originalProperties = record["properties"] as JObject; + + // Handle counterpartyName at root level if it exists + if ( + originalProperties != null + && originalProperties.ContainsKey("counterpartyName") + && originalProperties["counterpartyName"] is JObject counterpartyProp + && counterpartyProp["value"] != null + ) + { + record["counterpartyName"] = counterpartyProp["value"]; + } + + // Add label + string ironcladId = record["ironcladId"]?.ToString() ?? ""; + string name = record["name"]?.ToString() ?? ""; + record["label"] = $"{ironcladId}: {name}"; + + // Format attachments array + var recordAttachmentsObj = record["attachments"] as JObject; + if (recordAttachmentsObj != null) + { + var attachmentsArray = new JArray(); + foreach (var attachment in recordAttachmentsObj) + { + attachmentsArray.Add( + new JObject + { + ["displayName"] = attachment.Value["displayName"] ?? attachment.Key, + ["name"] = attachment.Key, + ["key"] = attachment.Key // Add the key property + } + ); + } + record["formattedAttachments"] = attachmentsArray; + } + + // Handle formatted properties if filtering is requested + if (requestedProperties.Any()) + { + var formattedProperties = new JObject(); + + // Initialize all containers + var recordProperties = new JObject(); + var recordClauses = new JObject(); + var recordAttachments = new JObject(); + + foreach (var propertyName in requestedProperties) + { + if ( + originalProperties != null + && originalProperties.ContainsKey(propertyName) + ) + { + var property = originalProperties[propertyName] as JObject; + if (property != null) + { + var propertyType = property["type"]?.ToString().ToLower(); + + if (propertyType == "clause") + { + // Handle clause properties + recordClauses[propertyName] = lstAllRcd_FormatClauseProperty( + propertyName, + property + ); + } + else + { + // Handle regular properties + recordProperties[propertyName] = lstAllRcd_FormatPropertyValue( + property + ); + } + } + } + + // Handle attachments separately + if ( + recordAttachmentsObj != null + && recordAttachmentsObj.ContainsKey(propertyName) + ) + { + var attachment = recordAttachmentsObj[propertyName] as JObject; + recordAttachments[propertyName] = new JObject + { + ["filename"] = attachment["filename"], + ["contentType"] = attachment["contentType"], + ["href"] = attachment["href"], + ["displayName"] = attachment["displayName"] ?? propertyName, + ["key"] = propertyName // Add the key property + }; + } + } + + // Always include all three properties in formattedProperties + formattedProperties["recordProperties"] = recordProperties; + formattedProperties["recordClauses"] = recordClauses; + formattedProperties["recordAttachments"] = recordAttachments; + + record["formattedProperties"] = formattedProperties; + } + } + } + + return body; + } + + private JToken lstAllRcd_FormatPropertyValue(JObject property) + { + if (property == null || !property.ContainsKey("type") || !property.ContainsKey("value")) + return null; + + string propertyType = property["type"].ToString().ToLower(); + var value = property["value"]; + + switch (propertyType) + { + case "duration": + return lstAllRcd_FormatDurationValue(value.ToString()); + case "monetary_amount": + return value as JObject ?? new JObject(); + // All other types (including address) are treated as simple values + default: + return value; + } + } + + private JObject lstAllRcd_FormatDurationValue(string isoDuration) + { + var result = new JObject { ["isoDuration"] = isoDuration }; + + var regex = new Regex(@"P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?"); + var match = regex.Match(isoDuration); + + if (match.Success) + { + result["years"] = lstAllRcd_ParseDurationComponent(match.Groups[1].Value); + result["months"] = lstAllRcd_ParseDurationComponent(match.Groups[2].Value); + result["weeks"] = lstAllRcd_ParseDurationComponent(match.Groups[3].Value); + result["days"] = lstAllRcd_ParseDurationComponent(match.Groups[4].Value); + } + + return result; + } + + private int lstAllRcd_ParseDurationComponent(string value) + { + return string.IsNullOrEmpty(value) ? 0 : int.Parse(value); + } + + private JObject lstAllRcd_FormatClauseProperty(string propertyName, JObject clause) + { + var clauseValue = clause["value"] as JObject; + if (clauseValue == null) + return new JObject(); + + var displayName = propertyName; + if (!displayName.EndsWith(" Clause", StringComparison.OrdinalIgnoreCase)) + { + displayName += " Clause"; + } + + return new JObject + { + ["displayName"] = displayName, + ["description"] = $"The {propertyName} clause.", + ["clauseText"] = clauseValue["clauseText"], + ["source"] = clauseValue["source"], + ["clauseType"] = clauseValue["clauseType"], + ["languagePosition"] = clauseValue["languagePosition"] + }; + } + + // ################################################################################ + // Retrieve Record ################################################################ + // ################################################################################ + + private JObject rtrRcd_TransformRetrieveRecord(JObject body) + { + var properties = body["properties"] as JObject; + var attachments = body["attachments"] as JObject; + + var formattedSchema = new JObject(); + var formattedProperties = new JObject(); + + if (properties != null) + { + formattedSchema["recordProperties"] = rtrRcd_FormatRecordPropertiesSchema(properties); + formattedSchema["recordClauses"] = rtrRcd_FormatRecordClausesSchema(properties); + formattedProperties["recordProperties"] = rtrRcd_FormatRecordProperties(properties); + formattedProperties["recordClauses"] = rtrRcd_FormatRecordClauses(properties); + } + + if (attachments != null) + { + formattedSchema["recordAttachments"] = rtrRcd_CreateAttachmentSchema(attachments); + formattedProperties["recordAttachments"] = rtrRcd_FormatAttachments(attachments); + body["attachmentsAsArray"] = rtrRcd_CreateAttachmentsArray(attachments); + } + + body["formattedSchema"] = new JObject + { + ["type"] = "object", + ["description"] = + "The record schema formatted for compatibility with the OpenAPI standard.", + ["x-ms-visibility"] = "important", + ["properties"] = formattedSchema + }; + body["formattedProperties"] = formattedProperties; + + return body; + } + + private JObject rtrRcd_FormatRecordPropertiesSchema(JObject properties) + { + var recordPropertiesSchema = new JObject(); + + foreach (var property in properties.Properties()) + { + if (!rtrRcd_IsClauseProperty(property)) + { + rtrRcd_ParseRecordSchemaProperty(property, recordPropertiesSchema); + } + } + + return new JObject + { + ["title"] = "Properties", + ["type"] = "object", + ["description"] = "The properties of the record.", + ["x-ms-visibility"] = "important", + ["properties"] = recordPropertiesSchema + }; + } + + private JObject rtrRcd_FormatRecordClausesSchema(JObject properties) + { + var recordClausesSchema = new JObject(); + + foreach (var property in properties.Properties()) + { + if (rtrRcd_IsClauseProperty(property)) + { + var clauseObject = rtrRcd_FormatClauseProperty(property); + recordClausesSchema[property.Name] = rtrRcd_CreateClauseSchema( + clauseObject["displayName"].ToString(), + clauseObject["description"].ToString() + ); + } + } + + return new JObject + { + ["title"] = "Clauses", + ["type"] = "object", + ["description"] = "The clauses of the record.", + ["x-ms-visibility"] = "important", + ["properties"] = recordClausesSchema + }; + } + + private JObject rtrRcd_FormatRecordProperties(JObject properties) + { + var transformedProperties = new JObject(); + + foreach (var property in properties.Properties()) + { + if (!rtrRcd_IsClauseProperty(property)) + { + var propertySchema = rtrRcd_GetRecordSchemaProperty(property.Name); + transformedProperties[property.Name] = rtrRcd_FormatRecordPropertyValue( + property.Value as JObject, + propertySchema + ); + } + } + + return transformedProperties; + } + + private JObject rtrRcd_FormatRecordClauses(JObject properties) + { + var transformedClauses = new JObject(); + + foreach (var property in properties.Properties()) + { + if (rtrRcd_IsClauseProperty(property)) + { + transformedClauses[property.Name] = rtrRcd_FormatClauseProperty(property); + } + } + + return transformedClauses; + } + + private bool rtrRcd_IsClauseProperty(JProperty property) + { + var propertyValue = property.Value as JObject; + return propertyValue != null && propertyValue["type"]?.ToString().ToLower() == "clause"; + } + + private void rtrRcd_ParseRecordSchemaProperty(JProperty property, JObject formattedSchema) + { + var propertyValue = property.Value as JObject; + if (propertyValue != null && propertyValue["type"] != null) + { + string propertyName = property.Name; + string propertyType = propertyValue["type"].ToString().ToLower(); + + var schemaProperty = rtrRcd_GetRecordSchemaProperty(propertyName); + string displayName = schemaProperty?["displayName"]?.ToString() ?? propertyName; + string description = + schemaProperty?["description"]?.ToString() ?? $"The {propertyName}."; + + JObject formattedProperty = rtrRcd_ParseRecordPropertySchemaByType( + propertyType, + displayName, + propertyName, + description + ); + formattedSchema[propertyName] = formattedProperty; + } + } + + private JObject rtrRcd_ParseRecordPropertySchemaByType( + string propertyType, + string displayName, + string propertyName, + string description + ) + { + switch (propertyType) + { + case "monetary_amount": + return rtrRcd_FormatMonetaryAmountPropertySchema(displayName, propertyName); + case "duration": + return rtrRcd_FormatDurationPropertySchema(displayName, propertyName, description); + // Address and all other types are treated as basic properties + default: + return rtrRcd_FormatBasicPropertySchema(propertyType, displayName, propertyName); + } + } + + private JObject rtrRcd_FormatAddressPropertySchema(string displayName, string propertyName) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["lines"] = new JObject + { + ["type"] = "array", + ["items"] = new JObject { ["type"] = "string" }, + ["title"] = "Address Lines", + ["description"] = "The lines of the address." + }, + ["locality"] = new JObject { ["type"] = "string", ["title"] = "Locality" }, + ["region"] = new JObject { ["type"] = "string", ["title"] = "Region" }, + ["postcode"] = new JObject { ["type"] = "string", ["title"] = "Postcode" }, + ["country"] = new JObject { ["type"] = "string", ["title"] = "Country" } + } + }; + } + + private JObject rtrRcd_FormatMonetaryAmountPropertySchema( + string displayName, + string propertyName + ) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["amount"] = new JObject + { + ["type"] = "number", + ["title"] = "Amount", + ["description"] = $"The amount of the {displayName}." + }, + ["currency"] = new JObject + { + ["type"] = "string", + ["title"] = "Currency", + ["description"] = $"The currency of the {displayName}." + } + } + }; + } + + private JObject rtrRcd_FormatDurationPropertySchema( + string displayName, + string propertyName, + string description + ) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["isoDuration"] = new JObject + { + ["type"] = "string", + ["title"] = "ISO Duration", + ["description"] = $"The ISO 8601 duration representation of the {displayName}." + }, + ["years"] = new JObject + { + ["type"] = "number", + ["title"] = "Years", + ["description"] = $"The years of the {displayName}." + }, + ["months"] = new JObject + { + ["type"] = "number", + ["title"] = "Months", + ["description"] = $"The months of the {displayName}." + }, + ["weeks"] = new JObject + { + ["type"] = "number", + ["title"] = "Weeks", + ["description"] = $"The weeks of the {displayName}." + }, + ["days"] = new JObject + { + ["type"] = "number", + ["title"] = "Days", + ["description"] = $"The days of the {displayName}." + } + } + }; + } + + private JObject rtrRcd_FormatBasicPropertySchema( + string propertyType, + string displayName, + string propertyName + ) + { + var formattedProperty = new JObject + { + ["title"] = displayName, + ["description"] = $"The {displayName}.", + ["x-ms-visibility"] = "important" + }; + + switch (propertyType) + { + case "string": + case "address": // Address is treated as string + formattedProperty["type"] = "string"; + break; + case "number": + case "integer": + formattedProperty["type"] = "number"; + break; + case "boolean": + formattedProperty["type"] = "boolean"; + break; + case "date": + formattedProperty["type"] = "string"; + formattedProperty["format"] = "date-time"; + break; + default: + formattedProperty["type"] = "string"; + break; + } + + return formattedProperty; + } + + private JObject rtrRcd_GetRecordSchemaProperty(string propertyName) + { + if (recordSchemaInfo == null || !recordSchemaInfo.ContainsKey("properties")) + return null; + + var properties = recordSchemaInfo["properties"] as JObject; + if (properties == null || !properties.ContainsKey(propertyName)) + return null; + + var propertyInfo = properties[propertyName] as JObject; + if (propertyInfo == null) + return null; + + return new JObject + { + ["displayName"] = propertyInfo["displayName"] ?? propertyName, + ["description"] = propertyInfo["description"] ?? $"The {propertyName}." + }; + } + + private JToken rtrRcd_FormatRecordPropertyValue(JObject propertyValue, JObject propertySchema) + { + if ( + propertyValue == null + || !propertyValue.ContainsKey("type") + || !propertyValue.ContainsKey("value") + ) + { + return null; + } + + string propertyType = propertyValue["type"].ToString().ToLower(); + var value = propertyValue["value"]; + + switch (propertyType) + { + case "monetary_amount": + return rtrRcd_FormatMonetaryAmountPropertyValue(value as JObject); + case "duration": + return rtrRcd_FormatDurationPropertyValue(value.ToString()); + default: + return value; + } + } + + private JObject rtrRcd_FormatMonetaryAmountPropertyValue(JObject monetaryAmount) + { + if (monetaryAmount == null) + { + return new JObject(); + } + + return new JObject + { + ["amount"] = monetaryAmount["amount"], + ["currency"] = monetaryAmount["currency"] + }; + } + + private JObject rtrRcd_FormatDurationPropertyValue(string isoDuration) + { + var result = new JObject { ["isoDuration"] = isoDuration }; + + var regex = new Regex(@"P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?"); + var match = regex.Match(isoDuration); + + if (match.Success) + { + result["years"] = rtrRcd_ParseDurationComponent(match.Groups[1].Value); + result["months"] = rtrRcd_ParseDurationComponent(match.Groups[2].Value); + result["weeks"] = rtrRcd_ParseDurationComponent(match.Groups[3].Value); + result["days"] = rtrRcd_ParseDurationComponent(match.Groups[4].Value); + } + + return result; + } + + private int rtrRcd_ParseDurationComponent(string value) + { + return string.IsNullOrEmpty(value) ? 0 : int.Parse(value); + } + + private JObject rtrRcd_FormatClauseProperty(JProperty property) + { + var clauseValue = (property.Value as JObject)?["value"] as JObject; + if (clauseValue == null) + { + return new JObject(); + } + + var schemaProperty = rtrRcd_GetRecordSchemaProperty(property.Name); + var displayName = schemaProperty?["displayName"]?.ToString() ?? property.Name; + + if (!displayName.EndsWith(" Clause", StringComparison.OrdinalIgnoreCase)) + { + displayName += " Clause"; + } + + return new JObject + { + ["displayName"] = displayName, + ["description"] = + schemaProperty?["description"]?.ToString() ?? $"The {property.Name} clause.", + ["clauseText"] = clauseValue["clauseText"], + ["source"] = clauseValue["source"], + ["clauseType"] = clauseValue["clauseType"], + ["languagePosition"] = clauseValue["languagePosition"] + }; + } + + private JObject rtrRcd_CreateClauseSchema(string displayName, string description) + { + return new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["displayName"] = new JObject + { + ["type"] = "string", + ["title"] = "Display Name", + ["description"] = "The display name of the clause." + }, + ["description"] = new JObject + { + ["type"] = "string", + ["title"] = "Description", + ["description"] = "The description of the clause." + }, + ["clauseText"] = new JObject + { + ["type"] = "string", + ["title"] = "Clause Text", + ["description"] = "The text content of the clause." + }, + ["source"] = new JObject + { + ["type"] = "string", + ["title"] = "Source", + ["description"] = "The source of the clause.", + ["x-ms-visibility"] = "internal" + }, + ["clauseType"] = new JObject + { + ["type"] = "string", + ["title"] = "Clause Type", + ["description"] = "The type of the clause.", + ["x-ms-visibility"] = "internal" + }, + ["languagePosition"] = new JObject + { + ["type"] = "object", + ["title"] = "Language Position", + ["description"] = "The language position of the clause.", + ["x-ms-visibility"] = "internal", + ["properties"] = new JObject + { + ["type"] = new JObject + { + ["type"] = "string", + ["title"] = "Type", + ["description"] = "The type of language position." + } + } + } + } + }; + } + + private JObject rtrRcd_CreateAttachmentSchema(JObject attachments) + { + var attachmentProperties = new JObject(); + + if ( + recordSchemaInfo != null && recordSchemaInfo["attachments"] is JObject attachmentSchemas + ) + { + foreach (var attachment in attachments.Properties()) + { + var attachmentName = attachment.Name; + var attachmentSchema = attachmentSchemas[attachmentName] as JObject; + var displayName = attachmentSchema?["displayName"]?.ToString() ?? attachmentName; + var description = + attachmentSchema?["description"]?.ToString() + ?? $"The {displayName} attachment."; + + attachmentProperties[attachmentName] = new JObject + { + ["type"] = "object", + ["title"] = displayName, + ["description"] = description, + ["x-ms-visibility"] = "important", + ["properties"] = new JObject + { + ["filename"] = new JObject + { + ["type"] = "string", + ["title"] = "Filename", + ["description"] = $"The filename of the {displayName}." + }, + ["contentType"] = new JObject + { + ["type"] = "string", + ["title"] = "Content Type", + ["description"] = $"The content type of the {displayName}." + }, + ["href"] = new JObject + { + ["type"] = "string", + ["title"] = "Download URL", + ["description"] = $"The download URL for the {displayName}." + }, + ["displayName"] = new JObject + { + ["type"] = "string", + ["title"] = "Display Name", + ["description"] = $"The display name of the {displayName}." + }, + ["key"] = new JObject + { + ["type"] = "string", + ["title"] = "Key", + ["description"] = $"The key of the {displayName}." + } + } + }; + } + } + + return new JObject + { + ["title"] = "Attachments", + ["type"] = "object", + ["description"] = "The attachments associated with the record.", + ["x-ms-visibility"] = "important", + ["properties"] = attachmentProperties + }; + } + + private JObject rtrRcd_FormatAttachments(JObject attachments) + { + var formattedAttachments = new JObject(); + + if ( + recordSchemaInfo != null && recordSchemaInfo["attachments"] is JObject attachmentSchemas + ) + { + foreach (var attachment in attachments.Properties()) + { + var attachmentName = attachment.Name; + var attachmentValue = attachment.Value as JObject; + var attachmentSchema = attachmentSchemas[attachmentName] as JObject; + var displayName = attachmentSchema?["displayName"]?.ToString() ?? attachmentName; + + formattedAttachments[attachmentName] = new JObject + { + ["filename"] = attachmentValue?["filename"], + ["contentType"] = attachmentValue?["contentType"], + ["href"] = attachmentValue?["href"], + ["displayName"] = displayName, + ["key"] = attachmentName + }; + } + } + + return formattedAttachments; + } + + private JArray rtrRcd_CreateAttachmentsArray(JObject attachments) + { + var attachmentsArray = new JArray(); + + if ( + recordSchemaInfo != null && recordSchemaInfo["attachments"] is JObject attachmentSchemas + ) + { + foreach (var attachment in attachments.Properties()) + { + var attachmentName = attachment.Name; + var attachmentSchema = attachmentSchemas[attachmentName] as JObject; + var displayName = attachmentSchema?["displayName"]?.ToString() ?? attachmentName; + + attachmentsArray.Add( + new JObject + { + ["name"] = attachmentName, + ["displayName"] = displayName, + ["key"] = attachmentName + } + ); + } + } + + return attachmentsArray; + } + + private async Task rtrRcd_RetrieveRecordSchemaInformation() + { + var baseUrl = this.Context.Request.RequestUri.GetLeftPart(UriPartial.Authority); + var schemaUrl = new Uri(new Uri(baseUrl), "/public/api/v1/records/metadata"); + + var request = new HttpRequestMessage(HttpMethod.Get, schemaUrl); + + foreach (var header in this.Context.Request.Headers) + { + request.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + + var response = await this.Context + .SendAsync(request, this.CancellationToken) + .ConfigureAwait(false); + + if (response.IsSuccessStatusCode) + { + var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var schemaResponse = JObject.Parse(content); + this.recordSchemaInfo = new JObject + { + ["properties"] = schemaResponse["properties"], + ["attachments"] = schemaResponse["attachments"] + }; + + this.Context.Logger.LogInformation( + $"Retrieved schema information: {this.recordSchemaInfo?.ToString()}" + ); + } + else + { + throw new Exception( + $"Failed to retrieve schema information. Status code: {response.StatusCode}" + ); + } + } + + // ################################################################################ + // Retrieve Email Thread ########################################################## + // ################################################################################ + private JObject rtrEml_TransformRetrieveEmailThread(JObject body) + { + var attachments = body["attachments"] as JArray; + if (attachments != null) + { + var updatedAttachments = new JArray( + attachments + .OfType() + .Where(attachment => attachment.ContainsKey("download")) + .Select( + attachment => + { + string downloadUrl = attachment["download"].ToString(); + string key = rtrEml_ExtractKeyFromDownloadUrl(downloadUrl); + attachment["key"] = key; + return attachment; + } + ) + ); + body["attachments"] = updatedAttachments; + } + return body; + } + + /// Extracts a key from the given download URL. + private string rtrEml_ExtractKeyFromDownloadUrl(string downloadUrl) + { + var match = Regex.Match(downloadUrl, @"/document/([^/]+)/download"); + if (match.Success && match.Groups.Count > 1) + { + return match.Groups[1].Value; + } + return string.Empty; + } +}