Skip to content

[API] Typekits

model

Utilities for working with Models in the context of Http.

isHttpFile

/**
* Check if a model is an Http file.
*
* @param model - model to check
*/
$(program).model.isHttpFile(model: Model): boolean;

modelProperty

Utilities for working with model properties in the context of Http.

getHttpHeaderOptions

/**
* Get the Http header options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpHeaderOptions(prop: ModelProperty): HeaderFieldOptions | undefined;

getHttpParamOptions

/**
* Get the Http parameter options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpParamOptions(prop: ModelProperty): HeaderFieldOptions | PathParameterOptions | QueryParameterOptions | undefined;

getHttpPathOptions

/**
* Get the Http path options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpPathOptions(prop: ModelProperty): PathParameterOptions | undefined;

getHttpQueryOptions

/**
* Get the Http query options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpQueryOptions(prop: ModelProperty): QueryParameterOptions | undefined;

isHttpHeader

/**
* Check if a model property is an Http header.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpHeader(prop: ModelProperty): boolean;

isHttpMultipartBody

/**
* Check if a model property is an Http multipart body.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpMultipartBody(prop: ModelProperty): boolean;

isHttpPathParam

/**
* Check if a model property is an Http path parameter.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpPathParam(prop: ModelProperty): boolean;

isHttpQueryParam

/**
* Check if a model property is an Http query parameter.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpQueryParam(prop: ModelProperty): boolean;

httpOperation

Utilities for working with HTTP operations.

flattenResponses

/**
* Get the responses for the given operation. This function will return an array of responses grouped by status code and content type.
*
* @param op - operation to extract the HttpResponse from
*/
$(program).httpOperation
.flattenResponses(op: HttpOperation): FlatHttpResponse[];

get Diagnosable

/**
* Get the corresponding HTTP operation for the given TypeSpec operation. The same TypeSpec operation will always return the exact same HttpOperation object.
*
* @param op - The TypeSpec operation to get the HTTP operation metadata for.
*/
$(program).httpOperation.get(op: Operation): HttpOperation;
$(program).httpOperation.get
.withDiagnostics(op: Operation): [HttpOperation, readonly Diagnostic[]];

getReturnType

/**
* Get the Http Return type for the given operation. This function will resolve the returnType based on the Http Operation.
*
* @param op - operation to get the return type for
*/
$(program).httpOperation.getReturnType(op: HttpOperation,
options: {
includeErrors?: boolean;
}): Type;

httpPart

Utilities for working with HTTP Parts.

get

$(program).httpPart.get(type: Type): HttpPart | undefined;

is

/**
* Check if the model is a HTTP part.
*
* @param type - model to check
*/
$(program).httpPart.is(type: Type): boolean;

unpack

/**
* Unpacks the wrapped model from the HTTP part or the original model if not an HttpPart.
*
* @param type - HttpPart model to unpack
*/
$(program).httpPart.unpack(type: Type): Type;

httpResponse

Utilities for working with HTTP responses.

isErrorResponse

/**
* Check if the response is an error response.
*/
$(program).httpResponse.isErrorResponse(response: FlatHttpResponse): boolean;