{
  "swagger": "2.0",
  "info": {
    "title": "Favorites service",
    "version": "0.1507.0",
    "description": "Send your API key as a bearer token: `Authorization: Bearer <api key>`."
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Your API key as a bearer token: `Authorization: Bearer <api key>`."
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/scout/v2/favorites/workspace/{workspaceRid}": {
      "get": {
        "operationId": "FavoritesService_getFavoritesList",
        "summary": "Get favorites list",
        "tags": [
          "Favorites Service"
        ],
        "description": "Retrieves the favorites list for the current user in the specified workspace.",
        "parameters": [
          {
            "name": "workspaceRid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "WorkspaceRid",
            "required": true
          },
          {
            "name": "resourceTypes",
            "in": "query",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ASSET",
                "RUN",
                "NOTEBOOK",
                "NOTEBOOK_TEMPLATE",
                "CHECKLIST",
                "SAVED_VIEW",
                "PROCEDURE",
                "PLAN"
              ]
            },
            "collectionFormat": "multi",
            "required": false,
            "description": "The resource types to include in the favorites list. If none are provided, all resource types will be included."
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/FavoritesListResponse"
            },
            "x-example": {
              "favorites": [
                {
                  "type": "asset",
                  "asset": "<asset rid>"
                }
              ]
            }
          }
        }
      },
      "put": {
        "operationId": "FavoritesService_setFavoritesList",
        "summary": "Set favorites list",
        "tags": [
          "Favorites Service"
        ],
        "description": "Overwrites the favorites list for the current user in the specified workspace.",
        "parameters": [
          {
            "name": "workspaceRid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "WorkspaceRid",
            "required": true
          },
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/SetFavoritesListRequest"
            },
            "required": true,
            "x-example": {
              "resources": [
                {
                  "type": "asset",
                  "asset": "<asset rid>"
                }
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/FavoritesListResponse"
            },
            "x-example": {
              "favorites": [
                {
                  "type": "asset",
                  "asset": "<asset rid>"
                }
              ]
            }
          }
        }
      }
    }
  },
  "definitions": {
    "FavoriteResource": {
      "type": "object",
      "x-union": true,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "asset",
            "run",
            "notebook",
            "notebookTemplate",
            "checklist",
            "savedView",
            "procedure",
            "plan"
          ]
        },
        "asset": {
          "type": "string",
          "format": "rid",
          "x-alias": "AssetRid"
        },
        "run": {
          "type": "string",
          "format": "rid",
          "x-alias": "RunRid"
        },
        "notebook": {
          "type": "string",
          "format": "rid",
          "x-alias": "NotebookRid"
        },
        "notebookTemplate": {
          "type": "string",
          "format": "rid",
          "x-alias": "TemplateRid"
        },
        "checklist": {
          "type": "string",
          "format": "rid",
          "x-alias": "ChecklistRid"
        },
        "savedView": {
          "type": "string",
          "format": "rid",
          "x-alias": "SavedViewRid"
        },
        "procedure": {
          "type": "string",
          "format": "rid",
          "x-alias": "ProcedureRid"
        },
        "plan": {
          "type": "string",
          "format": "rid",
          "x-alias": "PlanRid"
        }
      },
      "required": [
        "type"
      ],
      "description": "Set `type` to the name of one of the other fields, and set only that field.",
      "example": {
        "type": "asset",
        "asset": "string"
      }
    },
    "FavoritesListResponse": {
      "type": "object",
      "properties": {
        "favorites": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/FavoriteResource"
          }
        }
      }
    },
    "SetFavoritesListRequest": {
      "type": "object",
      "properties": {
        "resources": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/FavoriteResource"
          },
          "description": "The resources to set as the user's favorites. Note that the provided list will overwrite all the user's previous favorites."
        }
      },
      "example": {
        "resources": [
          {
            "type": "asset",
            "asset": "<asset rid>"
          }
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Favorites Service",
      "x-displayName": "Favorites service",
      "description": "Creating favorites allows users to pin specific resources (i.e. assets, workbooks, etc.) as favorites for quick access within search pages throughout the application for themselves.",
      "x-errors": [
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "Favorites:ResourcesNotFoundError"
        },
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "Favorites:DuplicateResourcesError"
        }
      ]
    }
  ]
}
