{
    "swagger": "2.0",
    "info": {
        "title": "OnePlan",
        "description": "OnePlan AI offers an AI-enabled Strategic Portfolio, Financial, Resource and Work Management Platform that fits the needs of every organization. OnePlan connects with Microsoft Project, Microsoft Planner, Azure DevOps, Jira, Smartsheet and more for a complete view into all work across the enterprise.",
        "termsOfService": "https://oneplan.ai/terms/",
        "contact": {
            "name": "OnePlan Support",
            "url": "https://support.oneplan.ai/",
            "email": "support@oneplan.ai"
        },
        "version": "1.0"
    },
    "host": "my.oneplan.ai",
    "basePath": "/api",
    "schemes": [
        "https"
    ],
    "consumes": [],
    "produces": [],
    "paths": {
        "/workplan/{PlanId}/flow/": {
            "get": {
                "summary": "Get Plan Details by Plan Id",
                "operationId": "GetPlan",
                "parameters": [
                    {
                        "name": "PlanId",
                        "in": "path",
                        "required": true,
                        "type": "string",
                        "x-ms-summary": "Plan Id",
                        "x-ms-url-encoding": "single",
                        "description": "Returns built in and custom fields by Plan Id"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/DynamicResponseGetListSchema"
                        }
                    }
                },
                "description": "Get WorkPlan"
            }
        },
        "/workplan/": {
            "post": {
                "summary": "Create a New Plan",
                "operationId": "CreatePlan",
                "consumes": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "IntegrationPost",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/CreatePlanReqMine"
                        },
                        "x-ms-summary": "WorkPlan Body",
                        "description": "WorkPlan fields to update"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "id"
                            ]
                        }
                    }
                },
                "description": "Creates a new Plan"
            }
        },
        "/integration/updateplanintegration": {
            "post": {
                "summary": "Add/Update Integration to Plan",
                "operationId": "StampMapping",
                "consumes": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "IsImport",
                        "x-ms-summary": "Is an import stamp",
                        "in": "query",
                        "required": true,
                        "type": "boolean",
                        "default": true,
                        "description": "Is this an item coming from an external system"
                    },
                    {
                        "name": "IntegrationPost",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/PlanIntegrationRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Adds or Updates Plan Integration Information"
            }
        },
        "/resources/GetResourceId": {
            "get": {
                "summary": "Lookup Resource Id",
                "operationId": "GetResourceId",
                "parameters": [
                    {
                        "name": "Name",
                        "in": "query",
                        "required": false,
                        "type": "string",
                        "x-ms-summary": "Resource Name",
                        "description": "Resource Name (String)"
                    },
                    {
                        "name": "Email ",
                        "in": "query",
                        "required": false,
                        "type": "string",
                        "x-ms-summary": "Resource Email",
                        "description": "Resource Email (String)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Return a Resource uuid using Email and Name"
            }
        },
        "/resources/{id}": {
            "get": {
                "summary": "Get Resource By Id",
                "operationId": "GetResourceById",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "string",
                        "x-ms-summary": "Resource Id",
                        "x-ms-url-encoding": "single",
                        "description": "Resource Id (uuid)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Returns built in and custom Resource fields by Resource ID"
            }
        },
        "/config/GetPlanTypeGuidByName": {
            "get": {
                "summary": "Get Plan Type Id",
                "operationId": "GetPlanTypeGuidByName",
                "parameters": [
                    {
                        "name": "Name",
                        "in": "query",
                        "required": true,
                        "type": "string",
                        "x-ms-summary": "Plan Type Name",
                        "description": "Plan Type Name (String)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Return the Plan Type Id by Plan Type Name"
            }
        },
        "/integration/getintegratedplanId": {
            "get": {
                "summary": "Get Plan Id by Integration Information",
                "operationId": "GetMappedItem",
                "parameters": [
                    {
                        "name": "IntegrationId",
                        "x-ms-summary": "Flow Id",
                        "in": "query",
                        "required": true,
                        "type": "string",
                        "description": "Flow Id"
                    },
                    {
                        "name": "ExternalItemId",
                        "x-ms-summary": "External Id",
                        "in": "query",
                        "required": true,
                        "type": "string",
                        "description": "External System Id"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Gets Plan Id of the integrated plan based on Flow ID and external Item Id"
            }
        },
        "/workplan/{id}/flow": {
            "post": {
                "summary": "Update a Plan by Plan Id",
                "operationId": "UpdatePlan",
                "consumes": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "string",
                        "x-ms-summary": "workplan id",
                        "x-ms-url-encoding": "single",
                        "description": "WorkPlan Id"
                    },
                    {
                        "name": "WorkPlan",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/DynamicResponseGetListSchema"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Updates the Plan Fields by Plan Id"
            }
        },
        "/workplan/{id}/step": {
            "post": {
                "summary": "Update the Process Step by Plan Id",
                "operationId": "StepUpdate",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "string",
                        "x-ms-summary": "workplan id",
                        "x-ms-url-encoding": "single",
                        "description": "WorkPlan Id"
                    },
                    {
                        "name": "StepName",
                        "in": "query",
                        "required": false,
                        "type": "string",
                        "x-ms-summary": "Process Step Name",
                        "description": "Process Step Name (String)"
                    },
                    {
                        "name": "StepId",
                        "in": "query",
                        "required": false,
                        "type": "string",
                        "x-ms-summary": "Process Step ID",
                        "description": "Process Step Id (uuid)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/DynamicResponseGetListSchema"
                        }
                    }
                },
                "description": "Updates the Plans Process Step by Plan Id"
            }
        },
        "/workplan/{id}/step/approve": {
            "post": {
                "summary": "Approve a Process Step for a Plan",
                "operationId": "Approve",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "string",
                        "x-ms-summary": "workplan id",
                        "x-ms-url-encoding": "single",
                        "description": "WorkPlan Id to approve step of"
                    },
                    {
                        "name": "state",
                        "in": "query",
                        "required": true,
                        "type": "string",
                        "enum": [
                            "Approved",
                            "Pending",
                            "Rejected"
                        ],
                        "x-ms-summary": "Approval State",
                        "description": "Approval State"
                    },
                    {
                        "name": "comment",
                        "in": "query",
                        "required": false,
                        "type": "string",
                        "x-ms-summary": "Comment",
                        "description": "Optional Comment for Approval"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/DynamicResponseGetListSchema"
                        }
                    }
                },
                "description": "Approve a process step for a plan"
            }
        },          
        "/workplan/fields/flow2": {
            "get": {
              "summary": "GetFields",
              "operationId": "GetFields",
              "parameters": [],
              "x-ms-visibility": "internal",
              "responses": {
                "200": {
                  "description": "OK",
                  "schema": {
                    "$ref": "#/definitions/DynamicResponseGetListSchema"
                  }
                }
              }
            }
          },        
        "/events/bylist/1": {
            "x-ms-notification-content": {
                "schema": {
                    "type": "object",
                    "properties": {
                        "Name": {
                            "type": "string",
                            "description": "Name"
                        },
                        "Id": {
                            "type": "string",
                            "description": "Id"
                        },
                        "Values": {
                            "type": "object",
                            "properties": {
                                "CurrentStep": {
                                    "type": "string",
                                    "description": "Current Step"
                                },
                                "NewStep": {
                                    "type": "string",
                                    "description": "New Step"
                                },
                                "LinkToPlan": {
                                    "type": "string",
                                    "description": "Link To Plan"
                                }
                            },
                            "description": "Values"
                        }
                    }
                }
            },
            "post": {
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Events by list",
                "summary": "When a Process Step Changes",
                "operationId": "StepUpdateTrigger",
                "consumes": [
                    "application/json"
                ],
                "x-ms-trigger": "single",
                "parameters": [
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "object",
                            "properties": {
                                "EventUrl": {
                                    "type": "string",
                                    "description": "EventUrl",
                                    "x-ms-notification-url": true,
                                    "x-ms-visibility": "internal",
                                    "title": ""
                                },
                                "List": {
                                    "type": "integer",
                                    "description": "List",
                                    "x-ms-visibility": "internal",
                                    "title": "",
                                    "default": 1
                                },
                                "Strategy": {
                                    "type": "string",
                                    "description": "Strategy",
                                    "title": "",
                                    "x-ms-visibility": "internal",
                                    "default": "@{workflow()['tags']['flowDisplayName']}"
                                },
                                "Triggers": {
                                    "type": "array",
                                    "items": {
                                        "type": "integer",
                                        "format": "int32"
                                    },
                                    "x-ms-visibility": "internal",
                                    "default": [
                                        1
                                    ]
                                }
                            },
                            "required": [
                                "List",
                                "Strategy",
                                "Triggers",
                                "EventUrl"
                            ]
                        }
                    }
                ]
            }
        },
        "/events/bylist/{EventList}": {
            "x-ms-notification-content": {
                "schema": {
                    "type": "object",
                    "properties": {
                        "Name": {
                            "type": "string",
                            "description": "Name"
                        },
                        "Id": {
                            "type": "string",
                            "description": "Id"
                        },
                        "Values": {
                            "type": "object",
                            "properties": {
                                "CurrentStep": {
                                    "type": "string",
                                    "description": "Current Step"
                                },
                                "NewStep": {
                                    "type": "string",
                                    "description": "New Step"
                                },
                                "LinkToPlan": {
                                    "type": "string",
                                    "description": "Link To Plan"
                                }
                            },
                            "description": "Values"
                        }
                    }
                }
            },
            "post": {
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Events by list",
                "summary": "When a Plan is added",
                "operationId": "StepAddTrigger",
                "consumes": [
                    "application/json"
                ],
                "x-ms-trigger": "single",
                "parameters": [
                    {
                        "name": "EventList",
                        "in": "path",
                        "required": true,
                        "type": "integer",
                        "x-ms-summary": "workplan id",
                        "x-ms-url-encoding": "single",
                        "x-ms-visibility": "internal",
                        "description": "EventList",
                        "default": 1
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "object",
                            "properties": {
                                "EventUrl": {
                                    "type": "string",
                                    "description": "EventUrl",
                                    "x-ms-notification-url": true,
                                    "x-ms-visibility": "internal",
                                    "title": ""
                                },
                                "List": {
                                    "type": "integer",
                                    "description": "List",
                                    "x-ms-visibility": "internal",
                                    "title": "",
                                    "default": 1
                                },
                                "Strategy": {
                                    "type": "string",
                                    "description": "Strategy",
                                    "title": "",
                                    "x-ms-visibility": "internal",
                                    "default": "@{workflow()['tags']['flowDisplayName']}"
                                },
                                "Triggers": {
                                    "type": "array",
                                    "items": {
                                        "type": "integer",
                                        "format": "int32"
                                    },
                                    "x-ms-visibility": "internal",
                                    "default": [
                                        0
                                    ]
                                }
                            },
                            "required": [
                                "List",
                                "Strategy",
                                "Triggers",
                                "EventUrl"
                            ]
                        }
                    }
                ]
            }
        },
        "/events/bylist/0": {
            "x-ms-notification-content": {
                "schema": {
                    "type": "object",
                    "properties": {
                        "Id": {
                            "type": "string",
                            "description": "Id"
                        },
                        "Name": {
                            "type": "string",
                            "description": "Name"
                        }
                    }
                }
            },
            "post": {
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {}
                    }
                },
                "description": "Events by List",
                "summary": "When a Plan is Updated",
                "operationId": "PlanUpdateTrigger",
                "consumes": [
                    "application/json"
                ],
                "x-ms-trigger": "single",
                "parameters": [
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "type": "object",
                            "properties": {
                                "EventUrl": {
                                    "type": "string",
                                    "description": "EventUrl",
                                    "x-ms-notification-url": true,
                                    "x-ms-visibility": "internal",
                                    "title": ""
                                },
                                "Strategy": {
                                    "type": "string",
                                    "description": "Strategy",
                                    "title": "",
                                    "x-ms-visibility": "internal",
                                    "default": "@{workflow()['tags']['flowDisplayName']}"
                                },
                                "Triggers": {
                                    "type": "array",
                                    "items": {
                                        "type": "integer",
                                        "format": "int32"
                                    },
                                    "x-ms-visibility": "internal",
                                    "default": [
                                        1
                                    ]
                                }
                            },
                            "required": [
                                "EventUrl",
                                "Strategy",
                                "Triggers"
                            ]
                        }
                    }
                ]
            }
        }
    },
    "definitions": {
        "DynamicResponseGetListSchema": {
            "type": "object",
            "x-ms-dynamic-schema": {
                "operationId": "GetFields",
                "parameters": {},
                "value-path": "properties"
            }
        },
        "CreatePlanReqMine": {
            "type": "object",
            "properties": {
                "WorkPlan": {
                    "type": "object",
                    "properties": {
                        "Name": {
                            "type": "string",
                            "x-ms-summary": "Plan Name"
                        },
                        "Owner": {
                            "type": "string",
                            "format": "uuid",
                            "x-ms-summary": "Plan Owner"
                        },
                        "PlanType": {
                            "type": "string",
                            "format": "uuid",
                            "x-ms-summary": "Plan Type Id"
                        },
                        "Fields": {
                            "$ref": "#/definitions/DynamicResponseGetListSchema"
                        }
                    },
                    "required": [
                        "Name",
                        "Owner",
                        "PlanType",
                        "Fields"
                    ]
                }
            },
            "required": [
                "WorkPlan"
            ]
        },
        "PlanIntegrationRequest": {
            "type": "object",
            "properties": {
                "PlanId": {
                    "type": "string",
                    "description": "Unique identifier for the plan",
                    "x-ms-summary": "Plan ID"
                },
                "IntegrationId": {
                    "type": "string",
                    "description": "Unique identifier for the integration (in our case flow ID)",
                    "x-ms-summary": "Flow ID"
                },
                "ItemId": {
                    "type": "string",
                    "description": "The mapped item id to external system",
                    "x-ms-summary": "External System Id"
                },
                "ItemUrl": {
                    "type": "string",
                    "description": "URL to mapped item in external system",
                    "x-ms-summary": "External System URL"
                },
                "IntegrationVersion": {
                    "type": "integer",
                    "description": "Integration version",
                    "x-ms-summary": "Integration Version",
                    "x-ms-visibility": "internal",
                    "default": 0
                }
            },
            "required": [
                "PlanId",
                "IntegrationId",
                "ItemId",
                "ItemUrl",
                "IntegrationVersion"
            ]
        }
    },
    "parameters": {},
    "responses": {},
    "securityDefinitions": {
        "basic-auth": {
            "type": "basic"
        }
    },
    "security": [
        {
            "basic-auth": []
        }
    ],
    "tags": [],
    "x-ms-connector-metadata": [
        {
            "propertyName": "Website",
            "propertyValue": "https://oneplan.ai/"
        },
        {
            "propertyName": "Privacy Policy",
            "propertyValue": "https://oneplan.ai/privacy-policy"
        },
        {
            "propertyName": "Categories",
            "propertyValue": "Business Management;Productivity"
        }
    ]
  }