UNPKG

@autorest/go

Version:
297 lines 15 kB
import * as method from './method.js'; import * as type from './type.js'; /** indicates the wire format for request bodies */ export type BodyFormat = 'JSON' | 'XML' | 'Text' | 'binary'; /** the union of all form body parameter types */ export type FormBodyParameter = FormBodyCollectionParameter | FormBodyScalarParameter; /** the union of all header parameter types */ export type HeaderParameter = HeaderCollectionParameter | HeaderMapParameter | HeaderScalarParameter; /** the union of all path parameter types */ export type PathParameter = PathCollectionParameter | PathScalarParameter; /** the union of all query parameter types */ export type QueryParameter = QueryCollectionParameter | QueryScalarParameter; /** defines the possible method parameter types */ export type MethodParameter = BodyParameter | FormBodyParameter | HeaderParameter | MultipartFormBodyParameter | PartialBodyParameter | PathParameter | QueryParameter | ResumeTokenParameter | URIParameter; /** parameter is sent in the HTTP request body */ export interface BodyParameter extends HttpParameterBase { kind: 'bodyParam'; /** the wire format of the request body */ bodyFormat: BodyFormat; /** value used for the Content-Type header */ contentType: string; /** optional XML schema metadata */ xml?: type.XMLInfo; } /** represents parameters that have a default value on the client side */ export interface ClientSideDefault { /** the literal used for the client-side default value */ defaultValue: type.Literal; } /** indicates how a collection is formatted on the wire */ export type CollectionFormat = 'csv' | 'ssv' | 'tsv' | 'pipes'; /** includes additional wire formats */ export type ExtendedCollectionFormat = CollectionFormat | 'multi'; /** a collection that's placed in form body data */ export interface FormBodyCollectionParameter extends HttpParameterBase { kind: 'formBodyCollectionParam'; /** the form data name for this parameter */ formDataName: string; /** the type of the parameter */ type: type.Slice; /** the format of the collection */ collectionFormat: ExtendedCollectionFormat; } /** parameter that's placed in form body data */ export interface FormBodyScalarParameter extends HttpParameterBase { kind: 'formBodyScalarParam'; /** the form data name for this parameter */ formDataName: string; } /** a collection that goes in a HTTP header */ export interface HeaderCollectionParameter extends HttpParameterBase { kind: 'headerCollectionParam'; /** the header in the HTTP request */ headerName: string; /** the collection of header param values */ type: type.Slice; /** the format of the collection */ collectionFormat: CollectionFormat; } /** * parameter map collection that goes in a HTTP header. * NOTE: this is a specialized parameter type to support storage. */ export interface HeaderMapParameter extends HttpParameterBase { kind: 'headerMapParam'; /** the header prefix for each header name in type */ headerName: string; /** the type of the param */ type: type.Map; } /** a value that goes in a HTTP header */ export interface HeaderScalarParameter extends HttpParameterBase { kind: 'headerScalarParam'; /** the header in the HTTP request */ headerName: string; /** the type of the parameter */ type: HeaderScalarType; /** * indicates this is an API version parameter * the default value is false. */ isApiVersion: boolean; } /** defines the possible types for a scalar header */ export type HeaderScalarType = type.Constant | type.EncodedBytes | type.Literal | type.Scalar | type.String | type.Time; /** parameter goes in multipart/form body */ export interface MultipartFormBodyParameter extends HttpParameterBase { kind: 'multipartFormBodyParam'; } /** * defines the style of a parameter. * * required - the parameter is required * optional - the parameter is optional * literal - there is no formal parameter, the value is emitted directly in the code (e.g. the Accept header parameter) * flag - the value is a literal and emitted in the code, but sent IFF the flag param is not nil (i.e. an optional LiteralValue) * ClientSideDefault - the parameter has an emitted default value that's sent if one isn't specified (implies optional) */ export type ParameterStyle = 'required' | 'optional' | 'literal' | 'flag' | ClientSideDefault; /** indicates where the value of a parameter originates */ export type ParameterLocation = 'client' | 'method'; /** a struct that contains a grouping of parameters */ export interface ParameterGroup { kind: 'paramGroup'; /** the name of the parameter */ name: string; /** any docs for the parameter */ docs: type.Docs; /** the name of the parameter group (i.e. the struct name) */ groupName: string; /** indicates if the parameter is required */ required: boolean; /** the location of the parameter */ location: ParameterLocation; /** the parameters that belong to this group */ params: Array<MethodParameter>; } /** a parameter that's a field within a type passed via the HTTP request body */ export interface PartialBodyParameter extends HttpParameterBase { kind: 'partialBodyParam'; /** the name of the field within the type sent in the request body */ serializedName: string; /** the wire format of the underlying type */ format: 'JSON' | 'XML'; /** optional XML schema metadata */ xml?: type.XMLInfo; } /** a collection of values that go in the HTTP path */ export interface PathCollectionParameter extends HttpParameterBase { kind: 'pathCollectionParam'; /** the segment name to be replaced with the values */ pathSegment: string; /** the type of the parameter */ type: type.Slice; /** indicates if the values must be URL encoded */ isEncoded: boolean; /** the format of the collection */ collectionFormat: CollectionFormat; } /** a value that goes in the HTTP path */ export interface PathScalarParameter extends HttpParameterBase { kind: 'pathScalarParam'; /** the segment name to be replaced with the value */ pathSegment: string; /** the type of the parameter */ type: PathScalarParameterType; /** indicates if the values must be URL encoded */ isEncoded: boolean; /** * indicates this is an API version parameter * the default value is false. */ isApiVersion: boolean; /** * this is ONLY for compat with autorest. * the default value is false. */ omitEmptyStringCheck: boolean; } /** defines the possible types for a PathScalarParameter */ export type PathScalarParameterType = type.Constant | type.EncodedBytes | type.Literal | type.Scalar | type.String | type.Time; /** a collection of values that go in the HTTP query string */ export interface QueryCollectionParameter extends HttpParameterBase { kind: 'queryCollectionParam'; /** the query string's key name */ queryParameter: string; /** the type of the parameter */ type: type.Slice; /** indicates if the values must be URL encoded */ isEncoded: boolean; /** the format of the collection */ collectionFormat: ExtendedCollectionFormat; } /** a scalar value that goes in the HTTP query string */ export interface QueryScalarParameter extends HttpParameterBase { kind: 'queryScalarParam'; /** the query string's key name */ queryParameter: string; /** the type of the parameter */ type: QueryScalarParameterType; /** indicates if the value must be URL encoded */ isEncoded: boolean; /** * indicates this is an API version parameter * the default value is false. */ isApiVersion: boolean; } /** defines the possible types for a QueryScalarParameter */ export type QueryScalarParameterType = type.Constant | type.EncodedBytes | type.Literal | type.Scalar | type.String | type.Time; /** the synthesized resume token parameter for LROs */ export interface ResumeTokenParameter extends HttpParameterBase { kind: 'resumeTokenParam'; } /** a segment of the host's URI */ export interface URIParameter extends HttpParameterBase { kind: 'uriParam'; /** the segment name to be replaced with the value */ uriPathSegment: string; /** the type of the parameter */ type: URIParameterType; /** * indicates this is an API version parameter * the default value is false. */ isApiVersion: boolean; } /** defines the possible types for a URIParameter */ export type URIParameterType = type.Constant | type.Scalar | type.String; /** narrows style to a ClientSideDefault within the conditional block */ export declare function isClientSideDefault(style: ParameterStyle): style is ClientSideDefault; /** narrows param to a FormBodyParameter within the conditional block */ export declare function isFormBodyParameter(param: MethodParameter): param is FormBodyParameter; /** narrows param to a HeaderParameter within the conditional block */ export declare function isHeaderParameter(param: MethodParameter): param is HeaderParameter; /** narrows type to a HeaderScalarType within the conditional block */ export declare function isHeaderScalarType(type: type.WireType): type is HeaderScalarType; /** narrows param to a PathParameter within the conditional block */ export declare function isPathParameter(param: MethodParameter): param is PathParameter; /** narrows type to a PathScalarParameterType within the conditional block */ export declare function isPathScalarParameterType(type: type.WireType): type is PathScalarParameterType; /** narrows param to a QueryParameter within the conditional block */ export declare function isQueryParameter(param: MethodParameter): param is QueryParameter; /** narrows type to a QueryScalarParameterType within the conditional block */ export declare function isQueryScalarParameterType(type: type.WireType): type is QueryScalarParameterType; /** returns true if the param is required */ export declare function isRequiredParameter(paramStyle: ParameterStyle): boolean; /** narrows type to a URIParameterType within the conditional block */ export declare function isURIParameterType(type: type.WireType): type is URIParameterType; /** returns true if the param is a literal */ export declare function isLiteralParameter(paramStyle: ParameterStyle): boolean; interface HttpParameterBase extends method.Parameter { /** * the parameter's type. * NOTE: if the type is a LiteralValue the style will either be literal or flag */ type: type.WireType; /** kind will have value literal or flag when type is a LiteralValue (see above comment) */ style: ParameterStyle; /** indicates if the parameter belongs to a parameter group */ group?: ParameterGroup; /** indicates if the parameter is part of the method signature or a value on the client */ location: ParameterLocation; } declare class HttpParameterBase extends method.Parameter implements HttpParameterBase { constructor(name: string, type: type.WireType, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class BodyParameter extends HttpParameterBase implements BodyParameter { constructor(name: string, bodyFormat: BodyFormat, contentType: string, type: type.WireType, style: ParameterStyle, byValue: boolean); } export declare class ClientSideDefault implements ClientSideDefault { constructor(defaultValue: type.Literal); } export declare class FormBodyCollectionParameter extends HttpParameterBase implements FormBodyCollectionParameter { constructor(name: string, formDataName: string, type: type.Slice, collectionFormat: ExtendedCollectionFormat, style: ParameterStyle, byValue: boolean); } export declare class FormBodyScalarParameter extends HttpParameterBase implements FormBodyScalarParameter { constructor(name: string, formDataName: string, type: type.WireType, style: ParameterStyle, byValue: boolean); } export declare class HeaderCollectionParameter extends HttpParameterBase implements HeaderCollectionParameter { constructor(name: string, headerName: string, type: type.Slice, collectionFormat: CollectionFormat, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class HeaderMapParameter extends HttpParameterBase implements HeaderMapParameter { constructor(name: string, headerName: string, type: type.Map, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class HeaderScalarParameter extends HttpParameterBase implements HeaderScalarParameter { constructor(name: string, headerName: string, type: HeaderScalarType, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class MultipartFormBodyParameter extends HttpParameterBase implements MultipartFormBodyParameter { constructor(name: string, type: type.WireType, style: ParameterStyle, byValue: boolean); } export declare class ParameterGroup implements ParameterGroup { constructor(name: string, groupName: string, required: boolean, location: ParameterLocation); } export declare class PartialBodyParameter extends HttpParameterBase implements PartialBodyParameter { constructor(name: string, serializedName: string, format: 'JSON' | 'XML', type: type.WireType, style: ParameterStyle, byValue: boolean); } export declare class PathCollectionParameter extends HttpParameterBase implements PathCollectionParameter { constructor(name: string, pathSegment: string, isEncoded: boolean, type: type.Slice, collectionFormat: CollectionFormat, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class PathScalarParameter extends HttpParameterBase implements PathScalarParameter { constructor(name: string, pathSegment: string, isEncoded: boolean, type: PathScalarParameterType, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class QueryCollectionParameter extends HttpParameterBase implements QueryCollectionParameter { constructor(name: string, queryParam: string, isEncoded: boolean, type: type.Slice, collectionFormat: ExtendedCollectionFormat, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class QueryScalarParameter extends HttpParameterBase implements QueryScalarParameter { constructor(name: string, queryParam: string, isEncoded: boolean, type: QueryScalarParameterType, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export declare class ResumeTokenParameter extends HttpParameterBase implements ResumeTokenParameter { constructor(); } export declare class URIParameter extends HttpParameterBase implements URIParameter { constructor(name: string, uriPathSegment: string, type: URIParameterType, style: ParameterStyle, byValue: boolean, location: ParameterLocation); } export {}; //# sourceMappingURL=param.d.ts.map