Skip to content

[API] Typekits

Utilities for working with Models in the context of Http.

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

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

/**
* Get the Http header options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpHeaderOptions(prop: ModelProperty): HeaderFieldOptions | undefined;
/**
* Get the Http parameter options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpParamOptions(prop: ModelProperty): HeaderFieldOptions | PathParameterOptions | QueryParameterOptions | undefined;
/**
* Get the Http path options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpPathOptions(prop: ModelProperty): PathParameterOptions | undefined;
/**
* Get the Http query options for a model property.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty
.getHttpQueryOptions(prop: ModelProperty): QueryParameterOptions | undefined;
/**
* Check if a model property is an Http header.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpHeader(prop: ModelProperty): boolean;
/**
* Check if a model property is an Http multipart body.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpMultipartBody(prop: ModelProperty): boolean;
/**
* Check if a model property is an Http path parameter.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpPathParam(prop: ModelProperty): boolean;
/**
* Check if a model property is an Http query parameter.
*
* @param prop - a TypeSpec ModelProperty
*/
$(program).modelProperty.isHttpQueryParam(prop: ModelProperty): boolean;

Utilities for working with HTTP operations.

/**
* 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 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[]];
/**
* 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;

Utilities for working with HTTP Parts.

$(program).httpPart.get(type: Type): HttpPart | undefined;
/**
* Check if the model is a HTTP part.
*
* @param type - model to check
*/
$(program).httpPart.is(type: Type): boolean;
/**
* 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;

Utilities for working with HTTP responses.

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