@typespec/http-client-java
Version:
TypeSpec library for emitting Java client from the TypeSpec REST protocol binding
46 lines • 2.3 kB
TypeScript
import { SdkClientType, SdkHttpOperation } from "@azure-tools/typespec-client-generator-core";
import { Program } from "@typespec/compiler";
import { Version } from "@typespec/versioning";
/**
* Gets the array of api-version on the TypeSpec service that contains this SDK client.
* `undefined` if the service is not versioned.
*
* @param program the program
* @param client the SDK client
* @returns the array of api-version on the TypeSpec service that contains this SDK client
*/
export declare function getServiceApiVersions(program: Program, client: SdkClientType<SdkHttpOperation>): Version[] | undefined;
/**
* Filter api-versions for "ServiceVersion".
* TODO(xiaofei) pending TCGC design: https://github.com/Azure/typespec-azure/issues/965
* We still cannot move to TCGC, due to it only recognizes api-versions from 1 service.
*
* @param pinnedApiVersion the api-version to use as filter base
* @param versions api-versions to filter
* @param excludePreview whether to exclude preview api-versions when pinnedApiVersion is stable, default is `true`
* @returns filtered api-versions
*/
export declare function getFilteredApiVersions(program: Program, pinnedApiVersion: string | undefined, versions: Version[], excludePreview?: boolean): Version[];
export declare function isStableApiVersionString(version: string): boolean;
/**
* Checks whether a version follows the YYYY-MM-DD(-preview) format.
* The "-preview" suffix is optional.
*
* @param version the version string to validate
* @returns true if the version follows the YYYY-MM-DD(-preview) format, false otherwise
*/
export declare function isVersionedByDate(version: string): boolean;
/**
* Compares two date-based versions to determine if the first version is earlier than the second.
* Assumes both versions have already passed isVersionedByDate validation.
*
* Comparison logic:
* 1. Compare by date (YYYY-MM-DD) first
* 2. If dates are equal, stable version is considered later than preview version
*
* @param version the version to check
* @param compareTo the version to compare against
* @returns true if version is earlier than compareTo, false otherwise
*/
export declare function isVersionEarlierThan(version: string, compareTo: string): boolean;
//# sourceMappingURL=versioning-utils.d.ts.map