{ "swagger": "2.0", "info": { "title": "WidgetAnalytics", "version": "2022-11-01-preview", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" } ] }, "schemes": [ "https" ], "produces": [ "application/json" ], "consumes": [ "application/json" ], "security": [ { "AadOauth2Auth": [ "https://azure.com/.default" ] } ], "securityDefinitions": { "AadOauth2Auth": { "type": "oauth2", "description": "The Azure Active Directory OAuth2 Flow", "flow": "accessCode", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "scopes": { "https://azure.com/.default": "" }, "tokenUrl": "https://login.microsoftonline.com/common/oauth2/token" } }, "tags": [], "paths": { "/widgets": { "get": { "operationId": "Widgets_ListWidgets", "description": "List Widget resources", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/PagedWidgetSuite" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" }, "headers": { "x-ms-error-code": { "type": "string", "description": "String error code indicating what went wrong." } } } }, "x-ms-examples": { "Widgets_ListWidgets - generated by [MaximumSet] rule": { "$ref": "./examples/Widgets_ListWidgets_MaximumSet_Gen.json" }, "Widgets_ListWidgets - generated by [MinimumSet] rule": { "$ref": "./examples/Widgets_ListWidgets_MinimumSet_Gen.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/widgets/{widgetName}": { "get": { "operationId": "Widgets_GetWidget", "description": "Fetch a Widget by name.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "widgetName", "in": "path", "description": "The widget name.", "required": true, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/WidgetSuite" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" }, "headers": { "x-ms-error-code": { "type": "string", "description": "String error code indicating what went wrong." } } } }, "x-ms-examples": { "Get widget by widget name. - generated by [MaximumSet] rule": { "$ref": "./examples/Widgets_GetWidget_MaximumSet_Gen.json" }, "Get widget by widget name. - generated by [MinimumSet] rule": { "$ref": "./examples/Widgets_GetWidget_MinimumSet_Gen.json" } } }, "patch": { "operationId": "Widgets_CreateOrUpdateWidget", "description": "Creates or updates a Widget asynchronously.", "consumes": [ "application/merge-patch+json" ], "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "widgetName", "in": "path", "description": "The widget name.", "required": true, "type": "string" }, { "name": "resource", "in": "body", "description": "The resource instance.", "required": true, "schema": { "$ref": "#/definitions/WidgetSuiteCreateOrUpdate" } } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/WidgetSuite" }, "headers": { "Operation-Location": { "type": "string", "format": "uri", "description": "The location for monitoring the operation state." } } }, "201": { "description": "The request has succeeded and a new resource has been created as a result.", "schema": { "$ref": "#/definitions/WidgetSuite" }, "headers": { "Operation-Location": { "type": "string", "format": "uri", "description": "The location for monitoring the operation state." } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" }, "headers": { "x-ms-error-code": { "type": "string", "description": "String error code indicating what went wrong." } } } }, "x-ms-examples": { "Widgets_CreateOrUpdateWidget - generated by [MaximumSet] rule": { "$ref": "./examples/Widgets_CreateOrUpdateWidget_MaximumSet_Gen.json" }, "Widgets_CreateOrUpdateWidget - generated by [MinimumSet] rule": { "$ref": "./examples/Widgets_CreateOrUpdateWidget_MinimumSet_Gen.json" } }, "x-ms-long-running-operation": true }, "delete": { "operationId": "Widgets_DeleteWidget", "description": "Delete a Widget asynchronously.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "widgetName", "in": "path", "description": "The widget name.", "required": true, "type": "string" } ], "responses": { "202": { "description": "The request has been accepted for processing, but processing has not yet completed.", "schema": { "type": "object", "description": "Provides status details for long running operations.", "properties": { "id": { "type": "string", "description": "The unique ID of the operation." }, "status": { "$ref": "#/definitions/Azure.Core.Foundations.OperationState", "description": "The status of the operation" }, "error": { "$ref": "#/definitions/Azure.Core.Foundations.Error", "description": "Error object that describes the error when status is \"Failed\"." } }, "required": [ "id", "status" ] }, "headers": { "Operation-Location": { "type": "string", "format": "uri", "description": "The location for monitoring the operation state." } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" }, "headers": { "x-ms-error-code": { "type": "string", "description": "String error code indicating what went wrong." } } } }, "x-ms-examples": { "Delete widget by widget name using long-running operation. - generated by [MaximumSet] rule": { "$ref": "./examples/Widgets_DeleteWidget_MaximumSet_Gen.json" }, "Delete widget by widget name using long-running operation. - generated by [MinimumSet] rule": { "$ref": "./examples/Widgets_DeleteWidget_MinimumSet_Gen.json" } }, "x-ms-long-running-operation": true } }, "/widgets/{widgetName}/operations/{operationId}": { "get": { "operationId": "Widgets_GetWidgetOperationStatus", "description": "Gets status of a Widget operation.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "widgetName", "in": "path", "description": "The widget name.", "required": true, "type": "string" }, { "name": "operationId", "in": "path", "description": "The unique ID of the operation.", "required": true, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "type": "object", "description": "Provides status details for long running operations.", "properties": { "id": { "type": "string", "description": "The unique ID of the operation." }, "status": { "$ref": "#/definitions/Azure.Core.Foundations.OperationState", "description": "The status of the operation" }, "error": { "$ref": "#/definitions/Azure.Core.Foundations.Error", "description": "Error object that describes the error when status is \"Failed\"." }, "result": { "$ref": "#/definitions/WidgetSuite", "description": "The result of the operation." } }, "required": [ "id", "status" ] } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" }, "headers": { "x-ms-error-code": { "type": "string", "description": "String error code indicating what went wrong." } } } }, "x-ms-examples": { "Widgets_GetWidgetOperationStatus - generated by [MaximumSet] rule": { "$ref": "./examples/Widgets_GetWidgetOperationStatus_MaximumSet_Gen.json" }, "Widgets_GetWidgetOperationStatus - generated by [MinimumSet] rule": { "$ref": "./examples/Widgets_GetWidgetOperationStatus_MinimumSet_Gen.json" } } } } }, "definitions": { "Azure.Core.Foundations.Error": { "type": "object", "description": "The error object.", "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "message": { "type": "string", "description": "A human-readable representation of the error." }, "target": { "type": "string", "description": "The target of the error." }, "details": { "type": "array", "description": "An array of details about specific errors that led to this reported error.", "items": { "$ref": "#/definitions/Azure.Core.Foundations.Error" } }, "innererror": { "$ref": "#/definitions/Azure.Core.Foundations.InnerError", "description": "An object containing more specific information than the current object about the error." } }, "required": [ "code", "message" ] }, "Azure.Core.Foundations.ErrorResponse": { "type": "object", "description": "A response containing error details.", "properties": { "error": { "$ref": "#/definitions/Azure.Core.Foundations.Error", "description": "The error object." } }, "required": [ "error" ] }, "Azure.Core.Foundations.InnerError": { "type": "object", "description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors.", "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "innererror": { "$ref": "#/definitions/Azure.Core.Foundations.InnerError", "description": "Inner error." } } }, "Azure.Core.Foundations.OperationState": { "type": "string", "description": "Enum describing allowed operation states.", "enum": [ "NotStarted", "Running", "Succeeded", "Failed", "Canceled" ], "x-ms-enum": { "name": "OperationState", "modelAsString": true, "values": [ { "name": "NotStarted", "value": "NotStarted", "description": "The operation has not started." }, { "name": "Running", "value": "Running", "description": "The operation is in progress." }, { "name": "Succeeded", "value": "Succeeded", "description": "The operation has completed successfully." }, { "name": "Failed", "value": "Failed", "description": "The operation has failed." }, { "name": "Canceled", "value": "Canceled", "description": "The operation has been canceled by the user." } ] } }, "FakedSharedModel": { "type": "object", "description": "Faked shared model", "properties": { "tag": { "type": "string", "description": "The tag." }, "createdAt": { "type": "string", "format": "date-time", "description": "The created date." } }, "required": [ "tag", "createdAt" ] }, "FakedSharedModelCreateOrUpdate": { "type": "object", "description": "Faked shared model", "properties": { "tag": { "type": "string", "description": "The tag." }, "createdAt": { "type": "string", "format": "date-time", "description": "The created date." } } }, "PagedWidgetSuite": { "type": "object", "description": "Paged collection of WidgetSuite items", "properties": { "value": { "type": "array", "description": "The WidgetSuite items on this page", "items": { "$ref": "#/definitions/WidgetSuite" } }, "nextLink": { "type": "string", "format": "uri", "description": "The link to the next page of items" } }, "required": [ "value" ] }, "WidgetSuite": { "type": "object", "description": "A widget.", "properties": { "name": { "type": "string", "description": "The widget name.", "readOnly": true }, "manufacturerId": { "type": "string", "description": "The ID of the widget's manufacturer." }, "sharedModel": { "$ref": "#/definitions/FakedSharedModel", "description": "The faked shared model." } }, "required": [ "name", "manufacturerId" ] }, "WidgetSuiteCreateOrUpdate": { "type": "object", "description": "A widget.", "properties": { "manufacturerId": { "type": "string", "description": "The ID of the widget's manufacturer." }, "sharedModel": { "$ref": "#/definitions/FakedSharedModelCreateOrUpdate", "description": "The faked shared model." } } } }, "parameters": { "Azure.Core.Foundations.ApiVersionParameter": { "name": "api-version", "in": "query", "description": "The API version to use for this operation.", "required": true, "type": "string", "minLength": 1, "x-ms-parameter-location": "method", "x-ms-client-name": "apiVersion" } } }