@autorest/go
Version:
AutoRest Go Generator
127 lines • 6.35 kB
TypeScript
import * as go from '../../codemodel.go/src/index.js';
import { ImportManager } from './imports.js';
export declare const commentLength = 120;
export declare const dateFormat = "2006-01-02";
export declare const datetimeRFC3339Format = "time.RFC3339Nano";
export declare const datetimeRFC1123Format = "time.RFC1123";
export declare const timeRFC3339Format = "15:04:05.999999999Z07:00";
/**
* returns the common source-file preamble (license comment, package name etc)
*
* @param codeModel the code model being emitted
* @param doNotEdit when false the 'DO NOT EDIT' clause is omitted
* @param packageName overrides the package name in the code model
* @returns the source file preamble
*/
export declare function contentPreamble(codeModel: go.CodeModel, doNotEdit?: boolean, packageName?: string): string;
export declare function sortAscending(a: string, b: string): number;
export declare function formatParameterTypeName(param: go.ClientParameter | go.ParameterGroup, pkgName?: string): string;
export declare function parameterByValue(param: go.ClientParameter): boolean;
export declare function sortParametersByRequired(a: go.ClientParameter | go.ParameterGroup, b: go.ClientParameter | go.ParameterGroup): number;
export declare function getCreateRequestParametersSig(method: go.MethodType | go.NextPageMethod): string;
export declare function getCreateRequestParameters(method: go.MethodType): string;
export declare function getMethodParameters(method: go.MethodType | go.NextPageMethod, paramsFilter?: (p: Array<go.MethodParameter>) => Array<go.MethodParameter>): Array<go.MethodParameter | go.ParameterGroup>;
export declare function getParamName(param: go.MethodParameter): string;
export declare function formatBytesEncoding(enc: go.BytesEncoding): string;
export declare function formatParamValue(param: go.MethodParameter, imports: ImportManager): string;
export declare function getDelimiterForCollectionFormat(cf: go.CollectionFormat): string;
export declare function formatValue(paramName: string, type: go.WireType, imports: ImportManager, defef?: boolean): string;
export declare function formatLiteralValue(value: go.Literal, withCast: boolean): string;
export declare function hasSchemaResponse(method: go.MethodType): boolean;
export declare function getResultFieldName(method: go.MethodType): string;
export declare function formatStatusCodes(statusCodes: Array<number>): string;
export declare function formatStatusCode(statusCode: number): string;
export declare function formatCommentAsBulletItem(prefix: string, docs: go.Docs): string;
export declare function formatDocCommentWithPrefix(prefix: string, docs: go.Docs): string;
export declare function formatDocComment(docs: go.Docs): string;
export declare function getParentImport(codeModel: go.CodeModel): string;
export declare function getBitSizeForNumber(intSize: 'float32' | 'float64' | 'int8' | 'int16' | 'int32' | 'int64'): string;
export declare function recursiveUnwrapMapSlice(item: go.WireType): go.WireType;
export declare function star(param: go.MethodParameter): string;
export type SerDeFormat = 'JSON' | 'XML';
export declare function getSerDeFormat(model: go.Model | go.PolymorphicModel, codeModel: go.CodeModel): SerDeFormat;
export declare function getAllClientParameters(codeModel: go.CodeModel): Array<go.ClientParameter>;
export declare function getCommonClientParameters(codeModel: go.CodeModel): Array<go.ClientParameter>;
/**
* groups method parameters based on their kind.
* note that the body param kinds are mutually exclusive.
*/
export interface MethodParamGroups {
/** the body parameter if applicable */
bodyParam?: go.BodyParameter;
/** encoded query params. can be empty */
encodedQueryParams: Array<go.QueryParameter>;
/** form body params. can be empty */
formBodyParams: Array<go.FormBodyParameter>;
/** head params. can be empty */
headerParams: Array<go.HeaderParameter>;
/** multipart-form body params. can be empty */
multipartBodyParams: Array<go.MultipartFormBodyParameter>;
/** path params. can be empty */
pathParams: Array<go.PathParameter>;
/** partial body params. can be empty */
partialBodyParams: Array<go.PartialBodyParameter>;
/** unencoded query params. can be empty */
unencodedQueryParams: Array<go.QueryParameter>;
}
/**
* enumerates method parameters and returns them based on kinds
*
* @param method the method containing the parameters to group
* @returns the groups of parameters
*/
export declare function getMethodParamGroups(method: go.MethodType | go.NextPageMethod): MethodParamGroups;
/** helper for managing indentation levels */
export declare class indentation {
private level;
constructor(level?: number);
/**
* returns spaces for the current indentation level
*
* @returns a string with the current indentation level
*/
get(): string;
/**
* increments the indentation level
*
* @returns this indentation instance
*/
push(): indentation;
/**
* decrements the indentation level
*
* @returns this indentation instance
*/
pop(): indentation;
}
/** the if condition in an if block */
export interface ifBlock {
/** the condition in the if block */
condition: string;
/** the body of the if block */
body: (indent: indentation) => string;
}
/** the else condition in an if/else block */
export interface elseBlock {
/** the body of the else block */
body: (indent: indentation) => string;
}
/**
* constructs an if block (can expand to include else if as necessary)
*
* @param indent the current indentation helper in scope
* @param ifBlock the if block definition
* @param elseBlock optional else block definition
* @returns the text for the if block
*/
export declare function buildIfBlock(indent: indentation, ifBlock: ifBlock, elseBlock?: elseBlock): string;
/**
* constructs an "if err != nil { return something }" block
*
* @param indent the current indentation helper in scope
* @param errVar the name of the error variable used in the condition
* @param returns the value(s) to return from the control block
* @returns the text for the error check block
*/
export declare function buildErrCheck(indent: indentation, errVar: string, returns: string): string;
//# sourceMappingURL=helpers.d.ts.map