{
  "x-generator": "NSwag v14.7.1.0 (NJsonSchema v11.6.1.0 (Newtonsoft.Json v13.0.0.0))",
  "openapi": "3.0.0",
  "info": {
    "title": "Sharing API",
    "contact": {
      "name": "Sharing API",
      "url": "https://api.enablenow.nl",
      "email": ""
    },
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.enablenow.nl"
    }
  ],
  "paths": {
    "/shares": {
      "get": {
        "tags": [
          "Shares"
        ],
        "summary": "Retrieve a list of shares",
        "operationId": "Shares_GetShares",
        "parameters": [
          {
            "name": "isExpired",
            "in": "query",
            "description": "Filters all expired shares from the results",
            "schema": {
              "type": "boolean",
              "nullable": true
            },
            "x-position": 1
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number to retrieve (optional) (defaults to 1)",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            },
            "x-position": 2
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Number of results to retrieve per page (optional) (defaults to 50)",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            },
            "x-position": 3
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a list of shares",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagedApiResponseOfShare"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetailsMetadata"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Shares"
        ],
        "summary": "Create a new share",
        "operationId": "Shares_CreateShare",
        "requestBody": {
          "x-name": "createShare",
          "description": "The share model used to create a new share",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Command"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "The identifier of the newly created share",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfGuid"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetailsMetadata"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shares/{shareId}": {
      "get": {
        "tags": [
          "Shares"
        ],
        "summary": "Retrieve a share by its EnableNow identifier",
        "operationId": "Shares_GetShareById",
        "parameters": [
          {
            "name": "shareId",
            "in": "path",
            "required": true,
            "description": "The EnableNow identifier of the share",
            "schema": {
              "type": "string",
              "format": "guid"
            },
            "x-position": 1
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a share",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfShare"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetailsMetadata"
                }
              }
            }
          },
          "404": {
            "description": "Share not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "put": {
        "tags": [
          "Shares"
        ],
        "summary": "Updates an existing share by its EnableNow identifier",
        "operationId": "Shares_UpdateShareById",
        "parameters": [
          {
            "name": "shareId",
            "in": "path",
            "required": true,
            "description": "The EnableNow identifier of the share",
            "schema": {
              "type": "string",
              "format": "guid"
            },
            "x-position": 1
          }
        ],
        "requestBody": {
          "x-name": "updateShare",
          "description": "The share model used to update the share",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Command2"
              }
            }
          },
          "required": true,
          "x-position": 2
        },
        "responses": {
          "204": {
            "description": "Succesfully updated"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetailsMetadata"
                }
              }
            }
          },
          "404": {
            "description": "Share not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Shares"
        ],
        "summary": "Deletes an existing share by its EnableNow identifier",
        "operationId": "Shares_DeleteShareById",
        "parameters": [
          {
            "name": "shareId",
            "in": "path",
            "required": true,
            "description": "The EnableNow identifier of the share",
            "schema": {
              "type": "string",
              "format": "guid"
            },
            "x-position": 1
          }
        ],
        "responses": {
          "204": {
            "description": "Succesfully deleted"
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetailsMetadata"
                }
              }
            }
          },
          "404": {
            "description": "Share not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "PagedApiResponseOfShare": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiResponseOfIEnumerableOfShare"
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "_pagination"
            ],
            "properties": {
              "_pagination": {
                "description": "The pagination metadata",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PaginationMetadata"
                  }
                ]
              }
            }
          }
        ]
      },
      "PaginationMetadata": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "page": {
            "type": "integer",
            "description": "The page number of the results.",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "description": "The number of results per page.",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "description": "The total number of results.",
            "format": "int32"
          },
          "totalPages": {
            "type": "integer",
            "description": "The total number of pages.",
            "format": "int32"
          }
        }
      },
      "ApiResponseOfIEnumerableOfShare": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "description": "The API result object",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/Share"
            }
          }
        }
      },
      "Share": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "clientId",
          "expirationDateUtc"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier of this share",
            "format": "guid"
          },
          "clientId": {
            "type": "string",
            "description": "The EnableNow ClientId of the app to share with"
          },
          "reference": {
            "type": "string",
            "description": "The external reference of this share",
            "nullable": true
          },
          "expirationDateUtc": {
            "type": "string",
            "description": "The expiration date of this share.",
            "format": "date-time"
          },
          "consentIds": {
            "type": "array",
            "description": "An array of EnableNow Consent identifiers to share ",
            "nullable": true,
            "items": {
              "type": "string",
              "format": "guid"
            }
          },
          "accountIds": {
            "type": "array",
            "description": "An array of EnableNow Account identifiers to share ",
            "nullable": true,
            "items": {
              "type": "string",
              "format": "guid"
            }
          },
          "analysisIds": {
            "type": "array",
            "description": "An array of EnableNow Analysis identifiers to share ",
            "nullable": true,
            "items": {
              "type": "string",
              "format": "guid"
            }
          }
        }
      },
      "ValidationProblemDetailsMetadata": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "description": "A URI reference [RFC3986] that identifies the problem type. This specification\nencourages that, when dereferenced, it provide human-readable documentation for\nthe problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member\nis not present, its value is assumed to be \"about:blank\".",
            "nullable": true
          },
          "title": {
            "type": "string",
            "description": "A short, human-readable summary of the problem type.It SHOULD NOT change from\noccurrence to occurrence of the problem, except for purposes of localization(e.g.,\nusing proactive content negotiation; see[RFC7231], Section 3.4).",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status code([RFC7231], Section 6) generated by the origin server for\nthis occurrence of the problem.",
            "format": "int32"
          },
          "traceId": {
            "type": "string",
            "description": "Unique Trace Id for this request",
            "nullable": true
          },
          "errors": {
            "type": "object",
            "description": "The errors associated with this request.",
            "nullable": true,
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "ApiResponseOfShare": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "description": "The API result object",
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/Share"
              }
            ]
          }
        }
      },
      "ApiResponseOfGuid": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "string",
            "description": "The API result object",
            "format": "guid"
          }
        }
      },
      "Command": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "clientId"
        ],
        "properties": {
          "clientId": {
            "type": "string",
            "description": "The EnableNow ClientId of the app to share with"
          },
          "reference": {
            "type": "string",
            "description": "The external reference of this share",
            "nullable": true
          },
          "expirationDateUtc": {
            "type": "string",
            "description": "The expiration date of this share. (defaults to 1 day from now)",
            "format": "date-time",
            "nullable": true
          },
          "consentIds": {
            "type": "array",
            "description": "An array of EnableNow Consent identifiers to share ",
            "nullable": true,
            "items": {
              "type": "string",
              "format": "guid"
            }
          },
          "accountIds": {
            "type": "array",
            "description": "An array of EnableNow Account identifiers to share ",
            "nullable": true,
            "items": {
              "type": "string",
              "format": "guid"
            }
          },
          "analysisIds": {
            "type": "array",
            "description": "An array of EnableNow Analysis identifiers to share ",
            "nullable": true,
            "items": {
              "type": "string",
              "format": "guid"
            }
          }
        }
      },
      "Command2": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expirationDateUtc": {
            "type": "string",
            "description": "The expiration date of this share. (defaults to 1 day from now)",
            "format": "date-time",
            "nullable": true
          }
        }
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "oauth2",
        "name": "Authorization",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "/connect/token",
            "scopes": {
              "customer-api": "Customer API"
            }
          }
        }
      }
    }
  }
}