Data types
TypeSpec.Http
AcceptedResponse
The request has been accepted for processing, but processing has not yet completed.
Properties
Name | Type | Description |
---|---|---|
statusCode | 202 | The status code. |
ApiKeyAuth
An API key is a token that a client provides when making API calls. The key can be sent in the query string:
or as a request header
or as a cookie
Template Parameters
Name | Description |
---|---|
Location | The location of the API key |
Name | The name of the API key |
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.AuthType.apiKey | |
in | Location | |
name | Name |
AuthorizationCodeFlow
Authorization Code flow
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.OAuth2FlowType.authorizationCode | authorization code flow |
authorizationUrl | string | the authorization URL |
tokenUrl | string | the token URL |
refreshUrl? | string | the refresh URL |
scopes? | string[] | list of scopes for the credential |
BadRequestResponse
The server could not understand the request due to invalid syntax.
Properties
Name | Type | Description |
---|---|---|
statusCode | 400 | The status code. |
BasicAuth
Basic authentication is a simple authentication scheme built into the HTTP protocol.
The client sends HTTP requests with the Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password.
For example, to authorize as demo / p@55w0rd
the client would send
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.AuthType.http | Http authentication |
scheme | "basic" | basic auth scheme |
BearerAuth
Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. The client must send this token in the Authorization header when making requests to protected resources:
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.AuthType.http | Http authentication |
scheme | "bearer" | bearer auth scheme |
Body
Defines a model with a single property of the given type, marked with @body
.
This can be useful in situations where you cannot use a bare type as the body and it is awkward to add a property.
Template Parameters
Name | Description |
---|---|
Type | The type of the model’s body property. |
Properties
Name | Type | Description |
---|---|---|
body | Type |
ClientCredentialsFlow
Client credentials flow
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.OAuth2FlowType.clientCredentials | client credential flow |
tokenUrl | string | the token URL |
refreshUrl? | string | the refresh URL |
scopes? | string[] | list of scopes for the credential |
ConflictResponse
The request conflicts with the current state of the server.
Properties
Name | Type | Description |
---|---|---|
statusCode | 409 | The status code. |
CookieOptions
Cookie Options.
Properties
Name | Type | Description |
---|---|---|
name? | string | Name in the cookie. |
CreatedResponse
The request has succeeded and a new resource has been created as a result.
Properties
Name | Type | Description |
---|---|---|
statusCode | 201 | The status code. |
File
Properties
Name | Type | Description |
---|---|---|
contentType? | string | |
filename? | string | |
contents | bytes |
ForbiddenResponse
Access is forbidden.
Properties
Name | Type | Description |
---|---|---|
statusCode | 403 | The status code. |
HeaderOptions
Header options.
Properties
Name | Type | Description |
---|---|---|
name? | string | Name of the header when sent over HTTP. |
format? | "csv" | "multi" | "tsv" | "ssv" | "pipes" | "simple" | "form" | Determines the format of the array if type array is used. |
HttpPart
Template Parameters
Name | Description |
---|---|
Type | |
Options |
Properties
None
HttpPartOptions
Properties
Name | Type | Description |
---|---|---|
name? | string | Name of the part when using the array form. |
ImplicitFlow
Implicit flow
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.OAuth2FlowType.implicit | implicit flow |
authorizationUrl | string | the authorization URL |
refreshUrl? | string | the refresh URL |
scopes? | string[] | list of scopes for the credential |
Link
Properties
Name | Type | Description |
---|---|---|
target | url | |
rel | string | |
attributes? | Record<unknown> |
LocationHeader
The Location header contains the URL where the status of the long running operation can be checked.
Properties
Name | Type | Description |
---|---|---|
location | string | The Location header contains the URL where the status of the long running operation can be checked. |
MovedResponse
The URL of the requested resource has been changed permanently. The new URL is given in the response.
Properties
Name | Type | Description |
---|---|---|
statusCode | 301 | The status code. |
location | string | The Location header contains the URL where the status of the long running operation can be checked. |
NoAuth
This authentication option signifies that API is not secured at all. It might be useful when overriding authentication on interface of operation level.
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.AuthType.noAuth |
NoContentResponse
There is no content to send for this request, but the headers may be useful.
Properties
Name | Type | Description |
---|---|---|
statusCode | 204 | The status code. |
NotFoundResponse
The server cannot find the requested resource.
Properties
Name | Type | Description |
---|---|---|
statusCode | 404 | The status code. |
NotModifiedResponse
The client has made a conditional request and the resource has not been modified.
Properties
Name | Type | Description |
---|---|---|
statusCode | 304 | The status code. |
OAuth2Auth
OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server.
OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials. For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner. For more information about OAuth 2.0, see oauth.net and RFC 6749.
Template Parameters
Name | Description |
---|---|
Flows | The list of supported OAuth2 flows |
Scopes | The list of OAuth2 scopes, which are common for every flow from Flows . This list is combined with the scopes defined in specific OAuth2 flows. |
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.AuthType.oauth2 | |
flows | Flows | |
defaultScopes | Scopes |
OkResponse
The request has succeeded.
Properties
Name | Type | Description |
---|---|---|
statusCode | 200 | The status code. |
OpenIdConnectAuth
OpenID Connect (OIDC) is an identity layer built on top of the OAuth 2.0 protocol and supported by some OAuth 2.0 providers, such as Google and Azure Active Directory. It defines a sign-in flow that enables a client application to authenticate a user, and to obtain information (or “claims”) about that user, such as the user name, email, and so on. User identity information is encoded in a secure JSON Web Token (JWT), called ID token. OpenID Connect defines a discovery mechanism, called OpenID Connect Discovery, where an OpenID server publishes its metadata at a well-known URL, typically
Template Parameters
Name | Description |
---|---|
ConnectUrl |
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.AuthType.openIdConnect | Auth type |
openIdConnectUrl | ConnectUrl | Connect url. It can be specified relative to the server URL |
PasswordFlow
Resource Owner Password flow
Properties
Name | Type | Description |
---|---|---|
type | TypeSpec.Http.OAuth2FlowType.password | password flow |
tokenUrl | string | the token URL |
refreshUrl? | string | the refresh URL |
scopes? | string[] | list of scopes for the credential |
PathOptions
Properties
Name | Type | Description |
---|---|---|
name? | string | Name of the parameter in the uri template. |
explode? | boolean | When interpolating this parameter in the case of array or object expand each value using the given style. Equivalent of adding * in the path parameter as per RFC-6570 |
style? | "simple" | "label" | "matrix" | "fragment" | "path" | Different interpolating styles for the path parameter. - simple : No special encoding.- label : Using . separator.- matrix : ; as separator.- fragment : # as separator.- path : / as separator. |
allowReserved? | boolean | When interpolating this parameter do not encode reserved characters. Equivalent of adding + in the path parameter as per RFC-6570 |
PlainData
Produces a new model with the same properties as T, but with @query
,
@header
, @body
, and @path
decorators removed from all properties.
Template Parameters
Name | Description |
---|---|
Data | The model to spread as the plain data. |
Properties
None
QueryOptions
Query parameter options.
Properties
Name | Type | Description |
---|---|---|
name? | string | Name of the query when included in the url. |
explode? | boolean | If true send each value in the array/object as a separate query parameter. Equivalent of adding * in the path parameter as per RFC-6570| Style | Explode | Uri Template | Primitive value id = 5 | Array id = [3, 4, 5] | Object id = {“role”: “admin”, “firstName”: “Alex”} | | ------ | ------- | -------------- | ---------------------- | ----------------------- | -------------------------------------------------- | | simple | false | /users{?id} | /users?id=5 | /users?id=3,4,5 | /users?id=role,admin,firstName,Alex || simple | true | /users{?id*} | /users?id=5 | /users?id=3&id=4&id=5 | /users?role=admin&firstName=Alex | |
format? | "multi" | "csv" | "ssv" | "tsv" | "simple" | "form" | "pipes" | Determines the format of the array if type array is used. DEPRECATED: use explode: true instead of multi or @encode |
Response
Describes an HTTP response.
Template Parameters
Name | Description |
---|---|
Status | The status code of the response. |
Properties
Name | Type | Description |
---|---|---|
statusCode | Status |
UnauthorizedResponse
Access is unauthorized.
Properties
Name | Type | Description |
---|---|---|
statusCode | 401 | The status code. |
ApiKeyLocation
Describes the location of the API key
Name | Value | Description |
---|---|---|
header | API key is a header value | |
query | API key is a query parameter | |
cookie | API key is found in a cookie |
AuthType
Authentication type
Name | Value | Description |
---|---|---|
http | HTTP | |
apiKey | API key | |
oauth2 | OAuth2 | |
openIdConnect | OpenID connect | |
noAuth | Empty auth |
OAuth2FlowType
Describes the OAuth2 flow type
Name | Value | Description |
---|---|---|
authorizationCode | authorization code flow | |
implicit | implicit flow | |
password | password flow | |
clientCredentials | client credential flow |