From 40a67144c145467e3b62b58ba2adb1b94bd7712a Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 25 Sep 2024 11:07:20 +0800 Subject: [PATCH 01/91] Normalize enum key name --- .../appconfiguration/src/models/index.ts | 8 +- .../swaggers/appconfiguration.json | 4 +- .../typespec-ts/src/modular/emitModels.ts | 4 +- packages/typespec-ts/src/utils/casingUtils.ts | 102 ++++++++++++++++++ 4 files changed, 114 insertions(+), 4 deletions(-) diff --git a/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts b/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts index 0302470563..550124ac22 100644 --- a/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts +++ b/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts @@ -220,6 +220,10 @@ export enum KnownGet6ItemsItem { Locked = "locked", /** Etag */ Etag = "etag", + /** UserSystem */ + UserSystem = "user, system", + /** UserXSystem */ + UserXSystem = "user x system ~", } /** @@ -234,7 +238,9 @@ export enum KnownGet6ItemsItem { * **last_modified** \ * **tags** \ * **locked** \ - * **etag** + * **etag** \ + * **user, system** \ + * **user x system ~** */ export type Get6ItemsItem = string; diff --git a/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json b/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json index f0a3cd6088..4982008675 100644 --- a/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json +++ b/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json @@ -191,7 +191,9 @@ "last_modified", "tags", "locked", - "etag" + "etag", + "user, system", + "user x system ~" ] }, "collectionFormat": "csv" diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 688ecd64d8..b6564767e4 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -19,7 +19,7 @@ import { buildOperationOptions } from "./buildOperations.js"; import { getDocsFromDescription } from "./helpers/docsHelpers.js"; import { getModularModelFilePath } from "./helpers/namingHelpers.js"; import { getType } from "./helpers/typeHelpers.js"; -import { toCamelCase } from "../utils/casingUtils.js"; +import { pascal, toCamelCase } from "../utils/casingUtils.js"; // ====== UTILITIES ====== @@ -201,7 +201,7 @@ export function buildModels( isExported: true, members: model.values?.map((v) => ({ - name: v.name, + name: pascal(v.name), value: v.value, docs: v.description ? [v.description] : [v.name] })) ?? [], diff --git a/packages/typespec-ts/src/utils/casingUtils.ts b/packages/typespec-ts/src/utils/casingUtils.ts index 7b67bfcfa3..d49e092758 100644 --- a/packages/typespec-ts/src/utils/casingUtils.ts +++ b/packages/typespec-ts/src/utils/casingUtils.ts @@ -46,3 +46,105 @@ export function toPascalCase(name: string): string { // Lowercase the first character return str.charAt(0).toUpperCase() + str.slice(1); } + +function IsFullyUpperCase(identifier: string, maxUppercasePreserve: number) { + const len = identifier.length; + if (len > 1) { + if ( + len <= maxUppercasePreserve && + identifier === identifier.toUpperCase() + ) { + return true; + } + + if (len <= maxUppercasePreserve + 1 && identifier.endsWith("s")) { + const i = identifier.substring(0, len - 1); + if (i.toUpperCase() === i) { + return true; + } + } + } + return false; +} + +function deconstruct( + identifier: string | Array, + maxUppercasePreserve: number +): Array { + return `${identifier}` + .replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar) + .replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123 => foo123 bar) + .replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, "$1$2« $3$4") // Add a space after a plural uppper cased word(e.g. MBsFoo => MBs Foo) + .replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, "$1 $2$3") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) + .replace(/«/g, "s") + .trim() + .split(/[\W|_]+/) + .map((each) => + IsFullyUpperCase(each, maxUppercasePreserve) ? each : each.toLowerCase() + ); +} + +function isEqual(s1: string, s2: string): boolean { + // when s2 is undefined and s1 is the string 'undefined', it returns 0, making this true. + // To prevent that, first we need to check if s2 is undefined. + return ( + s2 !== undefined && + !!s1 && + !s1.localeCompare(s2, undefined, { sensitivity: "base" }) + ); +} + +function removeSequentialDuplicates(identifier: Iterable) { + const ids = [...identifier].filter((each) => !!each); + for (let i = 0; i < ids.length; i++) { + while (isEqual(ids[i]!, ids[i - 1]!)) { + ids.splice(i, 1); + } + while (isEqual(ids[i]!, ids[i - 2]!) && isEqual(ids[i + 1]!, ids[i - 1]!)) { + ids.splice(i, 2); + } + } + + return ids; +} +function applyFormat( + normalizedContent: Array, + overrides: Record = {}, + separator = "", + formatter: (s: string, i: number) => string = (s) => s +) { + return normalizedContent + .map( + (each, index) => overrides[each.toLowerCase()] || formatter(each, index) + ) + .join(separator); +} + +function normalize( + identifier: string | Array, + removeDuplicates = true, + maxUppercasePreserve = 0 +): Array { + if (!identifier || identifier.length === 0) { + return [""]; + } + return typeof identifier === "string" + ? normalize( + deconstruct(identifier, maxUppercasePreserve), + removeDuplicates, + maxUppercasePreserve + ) + : removeDuplicates + ? removeSequentialDuplicates(identifier) + : identifier; +} + +export function pascal(name: string) { + const words = normalize(deconstruct(name, 6), false, 6); + const form = applyFormat(words, {}, "", (each) => capitalize(each)); + return form; +} + +function capitalize(s: string): string { + return s ? `${s.charAt(0).toUpperCase()}${s.slice(1)}` : s; +} From 3bd2ec2a9e4cf976935ba7113a1eceb1a29a719c Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 25 Sep 2024 11:12:39 +0800 Subject: [PATCH 02/91] Update the enum name --- .../generated/typespec-ts/src/models/models.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts index 622aefdb1c..6c33f896a9 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts @@ -854,11 +854,11 @@ export interface OperationDisplay { /** Known values of {@link Origin} that the service accepts. */ export enum KnownOrigin { /** user */ - user = "user", + User = "user", /** system */ - system = "system", + System = "system", /** user,system */ - "user,system" = "user,system", + UserSystem = "user,system", } /** From 740f6eead020a7967e3e3792669bf6f55cb7f012 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 23 Oct 2024 14:39:13 +0800 Subject: [PATCH 03/91] Merge to the latest main --- .../typespec-ts/src/models/models.ts | 1007 +++++++++++++---- 1 file changed, 786 insertions(+), 221 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts index 6c33f896a9..77cc9ef549 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts @@ -1,81 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { serializeRecord } from "../helpers/serializerHelpers.js"; - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ - readonly id?: string; - /** The name of the resource */ - readonly name?: string; - /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ - readonly type?: string; - /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - readonly systemData?: SystemData; -} - -export function resourceSerializer(item: Resource) { - return item as any; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", -} - -/** - * The kind of entity that created the resource. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: Record; - /** The geo-location where the resource lives */ - location: string; -} - -export function trackedResourceSerializer( - item: TrackedResource, -): Record { - return { - tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), - location: item["location"], - }; -} - /** The data product resource. */ export interface DataProduct extends TrackedResource { /** The resource-specific properties for this resource. */ @@ -84,18 +9,35 @@ export interface DataProduct extends TrackedResource { identity?: ManagedServiceIdentityV4; } -export function dataProductSerializer( - item: DataProduct, -): Record { +export function dataProductSerializer(item: DataProduct): any { return { - tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), + tags: item["tags"], location: item["location"], - properties: !item.properties - ? item.properties - : dataProductPropertiesSerializer(item.properties), - identity: !item.identity - ? item.identity - : managedServiceIdentityV4Serializer(item.identity), + properties: !item["properties"] + ? item["properties"] + : dataProductPropertiesSerializer(item["properties"]), + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentityV4Serializer(item["identity"]), + }; +} + +export function dataProductDeserializer(item: any): DataProduct { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : dataProductPropertiesDeserializer(item["properties"]), + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentityV4Deserializer(item["identity"]), }; } @@ -145,12 +87,16 @@ export interface DataProductProperties { export function dataProductPropertiesSerializer( item: DataProductProperties, -): Record { +): any { return { publisher: item["publisher"], product: item["product"], majorVersion: item["majorVersion"], - owners: item["owners"], + owners: !item["owners"] + ? item["owners"] + : item["owners"].map((p: any) => { + return p; + }), redundancy: item["redundancy"], purviewAccount: item["purviewAccount"], purviewCollection: item["purviewCollection"], @@ -158,36 +104,88 @@ export function dataProductPropertiesSerializer( publicNetworkAccess: item["publicNetworkAccess"], customerManagedKeyEncryptionEnabled: item["customerManagedKeyEncryptionEnabled"], - customerEncryptionKey: !item.customerEncryptionKey - ? item.customerEncryptionKey - : encryptionKeyDetailsSerializer(item.customerEncryptionKey), - networkacls: !item.networkacls - ? item.networkacls - : dataProductNetworkAclsSerializer(item.networkacls), - managedResourceGroupConfiguration: !item.managedResourceGroupConfiguration - ? item.managedResourceGroupConfiguration + customerEncryptionKey: !item["customerEncryptionKey"] + ? item["customerEncryptionKey"] + : encryptionKeyDetailsSerializer(item["customerEncryptionKey"]), + networkacls: !item["networkacls"] + ? item["networkacls"] + : dataProductNetworkAclsSerializer(item["networkacls"]), + managedResourceGroupConfiguration: !item[ + "managedResourceGroupConfiguration" + ] + ? item["managedResourceGroupConfiguration"] : managedResourceGroupConfigurationSerializer( - item.managedResourceGroupConfiguration, + item["managedResourceGroupConfiguration"], ), currentMinorVersion: item["currentMinorVersion"], }; } -/** Known values of {@link ProvisioningState} that the service accepts. */ +export function dataProductPropertiesDeserializer( + item: any, +): DataProductProperties { + return { + resourceGuid: item["resourceGuid"], + provisioningState: item["provisioningState"], + publisher: item["publisher"], + product: item["product"], + majorVersion: item["majorVersion"], + owners: !item["owners"] + ? item["owners"] + : item["owners"].map((p: any) => { + return p; + }), + redundancy: item["redundancy"], + purviewAccount: item["purviewAccount"], + purviewCollection: item["purviewCollection"], + privateLinksEnabled: item["privateLinksEnabled"], + publicNetworkAccess: item["publicNetworkAccess"], + customerManagedKeyEncryptionEnabled: + item["customerManagedKeyEncryptionEnabled"], + customerEncryptionKey: !item["customerEncryptionKey"] + ? item["customerEncryptionKey"] + : encryptionKeyDetailsDeserializer(item["customerEncryptionKey"]), + networkacls: !item["networkacls"] + ? item["networkacls"] + : dataProductNetworkAclsDeserializer(item["networkacls"]), + managedResourceGroupConfiguration: !item[ + "managedResourceGroupConfiguration" + ] + ? item["managedResourceGroupConfiguration"] + : managedResourceGroupConfigurationDeserializer( + item["managedResourceGroupConfiguration"], + ), + availableMinorVersions: !item["availableMinorVersions"] + ? item["availableMinorVersions"] + : item["availableMinorVersions"].map((p: any) => { + return p; + }), + currentMinorVersion: item["currentMinorVersion"], + documentation: item["documentation"], + consumptionEndpoints: !item["consumptionEndpoints"] + ? item["consumptionEndpoints"] + : consumptionEndpointsPropertiesDeserializer( + item["consumptionEndpoints"], + ), + keyVaultUrl: item["keyVaultUrl"], + }; +} + +/** The status of the current operation. */ export enum KnownProvisioningState { - /** Succeeded */ + /** Represents a succeeded operation. */ Succeeded = "Succeeded", - /** Failed */ + /** Represents a failed operation. */ Failed = "Failed", - /** Canceled */ + /** Represents a canceled operation. */ Canceled = "Canceled", - /** Provisioning */ + /** Represents a pending operation. */ Provisioning = "Provisioning", - /** Updating */ + /** Represents a pending operation. */ Updating = "Updating", - /** Deleting */ + /** Represents an operation under deletion. */ Deleting = "Deleting", - /** Accepted */ + /** Represents an accepted operation. */ Accepted = "Accepted", } @@ -196,21 +194,21 @@ export enum KnownProvisioningState { * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Succeeded** \ - * **Failed** \ - * **Canceled** \ - * **Provisioning** \ - * **Updating** \ - * **Deleting** \ - * **Accepted** + * **Succeeded**: Represents a succeeded operation. \ + * **Failed**: Represents a failed operation. \ + * **Canceled**: Represents a canceled operation. \ + * **Provisioning**: Represents a pending operation. \ + * **Updating**: Represents a pending operation. \ + * **Deleting**: Represents an operation under deletion. \ + * **Accepted**: Represents an accepted operation. */ export type ProvisioningState = string; -/** Known values of {@link ControlState} that the service accepts. */ +/** The data type state */ export enum KnownControlState { - /** Enabled */ + /** Field to enable a setting. */ Enabled = "Enabled", - /** Disabled */ + /** Field to disable a setting. */ Disabled = "Disabled", } @@ -219,8 +217,8 @@ export enum KnownControlState { * {@link KnownControlState} can be used interchangeably with ControlState, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Enabled** \ - * **Disabled** + * **Enabled**: Field to enable a setting. \ + * **Disabled**: Field to disable a setting. */ export type ControlState = string; @@ -236,7 +234,17 @@ export interface EncryptionKeyDetails { export function encryptionKeyDetailsSerializer( item: EncryptionKeyDetails, -): Record { +): any { + return { + keyVaultUri: item["keyVaultUri"], + keyName: item["keyName"], + keyVersion: item["keyVersion"], + }; +} + +export function encryptionKeyDetailsDeserializer( + item: any, +): EncryptionKeyDetails { return { keyVaultUri: item["keyVaultUri"], keyName: item["keyName"], @@ -258,13 +266,30 @@ export interface DataProductNetworkAcls { export function dataProductNetworkAclsSerializer( item: DataProductNetworkAcls, -): Record { +): any { return { - virtualNetworkRule: item["virtualNetworkRule"].map( - virtualNetworkRuleSerializer, + virtualNetworkRule: virtualNetworkRuleArraySerializer( + item["virtualNetworkRule"], ), - ipRules: item["ipRules"].map(iPRulesSerializer), - allowedQueryIpRangeList: item["allowedQueryIpRangeList"], + ipRules: iPRulesArraySerializer(item["ipRules"]), + allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { + return p; + }), + defaultAction: item["defaultAction"], + }; +} + +export function dataProductNetworkAclsDeserializer( + item: any, +): DataProductNetworkAcls { + return { + virtualNetworkRule: virtualNetworkRuleArrayDeserializer( + item["virtualNetworkRule"], + ), + ipRules: iPRulesArrayDeserializer(item["ipRules"]), + allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { + return p; + }), defaultAction: item["defaultAction"], }; } @@ -279,9 +304,11 @@ export interface VirtualNetworkRule { state?: string; } -export function virtualNetworkRuleSerializer( - item: VirtualNetworkRule, -): Record { +export function virtualNetworkRuleSerializer(item: VirtualNetworkRule): any { + return { id: item["id"], action: item["action"], state: item["state"] }; +} + +export function virtualNetworkRuleDeserializer(item: any): VirtualNetworkRule { return { id: item["id"], action: item["action"], @@ -289,6 +316,22 @@ export function virtualNetworkRuleSerializer( }; } +export function virtualNetworkRuleArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return virtualNetworkRuleSerializer(item); + }); +} + +export function virtualNetworkRuleArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return virtualNetworkRuleDeserializer(item); + }); +} + /** IP rule with specific IP or IP range in CIDR format. */ export interface IPRules { /** IP Rules Value */ @@ -297,18 +340,34 @@ export interface IPRules { action: string; } -export function iPRulesSerializer(item: IPRules): Record { +export function iPRulesSerializer(item: IPRules): any { + return { value: item["value"], action: item["action"] }; +} + +export function iPRulesDeserializer(item: any): IPRules { return { value: item["value"], action: item["action"], }; } -/** Known values of {@link DefaultAction} that the service accepts. */ +export function iPRulesArraySerializer(result: Array): any[] { + return result.map((item) => { + return iPRulesSerializer(item); + }); +} + +export function iPRulesArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return iPRulesDeserializer(item); + }); +} + +/** Specifies the default action of allow or deny when no other rules match. */ export enum KnownDefaultAction { - /** Allow */ + /** Represents allow action. */ Allow = "Allow", - /** Deny */ + /** Represents deny action. */ Deny = "Deny", } @@ -317,8 +376,8 @@ export enum KnownDefaultAction { * {@link KnownDefaultAction} can be used interchangeably with DefaultAction, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Allow** \ - * **Deny** + * **Allow**: Represents allow action. \ + * **Deny**: Represents deny action. */ export type DefaultAction = string; @@ -332,7 +391,13 @@ export interface ManagedResourceGroupConfiguration { export function managedResourceGroupConfigurationSerializer( item: ManagedResourceGroupConfiguration, -): Record { +): any { + return { name: item["name"], location: item["location"] }; +} + +export function managedResourceGroupConfigurationDeserializer( + item: any, +): ManagedResourceGroupConfiguration { return { name: item["name"], location: item["location"], @@ -355,6 +420,19 @@ export interface ConsumptionEndpointsProperties { readonly queryResourceId?: string; } +export function consumptionEndpointsPropertiesDeserializer( + item: any, +): ConsumptionEndpointsProperties { + return { + ingestionUrl: item["ingestionUrl"], + ingestionResourceId: item["ingestionResourceId"], + fileAccessUrl: item["fileAccessUrl"], + fileAccessResourceId: item["fileAccessResourceId"], + queryUrl: item["queryUrl"], + queryResourceId: item["queryResourceId"], + }; +} + /** Managed service identity (system assigned and/or user assigned identities) */ export interface ManagedServiceIdentityV4 { /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ @@ -369,27 +447,37 @@ export interface ManagedServiceIdentityV4 { export function managedServiceIdentityV4Serializer( item: ManagedServiceIdentityV4, -): Record { +): any { return { type: item["type"], - userAssignedIdentities: !item.userAssignedIdentities - ? item.userAssignedIdentities - : (serializeRecord( - item.userAssignedIdentities as any, - userAssignedIdentitySerializer, - ) as any), + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentityRecordSerializer(item["userAssignedIdentities"]), + }; +} + +export function managedServiceIdentityV4Deserializer( + item: any, +): ManagedServiceIdentityV4 { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentityRecordDeserializer(item["userAssignedIdentities"]), }; } -/** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ export enum KnownManagedServiceIdentityType { - /** None */ + /** No managed identity. */ None = "None", - /** SystemAssigned */ + /** System assigned managed identity. */ SystemAssigned = "SystemAssigned", - /** UserAssigned */ + /** User assigned managed identity. */ UserAssigned = "UserAssigned", - /** SystemAndUserAssigned */ + /** System and user assigned managed identity. */ SystemAndUserAssigned = "SystemAssigned, UserAssigned", } @@ -398,10 +486,10 @@ export enum KnownManagedServiceIdentityType { * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **None** \ - * **SystemAssigned** \ - * **UserAssigned** \ - * **SystemAssigned, UserAssigned** + * **None**: No managed identity. \ + * **SystemAssigned**: System assigned managed identity. \ + * **UserAssigned**: User assigned managed identity. \ + * **SystemAssigned, UserAssigned**: System and user assigned managed identity. */ export type ManagedServiceIdentityType = string; @@ -413,16 +501,166 @@ export interface UserAssignedIdentity { readonly clientId?: string; } -export function userAssignedIdentitySerializer(item: UserAssignedIdentity) { - return item as any; +export function userAssignedIdentitySerializer( + item: UserAssignedIdentity, +): any { + return item; +} + +export function userAssignedIdentityDeserializer( + item: any, +): UserAssignedIdentity { + return { + principalId: item["principalId"], + clientId: item["clientId"], + }; +} + +export function userAssignedIdentityRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : userAssignedIdentitySerializer(item[key]); + }); + return result; +} + +export function userAssignedIdentityRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : userAssignedIdentityDeserializer(item[key]); + }); + return result; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] + ? item["createdAt"] + : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; } +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + /** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ export interface ErrorResponse { /** The error object. */ error?: ErrorDetail; } +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] + ? item["error"] + : errorDetailDeserializer(item["error"]), + }; +} + /** The error detail. */ export interface ErrorDetail { /** The error code. */ @@ -437,6 +675,28 @@ export interface ErrorDetail { readonly additionalInfo?: ErrorAdditionalInfo[]; } +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] + ? item["details"] + : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + /** The resource management error additional info. */ export interface ErrorAdditionalInfo { /** The additional info type. */ @@ -445,6 +705,34 @@ export interface ErrorAdditionalInfo { readonly info?: Record; } +export function errorAdditionalInfoDeserializer( + item: any, +): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] + ? item["info"] + : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer( + item: any, +): _ErrorAdditionalInfoInfo { + return item; +} + +export function errorAdditionalInfoArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + /** The type used for update operations of the DataProduct. */ export interface DataProductUpdate { /** The managed service identities assigned to this resource. */ @@ -455,17 +743,15 @@ export interface DataProductUpdate { properties?: DataProductUpdateProperties; } -export function dataProductUpdateSerializer( - item: DataProductUpdate, -): Record { +export function dataProductUpdateSerializer(item: DataProductUpdate): any { return { - identity: !item.identity - ? item.identity - : managedServiceIdentityV4Serializer(item.identity), - tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), - properties: !item.properties - ? item.properties - : dataProductUpdatePropertiesSerializer(item.properties), + identity: !item["identity"] + ? item["identity"] + : managedServiceIdentityV4Serializer(item["identity"]), + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : dataProductUpdatePropertiesSerializer(item["properties"]), }; } @@ -485,9 +771,13 @@ export interface DataProductUpdateProperties { export function dataProductUpdatePropertiesSerializer( item: DataProductUpdateProperties, -): Record { +): any { return { - owners: item["owners"], + owners: !item["owners"] + ? item["owners"] + : item["owners"].map((p: any) => { + return p; + }), purviewAccount: item["purviewAccount"], purviewCollection: item["purviewCollection"], privateLinksEnabled: item["privateLinksEnabled"], @@ -505,9 +795,7 @@ export interface AccountSas { ipAddress: string; } -export function accountSasSerializer( - item: AccountSas, -): Record { +export function accountSasSerializer(item: AccountSas): any { return { startTimeStamp: item["startTimeStamp"].toISOString(), expiryTimeStamp: item["expiryTimeStamp"].toISOString(), @@ -521,18 +809,20 @@ export interface AccountSasToken { storageAccountSasToken: string; } +export function accountSasTokenDeserializer(item: any): AccountSasToken { + return { + storageAccountSasToken: item["storageAccountSasToken"], + }; +} + /** Details for KeyVault. */ export interface KeyVaultInfo { /** key vault url. */ keyVaultUrl: string; } -export function keyVaultInfoSerializer( - item: KeyVaultInfo, -): Record { - return { - keyVaultUrl: item["keyVaultUrl"], - }; +export function keyVaultInfoSerializer(item: KeyVaultInfo): any { + return { keyVaultUrl: item["keyVaultUrl"] }; } /** The details for role assignment common properties. */ @@ -553,22 +843,27 @@ export interface RoleAssignmentCommonProperties { export function roleAssignmentCommonPropertiesSerializer( item: RoleAssignmentCommonProperties, -): Record { +): any { return { roleId: item["roleId"], principalId: item["principalId"], userName: item["userName"], - dataTypeScope: item["dataTypeScope"], + dataTypeScope: item["dataTypeScope"].map((p: any) => { + return p; + }), principalType: item["principalType"], role: item["role"], }; } -/** Known values of {@link DataProductUserRole} that the service accepts. */ +/** The data type state */ export enum KnownDataProductUserRole { - /** Reader */ + /** Field to specify user of type Reader. */ Reader = "Reader", - /** SensitiveReader */ + /** + * Field to specify user of type SensitiveReader. + * This user has privileged access to read sensitive data of a data product. + */ SensitiveReader = "SensitiveReader", } @@ -577,8 +872,9 @@ export enum KnownDataProductUserRole { * {@link KnownDataProductUserRole} can be used interchangeably with DataProductUserRole, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Reader** \ - * **SensitiveReader** + * **Reader**: Field to specify user of type Reader. \ + * **SensitiveReader**: Field to specify user of type SensitiveReader. + * This user has privileged access to read sensitive data of a data product. */ export type DataProductUserRole = string; @@ -602,18 +898,45 @@ export interface RoleAssignmentDetail { export function roleAssignmentDetailSerializer( item: RoleAssignmentDetail, -): Record { +): any { + return { + roleId: item["roleId"], + principalId: item["principalId"], + userName: item["userName"], + dataTypeScope: item["dataTypeScope"].map((p: any) => { + return p; + }), + principalType: item["principalType"], + role: item["role"], + roleAssignmentId: item["roleAssignmentId"], + }; +} + +export function roleAssignmentDetailDeserializer( + item: any, +): RoleAssignmentDetail { return { roleId: item["roleId"], principalId: item["principalId"], userName: item["userName"], - dataTypeScope: item["dataTypeScope"], + dataTypeScope: item["dataTypeScope"].map((p: any) => { + return p; + }), principalType: item["principalType"], role: item["role"], roleAssignmentId: item["roleAssignmentId"], }; } +/** model interface _ListRolesAssignmentsRequest */ +export interface _ListRolesAssignmentsRequest {} + +export function _listRolesAssignmentsRequestSerializer( + item: _ListRolesAssignmentsRequest, +): any { + return item; +} + /** list role assignments. */ export interface ListRoleAssignments { /** Count of role assignments. */ @@ -622,6 +945,33 @@ export interface ListRoleAssignments { roleAssignmentResponse: RoleAssignmentDetail[]; } +export function listRoleAssignmentsDeserializer( + item: any, +): ListRoleAssignments { + return { + count: item["count"], + roleAssignmentResponse: roleAssignmentDetailArrayDeserializer( + item["roleAssignmentResponse"], + ), + }; +} + +export function roleAssignmentDetailArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return roleAssignmentDetailSerializer(item); + }); +} + +export function roleAssignmentDetailArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return roleAssignmentDetailDeserializer(item); + }); +} + /** The response of a DataProduct list operation. */ export interface _DataProductListResult { /** The DataProduct items on this page */ @@ -630,11 +980,27 @@ export interface _DataProductListResult { nextLink?: string; } -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} +export function _dataProductListResultDeserializer( + item: any, +): _DataProductListResult { + return { + value: dataProductArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function dataProductArraySerializer(result: Array): any[] { + return result.map((item) => { + return dataProductSerializer(item); + }); +} -export function proxyResourceSerializer(item: ProxyResource) { - return item as any; +export function dataProductArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return dataProductDeserializer(item); + }); } /** The data type resource. */ @@ -643,11 +1009,25 @@ export interface DataType extends ProxyResource { properties?: DataTypeProperties; } -export function dataTypeSerializer(item: DataType): Record { +export function dataTypeSerializer(item: DataType): any { return { - properties: !item.properties - ? item.properties - : dataTypePropertiesSerializer(item.properties), + properties: !item["properties"] + ? item["properties"] + : dataTypePropertiesSerializer(item["properties"]), + }; +} + +export function dataTypeDeserializer(item: any): DataType { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : dataTypePropertiesDeserializer(item["properties"]), }; } @@ -669,9 +1049,7 @@ export interface DataTypeProperties { readonly visualizationUrl?: string; } -export function dataTypePropertiesSerializer( - item: DataTypeProperties, -): Record { +export function dataTypePropertiesSerializer(item: DataTypeProperties): any { return { state: item["state"], storageOutputRetention: item["storageOutputRetention"], @@ -680,11 +1058,23 @@ export function dataTypePropertiesSerializer( }; } -/** Known values of {@link DataTypeState} that the service accepts. */ +export function dataTypePropertiesDeserializer(item: any): DataTypeProperties { + return { + provisioningState: item["provisioningState"], + state: item["state"], + stateReason: item["stateReason"], + storageOutputRetention: item["storageOutputRetention"], + databaseCacheRetention: item["databaseCacheRetention"], + databaseRetention: item["databaseRetention"], + visualizationUrl: item["visualizationUrl"], + }; +} + +/** The data type state */ export enum KnownDataTypeState { - /** Stopped */ + /** Field to specify stopped state. */ Stopped = "Stopped", - /** Running */ + /** Field to specify running state. */ Running = "Running", } @@ -693,24 +1083,40 @@ export enum KnownDataTypeState { * {@link KnownDataTypeState} can be used interchangeably with DataTypeState, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Stopped** \ - * **Running** + * **Stopped**: Field to specify stopped state. \ + * **Running**: Field to specify running state. */ export type DataTypeState = string; +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + /** The type used for update operations of the DataType. */ export interface DataTypeUpdate { /** The resource-specific properties for this resource. */ properties?: DataTypeUpdateProperties; } -export function dataTypeUpdateSerializer( - item: DataTypeUpdate, -): Record { +export function dataTypeUpdateSerializer(item: DataTypeUpdate): any { return { - properties: !item.properties - ? item.properties - : dataTypeUpdatePropertiesSerializer(item.properties), + properties: !item["properties"] + ? item["properties"] + : dataTypeUpdatePropertiesSerializer(item["properties"]), }; } @@ -728,7 +1134,7 @@ export interface DataTypeUpdateProperties { export function dataTypeUpdatePropertiesSerializer( item: DataTypeUpdateProperties, -): Record { +): any { return { state: item["state"], storageOutputRetention: item["storageOutputRetention"], @@ -737,6 +1143,13 @@ export function dataTypeUpdatePropertiesSerializer( }; } +/** model interface _DeleteDataRequest */ +export interface _DeleteDataRequest {} + +export function _deleteDataRequestSerializer(item: _DeleteDataRequest): any { + return item; +} + /** The details for container sas creation. */ export interface ContainerSaS { /** Sas token start timestamp. */ @@ -747,9 +1160,7 @@ export interface ContainerSaS { ipAddress: string; } -export function containerSaSSerializer( - item: ContainerSaS, -): Record { +export function containerSaSSerializer(item: ContainerSaS): any { return { startTimeStamp: item["startTimeStamp"].toISOString(), expiryTimeStamp: item["expiryTimeStamp"].toISOString(), @@ -763,6 +1174,12 @@ export interface ContainerSasToken { storageContainerSasToken: string; } +export function containerSasTokenDeserializer(item: any): ContainerSasToken { + return { + storageContainerSasToken: item["storageContainerSasToken"], + }; +} + /** The response of a DataType list operation. */ export interface _DataTypeListResult { /** The DataType items on this page */ @@ -771,12 +1188,49 @@ export interface _DataTypeListResult { nextLink?: string; } +export function _dataTypeListResultDeserializer( + item: any, +): _DataTypeListResult { + return { + value: dataTypeArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function dataTypeArraySerializer(result: Array): any[] { + return result.map((item) => { + return dataTypeSerializer(item); + }); +} + +export function dataTypeArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return dataTypeDeserializer(item); + }); +} + /** The data catalog resource. */ export interface DataProductsCatalog extends ProxyResource { /** The resource-specific properties for this resource. */ properties?: DataProductsCatalogProperties; } +export function dataProductsCatalogDeserializer( + item: any, +): DataProductsCatalog { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : dataProductsCatalogPropertiesDeserializer(item["properties"]), + }; +} + /** Details for data catalog properties. */ export interface DataProductsCatalogProperties { /** The data catalog provisioning state. */ @@ -785,6 +1239,15 @@ export interface DataProductsCatalogProperties { publishers: PublisherInformation[]; } +export function dataProductsCatalogPropertiesDeserializer( + item: any, +): DataProductsCatalogProperties { + return { + provisioningState: item["provisioningState"], + publishers: publisherInformationArrayDeserializer(item["publishers"]), + }; +} + /** Details for Publisher Information. */ export interface PublisherInformation { /** Name of the publisher. */ @@ -793,6 +1256,15 @@ export interface PublisherInformation { dataProducts: DataProductInformation[]; } +export function publisherInformationDeserializer( + item: any, +): PublisherInformation { + return { + publisherName: item["publisherName"], + dataProducts: dataProductInformationArrayDeserializer(item["dataProducts"]), + }; +} + /** Data Product Information */ export interface DataProductInformation { /** Name of data product. */ @@ -803,12 +1275,54 @@ export interface DataProductInformation { dataProductVersions: DataProductVersion[]; } +export function dataProductInformationDeserializer( + item: any, +): DataProductInformation { + return { + dataProductName: item["dataProductName"], + description: item["description"], + dataProductVersions: dataProductVersionArrayDeserializer( + item["dataProductVersions"], + ), + }; +} + /** Data Product Version. */ export interface DataProductVersion { /** Version of data product */ version: string; } +export function dataProductVersionDeserializer(item: any): DataProductVersion { + return { + version: item["version"], + }; +} + +export function dataProductVersionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return dataProductVersionDeserializer(item); + }); +} + +export function dataProductInformationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return dataProductInformationDeserializer(item); + }); +} + +export function publisherInformationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return publisherInformationDeserializer(item); + }); +} + /** The response of a DataProductsCatalog list operation. */ export interface _DataProductsCatalogListResult { /** The DataProductsCatalog items on this page */ @@ -817,6 +1331,23 @@ export interface _DataProductsCatalogListResult { nextLink?: string; } +export function _dataProductsCatalogListResultDeserializer( + item: any, +): _DataProductsCatalogListResult { + return { + value: dataProductsCatalogArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function dataProductsCatalogArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return dataProductsCatalogDeserializer(item); + }); +} + /** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ export interface _OperationListResult { /** The Operation items on this page */ @@ -825,6 +1356,15 @@ export interface _OperationListResult { nextLink?: string; } +export function _operationListResultDeserializer( + item: any, +): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + /** Details of a REST API operation, returned from the Resource Provider Operations API */ export interface Operation { /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ @@ -839,6 +1379,18 @@ export interface Operation { actionType?: ActionType; } +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] + ? item["display"] + : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + /** Localized display information for and operation. */ export interface OperationDisplay { /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ @@ -851,14 +1403,23 @@ export interface OperationDisplay { readonly description?: string; } -/** Known values of {@link Origin} that the service accepts. */ +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ export enum KnownOrigin { - /** user */ - User = "user", - /** system */ - System = "system", - /** user,system */ - UserSystem = "user,system", + /** Indicates the operation is initiated by a user. */ + user = "user", + /** Indicates the operation is initiated by a system. */ + system = "system", + /** Indicates the operation is initiated by a user or system. */ + "user,system" = "user,system", } /** @@ -866,15 +1427,15 @@ export enum KnownOrigin { * {@link KnownOrigin} can be used interchangeably with Origin, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **user** \ - * **system** \ - * **user,system** + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. */ export type Origin = string; -/** Known values of {@link ActionType} that the service accepts. */ +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ export enum KnownActionType { - /** Internal */ + /** Actions are for internal-only APIs. */ Internal = "Internal", } @@ -883,8 +1444,12 @@ export enum KnownActionType { * {@link KnownActionType} can be used interchangeably with ActionType, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Internal** + * **Internal**: Actions are for internal-only APIs. */ export type ActionType = string; -/** The available API versions for the Microsoft.NetworkAnalytics RP. */ -export type Versions = "2023-11-15"; + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} From 8b92d22ddee489913d5e9ec1294185f425e55f37 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 23 Oct 2024 14:50:47 +0800 Subject: [PATCH 04/91] Update the enum key after merging to main --- .../generated/typespec-ts/src/models/models.ts | 6 +++--- packages/typespec-ts/src/modular/emitModels.ts | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts index 77cc9ef549..803e2d74ff 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts @@ -1415,11 +1415,11 @@ export function operationDisplayDeserializer(item: any): OperationDisplay { /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ export enum KnownOrigin { /** Indicates the operation is initiated by a user. */ - user = "user", + User = "user", /** Indicates the operation is initiated by a system. */ - system = "system", + System = "system", /** Indicates the operation is initiated by a user or system. */ - "user,system" = "user,system", + UserSystem = "user,system", } /** diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 2786c733ef..da3bffc08d 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -37,10 +37,6 @@ import { addImportBySymbol } from "../utils/importHelper.js"; import { buildModelDeserializer } from "./serialization/buildDeserializerFunction.js"; import { buildModelSerializer } from "./serialization/buildSerializerFunction.js"; import { extractPagedMetadataNested } from "../utils/operationUtil.js"; -import { - getTypeExpression, - normalizeModelPropertyName -import { pascal, toCamelCase } from "../utils/casingUtils.js"; import path from "path"; import { refkey } from "../framework/refkey.js"; import { useContext } from "../contextManager.js"; @@ -53,6 +49,8 @@ import { isExtensibleEnum } from "./type-expressions/get-enum-expression.js"; import { isDiscriminatedUnion } from "./serialization/serializeUtils.js"; import { reportDiagnostic } from "../lib.js"; import { NoTarget } from "@typespec/compiler"; +import { getTypeExpression, normalizeModelPropertyName } from "./type-expressions/get-type-expression.js"; +import { pascal } from "../utils/casingUtils.js"; type InterfaceStructure = OptionalKind & { extends?: string[]; @@ -194,7 +192,6 @@ export function emitTypes( export function getModelsPath(sourceRoot: string): string { return path.join(...[sourceRoot, "models", `models.ts`]); - name: pascal(v.name), } function addSerializationFunctions( @@ -312,7 +309,7 @@ function getExtensibleEnumDescription(model: SdkEnumType): string | undefined { function emitEnumMember(member: SdkEnumValueType): EnumMemberStructure { const memberStructure: EnumMemberStructure = { kind: StructureKind.EnumMember, - name: member.name, + name: pascal(member.name), value: member.value }; From e5b97f3b2ccb4ded2f6e5b5a7cd1cdfbede30b13 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 23 Oct 2024 14:52:54 +0800 Subject: [PATCH 05/91] Update the api view --- .../typespec-ts/review/arm-networkanalytics.api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md index a8c9a0a0d4..6a0b680bba 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md @@ -385,9 +385,9 @@ export enum KnownManagedServiceIdentityType { // @public export enum KnownOrigin { - "user,system" = "user,system", - system = "system", - user = "user" + System = "system", + User = "user", + UserSystem = "user,system" } // @public From 849eec15dc84fa26b585c195f47e9e7201acef79 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 24 Oct 2024 11:09:27 +0800 Subject: [PATCH 06/91] Update the UT cases --- .../models/serialization/enumKeyNorm.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md new file mode 100644 index 0000000000..a83d5f83d7 --- /dev/null +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -0,0 +1,99 @@ +# Should generate enum key normalization cases + +## TypeSpec + +This is tsp definition. + +```tsp +union ExtensibleString { + pascal: "pascal", + pascalCase: "pascalCase", + PascalCase: PascalCase, + pascalcase: "pascalcase", + Pascalcase: "Pascalcase", + pascal_case_: "pascal_case_", + pascal_case: "pascal_case", + _pascal_case: "_pascal_case", + `pascal, case`: "pascal, case", + MAX_of_MLD: "MAX_of_MLD", + ___pascal____case6666: "___pascal____case6666", + _10Pascal: "_10Pascal", + `090`: "090", + `10`: "10", + `1.0`: "1.0", + `-1.0`: "-1.0", + string, +} + + +union ExtensibleNumber { + "One": 1, + "2": 2, + "-2.1": -2.1, + int8 +} +model Foo { + extensibleString: ExtensibleString; + extensibleNumber: ExtensibleNumber; +} +op post(@body body: Foo): void; +``` + +This is the tspconfig.yaml. + +```yaml +experimentalExtensibleEnums: true +``` + +## Provide generated models and its serializer + +Generated Models. + +```ts models +/** model interface Foo */ +export interface Foo { + extensibleString: ExtensibleString; + extensibleNumber: ExtensibleNumber; +} + +export function fooSerializer(item: Foo): any { + return { + extensibleString: item["extensibleString"], + extensibleNumber: item["extensibleNumber"] + }; +} + +/** Known values of {@link ExtensibleString} that the service accepts. */ +export enum KnownExtensibleString { + Pascal = "pascal", + // Please note duplicated names here and see design doc for more details + PascalCase = "pascalCase", + PascalCase = "PascalCase", + Pascalcase = "pascalcase", + Pascalcase = "Pascalcase", + PascalCase = "pascal_case_", + PascalCase = "pascal_case", + PascalCase = "_pascal_case", + PascalCase = "pascal, case", + MaxOfMld = "MAX_of_MLD", + PascalCase6666 = "___pascal____case6666", + "10Pascal" = "_10Pascal", + "090" = "090", + Number10 = "10", + "Number1.0" = "1.0", + "Number-1.0" = "-1.0" +} + +/** Type of ExtensibleString */ +export type ExtensibleString = string; + +/** Known values of {@link ExtensibleNumber} that the service accepts. */ +export enum KnownExtensibleNumber { + "One" = 1, + "Number2" = 2, + "Number-2.1" = -2.1 +} + +/** Type of ExtensibleNumber */ +export type ExtensibleNumber = number; +``` From 025ec548db9f13859b7d754519852ee7ebd9f5ce Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 30 Oct 2024 15:54:48 +0800 Subject: [PATCH 07/91] Revert un-necessary autorest changes --- .../generated/appconfiguration/src/models/index.ts | 8 +------- .../test/integration/swaggers/appconfiguration.json | 4 +--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts b/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts index 550124ac22..0302470563 100644 --- a/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts +++ b/packages/autorest.typescript/test/integration/generated/appconfiguration/src/models/index.ts @@ -220,10 +220,6 @@ export enum KnownGet6ItemsItem { Locked = "locked", /** Etag */ Etag = "etag", - /** UserSystem */ - UserSystem = "user, system", - /** UserXSystem */ - UserXSystem = "user x system ~", } /** @@ -238,9 +234,7 @@ export enum KnownGet6ItemsItem { * **last_modified** \ * **tags** \ * **locked** \ - * **etag** \ - * **user, system** \ - * **user x system ~** + * **etag** */ export type Get6ItemsItem = string; diff --git a/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json b/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json index 4982008675..f0a3cd6088 100644 --- a/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json +++ b/packages/autorest.typescript/test/integration/swaggers/appconfiguration.json @@ -191,9 +191,7 @@ "last_modified", "tags", "locked", - "etag", - "user, system", - "user x system ~" + "etag" ] }, "collectionFormat": "csv" From 96ce4532b31bbb709127b438d55c0f5212691e3e Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 30 Oct 2024 17:35:01 +0800 Subject: [PATCH 08/91] Refresh the integration testing for cadl-ranch --- .vscode/launch.json | 9 +- packages/rlc-common/src/helpers/nameUtils.ts | 25 +++- .../rlc-common/test/helpers/nameUtils.spec.ts | 28 +++- .../test/integration/packageJson.spec.ts | 4 +- .../generated/encode/bytes/src/index.d.ts | 126 +++++++++--------- .../generated/encode/duration/src/index.d.ts | 8 +- .../generated/media-types/src/index.d.ts | 2 +- .../generated/overload/src/index.d.ts | 2 +- .../generated/shared-route/src/index.d.ts | 2 +- .../generated/union-body/src/index.d.ts | 12 +- .../common-properties/src/index.d.ts | 2 +- .../generated/client/naming/src/index.d.ts | 6 +- .../generated/encode/bytes/src/index.d.ts | 8 +- .../generated/encode/duration/src/index.d.ts | 4 +- .../repeatability/src/index.d.ts | 2 +- .../generated/type/union/src/index.d.ts | 2 +- 16 files changed, 147 insertions(+), 95 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1f6a0fe332..e060208bbe 100755 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -103,7 +103,14 @@ "name": "[RLC-Common] Debug Unit Test", "request": "launch", "cwd": "${workspaceFolder}/packages/rlc-common", - "runtimeArgs": ["mocha", "test/**/*.spec.ts"], + "runtimeArgs": [ + "mocha", + "-r", + "ts-node/register", + "--loader=ts-node/esm", + "--experimental-specifier-resolution=node", + "test/**/*.spec.ts" + ], "runtimeExecutable": "npx", "skipFiles": ["/**"], "type": "pwa-node", diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 9a02df4ee1..ada61f3c9b 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -142,9 +142,12 @@ export function normalizeName( return name.replace("$DO_NOT_NORMALIZE$", ""); } const casingConvention = casingOverride ?? getCasingConvention(nameType); - const sanitizedName = sanitizeName(name); - const parts = getNameParts(sanitizedName); + const parts = deconstruct(name); const [firstPart, ...otherParts] = parts; + if (parts.length === 0) { + console.log("parts.length < 1", parts, name, getNameParts(sanitizeName(name))); + return name; + } const normalizedFirstPart = toCasing(firstPart, casingConvention); const normalizedParts = (otherParts || []) .map((part) => @@ -158,6 +161,20 @@ export function normalizeName( : normalized; } +function deconstruct( + identifier: string, +): Array { + const parts = `${identifier}` + .replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar) + .replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123 => foo123 bar) + .replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, "$1$2« $3$4") // Add a space after a plural uppper cased word(e.g. MBsFoo => MBs Foo) + .replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, "$1 $2$3") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) + .replace(/«/g, "s") + .trim() + .split(/[\W|_]+/); + return parts.filter((part) => part.trim().length > 0); +} + function checkBeginning(name: string): string { if (name.startsWith("@")) { return name.substring(1); @@ -170,6 +187,10 @@ function sanitizeName(name: string): string { return name.replace(/["'\\]+/g, ""); } +function isNumericLiteralName(name: string) { + return (+name).toString() === name; +} + export function getModelsName(title: string): string { const spaceRemovedTitle = title.replace(/ /g, ""); return `${spaceRemovedTitle.replace("Client", "")}Models`; diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 33ef9c7939..7f0006d245 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -14,9 +14,33 @@ describe("#normalizeName", () => { }); it("should normalize the name with camel case", () => { - expect(normalizeName("API_KEY", NameType.Parameter, true)).to.equal( - "apiKey" + expect(normalizeName("API_KEY", NameType.Parameter, true)).to.equal("apiKey"); + expect(normalizeName("pascalCase", NameType.Parameter, true)).to.equal( + "pascalCase" ); + expect(normalizeName("PascalCase", NameType.Parameter, true)).to.equal( + "pascalCase" + ); + expect(normalizeName("pascal_case_", NameType.Parameter, true)).to.equal( + "pascalCase" + ); + expect(normalizeName("_pascal_case", NameType.Parameter, true)).to.equal( + "pascalCase" + ); + expect(normalizeName("pascal, case", NameType.Parameter, true)).to.equal( + "pascalCase" + ); + expect(normalizeName("MAX_of_MLD", NameType.Parameter, true)).to.equal( + "maxOfMld" + ); + expect(normalizeName("___pascal____case6666", NameType.Parameter, true)).to.equal( + "pascalCase6666" + ); + + expect(normalizeName("_10Pascal", NameType.Parameter, true)).to.equal( + "10Pascal" + ); + }); }); diff --git a/packages/rlc-common/test/integration/packageJson.spec.ts b/packages/rlc-common/test/integration/packageJson.spec.ts index 15b0292e7a..a4dd725a2d 100644 --- a/packages/rlc-common/test/integration/packageJson.spec.ts +++ b/packages/rlc-common/test/integration/packageJson.spec.ts @@ -132,7 +132,7 @@ describe("Package file generation", () => { const expectedMetadata = { constantPaths: [ { - path: "src/msinternal/test.ts", + path: "src/msinternalTest.ts", prefix: "userAgentInfo" } ] @@ -155,7 +155,7 @@ describe("Package file generation", () => { prefix: "package-version" }, { - path: "src/msinternal/test.ts", + path: "src/msinternalTest.ts", prefix: "userAgentInfo" } ] diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts index 48da5b13dd..e488efa977 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts @@ -14,19 +14,19 @@ export declare interface Base64BytesPropertyOutput { value: string; } -export declare interface Base64urlArrayBytesProperty { +export declare interface Base64UrlArrayBytesProperty { value: string[]; } -export declare interface Base64urlArrayBytesPropertyOutput { +export declare interface Base64UrlArrayBytesPropertyOutput { value: string[]; } -export declare interface Base64urlBytesProperty { +export declare interface Base64UrlBytesProperty { value: string; } -export declare interface Base64urlBytesPropertyOutput { +export declare interface Base64UrlBytesPropertyOutput { value: string; } @@ -68,41 +68,41 @@ export declare interface HeaderBase64Headers { export declare type HeaderBase64Parameters = HeaderBase64HeaderParam & RequestParameters; -export declare interface HeaderBase64url { - get(options: HeaderBase64urlParameters): StreamableMethod; +export declare interface HeaderBase64Url { + get(options: HeaderBase64UrlParameters): StreamableMethod; } -export declare interface HeaderBase64url204Response extends HttpResponse { +export declare interface HeaderBase64Url204Response extends HttpResponse { status: "204"; } -export declare interface HeaderBase64urlArray { - get(options: HeaderBase64urlArrayParameters): StreamableMethod; +export declare interface HeaderBase64UrlArray { + get(options: HeaderBase64UrlArrayParameters): StreamableMethod; } -export declare interface HeaderBase64urlArray204Response extends HttpResponse { +export declare interface HeaderBase64UrlArray204Response extends HttpResponse { status: "204"; } -export declare interface HeaderBase64urlArrayHeaderParam { - headers: RawHttpHeadersInput & HeaderBase64urlArrayHeaders; +export declare interface HeaderBase64UrlArrayHeaderParam { + headers: RawHttpHeadersInput & HeaderBase64UrlArrayHeaders; } -export declare interface HeaderBase64urlArrayHeaders { +export declare interface HeaderBase64UrlArrayHeaders { value: string; } -export declare type HeaderBase64urlArrayParameters = HeaderBase64urlArrayHeaderParam & RequestParameters; +export declare type HeaderBase64UrlArrayParameters = HeaderBase64UrlArrayHeaderParam & RequestParameters; -export declare interface HeaderBase64urlHeaderParam { - headers: RawHttpHeadersInput & HeaderBase64urlHeaders; +export declare interface HeaderBase64UrlHeaderParam { + headers: RawHttpHeadersInput & HeaderBase64UrlHeaders; } -export declare interface HeaderBase64urlHeaders { +export declare interface HeaderBase64UrlHeaders { value: string; } -export declare type HeaderBase64urlParameters = HeaderBase64urlHeaderParam & RequestParameters; +export declare type HeaderBase64UrlParameters = HeaderBase64UrlHeaderParam & RequestParameters; export declare interface HeaderDefault { get(options: HeaderDefaultParameters): StreamableMethod; @@ -137,35 +137,35 @@ export declare interface PropertyBase64BodyParam { export declare type PropertyBase64Parameters = PropertyBase64BodyParam & RequestParameters; -export declare interface PropertyBase64url { - post(options: PropertyBase64urlParameters): StreamableMethod; +export declare interface PropertyBase64Url { + post(options: PropertyBase64UrlParameters): StreamableMethod; } -export declare interface PropertyBase64url200Response extends HttpResponse { +export declare interface PropertyBase64Url200Response extends HttpResponse { status: "200"; - body: Base64urlBytesPropertyOutput; + body: Base64UrlBytesPropertyOutput; } -export declare interface PropertyBase64urlArray { - post(options: PropertyBase64urlArrayParameters): StreamableMethod; +export declare interface PropertyBase64UrlArray { + post(options: PropertyBase64UrlArrayParameters): StreamableMethod; } -export declare interface PropertyBase64urlArray200Response extends HttpResponse { +export declare interface PropertyBase64UrlArray200Response extends HttpResponse { status: "200"; - body: Base64urlArrayBytesPropertyOutput; + body: Base64UrlArrayBytesPropertyOutput; } -export declare interface PropertyBase64urlArrayBodyParam { - body: Base64urlArrayBytesProperty; +export declare interface PropertyBase64UrlArrayBodyParam { + body: Base64UrlArrayBytesProperty; } -export declare type PropertyBase64urlArrayParameters = PropertyBase64urlArrayBodyParam & RequestParameters; +export declare type PropertyBase64UrlArrayParameters = PropertyBase64UrlArrayBodyParam & RequestParameters; -export declare interface PropertyBase64urlBodyParam { - body: Base64urlBytesProperty; +export declare interface PropertyBase64UrlBodyParam { + body: Base64UrlBytesProperty; } -export declare type PropertyBase64urlParameters = PropertyBase64urlBodyParam & RequestParameters; +export declare type PropertyBase64UrlParameters = PropertyBase64UrlBodyParam & RequestParameters; export declare interface PropertyDefault { post(options: PropertyDefaultParameters): StreamableMethod; @@ -200,39 +200,39 @@ export declare interface QueryBase64QueryParamProperties { value: string; } -export declare interface QueryBase64url { - get(options: QueryBase64urlParameters): StreamableMethod; +export declare interface QueryBase64Url { + get(options: QueryBase64UrlParameters): StreamableMethod; } -export declare interface QueryBase64url204Response extends HttpResponse { +export declare interface QueryBase64Url204Response extends HttpResponse { status: "204"; } -export declare interface QueryBase64urlArray { - get(options: QueryBase64urlArrayParameters): StreamableMethod; +export declare interface QueryBase64UrlArray { + get(options: QueryBase64UrlArrayParameters): StreamableMethod; } -export declare interface QueryBase64urlArray204Response extends HttpResponse { +export declare interface QueryBase64UrlArray204Response extends HttpResponse { status: "204"; } -export declare type QueryBase64urlArrayParameters = QueryBase64urlArrayQueryParam & RequestParameters; +export declare type QueryBase64UrlArrayParameters = QueryBase64UrlArrayQueryParam & RequestParameters; -export declare interface QueryBase64urlArrayQueryParam { - queryParameters: QueryBase64urlArrayQueryParamProperties; +export declare interface QueryBase64UrlArrayQueryParam { + queryParameters: QueryBase64UrlArrayQueryParamProperties; } -export declare interface QueryBase64urlArrayQueryParamProperties { +export declare interface QueryBase64UrlArrayQueryParamProperties { value: string[]; } -export declare type QueryBase64urlParameters = QueryBase64urlQueryParam & RequestParameters; +export declare type QueryBase64UrlParameters = QueryBase64UrlQueryParam & RequestParameters; -export declare interface QueryBase64urlQueryParam { - queryParameters: QueryBase64urlQueryParamProperties; +export declare interface QueryBase64UrlQueryParam { + queryParameters: QueryBase64UrlQueryParamProperties; } -export declare interface QueryBase64urlQueryParamProperties { +export declare interface QueryBase64UrlQueryParamProperties { value: string; } @@ -268,19 +268,19 @@ export declare interface RequestBodyBase64BodyParam { export declare type RequestBodyBase64Parameters = RequestBodyBase64BodyParam & RequestParameters; -export declare interface RequestBodyBase64url { - post(options: RequestBodyBase64urlParameters): StreamableMethod; +export declare interface RequestBodyBase64Url { + post(options: RequestBodyBase64UrlParameters): StreamableMethod; } -export declare interface RequestBodyBase64url204Response extends HttpResponse { +export declare interface RequestBodyBase64Url204Response extends HttpResponse { status: "204"; } -export declare interface RequestBodyBase64urlBodyParam { +export declare interface RequestBodyBase64UrlBodyParam { body: string; } -export declare type RequestBodyBase64urlParameters = RequestBodyBase64urlBodyParam & RequestParameters; +export declare type RequestBodyBase64UrlParameters = RequestBodyBase64UrlBodyParam & RequestParameters; export declare interface RequestBodyCustomContentType { post(options: RequestBodyCustomContentTypeParameters): StreamableMethod; @@ -343,16 +343,16 @@ export declare interface ResponseBodyBase64200Response extends HttpResponse { export declare type ResponseBodyBase64Parameters = RequestParameters; -export declare interface ResponseBodyBase64url { - get(options?: ResponseBodyBase64urlParameters): StreamableMethod; +export declare interface ResponseBodyBase64Url { + get(options?: ResponseBodyBase64UrlParameters): StreamableMethod; } -export declare interface ResponseBodyBase64url200Response extends HttpResponse { +export declare interface ResponseBodyBase64Url200Response extends HttpResponse { status: "200"; body: string; } -export declare type ResponseBodyBase64urlParameters = RequestParameters; +export declare type ResponseBodyBase64UrlParameters = RequestParameters; export declare interface ResponseBodyCustomContentType { get(options?: ResponseBodyCustomContentTypeParameters): StreamableMethod; @@ -400,26 +400,26 @@ export declare type ResponseBodyOctetStreamParameters = RequestParameters; export declare interface Routes { (path: "/encode/bytes/query/default"): QueryDefault; (path: "/encode/bytes/query/base64"): QueryBase64; - (path: "/encode/bytes/query/base64url"): QueryBase64url; - (path: "/encode/bytes/query/base64url-array"): QueryBase64urlArray; + (path: "/encode/bytes/query/base64url"): QueryBase64Url; + (path: "/encode/bytes/query/base64url-array"): QueryBase64UrlArray; (path: "/encode/bytes/property/default"): PropertyDefault; (path: "/encode/bytes/property/base64"): PropertyBase64; - (path: "/encode/bytes/property/base64url"): PropertyBase64url; - (path: "/encode/bytes/property/base64url-array"): PropertyBase64urlArray; + (path: "/encode/bytes/property/base64url"): PropertyBase64Url; + (path: "/encode/bytes/property/base64url-array"): PropertyBase64UrlArray; (path: "/encode/bytes/header/default"): HeaderDefault; (path: "/encode/bytes/header/base64"): HeaderBase64; - (path: "/encode/bytes/header/base64url"): HeaderBase64url; - (path: "/encode/bytes/header/base64url-array"): HeaderBase64urlArray; + (path: "/encode/bytes/header/base64url"): HeaderBase64Url; + (path: "/encode/bytes/header/base64url-array"): HeaderBase64UrlArray; (path: "/encode/bytes/body/request/default"): RequestBodyDefault; (path: "/encode/bytes/body/request/octet-stream"): RequestBodyOctetStream; (path: "/encode/bytes/body/request/custom-content-type"): RequestBodyCustomContentType; (path: "/encode/bytes/body/request/base64"): RequestBodyBase64; - (path: "/encode/bytes/body/request/base64url"): RequestBodyBase64url; + (path: "/encode/bytes/body/request/base64url"): RequestBodyBase64Url; (path: "/encode/bytes/body/response/default"): ResponseBodyDefault; (path: "/encode/bytes/body/response/octet-stream"): ResponseBodyOctetStream; (path: "/encode/bytes/body/response/custom-content-type"): ResponseBodyCustomContentType; (path: "/encode/bytes/body/response/base64"): ResponseBodyBase64; - (path: "/encode/bytes/body/response/base64url"): ResponseBodyBase64url; + (path: "/encode/bytes/body/response/base64url"): ResponseBodyBase64Url; } export { } diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts index 59c15bb80b..ef3592aaf7 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts @@ -165,11 +165,11 @@ export declare interface Int32SecondsDurationPropertyOutput { value: number; } -export declare interface ISO8601DurationProperty { +export declare interface Iso8601DurationProperty { value: string; } -export declare interface ISO8601DurationPropertyOutput { +export declare interface Iso8601DurationPropertyOutput { value: string; } @@ -254,11 +254,11 @@ export declare interface PropertyIso8601 { export declare interface PropertyIso8601200Response extends HttpResponse { status: "200"; - body: ISO8601DurationPropertyOutput; + body: Iso8601DurationPropertyOutput; } export declare interface PropertyIso8601BodyParam { - body: ISO8601DurationProperty; + body: Iso8601DurationProperty; } export declare type PropertyIso8601Parameters = PropertyIso8601BodyParam & RequestParameters; diff --git a/packages/typespec-ts/test/integration/generated/media-types/src/index.d.ts b/packages/typespec-ts/test/integration/generated/media-types/src/index.d.ts index c27340bd0f..3a1d587aff 100644 --- a/packages/typespec-ts/test/integration/generated/media-types/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/media-types/src/index.d.ts @@ -4,7 +4,7 @@ import { HttpResponse } from '@azure-rest/core-client'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; -declare function createClient($host: string, options?: MediaTypesClientOptions): MediaTypesClient; +declare function createClient(host: string, options?: MediaTypesClientOptions): MediaTypesClient; export default createClient; export declare interface GetByOverloadParent { diff --git a/packages/typespec-ts/test/integration/generated/overload/src/index.d.ts b/packages/typespec-ts/test/integration/generated/overload/src/index.d.ts index 640bed5005..62d938eddb 100644 --- a/packages/typespec-ts/test/integration/generated/overload/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/overload/src/index.d.ts @@ -4,7 +4,7 @@ import { HttpResponse } from '@azure-rest/core-client'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; -declare function createClient($host: string, options?: OveralodClientOptions): OveralodClient; +declare function createClient(host: string, options?: OveralodClientOptions): OveralodClient; export default createClient; export declare interface GetThing { diff --git a/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts b/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts index f70822eb02..3c071e24cf 100644 --- a/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts @@ -5,7 +5,7 @@ import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; -declare function createClient($host: string, options?: SharedRouteClientOptions): SharedRouteClient; +declare function createClient(host: string, options?: SharedRouteClientOptions): SharedRouteClient; export default createClient; export declare interface ErrorModelOutput { diff --git a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts index a17e3f37d4..75e3945338 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts @@ -19,19 +19,19 @@ export declare type PaymentMethods = "01"; export declare type PaymentMethodsOutput = "01"; -export declare interface RequestRegisterCC extends CommonRegistrationRequest { +export declare interface RequestRegisterCc extends CommonRegistrationRequest { payMethod: "01"; } -export declare interface RequestRegisterCCOutput extends CommonRegistrationRequestOutput { +export declare interface RequestRegisterCcOutput extends CommonRegistrationRequestOutput { payMethod: "01"; } -export declare interface RequestRegisterVA { +export declare interface RequestRegisterVa { prop: string; } -export declare interface RequestRegisterVAOutput { +export declare interface RequestRegisterVaOutput { prop: string; } @@ -45,7 +45,7 @@ export declare interface RequestUnionBody200Response extends HttpResponse { } export declare interface RequestUnionBodyBodyParam { - body: RequestRegisterCC | RequestRegisterVA; + body: RequestRegisterCc | RequestRegisterVa; } export declare type RequestUnionBodyParameters = RequestUnionBodyBodyParam & RequestParameters; @@ -56,7 +56,7 @@ export declare interface ResponseUnionBody { export declare interface ResponseUnionBody200Response extends HttpResponse { status: "200"; - body: RequestRegisterCCOutput | RequestRegisterVAOutput; + body: RequestRegisterCcOutput | RequestRegisterVaOutput; } export declare type ResponseUnionBodyParameters = RequestParameters; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts index 9c60e863f8..8acb197f50 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts @@ -51,7 +51,7 @@ export declare enum KnownManagedServiceIdentityType { None = "None", SystemAssigned = "SystemAssigned", UserAssigned = "UserAssigned", - "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned" + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned" } export declare interface ManagedIdentityTrackedResource extends TrackedResource { diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts index 6588f5f6d6..a36f1361fb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts @@ -16,7 +16,7 @@ export declare interface ClientModelLanguageOptionalParams extends OperationOpti export declare interface ClientModelOperations { client: (body: ClientModel, options?: ClientModelClientOptionalParams) => Promise; - language: (body: TSModel, options?: ClientModelLanguageOptionalParams) => Promise; + language: (body: TsModel, options?: ClientModelLanguageOptionalParams) => Promise; } export declare interface ClientNameAndJsonEncodedNameModel { @@ -39,7 +39,7 @@ export declare interface CompatibleWithEncodedNameOptionalParams extends Operati export declare type ExtensibleEnum = "value1" | "value2"; export declare interface LanguageClientNameModel { - tSName: boolean; + tsName: boolean; } export declare interface LanguageOptionalParams extends OperationOptions { @@ -72,7 +72,7 @@ export declare interface RequestOptionalParams extends OperationOptions { export declare interface ResponseOptionalParams extends OperationOptions { } -export declare interface TSModel { +export declare interface TsModel { defaultName: boolean; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts index e505dfd63f..7180a00474 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts @@ -6,11 +6,11 @@ export declare interface Base64BytesProperty { value: Uint8Array; } -export declare interface Base64urlArrayBytesProperty { +export declare interface Base64UrlArrayBytesProperty { value: Uint8Array[]; } -export declare interface Base64urlBytesProperty { +export declare interface Base64UrlBytesProperty { value: Uint8Array; } @@ -66,8 +66,8 @@ export declare interface PropertyDefaultOptionalParams extends OperationOptions export declare interface PropertyOperations { default: (body: DefaultBytesProperty, options?: PropertyDefaultOptionalParams) => Promise; base64: (body: Base64BytesProperty, options?: PropertyBase64OptionalParams) => Promise; - base64url: (body: Base64urlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; - base64urlArray: (body: Base64urlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; + base64url: (body: Base64UrlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; + base64urlArray: (body: Base64UrlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; } export declare interface QueryBase64OptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts index d5d531d085..39d87c823d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts @@ -61,7 +61,7 @@ export declare interface Int32SecondsDurationProperty { value: number; } -export declare interface ISO8601DurationProperty { +export declare interface Iso8601DurationProperty { value: string; } @@ -85,7 +85,7 @@ export declare interface PropertyIso8601OptionalParams extends OperationOptions export declare interface PropertyOperations { default: (body: DefaultDurationProperty, options?: PropertyDefaultOptionalParams) => Promise; - iso8601: (body: ISO8601DurationProperty, options?: PropertyIso8601OptionalParams) => Promise; + iso8601: (body: Iso8601DurationProperty, options?: PropertyIso8601OptionalParams) => Promise; int32Seconds: (body: Int32SecondsDurationProperty, options?: PropertyInt32SecondsOptionalParams) => Promise; floatSeconds: (body: FloatSecondsDurationProperty, options?: PropertyFloatSecondsOptionalParams) => Promise; float64Seconds: (body: Float64SecondsDurationProperty, options?: PropertyFloat64SecondsOptionalParams) => Promise; diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts index 21e9bdb2f7..0b4736e016 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts @@ -9,7 +9,7 @@ export declare class RepeatabilityClient { private _client; readonly pipeline: Pipeline; constructor(options?: RepeatabilityClientOptionalParams); - immediateSuccess(repeatabilityRequestID: string, repeatabilityFirstSent: Date, options?: ImmediateSuccessOptionalParams): Promise; + immediateSuccess(repeatabilityRequestId: string, repeatabilityFirstSent: Date, options?: ImmediateSuccessOptionalParams): Promise; } export declare interface RepeatabilityClientOptionalParams extends ClientOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts index 8f2ba23e83..83cc4f64eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts @@ -56,7 +56,7 @@ export declare interface IntsOnlySendOptionalParams extends OperationOptions { export declare enum KnownStringExtensibleNamedUnion { OptionB = "b", - c = "c" + C = "c" } export declare type Lr = "left" | "right"; From 898dd1c4fb955997804d8d20841870e46452aa53 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 30 Oct 2024 17:46:08 +0800 Subject: [PATCH 09/91] Update smoke testings --- .../review/arm-networkanalytics.api.md | 4 +- .../generated/typespec-ts/src/index.ts | 2 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 20 +- .../typespec-ts/src/restorePollerHelpers.ts | 4 +- .../review/ai-anomaly-detector.api.md | 8 +- .../generated/typespec-ts/src/index.ts | 4 +- .../generated/typespec-ts/src/models/index.ts | 4 +- .../typespec-ts/src/models/models.ts | 18 +- .../generated/typespec-ts/review/batch.api.md | 134 +-- .../typespec-ts/src/api/operations.ts | 202 ++-- .../generated/typespec-ts/src/api/options.ts | 78 +- .../generated/typespec-ts/src/batchClient.ts | 6 +- .../generated/typespec-ts/src/index.ts | 12 +- .../generated/typespec-ts/src/models/index.ts | 12 +- .../typespec-ts/src/models/models.ts | 158 +-- .../typespec-ts/review/load-testing.api.md | 36 +- .../generated/typespec-ts/src/models.ts | 26 +- .../generated/typespec-ts/src/outputModels.ts | 30 +- .../typespec-ts/review/load-testing.api.md | 156 +-- .../generated/typespec-ts/src/index.ts | 20 +- .../generated/typespec-ts/src/models/index.ts | 20 +- .../typespec-ts/src/models/models.ts | 170 +-- .../openai/generated/typespec-ts/README.md | 6 +- .../typespec-ts/review/openai.api.md | 10 +- .../beginAzureBatchImageGenerationSample.ts | 4 +- ...tchImageGenerationOperationStatusSample.ts | 4 +- .../samples-dev/getChatCompletionsSample.ts | 4 +- ...hatCompletionsWithAzureExtensionsSample.ts | 4 +- .../samples-dev/getCompletionsSample.ts | 4 +- .../samples-dev/getEmbeddingsSample.ts | 4 +- .../typespec-ts/src/clientDefinitions.ts | 2 +- .../openai/generated/typespec-ts/src/index.ts | 6 +- .../generated/typespec-ts/src/openAIClient.ts | 12 +- .../generated/typespec-ts/src/openAiClient.ts | 69 ++ .../generated/typespec-ts/src/outputModels.ts | 4 +- .../generated/typespec-ts/README.md | 10 +- .../typespec-ts/review/openai-generic.api.md | 14 +- .../typespec-ts/src/api/files/index.ts | 16 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/openAiContext.ts | 49 + .../typespec-ts/src/classic/audio/index.ts | 2 +- .../src/classic/audio/transcriptions/index.ts | 2 +- .../src/classic/audio/translations/index.ts | 2 +- .../src/classic/chat/completions/index.ts | 2 +- .../typespec-ts/src/classic/chat/index.ts | 2 +- .../src/classic/completions/index.ts | 2 +- .../typespec-ts/src/classic/edits/index.ts | 2 +- .../src/classic/embeddings/index.ts | 2 +- .../typespec-ts/src/classic/files/index.ts | 8 +- .../src/classic/fineTunes/index.ts | 2 +- .../src/classic/fineTuning/index.ts | 2 +- .../src/classic/fineTuning/jobs/index.ts | 2 +- .../typespec-ts/src/classic/images/index.ts | 2 +- .../typespec-ts/src/classic/models/index.ts | 2 +- .../src/classic/moderations/index.ts | 2 +- .../generated/typespec-ts/src/index.ts | 4 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 24 +- .../generated/typespec-ts/src/openAIClient.ts | 2 +- .../generated/typespec-ts/src/openAiClient.ts | 100 ++ .../generated/typespec-ts/README.md | 10 +- .../generated/typespec-ts/package.json | 89 +- .../typespec-ts/review/openai_modular.api.md | 1016 ----------------- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/openAiContext.ts | 58 + .../generated/typespec-ts/src/index.ts | 10 +- .../generated/typespec-ts/src/models/index.ts | 8 +- .../typespec-ts/src/models/models.ts | 38 +- .../generated/typespec-ts/src/openAIClient.ts | 2 +- .../generated/typespec-ts/src/openAiClient.ts | 190 +++ .../generated/typespec-ts/README.md | 4 +- .../generated/typespec-ts/package.json | 2 +- .../review/openai-non-branded.api.md | 38 +- .../typespec-ts/src/api/files/index.ts | 16 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/openAiContext.ts | 51 + .../typespec-ts/src/classic/audio/index.ts | 2 +- .../src/classic/audio/transcriptions/index.ts | 2 +- .../src/classic/audio/translations/index.ts | 2 +- .../src/classic/chat/completions/index.ts | 2 +- .../typespec-ts/src/classic/chat/index.ts | 2 +- .../src/classic/completions/index.ts | 2 +- .../typespec-ts/src/classic/edits/index.ts | 2 +- .../src/classic/embeddings/index.ts | 2 +- .../typespec-ts/src/classic/files/index.ts | 8 +- .../src/classic/fineTunes/index.ts | 2 +- .../src/classic/fineTuning/index.ts | 2 +- .../src/classic/fineTuning/jobs/index.ts | 2 +- .../typespec-ts/src/classic/images/index.ts | 2 +- .../typespec-ts/src/classic/models/index.ts | 2 +- .../src/classic/moderations/index.ts | 2 +- .../generated/typespec-ts/src/index.ts | 4 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 120 +- .../generated/typespec-ts/src/openAIClient.ts | 2 +- .../generated/typespec-ts/src/openAiClient.ts | 98 ++ 97 files changed, 1418 insertions(+), 1898 deletions(-) create mode 100644 packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts create mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts create mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts delete mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md create mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts create mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts create mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts create mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md index 6a0b680bba..45f0a23e89 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md @@ -78,7 +78,7 @@ export interface DataProductInformation { export interface DataProductNetworkAcls { allowedQueryIpRangeList: string[]; defaultAction: DefaultAction; - ipRules: IPRules[]; + ipRules: IpRules[]; virtualNetworkRule: VirtualNetworkRule[]; } @@ -328,7 +328,7 @@ export interface ErrorResponse { } // @public -export interface IPRules { +export interface IpRules { action: string; value?: string; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts index 1207d6385b..db09958503 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts @@ -19,7 +19,7 @@ export { EncryptionKeyDetails, DataProductNetworkAcls, VirtualNetworkRule, - IPRules, + IpRules, KnownDefaultAction, DefaultAction, ManagedResourceGroupConfiguration, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts index 63a064b63e..a8ebd500dc 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts @@ -11,7 +11,7 @@ export { EncryptionKeyDetails, DataProductNetworkAcls, VirtualNetworkRule, - IPRules, + IpRules, KnownDefaultAction, DefaultAction, ManagedResourceGroupConfiguration, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts index 803e2d74ff..a790661d84 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts @@ -257,7 +257,7 @@ export interface DataProductNetworkAcls { /** Virtual Network Rule */ virtualNetworkRule: VirtualNetworkRule[]; /** IP rule with specific IP or IP range in CIDR format. */ - ipRules: IPRules[]; + ipRules: IpRules[]; /** The list of query ips in the format of CIDR allowed to connect to query/visualization endpoint. */ allowedQueryIpRangeList: string[]; /** Default Action */ @@ -271,7 +271,7 @@ export function dataProductNetworkAclsSerializer( virtualNetworkRule: virtualNetworkRuleArraySerializer( item["virtualNetworkRule"], ), - ipRules: iPRulesArraySerializer(item["ipRules"]), + ipRules: ipRulesArraySerializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -286,7 +286,7 @@ export function dataProductNetworkAclsDeserializer( virtualNetworkRule: virtualNetworkRuleArrayDeserializer( item["virtualNetworkRule"], ), - ipRules: iPRulesArrayDeserializer(item["ipRules"]), + ipRules: ipRulesArrayDeserializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -333,33 +333,33 @@ export function virtualNetworkRuleArrayDeserializer( } /** IP rule with specific IP or IP range in CIDR format. */ -export interface IPRules { +export interface IpRules { /** IP Rules Value */ value?: string; /** The action of virtual network rule. */ action: string; } -export function iPRulesSerializer(item: IPRules): any { +export function ipRulesSerializer(item: IpRules): any { return { value: item["value"], action: item["action"] }; } -export function iPRulesDeserializer(item: any): IPRules { +export function ipRulesDeserializer(item: any): IpRules { return { value: item["value"], action: item["action"], }; } -export function iPRulesArraySerializer(result: Array): any[] { +export function ipRulesArraySerializer(result: Array): any[] { return result.map((item) => { - return iPRulesSerializer(item); + return ipRulesSerializer(item); }); } -export function iPRulesArrayDeserializer(result: Array): any[] { +export function ipRulesArrayDeserializer(result: Array): any[] { return result.map((item) => { - return iPRulesDeserializer(item); + return ipRulesDeserializer(item); }); } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts index 9a0c76fdf0..1c5965b2e2 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts @@ -11,7 +11,7 @@ import { import { _createDeserialize as _createDeserializeDataProducts, _updateDeserialize as _updateDeserializeDataProducts, - _$deleteDeserialize as _$deleteDeserializeDataProducts, + _$deleteDeserialize as _deleteDeserializeDataProducts, } from "./api/dataProducts/index.js"; import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; import { @@ -117,7 +117,7 @@ const deserializeMap: Record = { }, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": { - deserializer: _$deleteDeserializeDataProducts, + deserializer: _deleteDeserializeDataProducts, expectedStatuses: ["202", "204", "200"], }, }; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index 637424c1d1..b0d0dcdcc2 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -23,7 +23,7 @@ export interface AnomalyDetectorClientOptionalParams extends ClientOptions { } // @public -export type APIVersion = "v1.1"; +export type ApiVersion = "v1.1"; // @public export type ContinuablePage = TPage & { @@ -36,7 +36,7 @@ export type MultivariateAlignMode = "Inner" | "Outer"; // @public export interface MultivariateAlignPolicy { alignMode?: MultivariateAlignMode; - fillNAMethod?: MultivariateFillNAMethod; + fillNaMethod?: MultivariateFillNaMethod; paddingValue?: number; } @@ -103,7 +103,7 @@ export interface MultivariateErrorResponse { } // @public -export type MultivariateFillNAMethod = "Previous" | "Subsequent" | "Linear" | "Zero" | "Fixed"; +export type MultivariateFillNaMethod = "Previous" | "Subsequent" | "Linear" | "Zero" | "Fixed"; // @public export interface MultivariateGetMultivariateBatchDetectionResultOptionalParams extends OperationOptions { @@ -200,7 +200,7 @@ export interface MultivariateTrainMultivariateModelOptionalParams extends Operat // @public export interface MultivariateVariableState { effectiveCount?: number; - filledNARatio?: number; + filledNaRatio?: number; firstTimestamp?: Date; lastTimestamp?: Date; variable?: string; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts index d5a32173b2..da527da68d 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts @@ -23,7 +23,7 @@ export { MultivariateDataSchema, MultivariateAlignPolicy, MultivariateAlignMode, - MultivariateFillNAMethod, + MultivariateFillNaMethod, MultivariateModelStatus, MultivariateDiagnosticsInfo, MultivariateModelState, @@ -41,7 +41,7 @@ export { UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, UnivariateUnivariateChangePointDetectionResult, - APIVersion, + ApiVersion, } from "./models/index.js"; export { AnomalyDetectorClientOptionalParams, diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts index c8bde9b187..2b8060f03e 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts @@ -16,7 +16,7 @@ export { MultivariateDataSchema, MultivariateAlignPolicy, MultivariateAlignMode, - MultivariateFillNAMethod, + MultivariateFillNaMethod, MultivariateModelStatus, MultivariateDiagnosticsInfo, MultivariateModelState, @@ -34,5 +34,5 @@ export { UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, UnivariateUnivariateChangePointDetectionResult, - APIVersion, + ApiVersion, } from "./models.js"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index 999076c97d..4147a6b874 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -92,7 +92,7 @@ export interface MultivariateVariableState { /** Variable name in variable states. */ variable?: string; /** Proportion of missing values that need to be filled by fillNAMethod. */ - filledNARatio?: number; + filledNaRatio?: number; /** Number of effective data points before applying fillNAMethod. */ effectiveCount?: number; /** First valid timestamp with value of input data. */ @@ -106,7 +106,7 @@ export function multivariateVariableStateSerializer( ): any { return { variable: item["variable"], - filledNARatio: item["filledNARatio"], + filledNARatio: item["filledNaRatio"], effectiveCount: item["effectiveCount"], firstTimestamp: item["firstTimestamp"]?.toISOString(), lastTimestamp: item["lastTimestamp"]?.toISOString(), @@ -118,7 +118,7 @@ export function multivariateVariableStateDeserializer( ): MultivariateVariableState { return { variable: item["variable"], - filledNARatio: item["filledNARatio"], + filledNaRatio: item["filledNARatio"], effectiveCount: item["effectiveCount"], firstTimestamp: !item["firstTimestamp"] ? item["firstTimestamp"] @@ -416,7 +416,7 @@ export interface MultivariateAlignPolicy { * An optional field, indicating how missing values will be filled. One of * Previous, Subsequent, Linear, Zero, Fixed. */ - fillNAMethod?: MultivariateFillNAMethod; + fillNaMethod?: MultivariateFillNaMethod; /** An optional field. Required when fillNAMethod is Fixed. */ paddingValue?: number; } @@ -426,7 +426,7 @@ export function multivariateAlignPolicySerializer( ): any { return { alignMode: item["alignMode"], - fillNAMethod: item["fillNAMethod"], + fillNAMethod: item["fillNaMethod"], paddingValue: item["paddingValue"], }; } @@ -436,7 +436,7 @@ export function multivariateAlignPolicyDeserializer( ): MultivariateAlignPolicy { return { alignMode: item["alignMode"], - fillNAMethod: item["fillNAMethod"], + fillNaMethod: item["fillNAMethod"], paddingValue: item["paddingValue"], }; } @@ -444,7 +444,7 @@ export function multivariateAlignPolicyDeserializer( /** Type of MultivariateAlignMode */ export type MultivariateAlignMode = "Inner" | "Outer"; /** An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. */ -export type MultivariateFillNAMethod = +export type MultivariateFillNaMethod = | "Previous" | "Subsequent" | "Linear" @@ -1071,5 +1071,5 @@ export function univariateUnivariateChangePointDetectionResultDeserializer( }; } -/** Type of APIVersion */ -export type APIVersion = "v1.1"; +/** Type of ApiVersion */ +export type ApiVersion = "v1.1"; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md index 500a68f432..28a94b383c 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md @@ -139,7 +139,7 @@ export class BatchClient { getJobSchedule(jobScheduleId: string, options?: GetJobScheduleOptionalParams): Promise; getJobTaskCounts(jobId: string, options?: GetJobTaskCountsOptionalParams): Promise; getNode(poolId: string, nodeId: string, options?: GetNodeOptionalParams): Promise; - getNodeExtension(poolId: string, nodeId: string, extensionName: string, options?: GetNodeExtensionOptionalParams): Promise; + getNodeExtension(poolId: string, nodeId: string, extensionName: string, options?: GetNodeExtensionOptionalParams): Promise; getNodeFile(poolId: string, nodeId: string, filePath: string, options?: GetNodeFileOptionalParams): Promise; getNodeFileProperties(poolId: string, nodeId: string, filePath: string, options?: GetNodeFilePropertiesOptionalParams): Promise; getNodeRemoteDesktopFile(poolId: string, nodeId: string, options?: GetNodeRemoteDesktopFileOptionalParams): Promise; @@ -155,7 +155,7 @@ export class BatchClient { listJobs(options?: ListJobsOptionalParams): PagedAsyncIterableIterator; listJobSchedules(options?: ListJobSchedulesOptionalParams): PagedAsyncIterableIterator; listJobsFromSchedule(jobScheduleId: string, options?: ListJobsFromScheduleOptionalParams): PagedAsyncIterableIterator; - listNodeExtensions(poolId: string, nodeId: string, options?: ListNodeExtensionsOptionalParams): PagedAsyncIterableIterator; + listNodeExtensions(poolId: string, nodeId: string, options?: ListNodeExtensionsOptionalParams): PagedAsyncIterableIterator; listNodeFiles(poolId: string, nodeId: string, options?: ListNodeFilesOptionalParams): PagedAsyncIterableIterator; listNodes(poolId: string, options?: ListNodesOptionalParams): PagedAsyncIterableIterator; listPoolNodeCounts(options?: ListPoolNodeCountsOptionalParams): PagedAsyncIterableIterator; @@ -946,32 +946,32 @@ export interface GetApplicationOptionalParams extends OperationOptions { // @public export interface GetCertificateOptionalParams extends OperationOptions { - $select?: string[]; apiVersion?: string; + select?: string[]; timeOutInSeconds?: number; } // @public export interface GetJobOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; apiVersion?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + select?: string[]; timeOutInSeconds?: number; } // @public export interface GetJobScheduleOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; apiVersion?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + select?: string[]; timeOutInSeconds?: number; } @@ -983,8 +983,8 @@ export interface GetJobTaskCountsOptionalParams extends OperationOptions { // @public export interface GetNodeExtensionOptionalParams extends OperationOptions { - $select?: string[]; apiVersion?: string; + select?: string[]; timeOutInSeconds?: number; } @@ -1007,8 +1007,8 @@ export interface GetNodeFilePropertiesOptionalParams extends OperationOptions { // @public export interface GetNodeOptionalParams extends OperationOptions { - $select?: string[]; apiVersion?: string; + select?: string[]; timeOutInSeconds?: number; } @@ -1026,13 +1026,13 @@ export interface GetNodeRemoteLoginSettingsOptionalParams extends OperationOptio // @public export interface GetPoolOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; apiVersion?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + select?: string[]; timeOutInSeconds?: number; } @@ -1055,13 +1055,13 @@ export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { // @public export interface GetTaskOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; apiVersion?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + select?: string[]; timeOutInSeconds?: number; } @@ -1077,7 +1077,7 @@ export interface ImageInformation { capabilities?: string[]; imageReference: ImageReference; nodeAgentSkuId: string; - osType: OSType; + osType: OsType; verificationType: VerificationType; } @@ -1097,7 +1097,7 @@ export interface InboundEndpoint { frontendPort: number; name: string; protocol: InboundEndpointProtocol; - publicFQDN?: string; + publicFqdn?: string; publicIpAddress?: string; } @@ -1105,7 +1105,7 @@ export interface InboundEndpoint { export type InboundEndpointProtocol = "tcp" | "udp"; // @public -export interface InboundNATPool { +export interface InboundNatPool { backendPort: number; frontendPortRangeEnd: number; frontendPortRangeStart: number; @@ -1258,19 +1258,19 @@ export type JobScheduleState = "active" | "completed" | "disabled" | "terminatin // @public export interface JobScheduleStatistics { - kernelCPUTime: string; + kernelCpuTime: string; lastUpdateTime: Date; numFailedTasks: number; numSucceededTasks: number; numTaskRetries: number; - readIOGiB: number; + readIoGiB: number; readIOps: number; startTime: Date; url: string; - userCPUTime: string; + userCpuTime: string; waitTime: string; wallClockTime: string; - writeIOGiB: number; + writeIoGiB: number; writeIOps: number; } @@ -1306,19 +1306,19 @@ export type JobState = "active" | "disabling" | "disabled" | "enabling" | "termi // @public export interface JobStatistics { - kernelCPUTime: string; + kernelCpuTime: string; lastUpdateTime: Date; numFailedTasks: number; numSucceededTasks: number; numTaskRetries: number; - readIOGiB: number; + readIoGiB: number; readIOps: number; startTime: Date; url: string; - userCPUTime: string; + userCpuTime: string; waitTime: string; wallClockTime: string; - writeIOGiB: number; + writeIoGiB: number; writeIOps: number; } @@ -1338,62 +1338,62 @@ export interface ListApplicationsOptionalParams extends OperationOptions { // @public export interface ListCertificatesOptionalParams extends OperationOptions { - $filter?: string; - $select?: string[]; apiVersion?: string; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobPreparationAndReleaseTaskStatusOptionalParams extends OperationOptions { - $filter?: string; - $select?: string[]; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobSchedulesOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; apiVersion?: string; + expand?: string[]; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobsFromScheduleOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; apiVersion?: string; + expand?: string[]; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobsOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; apiVersion?: string; + expand?: string[]; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListNodeExtensionsOptionalParams extends OperationOptions { - $select?: string[]; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListNodeFilesOptionalParams extends OperationOptions { - $filter?: string; apiVersion?: string; + filter?: string; maxresults?: number; recursive?: boolean; timeOutInSeconds?: number; @@ -1401,36 +1401,36 @@ export interface ListNodeFilesOptionalParams extends OperationOptions { // @public export interface ListNodesOptionalParams extends OperationOptions { - $filter?: string; - $select?: string[]; apiVersion?: string; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListPoolNodeCountsOptionalParams extends OperationOptions { - $filter?: string; apiVersion?: string; + filter?: string; maxresults?: number; timeOutInSeconds?: number; } // @public export interface ListPoolsOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; apiVersion?: string; + expand?: string[]; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { - $filter?: string; apiVersion?: string; endtime?: Date; + filter?: string; maxresults?: number; starttime?: Date; timeOutInSeconds?: number; @@ -1438,22 +1438,22 @@ export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { // @public export interface ListSubTasksOptionalParams extends OperationOptions { - $select?: string[]; apiVersion?: string; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListSupportedImagesOptionalParams extends OperationOptions { - $filter?: string; + filter?: string; maxresults?: number; timeOutInSeconds?: number; } // @public export interface ListTaskFilesOptionalParams extends OperationOptions { - $filter?: string; apiVersion?: string; + filter?: string; maxresults?: number; recursive?: boolean; timeOutInSeconds?: number; @@ -1461,11 +1461,11 @@ export interface ListTaskFilesOptionalParams extends OperationOptions { // @public export interface ListTasksOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; apiVersion?: string; + expand?: string[]; + filter?: string; maxresults?: number; + select?: string[]; timeOutInSeconds?: number; } @@ -1592,10 +1592,10 @@ export interface NodeRemoveOptions { } // @public -export interface NodeVMExtension { - instanceView?: VMExtensionInstanceView; +export interface NodeVmExtension { + instanceView?: VmExtensionInstanceView; provisioningState?: string; - vmExtension?: VMExtension; + vmExtension?: VmExtension; } // @public @@ -1605,12 +1605,12 @@ export type OnAllTasksComplete = "noaction" | "terminatejob"; export type OnTaskFailure = "noaction" | "performexitoptionsjobaction"; // @public -export interface OSDisk { - ephemeralOSDiskSettings?: DiffDiskSettings; +export interface OsDisk { + ephemeralOsDiskSettings?: DiffDiskSettings; } // @public -export type OSType = "linux" | "windows"; +export type OsType = "linux" | "windows"; // @public export interface OutputFile { @@ -1654,7 +1654,7 @@ export interface PageSettings { // @public export interface PoolEndpointConfiguration { - inboundNatPools: InboundNATPool[]; + inboundNatPools: InboundNatPool[]; } // @public @@ -2069,16 +2069,16 @@ export type TaskState = "active" | "preparing" | "running" | "completed"; // @public export interface TaskStatistics { - kernelCPUTime: string; + kernelCpuTime: string; lastUpdateTime: Date; - readIOGiB: number; + readIoGiB: number; readIOps: number; startTime: Date; url: string; - userCPUTime: string; + userCpuTime: string; waitTime: string; wallClockTime: string; - writeIOGiB: number; + writeIoGiB: number; writeIOps: number; } @@ -2205,12 +2205,12 @@ export interface VirtualMachineConfiguration { containerConfiguration?: ContainerConfiguration; dataDisks?: DataDisk[]; diskEncryptionConfiguration?: DiskEncryptionConfiguration; - extensions?: VMExtension[]; + extensions?: VmExtension[]; imageReference: ImageReference; licenseType?: string; nodeAgentSkuId: string; nodePlacementConfiguration?: NodePlacementConfiguration; - osDisk?: OSDisk; + osDisk?: OsDisk; windowsConfiguration?: WindowsConfiguration; } @@ -2220,7 +2220,7 @@ export interface VirtualMachineInfo { } // @public -export interface VMExtension { +export interface VmExtension { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; name: string; @@ -2233,7 +2233,7 @@ export interface VMExtension { } // @public -export interface VMExtensionInstanceView { +export interface VmExtensionInstanceView { name?: string; statuses?: InstanceViewStatus[]; subStatuses?: InstanceViewStatus[]; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts index 30f6aae1d0..5b4563bcb2 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts @@ -98,10 +98,10 @@ import { uploadBatchServiceLogsResultDeserializer, _BatchNodeListResult, _batchNodeListResultDeserializer, - NodeVMExtension, - nodeVMExtensionDeserializer, - _NodeVMExtensionList, - _nodeVMExtensionListDeserializer, + NodeVmExtension, + nodeVmExtensionDeserializer, + _NodeVmExtensionList, + _nodeVmExtensionListDeserializer, _NodeFileListResult, _nodeFileListResultDeserializer, NodeFile, @@ -299,7 +299,7 @@ export function _listPoolUsageMetricsSend( timeOut: options?.timeOutInSeconds, starttime: options?.starttime?.toISOString(), endtime: options?.endtime?.toISOString(), - $filter: options?.$filter, + $filter: options?.filter, }, }); } @@ -391,15 +391,15 @@ export function _listPoolsSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -594,14 +594,14 @@ export function _getPoolSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -1131,7 +1131,7 @@ export function _listSupportedImagesSend( queryParameters: { maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, }, }); } @@ -1173,7 +1173,7 @@ export function _listPoolNodeCountsSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, }, }); } @@ -1307,14 +1307,14 @@ export function _getJobSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -1753,15 +1753,15 @@ export function _listJobsSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -1804,15 +1804,15 @@ export function _listJobsFromScheduleSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -1859,10 +1859,10 @@ export function _listJobPreparationAndReleaseTaskStatusSend( queryParameters: { maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -1999,10 +1999,10 @@ export function _listCertificatesSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -2165,9 +2165,9 @@ export function _getCertificateSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -2357,14 +2357,14 @@ export function _getJobScheduleSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -2776,15 +2776,15 @@ export function _listJobSchedulesSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -2874,15 +2874,15 @@ export function _listTasksSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -3082,14 +3082,14 @@ export function _getTaskSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -3202,9 +3202,9 @@ export function _listSubTasksSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -3573,7 +3573,7 @@ export function _listTaskFilesSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, recursive: options?.recursive, }, }); @@ -3790,9 +3790,9 @@ export function _getNodeSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -4187,10 +4187,10 @@ export function _listNodesSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -4242,9 +4242,9 @@ export function _getNodeExtensionSend( queryParameters: { "api-version": options?.apiVersion ?? "2023-05-01.17.0", timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -4253,13 +4253,13 @@ export function _getNodeExtensionSend( export async function _getNodeExtensionDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return nodeVMExtensionDeserializer(result.body); + return nodeVmExtensionDeserializer(result.body); } /** Gets information about the specified Compute Node Extension. */ @@ -4269,7 +4269,7 @@ export async function getNodeExtension( nodeId: string, extensionName: string, options: GetNodeExtensionOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _getNodeExtensionSend( context, poolId, @@ -4293,9 +4293,9 @@ export function _listNodeExtensionsSend( queryParameters: { maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -4304,13 +4304,13 @@ export function _listNodeExtensionsSend( export async function _listNodeExtensionsDeserialize( result: PathUncheckedResponse, -): Promise<_NodeVMExtensionList> { +): Promise<_NodeVmExtensionList> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _nodeVMExtensionListDeserializer(result.body); + return _nodeVmExtensionListDeserializer(result.body); } /** Lists the Compute Nodes Extensions in the specified Pool. */ @@ -4319,7 +4319,7 @@ export function listNodeExtensions( poolId: string, nodeId: string, options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, () => _listNodeExtensionsSend(context, poolId, nodeId, options), @@ -4537,7 +4537,7 @@ export function _listNodeFilesSend( "api-version": options?.apiVersion ?? "2023-05-01.17.0", maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, recursive: options?.recursive, }, }); diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts index 8ba92886ba..3328bc1593 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts @@ -66,7 +66,7 @@ export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. */ - $filter?: string; + filter?: string; } /** Optional parameters. */ @@ -100,11 +100,11 @@ export interface ListPoolsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -211,9 +211,9 @@ export interface GetPoolOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -452,7 +452,7 @@ export interface ListSupportedImagesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. */ - $filter?: string; + filter?: string; } /** Optional parameters. */ @@ -473,7 +473,7 @@ export interface ListPoolNodeCountsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. */ - $filter?: string; + filter?: string; } /** Optional parameters. */ @@ -545,9 +545,9 @@ export interface GetJobOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -766,11 +766,11 @@ export interface ListJobsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -791,11 +791,11 @@ export interface ListJobsFromScheduleOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -815,9 +815,9 @@ export interface ListJobPreparationAndReleaseTaskStatusOptionalParams * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-preparation-and-release-status. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -862,9 +862,9 @@ export interface ListCertificatesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -900,7 +900,7 @@ export interface GetCertificateOptionalParams extends OperationOptions { */ timeOutInSeconds?: number; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1007,9 +1007,9 @@ export interface GetJobScheduleOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1222,11 +1222,11 @@ export interface ListJobSchedulesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1260,11 +1260,11 @@ export interface ListTasksOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1349,9 +1349,9 @@ export interface GetTaskOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1401,7 +1401,7 @@ export interface ListSubTasksOptionalParams extends OperationOptions { */ timeOutInSeconds?: number; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1561,7 +1561,7 @@ export interface ListTaskFilesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. */ - $filter?: string; + filter?: string; /** * Whether to list children of the Task directory. This parameter can be used in * combination with the filter parameter to list specific type of files. @@ -1616,7 +1616,7 @@ export interface GetNodeOptionalParams extends OperationOptions { */ timeOutInSeconds?: number; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1730,9 +1730,9 @@ export interface ListNodesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1745,7 +1745,7 @@ export interface GetNodeExtensionOptionalParams extends OperationOptions { */ timeOutInSeconds?: number; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1761,7 +1761,7 @@ export interface ListNodeExtensionsOptionalParams extends OperationOptions { */ timeOutInSeconds?: number; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1851,7 +1851,7 @@ export interface ListNodeFilesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. */ - $filter?: string; + filter?: string; /** Whether to list children of a directory. */ recursive?: boolean; } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts index 27778a6f04..4d2160babc 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts @@ -165,7 +165,7 @@ import { BatchNodeRemoteLoginSettingsResult, UploadBatchServiceLogsOptions, UploadBatchServiceLogsResult, - NodeVMExtension, + NodeVmExtension, NodeFile, BatchTaskCreateOptions, BatchTask, @@ -1117,7 +1117,7 @@ export class BatchClient { nodeId: string, extensionName: string, options: GetNodeExtensionOptionalParams = { requestOptions: {} }, - ): Promise { + ): Promise { return getNodeExtension( this._client, poolId, @@ -1132,7 +1132,7 @@ export class BatchClient { poolId: string, nodeId: string, options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { + ): PagedAsyncIterableIterator { return listNodeExtensions(this._client, poolId, nodeId, options); } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts index f9b9845b5e..01604be491 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts @@ -57,9 +57,9 @@ export { BatchNodeRemoteLoginSettingsResult, UploadBatchServiceLogsOptions, UploadBatchServiceLogsResult, - NodeVMExtension, - VMExtension, - VMExtensionInstanceView, + NodeVmExtension, + VmExtension, + VmExtensionInstanceView, InstanceViewStatus, StatusLevelTypes, NodeFile, @@ -122,7 +122,7 @@ export { DiskEncryptionTarget, NodePlacementConfiguration, NodePlacementPolicyType, - OSDisk, + OsDisk, DiffDiskSettings, DiffDiskPlacement, TaskSchedulingPolicy, @@ -130,7 +130,7 @@ export { NetworkConfiguration, DynamicVNetAssignmentScope, PoolEndpointConfiguration, - InboundNATPool, + InboundNatPool, NetworkSecurityGroupRule, NetworkSecurityGroupRuleAccess, PublicIpAddressConfiguration, @@ -174,7 +174,7 @@ export { TaskCounts, TaskSlotCounts, ImageInformation, - OSType, + OsType, VerificationType, PoolNodeCounts, NodeCounts, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts index dcbfd2ea4d..7508d64be4 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts @@ -50,9 +50,9 @@ export { BatchNodeRemoteLoginSettingsResult, UploadBatchServiceLogsOptions, UploadBatchServiceLogsResult, - NodeVMExtension, - VMExtension, - VMExtensionInstanceView, + NodeVmExtension, + VmExtension, + VmExtensionInstanceView, InstanceViewStatus, StatusLevelTypes, NodeFile, @@ -115,7 +115,7 @@ export { DiskEncryptionTarget, NodePlacementConfiguration, NodePlacementPolicyType, - OSDisk, + OsDisk, DiffDiskSettings, DiffDiskPlacement, TaskSchedulingPolicy, @@ -123,7 +123,7 @@ export { NetworkConfiguration, DynamicVNetAssignmentScope, PoolEndpointConfiguration, - InboundNATPool, + InboundNatPool, NetworkSecurityGroupRule, NetworkSecurityGroupRuleAccess, PublicIpAddressConfiguration, @@ -167,7 +167,7 @@ export { TaskCounts, TaskSlotCounts, ImageInformation, - OSType, + OsType, VerificationType, PoolNodeCounts, NodeCounts, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts index 4041b8d5e2..6b85d12127 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts @@ -889,7 +889,7 @@ export interface InboundEndpoint { /** The public IP address of the Compute Node. */ publicIpAddress?: string; /** The public fully qualified domain name for the Compute Node. */ - publicFQDN?: string; + publicFqdn?: string; /** The public port number of the endpoint. */ frontendPort: number; /** The backend port number of the endpoint. */ @@ -901,7 +901,7 @@ export function inboundEndpointDeserializer(item: any): InboundEndpoint { name: item["name"], protocol: item["protocol"], publicIpAddress: item["publicIPAddress"], - publicFQDN: item["publicFQDN"], + publicFqdn: item["publicFQDN"], frontendPort: item["frontendPort"], backendPort: item["backendPort"], }; @@ -1130,29 +1130,29 @@ export function batchNodeArrayDeserializer(result: Array): any[] { } /** The configuration for virtual machine extension instance view. */ -export interface NodeVMExtension { +export interface NodeVmExtension { /** The provisioning state of the virtual machine extension. */ provisioningState?: string; /** The virtual machine extension. */ - vmExtension?: VMExtension; + vmExtension?: VmExtension; /** The vm extension instance view. */ - instanceView?: VMExtensionInstanceView; + instanceView?: VmExtensionInstanceView; } -export function nodeVMExtensionDeserializer(item: any): NodeVMExtension { +export function nodeVmExtensionDeserializer(item: any): NodeVmExtension { return { provisioningState: item["provisioningState"], vmExtension: !item["vmExtension"] ? item["vmExtension"] - : vMExtensionDeserializer(item["vmExtension"]), + : vmExtensionDeserializer(item["vmExtension"]), instanceView: !item["instanceView"] ? item["instanceView"] - : vMExtensionInstanceViewDeserializer(item["instanceView"]), + : vmExtensionInstanceViewDeserializer(item["instanceView"]), }; } /** The configuration for virtual machine extensions. */ -export interface VMExtension { +export interface VmExtension { /** The name of the virtual machine extension. */ name: string; /** The name of the extension handler publisher. */ @@ -1173,7 +1173,7 @@ export interface VMExtension { provisionAfterExtensions?: string[]; } -export function vMExtensionSerializer(item: VMExtension): any { +export function vmExtensionSerializer(item: VmExtension): any { return { name: item["name"], publisher: item["publisher"], @@ -1191,7 +1191,7 @@ export function vMExtensionSerializer(item: VMExtension): any { }; } -export function vMExtensionDeserializer(item: any): VMExtension { +export function vmExtensionDeserializer(item: any): VmExtension { return { name: item["name"], publisher: item["publisher"], @@ -1210,7 +1210,7 @@ export function vMExtensionDeserializer(item: any): VMExtension { } /** The vm extension instance view. */ -export interface VMExtensionInstanceView { +export interface VmExtensionInstanceView { /** The name of the vm extension instance view. */ name?: string; /** The resource status information. */ @@ -1219,9 +1219,9 @@ export interface VMExtensionInstanceView { subStatuses?: InstanceViewStatus[]; } -export function vMExtensionInstanceViewDeserializer( +export function vmExtensionInstanceViewDeserializer( item: any, -): VMExtensionInstanceView { +): VmExtensionInstanceView { return { name: item["name"], statuses: !item["statuses"] @@ -1269,29 +1269,29 @@ export function instanceViewStatusArrayDeserializer( } /** The result of listing the Compute Node extensions in a Node. */ -export interface _NodeVMExtensionList { +export interface _NodeVmExtensionList { /** The list of Compute Node extensions. */ - value?: NodeVMExtension[]; + value?: NodeVmExtension[]; /** The URL to get the next set of results. */ odataNextLink?: string; } -export function _nodeVMExtensionListDeserializer( +export function _nodeVmExtensionListDeserializer( item: any, -): _NodeVMExtensionList { +): _NodeVmExtensionList { return { value: !item["value"] ? item["value"] - : nodeVMExtensionArrayDeserializer(item["value"]), + : nodeVmExtensionArrayDeserializer(item["value"]), odataNextLink: item["odata.nextLink"], }; } -export function nodeVMExtensionArrayDeserializer( - result: Array, +export function nodeVmExtensionArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return nodeVMExtensionDeserializer(item); + return nodeVmExtensionDeserializer(item); }); } @@ -2238,9 +2238,9 @@ export interface TaskStatistics { /** The time at which the statistics were last updated. All statistics are limited to the range between startTime and lastUpdateTime. */ lastUpdateTime: Date; /** The total user mode CPU time (summed across all cores and all Compute Nodes) consumed by the Task. */ - userCPUTime: string; + userCpuTime: string; /** The total kernel mode CPU time (summed across all cores and all Compute Nodes) consumed by the Task. */ - kernelCPUTime: string; + kernelCpuTime: string; /** The total wall clock time of the Task. The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If the Task was retried, this includes the wall clock time of all the Task retries. */ wallClockTime: string; /** The total number of disk read operations made by the Task. */ @@ -2248,9 +2248,9 @@ export interface TaskStatistics { /** The total number of disk write operations made by the Task. */ writeIOps: number; /** The total gibibytes read from disk by the Task. */ - readIOGiB: number; + readIoGiB: number; /** The total gibibytes written to disk by the Task. */ - writeIOGiB: number; + writeIoGiB: number; /** The total wait time of the Task. The wait time for a Task is defined as the elapsed time between the creation of the Task and the start of Task execution. (If the Task is retried due to failures, the wait time is the time to the most recent Task execution.). */ waitTime: string; } @@ -2260,13 +2260,13 @@ export function taskStatisticsDeserializer(item: any): TaskStatistics { url: item["url"], startTime: new Date(item["startTime"]), lastUpdateTime: new Date(item["lastUpdateTime"]), - userCPUTime: item["userCPUTime"], - kernelCPUTime: item["kernelCPUTime"], + userCpuTime: item["userCPUTime"], + kernelCpuTime: item["kernelCPUTime"], wallClockTime: item["wallClockTime"], readIOps: item["readIOps"], writeIOps: item["writeIOps"], - readIOGiB: item["readIOGiB"], - writeIOGiB: item["writeIOGiB"], + readIoGiB: item["readIOGiB"], + writeIoGiB: item["writeIOGiB"], waitTime: item["waitTime"], }; } @@ -3345,9 +3345,9 @@ export interface VirtualMachineConfiguration { /** The node placement configuration for the pool. This configuration will specify rules on how nodes in the pool will be physically allocated. */ nodePlacementConfiguration?: NodePlacementConfiguration; /** The virtual machine extension for the pool. If specified, the extensions mentioned in this configuration will be installed on each node. */ - extensions?: VMExtension[]; + extensions?: VmExtension[]; /** Settings for the operating system disk of the Virtual Machine. */ - osDisk?: OSDisk; + osDisk?: OsDisk; } export function virtualMachineConfigurationSerializer( @@ -3378,8 +3378,8 @@ export function virtualMachineConfigurationSerializer( ), extensions: !item["extensions"] ? item["extensions"] - : vMExtensionArraySerializer(item["extensions"]), - osDisk: !item["osDisk"] ? item["osDisk"] : oSDiskSerializer(item["osDisk"]), + : vmExtensionArraySerializer(item["extensions"]), + osDisk: !item["osDisk"] ? item["osDisk"] : osDiskSerializer(item["osDisk"]), }; } @@ -3411,10 +3411,10 @@ export function virtualMachineConfigurationDeserializer( ), extensions: !item["extensions"] ? item["extensions"] - : vMExtensionArrayDeserializer(item["extensions"]), + : vmExtensionArrayDeserializer(item["extensions"]), osDisk: !item["osDisk"] ? item["osDisk"] - : oSDiskDeserializer(item["osDisk"]), + : osDiskDeserializer(item["osDisk"]), }; } @@ -3614,37 +3614,37 @@ export function nodePlacementConfigurationDeserializer( /** NodePlacementPolicyType enums */ export type NodePlacementPolicyType = "regional" | "zonal"; -export function vMExtensionArraySerializer(result: Array): any[] { +export function vmExtensionArraySerializer(result: Array): any[] { return result.map((item) => { - return vMExtensionSerializer(item); + return vmExtensionSerializer(item); }); } -export function vMExtensionArrayDeserializer( - result: Array, +export function vmExtensionArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return vMExtensionDeserializer(item); + return vmExtensionDeserializer(item); }); } /** Settings for the operating system disk of the compute node (VM). */ -export interface OSDisk { +export interface OsDisk { /** Specifies the ephemeral Disk Settings for the operating system disk used by the compute node (VM). */ - ephemeralOSDiskSettings?: DiffDiskSettings; + ephemeralOsDiskSettings?: DiffDiskSettings; } -export function oSDiskSerializer(item: OSDisk): any { +export function osDiskSerializer(item: OsDisk): any { return { - ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] - ? item["ephemeralOSDiskSettings"] - : diffDiskSettingsSerializer(item["ephemeralOSDiskSettings"]), + ephemeralOSDiskSettings: !item["ephemeralOsDiskSettings"] + ? item["ephemeralOsDiskSettings"] + : diffDiskSettingsSerializer(item["ephemeralOsDiskSettings"]), }; } -export function oSDiskDeserializer(item: any): OSDisk { +export function osDiskDeserializer(item: any): OsDisk { return { - ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] + ephemeralOsDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] : diffDiskSettingsDeserializer(item["ephemeralOSDiskSettings"]), }; @@ -3751,14 +3751,14 @@ export type DynamicVNetAssignmentScope = "none" | "job"; /** The endpoint configuration for a Pool. */ export interface PoolEndpointConfiguration { /** A list of inbound NAT Pools that can be used to address specific ports on an individual Compute Node externally. The maximum number of inbound NAT Pools per Batch Pool is 5. If the maximum number of inbound NAT Pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. */ - inboundNatPools: InboundNATPool[]; + inboundNatPools: InboundNatPool[]; } export function poolEndpointConfigurationSerializer( item: PoolEndpointConfiguration, ): any { return { - inboundNATPools: inboundNATPoolArraySerializer(item["inboundNatPools"]), + inboundNATPools: inboundNatPoolArraySerializer(item["inboundNatPools"]), }; } @@ -3766,7 +3766,7 @@ export function poolEndpointConfigurationDeserializer( item: any, ): PoolEndpointConfiguration { return { - inboundNatPools: inboundNATPoolArrayDeserializer(item["inboundNATPools"]), + inboundNatPools: inboundNatPoolArrayDeserializer(item["inboundNATPools"]), }; } @@ -3774,7 +3774,7 @@ export function poolEndpointConfigurationDeserializer( * A inbound NAT Pool that can be used to address specific ports on Compute Nodes * in a Batch Pool externally. */ -export interface InboundNATPool { +export interface InboundNatPool { /** The name of the endpoint. The name must be unique within a Batch Pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. */ name: string; /** The protocol of the endpoint. */ @@ -3789,7 +3789,7 @@ export interface InboundNATPool { networkSecurityGroupRules?: NetworkSecurityGroupRule[]; } -export function inboundNATPoolSerializer(item: InboundNATPool): any { +export function inboundNatPoolSerializer(item: InboundNatPool): any { return { name: item["name"], protocol: item["protocol"], @@ -3804,7 +3804,7 @@ export function inboundNATPoolSerializer(item: InboundNATPool): any { }; } -export function inboundNATPoolDeserializer(item: any): InboundNATPool { +export function inboundNatPoolDeserializer(item: any): InboundNatPool { return { name: item["name"], protocol: item["protocol"], @@ -3880,19 +3880,19 @@ export function networkSecurityGroupRuleArrayDeserializer( }); } -export function inboundNATPoolArraySerializer( - result: Array, +export function inboundNatPoolArraySerializer( + result: Array, ): any[] { return result.map((item) => { - return inboundNATPoolSerializer(item); + return inboundNatPoolSerializer(item); }); } -export function inboundNATPoolArrayDeserializer( - result: Array, +export function inboundNatPoolArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return inboundNATPoolDeserializer(item); + return inboundNatPoolDeserializer(item); }); } @@ -4366,9 +4366,9 @@ export interface JobScheduleStatistics { /** The time at which the statistics were last updated. All statistics are limited to the range between startTime and lastUpdateTime. */ lastUpdateTime: Date; /** The total user mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in all Jobs created under the schedule. */ - userCPUTime: string; + userCpuTime: string; /** The total kernel mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in all Jobs created under the schedule. */ - kernelCPUTime: string; + kernelCpuTime: string; /** The total wall clock time of all the Tasks in all the Jobs created under the schedule. The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If a Task was retried, this includes the wall clock time of all the Task retries. */ wallClockTime: string; /** The total number of disk read operations made by all Tasks in all Jobs created under the schedule. */ @@ -4376,9 +4376,9 @@ export interface JobScheduleStatistics { /** The total number of disk write operations made by all Tasks in all Jobs created under the schedule. */ writeIOps: number; /** The total gibibytes read from disk by all Tasks in all Jobs created under the schedule. */ - readIOGiB: number; + readIoGiB: number; /** The total gibibytes written to disk by all Tasks in all Jobs created under the schedule. */ - writeIOGiB: number; + writeIoGiB: number; /** The total number of Tasks successfully completed during the given time range in Jobs created under the schedule. A Task completes successfully if it returns exit code 0. */ numSucceededTasks: number; /** The total number of Tasks that failed during the given time range in Jobs created under the schedule. A Task fails if it exhausts its maximum retry count without returning exit code 0. */ @@ -4396,13 +4396,13 @@ export function jobScheduleStatisticsDeserializer( url: item["url"], startTime: new Date(item["startTime"]), lastUpdateTime: new Date(item["lastUpdateTime"]), - userCPUTime: item["userCPUTime"], - kernelCPUTime: item["kernelCPUTime"], + userCpuTime: item["userCPUTime"], + kernelCpuTime: item["kernelCPUTime"], wallClockTime: item["wallClockTime"], readIOps: item["readIOps"], writeIOps: item["writeIOps"], - readIOGiB: item["readIOGiB"], - writeIOGiB: item["writeIOGiB"], + readIoGiB: item["readIOGiB"], + writeIoGiB: item["writeIOGiB"], numSucceededTasks: item["numSucceededTasks"], numFailedTasks: item["numFailedTasks"], numTaskRetries: item["numTaskRetries"], @@ -4832,9 +4832,9 @@ export interface JobStatistics { /** The time at which the statistics were last updated. All statistics are limited to the range between startTime and lastUpdateTime. */ lastUpdateTime: Date; /** The total user mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in the Job. */ - userCPUTime: string; + userCpuTime: string; /** The total kernel mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in the Job. */ - kernelCPUTime: string; + kernelCpuTime: string; /** The total wall clock time of all Tasks in the Job. The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If a Task was retried, this includes the wall clock time of all the Task retries. */ wallClockTime: string; /** The total number of disk read operations made by all Tasks in the Job. */ @@ -4842,9 +4842,9 @@ export interface JobStatistics { /** The total number of disk write operations made by all Tasks in the Job. */ writeIOps: number; /** The total amount of data in GiB read from disk by all Tasks in the Job. */ - readIOGiB: number; + readIoGiB: number; /** The total amount of data in GiB written to disk by all Tasks in the Job. */ - writeIOGiB: number; + writeIoGiB: number; /** The total number of Tasks successfully completed in the Job during the given time range. A Task completes successfully if it returns exit code 0. */ numSucceededTasks: number; /** The total number of Tasks in the Job that failed during the given time range. A Task fails if it exhausts its maximum retry count without returning exit code 0. */ @@ -4860,13 +4860,13 @@ export function jobStatisticsDeserializer(item: any): JobStatistics { url: item["url"], startTime: new Date(item["startTime"]), lastUpdateTime: new Date(item["lastUpdateTime"]), - userCPUTime: item["userCPUTime"], - kernelCPUTime: item["kernelCPUTime"], + userCpuTime: item["userCPUTime"], + kernelCpuTime: item["kernelCPUTime"], wallClockTime: item["wallClockTime"], readIOps: item["readIOps"], writeIOps: item["writeIOps"], - readIOGiB: item["readIOGiB"], - writeIOGiB: item["writeIOGiB"], + readIoGiB: item["readIOGiB"], + writeIoGiB: item["writeIOGiB"], numSucceededTasks: item["numSucceededTasks"], numFailedTasks: item["numFailedTasks"], numTaskRetries: item["numTaskRetries"], @@ -5305,7 +5305,7 @@ export interface ImageInformation { /** The reference to the Azure Virtual Machine's Marketplace Image. */ imageReference: ImageReference; /** The type of operating system (e.g. Windows or Linux) of the Image. */ - osType: OSType; + osType: OsType; /** The capabilities or features which the Image supports. Not every capability of the Image is listed. Capabilities in this list are considered of special interest and are generally related to integration with other features in the Azure Batch service. */ capabilities?: string[]; /** The time when the Azure Batch service will stop accepting create Pool requests for the Image. */ @@ -5332,7 +5332,7 @@ export function imageInformationDeserializer(item: any): ImageInformation { } /** OSType enums */ -export type OSType = "linux" | "windows"; +export type OsType = "linux" | "windows"; /** VerificationType enums */ export type VerificationType = "verified" | "unverified"; diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md index 1e03938d8f..ba6897ebc0 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md @@ -1373,9 +1373,9 @@ export interface PassFailCriteriaOutput { // @public export interface PassFailMetric { - action?: PFAction; - aggregate?: PFAgFunc; - clientMetric?: PFMetrics; + action?: PfAction; + aggregate?: PfAgFunc; + clientMetric?: PfMetrics; condition?: string; requestName?: string; value?: number; @@ -1383,45 +1383,45 @@ export interface PassFailMetric { // @public export interface PassFailMetricOutput { - action?: PFActionOutput; + action?: PfActionOutput; readonly actualValue?: number; - aggregate?: PFAgFuncOutput; - clientMetric?: PFMetricsOutput; + aggregate?: PfAgFuncOutput; + clientMetric?: PfMetricsOutput; condition?: string; requestName?: string; - readonly result?: PFResultOutput; + readonly result?: PfResultOutput; value?: number; } // @public -export type PFAction = "continue" | "stop"; +export type PfAction = "continue" | "stop"; // @public -export type PFActionOutput = "continue" | "stop"; +export type PfActionOutput = "continue" | "stop"; // @public -export type PFAgFunc = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; +export type PfAgFunc = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; // @public -export type PFAgFuncOutput = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; +export type PfAgFuncOutput = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; // @public -export type PFMetrics = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; +export type PfMetrics = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; // @public -export type PFMetricsOutput = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; +export type PfMetricsOutput = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; // @public -export type PFResult = "passed" | "undetermined" | "failed"; +export type PfResult = "passed" | "undetermined" | "failed"; // @public -export type PFResultOutput = "passed" | "undetermined" | "failed"; +export type PfResultOutput = "passed" | "undetermined" | "failed"; // @public -export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +export type PfTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; // @public -export type PFTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +export type PfTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; // @public export interface ResourceMetric { @@ -1665,7 +1665,7 @@ export interface TestRunOutput { readonly subnetId?: string; readonly testArtifacts?: TestRunArtifactsOutput; testId?: string; - readonly testResult?: PFTestResultOutput; + readonly testResult?: PfTestResultOutput; readonly testRunId: string; readonly testRunStatistics?: Record; readonly virtualUsers?: number; diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts index 06ea3de8a6..f907d19836 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts @@ -40,14 +40,14 @@ export interface PassFailCriteria { /** Pass fail metric */ export interface PassFailMetric { /** The client metric on which the criteria should be applied. */ - clientMetric?: PFMetrics; + clientMetric?: PfMetrics; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests */ - aggregate?: PFAgFunc; + aggregate?: PfAgFunc; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -58,7 +58,7 @@ export interface PassFailMetric { */ value?: number; /** Action taken after the threshold is met. Default is ‘continue’. */ - action?: PFAction; + action?: PfAction; } /** Secret */ @@ -299,15 +299,15 @@ export interface TestRunServerMetricConfig { metrics?: Record; } -/** Alias for PFMetrics */ -export type PFMetrics = +/** Alias for PfMetrics */ +export type PfMetrics = | "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; -/** Alias for PFAgFunc */ -export type PFAgFunc = +/** Alias for PfAgFunc */ +export type PfAgFunc = | "count" | "percentage" | "avg" @@ -317,10 +317,10 @@ export type PFAgFunc = | "p99" | "min" | "max"; -/** Alias for PFAction */ -export type PFAction = "continue" | "stop"; -/** Alias for PFResult */ -export type PFResult = "passed" | "undetermined" | "failed"; +/** Alias for PfAction */ +export type PfAction = "continue" | "stop"; +/** Alias for PfResult */ +export type PfResult = "passed" | "undetermined" | "failed"; /** Alias for SecretType */ export type SecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; /** Alias for CertificateType */ @@ -334,8 +334,8 @@ export type FileStatus = | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; -/** Alias for PFTestResult */ -export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for PfTestResult */ +export type PfTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; /** Alias for Status */ export type Status = | "ACCEPTED" diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts index 69862f8718..1305208978 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts @@ -52,14 +52,14 @@ export interface PassFailCriteriaOutput { /** Pass fail metric */ export interface PassFailMetricOutput { /** The client metric on which the criteria should be applied. */ - clientMetric?: PFMetricsOutput; + clientMetric?: PfMetricsOutput; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests */ - aggregate?: PFAgFuncOutput; + aggregate?: PfAgFuncOutput; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -70,11 +70,11 @@ export interface PassFailMetricOutput { */ value?: number; /** Action taken after the threshold is met. Default is ‘continue’. */ - action?: PFActionOutput; + action?: PfActionOutput; /** The actual value of the client metric for the test run. */ readonly actualValue?: number; /** Outcome of the test run. */ - readonly result?: PFResultOutput; + readonly result?: PfResultOutput; } /** Secret */ @@ -294,7 +294,7 @@ export interface TestRunOutput { /** Collection of test run artifacts */ readonly testArtifacts?: TestRunArtifactsOutput; /** Test result for pass/Fail criteria used during the test run. */ - readonly testResult?: PFTestResultOutput; + readonly testResult?: PfTestResultOutput; /** Number of virtual users, for which test has been run. */ readonly virtualUsers?: number; /** Display name of a testRun. */ @@ -547,15 +547,15 @@ export interface TestRunServerMetricConfigOutput { readonly lastModifiedBy?: string; } -/** Alias for PFMetricsOutput */ -export type PFMetricsOutput = +/** Alias for PfMetricsOutput */ +export type PfMetricsOutput = | "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; -/** Alias for PFAgFuncOutput */ -export type PFAgFuncOutput = +/** Alias for PfAgFuncOutput */ +export type PfAgFuncOutput = | "count" | "percentage" | "avg" @@ -565,10 +565,10 @@ export type PFAgFuncOutput = | "p99" | "min" | "max"; -/** Alias for PFActionOutput */ -export type PFActionOutput = "continue" | "stop"; -/** Alias for PFResultOutput */ -export type PFResultOutput = "passed" | "undetermined" | "failed"; +/** Alias for PfActionOutput */ +export type PfActionOutput = "continue" | "stop"; +/** Alias for PfResultOutput */ +export type PfResultOutput = "passed" | "undetermined" | "failed"; /** Alias for SecretTypeOutput */ export type SecretTypeOutput = "AKV_SECRET_URI" | "SECRET_VALUE"; /** Alias for CertificateTypeOutput */ @@ -585,8 +585,8 @@ export type FileStatusOutput = | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; -/** Alias for PFTestResultOutput */ -export type PFTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for PfTestResultOutput */ +export type PfTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; /** Alias for StatusOutput */ export type StatusOutput = | "ACCEPTED" diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index fbf53685e3..10ace53285 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -135,7 +135,7 @@ export type FileType = string; // @public export interface FunctionFlexConsumptionResourceConfiguration { httpConcurrency: number; - instanceMemoryMB: number; + instanceMemoryMb: number; } // @public @@ -195,26 +195,26 @@ export enum KnownAggregationType { // @public export enum KnownCertificateType { - AKV_CERT_URI = "AKV_CERT_URI" + AKVCERTURI = "AKV_CERT_URI" } // @public export enum KnownFileStatus { - NOT_VALIDATED = "NOT_VALIDATED", - VALIDATION_FAILURE = "VALIDATION_FAILURE", - VALIDATION_INITIATED = "VALIDATION_INITIATED", - VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", - VALIDATION_SUCCESS = "VALIDATION_SUCCESS" + NOTValidated = "NOT_VALIDATED", + ValidationFailure = "VALIDATION_FAILURE", + ValidationInitiated = "VALIDATION_INITIATED", + ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", + ValidationSuccess = "VALIDATION_SUCCESS" } // @public export enum KnownFileType { - ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", - JMX_FILE = "JMX_FILE", - TEST_SCRIPT = "TEST_SCRIPT", - URL_TEST_CONFIG = "URL_TEST_CONFIG", - USER_PROPERTIES = "USER_PROPERTIES", - ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS" + AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", + JMXFILE = "JMX_FILE", + TESTSCRIPT = "TEST_SCRIPT", + URLTESTCONFIG = "URL_TEST_CONFIG", + USERProperties = "USER_PROPERTIES", + ZIPPEDArtifacts = "ZIPPED_ARTIFACTS" } // @public @@ -230,50 +230,50 @@ export enum KnownMetricUnit { } // @public -export enum KnownPFAction { - "continue" = "continue", - stop = "stop" +export enum KnownPfAction { + Continue = "continue", + Stop = "stop" } // @public -export enum KnownPFAgFunc { - "p99.9" = "p99.9", - "p99.99" = "p99.99", - avg = "avg", - count = "count", - max = "max", - min = "min", - p50 = "p50", - p75 = "p75", - p90 = "p90", - p95 = "p95", - p96 = "p96", - p97 = "p97", - p98 = "p98", - p99 = "p99", - percentage = "percentage" +export enum KnownPfAgFunc { + Avg = "avg", + Count = "count", + Max = "max", + Min = "min", + P50 = "p50", + P75 = "p75", + P90 = "p90", + P95 = "p95", + P96 = "p96", + P97 = "p97", + P98 = "p98", + P99 = "p99", + P999 = "p99.9", + P9999 = "p99.99", + Percentage = "percentage" } // @public -export enum KnownPFMetrics { - error = "error", - latency = "latency", - requests = "requests", - requests_per_sec = "requests_per_sec", - response_time_ms = "response_time_ms" +export enum KnownPfMetrics { + Error = "error", + Latency = "latency", + Requests = "requests", + RequestsPerSec = "requests_per_sec", + ResponseTimeMs = "response_time_ms" } // @public -export enum KnownPFResult { - failed = "failed", - passed = "passed", - undetermined = "undetermined" +export enum KnownPfResult { + Failed = "failed", + Passed = "passed", + Undetermined = "undetermined" } // @public -export enum KnownPFTestResult { +export enum KnownPfTestResult { FAILED = "FAILED", - NOT_APPLICABLE = "NOT_APPLICABLE", + NOTApplicable = "NOT_APPLICABLE", PASSED = "PASSED" } @@ -296,28 +296,28 @@ export enum KnownResourceKind { // @public export enum KnownSecretType { - AKV_SECRET_URI = "AKV_SECRET_URI", - SECRET_VALUE = "SECRET_VALUE" + AKVSECRETURI = "AKV_SECRET_URI", + SECRETVALUE = "SECRET_VALUE" } // @public export enum KnownStatus { - ACCEPTED = "ACCEPTED", - CANCELLED = "CANCELLED", - CANCELLING = "CANCELLING", - CONFIGURED = "CONFIGURED", - CONFIGURING = "CONFIGURING", - DEPROVISIONED = "DEPROVISIONED", - DEPROVISIONING = "DEPROVISIONING", + Accepted = "ACCEPTED", + Cancelled = "CANCELLED", + Cancelling = "CANCELLING", + Configured = "CONFIGURED", + Configuring = "CONFIGURING", + Deprovisioned = "DEPROVISIONED", + Deprovisioning = "DEPROVISIONING", DONE = "DONE", - EXECUTED = "EXECUTED", - EXECUTING = "EXECUTING", + Executed = "EXECUTED", + Executing = "EXECUTING", FAILED = "FAILED", - NOTSTARTED = "NOTSTARTED", - PROVISIONED = "PROVISIONED", - PROVISIONING = "PROVISIONING", - VALIDATION_FAILURE = "VALIDATION_FAILURE", - VALIDATION_SUCCESS = "VALIDATION_SUCCESS" + Notstarted = "NOTSTARTED", + Provisioned = "PROVISIONED", + Provisioning = "PROVISIONING", + ValidationFailure = "VALIDATION_FAILURE", + ValidationSuccess = "VALIDATION_SUCCESS" } // @public @@ -329,13 +329,13 @@ export enum KnownTestKind { // @public export enum KnownTestProfileRunStatus { - ACCEPTED = "ACCEPTED", - CANCELLED = "CANCELLED", - CANCELLING = "CANCELLING", + Accepted = "ACCEPTED", + Cancelled = "CANCELLED", + Cancelling = "CANCELLING", DONE = "DONE", - EXECUTING = "EXECUTING", + Executing = "EXECUTING", FAILED = "FAILED", - NOTSTARTED = "NOTSTARTED" + Notstarted = "NOTSTARTED" } // @public @@ -443,7 +443,7 @@ export interface LoadTestConfiguration { optionalLoadTestConfig?: OptionalLoadTestConfig; quickStartTest?: boolean; regionalLoadTestConfig?: RegionalConfiguration[]; - splitAllCSVs?: boolean; + splitAllCsVs?: boolean; } // @public (undocumented) @@ -571,30 +571,30 @@ export interface PassFailCriteria { // @public export interface PassFailMetric { - action?: PFAction; + action?: PfAction; readonly actualValue?: number; - aggregate?: PFAgFunc; - clientMetric?: PFMetrics; + aggregate?: PfAgFunc; + clientMetric?: PfMetrics; condition?: string; requestName?: string; - readonly result?: PFResult; + readonly result?: PfResult; value?: number; } // @public -export type PFAction = string; +export type PfAction = string; // @public -export type PFAgFunc = string; +export type PfAgFunc = string; // @public -export type PFMetrics = string; +export type PfMetrics = string; // @public -export type PFResult = string; +export type PfResult = string; // @public -export type PFTestResult = string; +export type PfTestResult = string; // @public export type RecommendationCategory = string; @@ -669,7 +669,7 @@ export interface Test { readonly lastModifiedDateTime?: Date; loadTestConfiguration?: LoadTestConfiguration; passFailCriteria?: PassFailCriteria; - publicIPDisabled?: boolean; + publicIpDisabled?: boolean; secrets?: Record; subnetId?: string; readonly testId: string; @@ -803,7 +803,7 @@ export interface TestRun { loadTestConfiguration?: LoadTestConfiguration; passFailCriteria?: PassFailCriteria; readonly portalUrl?: string; - readonly publicIPDisabled?: boolean; + readonly publicIpDisabled?: boolean; readonly regionalStatistics?: Record; requestDataLevel?: RequestDataLevel; secrets?: Record; @@ -812,7 +812,7 @@ export interface TestRun { readonly subnetId?: string; readonly testArtifacts?: TestRunArtifacts; testId?: string; - readonly testResult?: PFTestResult; + readonly testResult?: PfTestResult; readonly testRunId: string; readonly testRunStatistics?: Record; readonly virtualUsers?: number; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts index 2879d059ec..f8614d1dd4 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts @@ -12,14 +12,14 @@ export { Test, PassFailCriteria, PassFailMetric, - KnownPFMetrics, - PFMetrics, - KnownPFAgFunc, - PFAgFunc, - KnownPFAction, - PFAction, - KnownPFResult, - PFResult, + KnownPfMetrics, + PfMetrics, + KnownPfAgFunc, + PfAgFunc, + KnownPfAction, + PfAction, + KnownPfResult, + PfResult, AutoStopCriteria, Secret, KnownSecretType, @@ -50,8 +50,8 @@ export { TestRunFileInfo, TestRunOutputArtifacts, ArtifactsContainerInfo, - KnownPFTestResult, - PFTestResult, + KnownPfTestResult, + PfTestResult, KnownStatus, Status, KnownRequestDataLevel, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts index a50a8878e2..9c97d8d604 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts @@ -5,14 +5,14 @@ export { Test, PassFailCriteria, PassFailMetric, - KnownPFMetrics, - PFMetrics, - KnownPFAgFunc, - PFAgFunc, - KnownPFAction, - PFAction, - KnownPFResult, - PFResult, + KnownPfMetrics, + PfMetrics, + KnownPfAgFunc, + PfAgFunc, + KnownPfAction, + PfAction, + KnownPfResult, + PfResult, AutoStopCriteria, Secret, KnownSecretType, @@ -43,8 +43,8 @@ export { TestRunFileInfo, TestRunOutputArtifacts, ArtifactsContainerInfo, - KnownPFTestResult, - PFTestResult, + KnownPfTestResult, + PfTestResult, KnownStatus, Status, KnownRequestDataLevel, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts index 676ef53a97..2a19c424fc 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts @@ -36,7 +36,7 @@ export interface Test { /** Kind of test. */ kind?: TestKind; /** Inject load test engines without deploying public IP for outbound access */ - publicIPDisabled?: boolean; + publicIpDisabled?: boolean; /** Type of the managed identity referencing the Key vault. */ keyvaultReferenceIdentityType?: string; /** Resource Id of the managed identity referencing the Key vault. */ @@ -74,7 +74,7 @@ export function testSerializer(item: Test): any { displayName: item["displayName"], subnetId: item["subnetId"], kind: item["kind"], - publicIPDisabled: item["publicIPDisabled"], + publicIPDisabled: item["publicIpDisabled"], keyvaultReferenceIdentityType: item["keyvaultReferenceIdentityType"], keyvaultReferenceIdentityId: item["keyvaultReferenceIdentityId"], }; @@ -107,7 +107,7 @@ export function testDeserializer(item: any): Test { displayName: item["displayName"], subnetId: item["subnetId"], kind: item["kind"], - publicIPDisabled: item["publicIPDisabled"], + publicIpDisabled: item["publicIPDisabled"], keyvaultReferenceIdentityType: item["keyvaultReferenceIdentityType"], keyvaultReferenceIdentityId: item["keyvaultReferenceIdentityId"], createdDateTime: !item["createdDateTime"] @@ -146,14 +146,14 @@ export function passFailCriteriaDeserializer(item: any): PassFailCriteria { /** Pass fail metric */ export interface PassFailMetric { /** The client metric on which the criteria should be applied. */ - clientMetric?: PFMetrics; + clientMetric?: PfMetrics; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests */ - aggregate?: PFAgFunc; + aggregate?: PfAgFunc; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -164,11 +164,11 @@ export interface PassFailMetric { */ value?: number; /** Action taken after the threshold is met. Default is ‘continue’. */ - action?: PFAction; + action?: PfAction; /** The actual value of the client metric for the test run. */ readonly actualValue?: number; /** Outcome of the test run. */ - readonly result?: PFResult; + readonly result?: PfResult; } export function passFailMetricSerializer(item: PassFailMetric): any { @@ -196,17 +196,17 @@ export function passFailMetricDeserializer(item: any): PassFailMetric { } /** Metrics for pass/fail criteria. */ -export enum KnownPFMetrics { +export enum KnownPfMetrics { /** Pass fail criteria for response time metric in milliseconds. */ - response_time_ms = "response_time_ms", + ResponseTimeMs = "response_time_ms", /** Pass fail criteria for latency metric in milliseconds. */ - latency = "latency", + Latency = "latency", /** Pass fail criteria for error metric. */ - error = "error", + Error = "error", /** Pass fail criteria for total requests. */ - requests = "requests", + Requests = "requests", /** Pass fail criteria for request per second. */ - requests_per_sec = "requests_per_sec", + RequestsPerSec = "requests_per_sec", } /** @@ -220,40 +220,40 @@ export enum KnownPFMetrics { * **requests**: Pass fail criteria for total requests. \ * **requests_per_sec**: Pass fail criteria for request per second. */ -export type PFMetrics = string; +export type PfMetrics = string; /** Aggregation functions for pass/fail criteria. */ -export enum KnownPFAgFunc { +export enum KnownPfAgFunc { /** Criteria applies for count value. */ - count = "count", + Count = "count", /** Criteria applies for given percentage value. */ - percentage = "percentage", + Percentage = "percentage", /** Criteria applies for avg value. */ - avg = "avg", + Avg = "avg", /** Criteria applies for 50th percentile value. */ - p50 = "p50", + P50 = "p50", /** Criteria applies for 75th percentile value. */ - p75 = "p75", + P75 = "p75", /** Criteria applies for 90th percentile value. */ - p90 = "p90", + P90 = "p90", /** Criteria applies for 95th percentile value. */ - p95 = "p95", + P95 = "p95", /** Criteria applies for 96th percentile value. */ - p96 = "p96", + P96 = "p96", /** Criteria applies for 97th percentile value. */ - p97 = "p97", + P97 = "p97", /** Criteria applies for 98th percentile value. */ - p98 = "p98", + P98 = "p98", /** Criteria applies for 99th percentile value. */ - p99 = "p99", + P99 = "p99", /** Criteria applies for 99.9th percentile value. */ - "p99.9" = "p99.9", + P999 = "p99.9", /** Criteria applies for 99.99th percentile value. */ - "p99.99" = "p99.99", + P9999 = "p99.99", /** Criteria applies for minimum value. */ - min = "min", + Min = "min", /** Criteria applies for maximum value. */ - max = "max", + Max = "max", } /** @@ -277,14 +277,14 @@ export enum KnownPFAgFunc { * **min**: Criteria applies for minimum value. \ * **max**: Criteria applies for maximum value. */ -export type PFAgFunc = string; +export type PfAgFunc = string; /** Action to take on failure of pass/fail criteria. */ -export enum KnownPFAction { +export enum KnownPfAction { /** Test will continue to run even if pass fail metric criteria metric gets failed. */ - "continue" = "continue", + Continue = "continue", /** Test run will stop if pass fail criteria metric is not passed. */ - stop = "stop", + Stop = "stop", } /** @@ -295,16 +295,16 @@ export enum KnownPFAction { * **continue**: Test will continue to run even if pass fail metric criteria metric gets failed. \ * **stop**: Test run will stop if pass fail criteria metric is not passed. */ -export type PFAction = string; +export type PfAction = string; /** Pass/fail criteria result. */ -export enum KnownPFResult { +export enum KnownPfResult { /** Given pass fail criteria metric has passed. */ - passed = "passed", + Passed = "passed", /** Given pass fail criteria metric couldn't determine. */ - undetermined = "undetermined", + Undetermined = "undetermined", /** Given pass fail criteria metric has failed. */ - failed = "failed", + Failed = "failed", } /** @@ -316,7 +316,7 @@ export enum KnownPFResult { * **undetermined**: Given pass fail criteria metric couldn't determine. \ * **failed**: Given pass fail criteria metric has failed. */ -export type PFResult = string; +export type PfResult = string; export function passFailMetricRecordSerializer( item: Record, @@ -388,9 +388,9 @@ export function secretDeserializer(item: any): Secret { /** Types of secrets supported. */ export enum KnownSecretType { /** If the secret is stored in an Azure Key Vault. */ - AKV_SECRET_URI = "AKV_SECRET_URI", + AKVSECRETURI = "AKV_SECRET_URI", /** If the secret value provided as plain text. */ - SECRET_VALUE = "SECRET_VALUE", + SECRETVALUE = "SECRET_VALUE", } /** @@ -450,7 +450,7 @@ export function certificateMetadataDeserializer( /** Types of certificates supported. */ export enum KnownCertificateType { /** If the certificate is stored in an Azure Key Vault. */ - AKV_CERT_URI = "AKV_CERT_URI", + AKVCERTURI = "AKV_CERT_URI", } /** @@ -472,7 +472,7 @@ export interface LoadTestConfiguration { * input data evenly across all engine instances. If you provide multiple CSV * files, each file will be split evenly. */ - splitAllCSVs?: boolean; + splitAllCsVs?: boolean; /** * If true, optionalLoadTestConfig is required and JMX script for the load test is * not required to upload. @@ -489,7 +489,7 @@ export function loadTestConfigurationSerializer( ): any { return { engineInstances: item["engineInstances"], - splitAllCSVs: item["splitAllCSVs"], + splitAllCSVs: item["splitAllCsVs"], quickStartTest: item["quickStartTest"], optionalLoadTestConfig: !item["optionalLoadTestConfig"] ? item["optionalLoadTestConfig"] @@ -505,7 +505,7 @@ export function loadTestConfigurationDeserializer( ): LoadTestConfiguration { return { engineInstances: item["engineInstances"], - splitAllCSVs: item["splitAllCSVs"], + splitAllCsVs: item["splitAllCSVs"], quickStartTest: item["quickStartTest"], optionalLoadTestConfig: !item["optionalLoadTestConfig"] ? item["optionalLoadTestConfig"] @@ -672,17 +672,17 @@ export function testFileInfoDeserializer(item: any): TestFileInfo { /** Types of file supported. */ export enum KnownFileType { /** If the file is a JMX script. */ - JMX_FILE = "JMX_FILE", + JMXFILE = "JMX_FILE", /** If the file is a user properties file. */ - USER_PROPERTIES = "USER_PROPERTIES", + USERProperties = "USER_PROPERTIES", /** If the file is not among any of the other supported file types. */ - ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", + AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", /** If the file is a compressed archive containing a collection of various artifacts or resources. */ - ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS", + ZIPPEDArtifacts = "ZIPPED_ARTIFACTS", /** If the file is a JSON config file to define the requests for a URL test. */ - URL_TEST_CONFIG = "URL_TEST_CONFIG", + URLTESTCONFIG = "URL_TEST_CONFIG", /** If the file is a test script. */ - TEST_SCRIPT = "TEST_SCRIPT", + TESTSCRIPT = "TEST_SCRIPT", } /** @@ -702,15 +702,15 @@ export type FileType = string; /** File status. */ export enum KnownFileStatus { /** File is not validated. */ - NOT_VALIDATED = "NOT_VALIDATED", + NOTValidated = "NOT_VALIDATED", /** File is validated. */ - VALIDATION_SUCCESS = "VALIDATION_SUCCESS", + ValidationSuccess = "VALIDATION_SUCCESS", /** File validation is failed. */ - VALIDATION_FAILURE = "VALIDATION_FAILURE", + ValidationFailure = "VALIDATION_FAILURE", /** File validation is in progress. */ - VALIDATION_INITIATED = "VALIDATION_INITIATED", + ValidationInitiated = "VALIDATION_INITIATED", /** Validation is not required. */ - VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", + ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", } /** @@ -1006,7 +1006,7 @@ export interface TestRun { /** Collection of test run artifacts */ readonly testArtifacts?: TestRunArtifacts; /** Test result for pass/Fail criteria used during the test run. */ - readonly testResult?: PFTestResult; + readonly testResult?: PfTestResult; /** Number of virtual users, for which test has been run. */ readonly virtualUsers?: number; /** Display name of a testRun. */ @@ -1036,7 +1036,7 @@ export interface TestRun { /** Enable or disable debug level logging. True if debug logs are enabled for the test run. False otherwise */ debugLogsEnabled?: boolean; /** Inject load test engines without deploying public IP for outbound access */ - readonly publicIPDisabled?: boolean; + readonly publicIpDisabled?: boolean; /** The creation datetime(RFC 3339 literal format). */ readonly createdDateTime?: Date; /** The user that created. */ @@ -1125,7 +1125,7 @@ export function testRunDeserializer(item: any): TestRun { kind: item["kind"], requestDataLevel: item["requestDataLevel"], debugLogsEnabled: item["debugLogsEnabled"], - publicIPDisabled: item["publicIPDisabled"], + publicIpDisabled: item["publicIPDisabled"], createdDateTime: !item["createdDateTime"] ? item["createdDateTime"] : new Date(item["createdDateTime"]), @@ -1386,11 +1386,11 @@ export function artifactsContainerInfoDeserializer( } /** Test result based on pass/fail criteria. */ -export enum KnownPFTestResult { +export enum KnownPfTestResult { /** Pass/fail criteria has passed. */ PASSED = "PASSED", /** Pass/fail criteria is not applicable. */ - NOT_APPLICABLE = "NOT_APPLICABLE", + NOTApplicable = "NOT_APPLICABLE", /** Pass/fail criteria has failed. */ FAILED = "FAILED", } @@ -1404,42 +1404,42 @@ export enum KnownPFTestResult { * **NOT_APPLICABLE**: Pass\/fail criteria is not applicable. \ * **FAILED**: Pass\/fail criteria has failed. */ -export type PFTestResult = string; +export type PfTestResult = string; /** Test run status. */ export enum KnownStatus { /** Test run request is accepted. */ - ACCEPTED = "ACCEPTED", + Accepted = "ACCEPTED", /** Test run is not yet started. */ - NOTSTARTED = "NOTSTARTED", + Notstarted = "NOTSTARTED", /** Test run is provisioning. */ - PROVISIONING = "PROVISIONING", + Provisioning = "PROVISIONING", /** Test run is provisioned. */ - PROVISIONED = "PROVISIONED", + Provisioned = "PROVISIONED", /** Test run is getting configured. */ - CONFIGURING = "CONFIGURING", + Configuring = "CONFIGURING", /** Test run configuration is done. */ - CONFIGURED = "CONFIGURED", + Configured = "CONFIGURED", /** Test run has started executing. */ - EXECUTING = "EXECUTING", + Executing = "EXECUTING", /** Test run execution is completed. */ - EXECUTED = "EXECUTED", + Executed = "EXECUTED", /** Test run is getting deprovisioned. */ - DEPROVISIONING = "DEPROVISIONING", + Deprovisioning = "DEPROVISIONING", /** Test run is deprovisioned. */ - DEPROVISIONED = "DEPROVISIONED", + Deprovisioned = "DEPROVISIONED", /** Test run is completed. */ DONE = "DONE", /** Test run is being cancelled. */ - CANCELLING = "CANCELLING", + Cancelling = "CANCELLING", /** Test run request is cancelled. */ - CANCELLED = "CANCELLED", + Cancelled = "CANCELLED", /** Test run request is failed. */ FAILED = "FAILED", /** Test run JMX file is validated. */ - VALIDATION_SUCCESS = "VALIDATION_SUCCESS", + ValidationSuccess = "VALIDATION_SUCCESS", /** Test run JMX file validation is failed. */ - VALIDATION_FAILURE = "VALIDATION_FAILURE", + ValidationFailure = "VALIDATION_FAILURE", } /** @@ -2170,7 +2170,7 @@ export function functionFlexConsumptionTargetResourceConfigurationsDeserializer( /** Resource configuration instance for a Flex Consumption based Azure Function App. */ export interface FunctionFlexConsumptionResourceConfiguration { /** Memory size of the instance. Supported values are 2048, 4096. */ - instanceMemoryMB: number; + instanceMemoryMb: number; /** HTTP Concurrency for the function app. */ httpConcurrency: number; } @@ -2179,7 +2179,7 @@ export function functionFlexConsumptionResourceConfigurationSerializer( item: FunctionFlexConsumptionResourceConfiguration, ): any { return { - instanceMemoryMB: item["instanceMemoryMB"], + instanceMemoryMB: item["instanceMemoryMb"], httpConcurrency: item["httpConcurrency"], }; } @@ -2188,7 +2188,7 @@ export function functionFlexConsumptionResourceConfigurationDeserializer( item: any, ): FunctionFlexConsumptionResourceConfiguration { return { - instanceMemoryMB: item["instanceMemoryMB"], + instanceMemoryMb: item["instanceMemoryMB"], httpConcurrency: item["httpConcurrency"], }; } @@ -2309,17 +2309,17 @@ export function testProfileRunDeserializer(item: any): TestProfileRun { /** Test profile run status. */ export enum KnownTestProfileRunStatus { /** Test profile run request is accepted. */ - ACCEPTED = "ACCEPTED", + Accepted = "ACCEPTED", /** Test profile run is not yet started. */ - NOTSTARTED = "NOTSTARTED", + Notstarted = "NOTSTARTED", /** Test profile run has started executing. */ - EXECUTING = "EXECUTING", + Executing = "EXECUTING", /** Test profile run has completed successfully. */ DONE = "DONE", /** Test profile run is being cancelled. */ - CANCELLING = "CANCELLING", + Cancelling = "CANCELLING", /** Test profile run is cancelled. */ - CANCELLED = "CANCELLED", + Cancelled = "CANCELLED", /** Test profile run has failed. */ FAILED = "FAILED", } diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/README.md b/packages/typespec-test/test/openai/generated/typespec-ts/README.md index 60ce9bff07..7e2ce03990 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai/generated/typespec-ts/README.md @@ -1,4 +1,4 @@ -# OpenAI REST client library for JavaScript +# OpenAi REST client library for JavaScript Azure OpenAI APIs for completions and search @@ -20,13 +20,13 @@ Key links: ### Install the `@msinternal/openai` package -Install the OpenAI REST client REST client library for JavaScript with `npm`: +Install the OpenAi REST client REST client library for JavaScript with `npm`: ```bash npm install @msinternal/openai ``` -### Create and authenticate a `OpenAIClient` +### Create and authenticate a `OpenAiClient` To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), provide an instance of the desired credential type obtained from the diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md b/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md index c99e745d38..ba9983f71f 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md +++ b/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md @@ -39,7 +39,7 @@ export interface AzureChatExtensionsMessageContextOutput { export type AzureChatExtensionType = "AzureCognitiveSearch"; // @public -export type AzureOpenAIOperationStateOutput = "notRunning" | "running" | "succeeded" | "canceled" | "failed"; +export type AzureOpenAiOperationStateOutput = "notRunning" | "running" | "succeeded" | "canceled" | "failed"; // @public export interface BatchImageGenerationOperationResponseOutput { @@ -48,7 +48,7 @@ export interface BatchImageGenerationOperationResponseOutput { expires?: number; id: string; result?: ImageGenerationsOutput; - status: AzureOpenAIOperationStateOutput; + status: AzureOpenAiOperationStateOutput; } // @public (undocumented) @@ -237,7 +237,7 @@ export interface ContentFilterResultsOutput { export type ContentFilterSeverityOutput = "safe" | "low" | "medium" | "high"; // @public -function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: OpenAIClientOptions): OpenAIClient; +function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: OpenAiClientOptions): OpenAiClient; export default createClient; // @public @@ -524,12 +524,12 @@ export function isUnexpected(response: GetAzureBatchImageGenerationOperationStat export function isUnexpected(response: BeginAzureBatchImageGeneration202Response | BeginAzureBatchImageGenerationLogicalResponse | BeginAzureBatchImageGenerationDefaultResponse): response is BeginAzureBatchImageGenerationDefaultResponse; // @public (undocumented) -export type OpenAIClient = Client & { +export type OpenAiClient = Client & { path: Routes; }; // @public -export interface OpenAIClientOptions extends ClientOptions { +export interface OpenAiClientOptions extends ClientOptions { apiVersion?: string; } diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts index 585ce76238..5b2459225e 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { AzureKeyCredential } from "@azure/core-auth"; -import createOpenAIClient, { getLongRunningPoller } from "@msinternal/openai"; +import createOpenAiClient, { getLongRunningPoller } from "@msinternal/openai"; import * as dotenv from "dotenv"; dotenv.config(); @@ -15,7 +15,7 @@ dotenv.config(); async function beginAzureBatchImageGenerationSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAIClient(endpointParam, credential); + const client = createOpenAiClient(endpointParam, credential); const initialResponse = await client .path("/images/generations:submit") .post({ diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts index 9c1727997e..f7ab71df66 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAIClient from "@msinternal/openai"; +import createOpenAiClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getAzureBatchImageGenerationOperationStatusSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAIClient(endpointParam, credential); + const client = createOpenAiClient(endpointParam, credential); const operationId = "{Your operationId}"; const result = await client .path("/operations/images/{operationId}", operationId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts index 6fa9865c47..adf8ba85ee 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAIClient from "@msinternal/openai"; +import createOpenAiClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getChatCompletionsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAIClient(endpointParam, credential); + const client = createOpenAiClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path("/deployments/{deploymentId}/chat/completions", deploymentId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts index e1af95330f..473f3171af 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAIClient from "@msinternal/openai"; +import createOpenAiClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getChatCompletionsWithAzureExtensionsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAIClient(endpointParam, credential); + const client = createOpenAiClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path( diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts index a460a3c466..1fa59d2e14 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAIClient from "@msinternal/openai"; +import createOpenAiClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getCompletionsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAIClient(endpointParam, credential); + const client = createOpenAiClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path("/deployments/{deploymentId}/completions", deploymentId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts index b066f2a051..95b94c049b 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAIClient from "@msinternal/openai"; +import createOpenAiClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getEmbeddingsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAIClient(endpointParam, credential); + const client = createOpenAiClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path("/deployments/{deploymentId}/embeddings", deploymentId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts index 6f5a60af22..847d4e4bcd 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts @@ -122,6 +122,6 @@ export interface Routes { (path: "/images/generations:submit"): BeginAzureBatchImageGeneration; } -export type OpenAIClient = Client & { +export type OpenAiClient = Client & { path: Routes; }; diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts index d46bbd7f21..91f1cf8d67 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import OpenAIClient from "./openAIClient.js"; +import OpenAiClient from "./openAiClient.js"; -export * from "./openAIClient.js"; +export * from "./openAiClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; @@ -12,4 +12,4 @@ export * from "./models.js"; export * from "./outputModels.js"; export * from "./pollingHelper.js"; -export default OpenAIClient; +export default OpenAiClient; diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts index b690a0f57e..f3f971f2e3 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts @@ -4,16 +4,16 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { TokenCredential, KeyCredential } from "@azure/core-auth"; -import { OpenAIClient } from "./clientDefinitions.js"; +import { OpenAiClient } from "./clientDefinitions.js"; /** The optional parameters for the client */ -export interface OpenAIClientOptions extends ClientOptions { +export interface OpenAiClientOptions extends ClientOptions { /** The api version option of the client */ apiVersion?: string; } /** - * Initialize a new instance of `OpenAIClient` + * Initialize a new instance of `OpenAiClient` * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: * https://westus.api.cognitive.microsoft.com). * @param credentials - uniquely identify client credential @@ -22,8 +22,8 @@ export interface OpenAIClientOptions extends ClientOptions { export default function createClient( endpointParam: string, credentials: TokenCredential | KeyCredential, - { apiVersion = "2023-08-01-preview", ...options }: OpenAIClientOptions = {}, -): OpenAIClient { + { apiVersion = "2023-08-01-preview", ...options }: OpenAiClientOptions = {}, +): OpenAiClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; const userAgentInfo = `azsdk-js-openai-rest/1.0.0-beta.1`; @@ -46,7 +46,7 @@ export default function createClient( apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", }, }; - const client = getClient(endpointUrl, credentials, options) as OpenAIClient; + const client = getClient(endpointUrl, credentials, options) as OpenAiClient; client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); client.pipeline.addPolicy({ diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts new file mode 100644 index 0000000000..f3f971f2e3 --- /dev/null +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "./logger.js"; +import { TokenCredential, KeyCredential } from "@azure/core-auth"; +import { OpenAiClient } from "./clientDefinitions.js"; + +/** The optional parameters for the client */ +export interface OpenAiClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} + +/** + * Initialize a new instance of `OpenAiClient` + * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export default function createClient( + endpointParam: string, + credentials: TokenCredential | KeyCredential, + { apiVersion = "2023-08-01-preview", ...options }: OpenAiClientOptions = {}, +): OpenAiClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; + const userAgentInfo = `azsdk-js-openai-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + scopes: options.credentials?.scopes ?? [ + "https://cognitiveservices.azure.com/.default", + ], + apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", + }, + }; + const client = getClient(endpointUrl, credentials, options) as OpenAiClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + + return client; +} diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts index c271d6a8ce..719bca87f1 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts @@ -267,7 +267,7 @@ export interface BatchImageGenerationOperationResponseOutput { /** The result of the operation if the operation succeeded. */ result?: ImageGenerationsOutput; /** The status of the operation */ - status: AzureOpenAIOperationStateOutput; + status: AzureOpenAiOperationStateOutput; /** The error if the operation failed. */ error?: ErrorModel; } @@ -308,7 +308,7 @@ export type ChatRoleOutput = | "function" | "tool"; /** The state of a job or item. */ -export type AzureOpenAIOperationStateOutput = +export type AzureOpenAiOperationStateOutput = | "notRunning" | "running" | "succeeded" diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md b/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md index b8a3dcc345..75ab58cc13 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md @@ -1,6 +1,6 @@ -# OpenAI client library for JavaScript +# OpenAi client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAI client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAi client. The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. @@ -18,7 +18,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@msinternal/openai-generic` package -Install the OpenAI client library for JavaScript with `npm`: +Install the OpenAi client library for JavaScript with `npm`: ```bash npm install @msinternal/openai-generic @@ -31,7 +31,7 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### OpenAIClient +### OpenAiClient -`OpenAIClient` is the primary interface for developers using the OpenAI client library. Explore the methods on this client object to understand the different features of the OpenAI service that you can access. +`OpenAiClient` is the primary interface for developers using the OpenAi client library. Explore the methods on this client object to understand the different features of the OpenAi service that you can access. diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md index 880f949032..529a468cf8 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md @@ -450,14 +450,14 @@ export interface FilesListOptionalParams extends OperationOptions { // @public export interface FilesOperations { // (undocumented) - create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; delete: (fileId: string, options?: FilesDeleteOptionalParams) => Promise; // (undocumented) download: (fileId: string, options?: FilesDownloadOptionalParams) => Promise; // (undocumented) list: (options?: FilesListOptionalParams) => Promise; // (undocumented) - retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; } // @public @@ -482,11 +482,11 @@ export interface FineTune { model: string; object: "fine-tune"; organization_id: string; - result_files: OpenAIFile[]; + result_files: OpenAiFile[]; status: "created" | "running" | "succeeded" | "failed" | "cancelled"; - training_files: OpenAIFile[]; + training_files: OpenAiFile[]; updated_at: Date; - validation_files: OpenAIFile[]; + validation_files: OpenAiFile[]; } // @public @@ -660,7 +660,7 @@ export interface ImagesResponse { // @public export interface ListFilesResponse { // (undocumented) - data: OpenAIFile[]; + data: OpenAiFile[]; // (undocumented) object: string; } @@ -768,7 +768,7 @@ export interface OpenAIClientOptionalParams extends ClientOptions { } // @public -export interface OpenAIFile { +export interface OpenAiFile { bytes: number; createdAt: Date; filename: string; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts index 899412257a..738d52cd1a 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts @@ -10,8 +10,8 @@ import { FilesRetrieveOptionalParams, } from "../index.js"; import { - OpenAIFile, - openAIFileDeserializer, + OpenAiFile, + openAiFileDeserializer, ListFilesResponse, listFilesResponseDeserializer, CreateFileRequest, @@ -70,20 +70,20 @@ export function _createSend( export async function _createDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return openAiFileDeserializer(result.body); } export async function create( context: Client, file: CreateFileRequest, options: FilesCreateOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _createSend(context, file, options); return _createDeserialize(result); } @@ -100,20 +100,20 @@ export function _retrieveSend( export async function _retrieveDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return openAiFileDeserializer(result.body); } export async function retrieve( context: Client, fileId: string, options: FilesRetrieveOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _retrieveSend(context, fileId, options); return _retrieveDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts index 2f0d3bb507..56ab77acd4 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts @@ -5,7 +5,7 @@ export { createOpenAI, OpenAIContext, OpenAIClientOptionalParams, -} from "./openAIContext.js"; +} from "./openAiContext.js"; export { AudioTranscriptionsCreateOptionalParams, AudioTranslationsCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts new file mode 100644 index 0000000000..c3fd4009de --- /dev/null +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { KeyCredential, isKeyCredential } from "@azure/core-auth"; + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export interface OpenAIContext extends Client {} + +/** Optional parameters for the client. */ +export interface OpenAIClientOptionalParams extends ClientOptions {} + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export function createOpenAI( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, +): OpenAIContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; + + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + }; + const clientContext = getClient(endpointUrl, undefined, updatedOptions); + + if (isKeyCredential(credential)) { + clientContext.pipeline.addPolicy({ + name: "customKeyCredentialPolicy", + sendRequest(request, next) { + request.headers.set("Authorization", "Bearer " + credential.key); + return next(request); + }, + }); + } + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + return clientContext; +} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts index a86bb79fc7..4972ed1d97 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { AudioTranscriptionsOperations, getAudioTranscriptionsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts index 8bcb7743fa..fa7c53455f 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create } from "../../../api/audio/transcriptions/index.js"; import { AudioTranscriptionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts index 33b7b2498e..0a32c79d14 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create } from "../../../api/audio/translations/index.js"; import { AudioTranslationsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts index 65541432b4..a48e72c807 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create } from "../../../api/chat/completions/index.js"; import { ChatCompletionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts index 6fa08609e1..fb7d29c7a2 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { ChatCompletionsOperations, getChatCompletionsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts index 55c2aa082d..6b9a4ee9ea 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/completions/index.js"; import { CompletionsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts index e56d78ba9f..7082f8456c 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/edits/index.js"; import { EditsCreateOptionalParams } from "../../api/options.js"; import { CreateEditRequest, CreateEditResponse } from "../../models/models.js"; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts index 6c35f0a9d8..9b076d37eb 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/embeddings/index.js"; import { EmbeddingsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts index d7996abe49..a5b8b9a4b9 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { list, create, @@ -19,7 +19,7 @@ import { import { ListFilesResponse, CreateFileRequest, - OpenAIFile, + OpenAiFile, DeleteFileResponse, } from "../../models/models.js"; @@ -29,11 +29,11 @@ export interface FilesOperations { create: ( file: CreateFileRequest, options?: FilesCreateOptionalParams, - ) => Promise; + ) => Promise; retrieve: ( fileId: string, options?: FilesRetrieveOptionalParams, - ) => Promise; + ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts index 17c0cc5071..69e114a0bb 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts index 59fe849ce8..cca13e74d2 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { FineTuningJobsOperations, getFineTuningJobsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index f31081a07b..df45d41a3f 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts index fc1d3b2aa9..221fd9ac4b 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create, createEdit, createVariation } from "../../api/images/index.js"; import { ImagesCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts index c0556a1b74..05c6050f89 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { list, retrieve, $delete } from "../../api/models/index.js"; import { ModelsListOptionalParams, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts index f89bec51a9..8ba5e9ed2b 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/moderations/index.js"; import { ModerationsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts index f313205ae6..e78cc38b12 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export { OpenAIClient } from "./openAIClient.js"; +export { OpenAIClient } from "./openAiClient.js"; export { CreateModerationRequest, CreateModerationResponse, @@ -17,7 +17,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAIFile, + OpenAiFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts index c6775fe0ff..f77a8d29bd 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts @@ -16,7 +16,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAIFile, + OpenAiFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts index c19c8565ed..b4131931b4 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts @@ -636,11 +636,11 @@ export interface FineTune { classification_n_classes?: number; }; /** The list of files used for training. */ - training_files: OpenAIFile[]; + training_files: OpenAiFile[]; /** The list of files used for validation. */ - validation_files: OpenAIFile[]; + validation_files: OpenAiFile[]; /** The compiled results files for the fine-tuning job. */ - result_files: OpenAIFile[]; + result_files: OpenAiFile[]; /** The list of events that have been observed in the lifecycle of the FineTune job. */ events?: FineTuneEvent[]; } @@ -656,9 +656,9 @@ export function fineTuneDeserializer(item: any): FineTune { organization_id: item["organization_id"], status: item["status"], hyperparams: _fineTuneHyperparamsDeserializer(item["hyperparams"]), - training_files: openAIFileArrayDeserializer(item["training_files"]), - validation_files: openAIFileArrayDeserializer(item["validation_files"]), - result_files: openAIFileArrayDeserializer(item["result_files"]), + training_files: openAiFileArrayDeserializer(item["training_files"]), + validation_files: openAiFileArrayDeserializer(item["validation_files"]), + result_files: openAiFileArrayDeserializer(item["result_files"]), events: !item["events"] ? item["events"] : fineTuneEventArrayDeserializer(item["events"]), @@ -704,7 +704,7 @@ export function _fineTuneHyperparamsDeserializer( } /** The `File` object represents a document that has been uploaded to OpenAI. */ -export interface OpenAIFile { +export interface OpenAiFile { /** The file identifier, which can be referenced in the API endpoints. */ id: string; /** The object type, which is always "file". */ @@ -735,7 +735,7 @@ export interface OpenAIFile { status_details?: string | null; } -export function openAIFileDeserializer(item: any): OpenAIFile { +export function openAiFileDeserializer(item: any): OpenAiFile { return { id: item["id"], object: item["object"], @@ -748,9 +748,9 @@ export function openAIFileDeserializer(item: any): OpenAIFile { }; } -export function openAIFileArrayDeserializer(result: Array): any[] { +export function openAiFileArrayDeserializer(result: Array): any[] { return result.map((item) => { - return openAIFileDeserializer(item); + return openAiFileDeserializer(item); }); } @@ -818,13 +818,13 @@ export function listFineTuneEventsResponseDeserializer( /** model interface ListFilesResponse */ export interface ListFilesResponse { object: string; - data: OpenAIFile[]; + data: OpenAiFile[]; } export function listFilesResponseDeserializer(item: any): ListFilesResponse { return { object: item["object"], - data: openAIFileArrayDeserializer(item["data"]), + data: openAiFileArrayDeserializer(item["data"]), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts index 2b85b3f2f6..be7580d846 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts @@ -41,7 +41,7 @@ import { import { Pipeline } from "@azure/core-rest-pipeline"; import { KeyCredential } from "@azure/core-auth"; -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts new file mode 100644 index 0000000000..be7580d846 --- /dev/null +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; +import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; +import { + getFineTuningOperations, + FineTuningOperations, +} from "./classic/fineTuning/index.js"; +import { + getCompletionsOperations, + CompletionsOperations, +} from "./classic/completions/index.js"; +import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; +import { + getEmbeddingsOperations, + EmbeddingsOperations, +} from "./classic/embeddings/index.js"; +import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; +import { + getFineTunesOperations, + FineTunesOperations, +} from "./classic/fineTunes/index.js"; +import { + getModelsOperations, + ModelsOperations, +} from "./classic/models/index.js"; +import { + getImagesOperations, + ImagesOperations, +} from "./classic/images/index.js"; +import { + getModerationsOperations, + ModerationsOperations, +} from "./classic/moderations/index.js"; +import { + createOpenAI, + OpenAIContext, + OpenAIClientOptionalParams, +} from "./api/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { KeyCredential } from "@azure/core-auth"; + +export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; + +export class OpenAIClient { + private _client: OpenAIContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ + constructor( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : "azsdk-js-client"; + this._client = createOpenAI(credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.audio = getAudioOperations(this._client); + this.chat = getChatOperations(this._client); + this.fineTuning = getFineTuningOperations(this._client); + this.completions = getCompletionsOperations(this._client); + this.edits = getEditsOperations(this._client); + this.embeddings = getEmbeddingsOperations(this._client); + this.files = getFilesOperations(this._client); + this.fineTunes = getFineTunesOperations(this._client); + this.models = getModelsOperations(this._client); + this.images = getImagesOperations(this._client); + this.moderations = getModerationsOperations(this._client); + } + + /** The operation groups for AudioTranscriptions */ + public readonly audio: AudioOperations; + /** The operation groups for ChatCompletions */ + public readonly chat: ChatOperations; + /** The operation groups for FineTuningJobs */ + public readonly fineTuning: FineTuningOperations; + /** The operation groups for Completions */ + public readonly completions: CompletionsOperations; + /** The operation groups for Edits */ + public readonly edits: EditsOperations; + /** The operation groups for Embeddings */ + public readonly embeddings: EmbeddingsOperations; + /** The operation groups for Files */ + public readonly files: FilesOperations; + /** The operation groups for FineTunes */ + public readonly fineTunes: FineTunesOperations; + /** The operation groups for Models */ + public readonly models: ModelsOperations; + /** The operation groups for Images */ + public readonly images: ImagesOperations; + /** The operation groups for Moderations */ + public readonly moderations: ModerationsOperations; +} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md index c87d4724a4..b961e5cbcd 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md @@ -1,6 +1,6 @@ -# OpenAI client library for JavaScript +# OpenAi client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAI client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAi client. Azure OpenAI APIs for completions and search @@ -18,7 +18,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@msinternal/openai_modular` package -Install the OpenAI client library for JavaScript with `npm`: +Install the OpenAi client library for JavaScript with `npm`: ```bash npm install @msinternal/openai_modular @@ -31,7 +31,7 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### OpenAIClient +### OpenAiClient -`OpenAIClient` is the primary interface for developers using the OpenAI client library. Explore the methods on this client object to understand the different features of the OpenAI service that you can access. +`OpenAiClient` is the primary interface for developers using the OpenAi client library. Explore the methods on this client object to understand the different features of the OpenAi service that you can access. diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json index fe97d3a2b2..49f60ee835 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json @@ -14,34 +14,15 @@ "./models": "./src/models/index.ts", "./api": "./src/api/index.ts" }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], "selfLink": false }, "type": "module", - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], "author": "Microsoft Corporation", "license": "MIT", - "files": [ - "dist", - "README.md", - "LICENSE", - "review/*", - "CHANGELOG.md" - ], + "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], "dependencies": { "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.3.1", @@ -83,65 +64,5 @@ "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tshy && npm run unit-test:node && npm run unit-test:browser && npm run integration-test", "build": "npm run clean && tshy && npm run extract-api" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - }, - "./models": { - "browser": { - "types": "./dist/browser/models/index.d.ts", - "default": "./dist/browser/models/index.js" - }, - "react-native": { - "types": "./dist/react-native/models/index.d.ts", - "default": "./dist/react-native/models/index.js" - }, - "import": { - "types": "./dist/esm/models/index.d.ts", - "default": "./dist/esm/models/index.js" - }, - "require": { - "types": "./dist/commonjs/models/index.d.ts", - "default": "./dist/commonjs/models/index.js" - } - }, - "./api": { - "browser": { - "types": "./dist/browser/api/index.d.ts", - "default": "./dist/browser/api/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/index.d.ts", - "default": "./dist/react-native/api/index.js" - }, - "import": { - "types": "./dist/esm/api/index.d.ts", - "default": "./dist/esm/api/index.js" - }, - "require": { - "types": "./dist/commonjs/api/index.d.ts", - "default": "./dist/commonjs/api/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "module": "./dist/esm/index.js" + } } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md deleted file mode 100644 index 6925fd7c7a..0000000000 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md +++ /dev/null @@ -1,1016 +0,0 @@ -## API Report File for "@msinternal/openai_modular" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { ClientOptions } from '@azure-rest/core-client'; -import { ErrorModel } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { TokenCredential } from '@azure/core-auth'; - -// @public -export type AudioTaskLabel = "transcribe" | "translate"; - -// @public -export interface AudioTranscription { - duration?: number; - language?: string; - segments?: AudioTranscriptionSegment[]; - task?: AudioTaskLabel; - text: string; - words?: AudioTranscriptionWord[]; -} - -// @public -export type AudioTranscriptionFormat = "json" | "verbose_json" | "text" | "srt" | "vtt"; - -// @public -export interface AudioTranscriptionOptions { - file: Uint8Array; - filename?: string; - language?: string; - model?: string; - prompt?: string; - responseFormat?: AudioTranscriptionFormat; - temperature?: number; - timestampGranularities?: AudioTranscriptionTimestampGranularity[]; -} - -// @public -export interface AudioTranscriptionSegment { - avgLogprob: number; - compressionRatio: number; - end: number; - id: number; - noSpeechProb: number; - seek: number; - start: number; - temperature: number; - text: string; - tokens: number[]; -} - -// @public -export type AudioTranscriptionTimestampGranularity = "word" | "segment"; - -// @public -export interface AudioTranscriptionWord { - end: number; - start: number; - word: string; -} - -// @public -export interface AudioTranslation { - duration?: number; - language?: string; - segments?: AudioTranslationSegment[]; - task?: AudioTaskLabel; - text: string; -} - -// @public -export type AudioTranslationFormat = "json" | "verbose_json" | "text" | "srt" | "vtt"; - -// @public -export interface AudioTranslationOptions { - file: Uint8Array; - filename?: string; - model?: string; - prompt?: string; - responseFormat?: AudioTranslationFormat; - temperature?: number; -} - -// @public -export interface AudioTranslationSegment { - avgLogprob: number; - compressionRatio: number; - end: number; - id: number; - noSpeechProb: number; - seek: number; - start: number; - temperature: number; - text: string; - tokens: number[]; -} - -// @public -export interface AzureChatEnhancementConfiguration { - grounding?: AzureChatGroundingEnhancementConfiguration; - ocr?: AzureChatOCREnhancementConfiguration; -} - -// @public -export interface AzureChatEnhancements { - grounding?: AzureGroundingEnhancement; -} - -// @public -export interface AzureChatExtensionConfiguration { - type: AzureChatExtensionType; -} - -// @public -export type AzureChatExtensionConfigurationUnion = AzureSearchChatExtensionConfiguration | AzureMachineLearningIndexChatExtensionConfiguration | AzureCosmosDBChatExtensionConfiguration | ElasticsearchChatExtensionConfiguration | PineconeChatExtensionConfiguration | AzureChatExtensionConfiguration; - -// @public -export interface AzureChatExtensionDataSourceResponseCitation { - chunkId?: string; - content: string; - filepath?: string; - title?: string; - url?: string; -} - -// @public -export interface AzureChatExtensionRetrievedDocument { - chunkId?: string; - content: string; - dataSourceIndex: number; - filepath?: string; - filterReason?: AzureChatExtensionRetrieveDocumentFilterReason; - originalSearchScore?: number; - rerankScore?: number; - searchQueries: string[]; - title?: string; - url?: string; -} - -// @public -export type AzureChatExtensionRetrieveDocumentFilterReason = "score" | "rerank"; - -// @public -export interface AzureChatExtensionsMessageContext { - allRetrievedDocuments?: AzureChatExtensionRetrievedDocument[]; - citations?: AzureChatExtensionDataSourceResponseCitation[]; - intent?: string; -} - -// @public -export type AzureChatExtensionType = "azure_search" | "azure_ml_index" | "azure_cosmos_db" | "elasticsearch" | "pinecone"; - -// @public -export interface AzureChatGroundingEnhancementConfiguration { - enabled: boolean; -} - -// @public -export interface AzureChatOCREnhancementConfiguration { - enabled: boolean; -} - -// @public -export interface AzureCosmosDBChatExtensionConfiguration extends AzureChatExtensionConfiguration { - parameters: AzureCosmosDBChatExtensionParameters; - type: "azure_cosmos_db"; -} - -// @public -export interface AzureCosmosDBChatExtensionParameters { - allowPartialResult?: boolean; - authentication?: OnYourDataAuthenticationOptionsUnion; - containerName: string; - databaseName: string; - embeddingDependency: OnYourDataVectorizationSourceUnion; - fieldsMapping: AzureCosmosDBFieldMappingOptions; - includeContexts?: OnYourDataContextProperty[]; - indexName: string; - inScope?: boolean; - maxSearchQueries?: number; - roleInformation?: string; - strictness?: number; - topNDocuments?: number; -} - -// @public -export interface AzureCosmosDBFieldMappingOptions { - contentFields: string[]; - contentFieldsSeparator?: string; - filepathField?: string; - titleField?: string; - urlField?: string; - vectorFields: string[]; -} - -// @public -export interface AzureGroundingEnhancement { - lines: AzureGroundingEnhancementLine[]; -} - -// @public -export interface AzureGroundingEnhancementCoordinatePoint { - x: number; - y: number; -} - -// @public -export interface AzureGroundingEnhancementLine { - spans: AzureGroundingEnhancementLineSpan[]; - text: string; -} - -// @public -export interface AzureGroundingEnhancementLineSpan { - length: number; - offset: number; - polygon: AzureGroundingEnhancementCoordinatePoint[]; - text: string; -} - -// @public -export interface AzureMachineLearningIndexChatExtensionConfiguration extends AzureChatExtensionConfiguration { - parameters: AzureMachineLearningIndexChatExtensionParameters; - type: "azure_ml_index"; -} - -// @public -export interface AzureMachineLearningIndexChatExtensionParameters { - allowPartialResult?: boolean; - authentication?: OnYourDataAuthenticationOptionsUnion; - filter?: string; - includeContexts?: OnYourDataContextProperty[]; - inScope?: boolean; - maxSearchQueries?: number; - name: string; - projectResourceId: string; - roleInformation?: string; - strictness?: number; - topNDocuments?: number; - version: string; -} - -// @public -export interface AzureSearchChatExtensionConfiguration extends AzureChatExtensionConfiguration { - parameters: AzureSearchChatExtensionParameters; - type: "azure_search"; -} - -// @public -export interface AzureSearchChatExtensionParameters { - allowPartialResult?: boolean; - authentication?: OnYourDataAuthenticationOptionsUnion; - embeddingDependency?: OnYourDataVectorizationSourceUnion; - endpoint: string; - fieldsMapping?: AzureSearchIndexFieldMappingOptions; - filter?: string; - includeContexts?: OnYourDataContextProperty[]; - indexName: string; - inScope?: boolean; - maxSearchQueries?: number; - queryType?: AzureSearchQueryType; - roleInformation?: string; - semanticConfiguration?: string; - strictness?: number; - topNDocuments?: number; -} - -// @public -export interface AzureSearchIndexFieldMappingOptions { - contentFields?: string[]; - contentFieldsSeparator?: string; - filepathField?: string; - imageVectorFields?: string[]; - titleField?: string; - urlField?: string; - vectorFields?: string[]; -} - -// @public -export type AzureSearchQueryType = "simple" | "semantic" | "vector" | "vector_simple_hybrid" | "vector_semantic_hybrid"; - -// @public -export interface ChatChoice { - contentFilterResults?: ContentFilterResultsForChoice; - delta?: ChatResponseMessage; - enhancements?: AzureChatEnhancements; - finishDetails?: ChatFinishDetailsUnion; - finishReason: CompletionsFinishReason | null; - index: number; - logprobs: ChatChoiceLogProbabilityInfo | null; - message?: ChatResponseMessage; -} - -// @public -export interface ChatChoiceLogProbabilityInfo { - content: ChatTokenLogProbabilityResult[] | null; -} - -// @public -export interface ChatCompletions { - choices: ChatChoice[]; - created: Date; - id: string; - model?: string; - promptFilterResults?: ContentFilterResultsForPrompt[]; - systemFingerprint?: string; - usage: CompletionsUsage; -} - -// @public -export interface ChatCompletionsFunctionToolCall extends ChatCompletionsToolCall { - function: FunctionCall; - type: "function"; -} - -// @public -export interface ChatCompletionsFunctionToolDefinition extends ChatCompletionsToolDefinition { - function: FunctionDefinition; - type: "function"; -} - -// @public -export interface ChatCompletionsFunctionToolSelection { - name: string; -} - -// @public -export interface ChatCompletionsJsonResponseFormat extends ChatCompletionsResponseFormat { - type: "json_object"; -} - -// @public -export interface ChatCompletionsNamedFunctionToolSelection extends ChatCompletionsNamedToolSelection { - function: ChatCompletionsFunctionToolSelection; - type: "function"; -} - -// @public -export interface ChatCompletionsNamedToolSelection { - type: string; -} - -// @public -export type ChatCompletionsNamedToolSelectionUnion = ChatCompletionsNamedFunctionToolSelection | ChatCompletionsNamedToolSelection; - -// @public -export interface ChatCompletionsOptions { - dataSources?: AzureChatExtensionConfigurationUnion[]; - enhancements?: AzureChatEnhancementConfiguration; - frequencyPenalty?: number; - functionCall?: FunctionCallPreset | FunctionName; - functions?: FunctionDefinition[]; - logitBias?: Record; - logprobs?: boolean | null; - maxTokens?: number; - messages: ChatRequestMessageUnion[]; - model?: string; - n?: number; - presencePenalty?: number; - responseFormat?: ChatCompletionsResponseFormatUnion; - seed?: number; - stop?: string[]; - stream?: boolean; - temperature?: number; - toolChoice?: ChatCompletionsToolSelectionPreset | ChatCompletionsNamedToolSelectionUnion; - tools?: ChatCompletionsToolDefinitionUnion[]; - topLogprobs?: number | null; - topP?: number; - user?: string; -} - -// @public -export interface ChatCompletionsResponseFormat { - type: string; -} - -// @public -export type ChatCompletionsResponseFormatUnion = ChatCompletionsTextResponseFormat | ChatCompletionsJsonResponseFormat | ChatCompletionsResponseFormat; - -// @public -export interface ChatCompletionsTextResponseFormat extends ChatCompletionsResponseFormat { - type: "text"; -} - -// @public -export interface ChatCompletionsToolCall { - id: string; - type: string; -} - -// @public -export type ChatCompletionsToolCallUnion = ChatCompletionsFunctionToolCall | ChatCompletionsToolCall; - -// @public -export interface ChatCompletionsToolDefinition { - type: string; -} - -// @public -export type ChatCompletionsToolDefinitionUnion = ChatCompletionsFunctionToolDefinition | ChatCompletionsToolDefinition; - -// @public -export type ChatCompletionsToolSelectionPreset = "auto" | "none"; - -// @public -export interface ChatFinishDetails { - type: string; -} - -// @public -export type ChatFinishDetailsUnion = StopFinishDetails | MaxTokensFinishDetails | ChatFinishDetails; - -// @public -export interface ChatMessageContentItem { - type: string; -} - -// @public -export type ChatMessageContentItemUnion = ChatMessageTextContentItem | ChatMessageImageContentItem | ChatMessageContentItem; - -// @public -export interface ChatMessageImageContentItem extends ChatMessageContentItem { - imageUrl: ChatMessageImageUrl; - type: "image_url"; -} - -// @public -export type ChatMessageImageDetailLevel = "auto" | "low" | "high"; - -// @public -export interface ChatMessageImageUrl { - detail?: ChatMessageImageDetailLevel; - url: string; -} - -// @public -export interface ChatMessageTextContentItem extends ChatMessageContentItem { - text: string; - type: "text"; -} - -// @public -export interface ChatRequestAssistantMessage extends ChatRequestMessage { - content: string | null; - functionCall?: FunctionCall; - name?: string; - role: "assistant"; - toolCalls?: ChatCompletionsToolCallUnion[]; -} - -// @public -export interface ChatRequestFunctionMessage extends ChatRequestMessage { - content: string | null; - name: string; - role: "function"; -} - -// @public -export interface ChatRequestMessage { - role: ChatRole; -} - -// @public -export type ChatRequestMessageUnion = ChatRequestSystemMessage | ChatRequestUserMessage | ChatRequestAssistantMessage | ChatRequestToolMessage | ChatRequestFunctionMessage | ChatRequestMessage; - -// @public -export interface ChatRequestSystemMessage extends ChatRequestMessage { - content: string; - name?: string; - role: "system"; -} - -// @public -export interface ChatRequestToolMessage extends ChatRequestMessage { - content: string | null; - role: "tool"; - toolCallId: string; -} - -// @public -export interface ChatRequestUserMessage extends ChatRequestMessage { - content: string | ChatMessageContentItemUnion[]; - name?: string; - role: "user"; -} - -// @public -export interface ChatResponseMessage { - content: string | null; - context?: AzureChatExtensionsMessageContext; - functionCall?: FunctionCall; - role: ChatRole; - toolCalls?: ChatCompletionsToolCallUnion[]; -} - -// @public -export type ChatRole = "system" | "assistant" | "user" | "function" | "tool"; - -// @public -export interface ChatTokenLogProbabilityInfo { - bytes: number[] | null; - logprob: number; - token: string; -} - -// @public -export interface ChatTokenLogProbabilityResult { - bytes: number[] | null; - logprob: number; - token: string; - topLogprobs: ChatTokenLogProbabilityInfo[] | null; -} - -// @public -export interface Choice { - contentFilterResults?: ContentFilterResultsForChoice; - finishReason: CompletionsFinishReason | null; - index: number; - logprobs: CompletionsLogProbabilityModel | null; - text: string; -} - -// @public -export interface Completions { - choices: Choice[]; - created: Date; - id: string; - promptFilterResults?: ContentFilterResultsForPrompt[]; - usage: CompletionsUsage; -} - -// @public -export type CompletionsFinishReason = "stop" | "length" | "content_filter" | "function_call" | "tool_calls"; - -// @public -export interface CompletionsLogProbabilityModel { - textOffset: number[]; - tokenLogprobs: (number | null)[]; - tokens: string[]; - topLogprobs: Record[]; -} - -// @public -export interface CompletionsOptions { - bestOf?: number; - echo?: boolean; - frequencyPenalty?: number; - logitBias?: Record; - logprobs?: number; - maxTokens?: number; - model?: string; - n?: number; - presencePenalty?: number; - prompt: string[]; - stop?: string[]; - stream?: boolean; - suffix?: string; - temperature?: number; - topP?: number; - user?: string; -} - -// @public -export interface CompletionsUsage { - completionTokens: number; - promptTokens: number; - totalTokens: number; -} - -// @public -export interface ContentFilterBlocklistIdResult { - filtered: boolean; - id: string; -} - -// @public -export interface ContentFilterCitedDetectionResult { - detected: boolean; - filtered: boolean; - license: string; - url?: string; -} - -// @public -export interface ContentFilterDetailedResults { - details: ContentFilterBlocklistIdResult[]; - filtered: boolean; -} - -// @public -export interface ContentFilterDetectionResult { - detected: boolean; - filtered: boolean; -} - -// @public -export interface ContentFilterResult { - filtered: boolean; - severity: ContentFilterSeverity; -} - -// @public -export interface ContentFilterResultDetailsForPrompt { - customBlocklists?: ContentFilterDetailedResults; - error?: ErrorModel; - hate?: ContentFilterResult; - indirectAttack?: ContentFilterDetectionResult; - jailbreak?: ContentFilterDetectionResult; - profanity?: ContentFilterDetectionResult; - selfHarm?: ContentFilterResult; - sexual?: ContentFilterResult; - violence?: ContentFilterResult; -} - -// @public -export interface ContentFilterResultsForChoice { - customBlocklists?: ContentFilterDetailedResults; - error?: ErrorModel; - hate?: ContentFilterResult; - profanity?: ContentFilterDetectionResult; - protectedMaterialCode?: ContentFilterCitedDetectionResult; - protectedMaterialText?: ContentFilterDetectionResult; - selfHarm?: ContentFilterResult; - sexual?: ContentFilterResult; - violence?: ContentFilterResult; -} - -// @public -export interface ContentFilterResultsForPrompt { - contentFilterResults: ContentFilterResultDetailsForPrompt; - promptIndex: number; -} - -// @public -export type ContentFilterSeverity = "safe" | "low" | "medium" | "high"; - -// @public -export interface ElasticsearchChatExtensionConfiguration extends AzureChatExtensionConfiguration { - parameters: ElasticsearchChatExtensionParameters; - type: "elasticsearch"; -} - -// @public -export interface ElasticsearchChatExtensionParameters { - allowPartialResult?: boolean; - authentication?: OnYourDataAuthenticationOptionsUnion; - embeddingDependency?: OnYourDataVectorizationSourceUnion; - endpoint: string; - fieldsMapping?: ElasticsearchIndexFieldMappingOptions; - includeContexts?: OnYourDataContextProperty[]; - indexName: string; - inScope?: boolean; - maxSearchQueries?: number; - queryType?: ElasticsearchQueryType; - roleInformation?: string; - strictness?: number; - topNDocuments?: number; -} - -// @public -export interface ElasticsearchIndexFieldMappingOptions { - contentFields?: string[]; - contentFieldsSeparator?: string; - filepathField?: string; - titleField?: string; - urlField?: string; - vectorFields?: string[]; -} - -// @public -export type ElasticsearchQueryType = "simple" | "vector"; - -// @public -export type EmbeddingEncodingFormat = "float" | "base64"; - -// @public -export interface EmbeddingItem { - embedding: number[]; - index: number; -} - -// @public -export interface Embeddings { - data: EmbeddingItem[]; - usage: EmbeddingsUsage; -} - -// @public -export interface EmbeddingsOptions { - dimensions?: number; - encodingFormat?: EmbeddingEncodingFormat; - input: string[]; - inputType?: string; - model?: string; - user?: string; -} - -// @public -export interface EmbeddingsUsage { - promptTokens: number; - totalTokens: number; -} - -// @public -export interface FunctionCall { - arguments: string; - name: string; -} - -// @public -export type FunctionCallPreset = "auto" | "none"; - -// @public -export interface FunctionDefinition { - description?: string; - name: string; - parameters?: any; -} - -// @public -export interface FunctionName { - name: string; -} - -// @public -export interface GenerateSpeechFromTextOptionalParams extends OperationOptions { -} - -// @public -export interface GetAudioTranscriptionAsPlainTextOptionalParams extends OperationOptions { - contentType?: string; -} - -// @public -export interface GetAudioTranscriptionAsResponseObjectOptionalParams extends OperationOptions { - contentType?: string; -} - -// @public -export interface GetAudioTranslationAsPlainTextOptionalParams extends OperationOptions { - contentType?: string; -} - -// @public -export interface GetAudioTranslationAsResponseObjectOptionalParams extends OperationOptions { - contentType?: string; -} - -// @public -export interface GetChatCompletionsOptionalParams extends OperationOptions { -} - -// @public -export interface GetCompletionsOptionalParams extends OperationOptions { -} - -// @public -export interface GetEmbeddingsOptionalParams extends OperationOptions { -} - -// @public -export interface GetImageGenerationsOptionalParams extends OperationOptions { -} - -// @public -export interface ImageGenerationContentFilterResults { - hate?: ContentFilterResult; - selfHarm?: ContentFilterResult; - sexual?: ContentFilterResult; - violence?: ContentFilterResult; -} - -// @public -export interface ImageGenerationData { - base64Data?: string; - contentFilterResults?: ImageGenerationContentFilterResults; - promptFilterResults?: ImageGenerationPromptFilterResults; - revisedPrompt?: string; - url?: string; -} - -// @public -export interface ImageGenerationOptions { - model?: string; - n?: number; - prompt: string; - quality?: ImageGenerationQuality; - responseFormat?: ImageGenerationResponseFormat; - size?: ImageSize; - style?: ImageGenerationStyle; - user?: string; -} - -// @public -export interface ImageGenerationPromptFilterResults { - customBlocklists?: ContentFilterDetailedResults; - hate?: ContentFilterResult; - jailbreak?: ContentFilterDetectionResult; - profanity?: ContentFilterDetectionResult; - selfHarm?: ContentFilterResult; - sexual?: ContentFilterResult; - violence?: ContentFilterResult; -} - -// @public -export type ImageGenerationQuality = "standard" | "hd"; - -// @public -export type ImageGenerationResponseFormat = "url" | "b64_json"; - -// @public -export interface ImageGenerations { - created: Date; - data: ImageGenerationData[]; -} - -// @public -export type ImageGenerationStyle = "natural" | "vivid"; - -// @public -export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792"; - -// @public -export interface MaxTokensFinishDetails extends ChatFinishDetails { - type: "max_tokens"; -} - -// @public -export interface OnYourDataAccessTokenAuthenticationOptions extends OnYourDataAuthenticationOptions { - accessToken: string; - type: "access_token"; -} - -// @public -export interface OnYourDataApiKeyAuthenticationOptions extends OnYourDataAuthenticationOptions { - key: string; - type: "api_key"; -} - -// @public -export interface OnYourDataAuthenticationOptions { - type: OnYourDataAuthenticationType; -} - -// @public -export type OnYourDataAuthenticationOptionsUnion = OnYourDataApiKeyAuthenticationOptions | OnYourDataConnectionStringAuthenticationOptions | OnYourDataKeyAndKeyIdAuthenticationOptions | OnYourDataEncodedApiKeyAuthenticationOptions | OnYourDataAccessTokenAuthenticationOptions | OnYourDataSystemAssignedManagedIdentityAuthenticationOptions | OnYourDataUserAssignedManagedIdentityAuthenticationOptions | OnYourDataAuthenticationOptions; - -// @public -export type OnYourDataAuthenticationType = "api_key" | "connection_string" | "key_and_key_id" | "encoded_api_key" | "access_token" | "system_assigned_managed_identity" | "user_assigned_managed_identity"; - -// @public -export interface OnYourDataConnectionStringAuthenticationOptions extends OnYourDataAuthenticationOptions { - connectionString: string; - type: "connection_string"; -} - -// @public -export type OnYourDataContextProperty = "citations" | "intent" | "all_retrieved_documents"; - -// @public -export interface OnYourDataDeploymentNameVectorizationSource extends OnYourDataVectorizationSource { - deploymentName: string; - dimensions?: number; - type: "deployment_name"; -} - -// @public -export interface OnYourDataEncodedApiKeyAuthenticationOptions extends OnYourDataAuthenticationOptions { - encodedApiKey: string; - type: "encoded_api_key"; -} - -// @public -export interface OnYourDataEndpointVectorizationSource extends OnYourDataVectorizationSource { - authentication: OnYourDataVectorSearchAuthenticationOptionsUnion; - endpoint: string; - type: "endpoint"; -} - -// @public -export interface OnYourDataKeyAndKeyIdAuthenticationOptions extends OnYourDataAuthenticationOptions { - key: string; - keyId: string; - type: "key_and_key_id"; -} - -// @public -export interface OnYourDataModelIdVectorizationSource extends OnYourDataVectorizationSource { - modelId: string; - type: "model_id"; -} - -// @public -export interface OnYourDataSystemAssignedManagedIdentityAuthenticationOptions extends OnYourDataAuthenticationOptions { - type: "system_assigned_managed_identity"; -} - -// @public -export interface OnYourDataUserAssignedManagedIdentityAuthenticationOptions extends OnYourDataAuthenticationOptions { - managedIdentityResourceId: string; - type: "user_assigned_managed_identity"; -} - -// @public -export interface OnYourDataVectorizationSource { - type: OnYourDataVectorizationSourceType; -} - -// @public -export type OnYourDataVectorizationSourceType = "endpoint" | "deployment_name" | "model_id"; - -// @public -export type OnYourDataVectorizationSourceUnion = OnYourDataEndpointVectorizationSource | OnYourDataDeploymentNameVectorizationSource | OnYourDataModelIdVectorizationSource | OnYourDataVectorizationSource; - -// @public -export interface OnYourDataVectorSearchAccessTokenAuthenticationOptions extends OnYourDataVectorSearchAuthenticationOptions { - accessToken: string; - type: "access_token"; -} - -// @public -export interface OnYourDataVectorSearchApiKeyAuthenticationOptions extends OnYourDataVectorSearchAuthenticationOptions { - key: string; - type: "api_key"; -} - -// @public -export interface OnYourDataVectorSearchAuthenticationOptions { - type: OnYourDataVectorSearchAuthenticationType; -} - -// @public -export type OnYourDataVectorSearchAuthenticationOptionsUnion = OnYourDataVectorSearchApiKeyAuthenticationOptions | OnYourDataVectorSearchAccessTokenAuthenticationOptions | OnYourDataVectorSearchAuthenticationOptions; - -// @public -export type OnYourDataVectorSearchAuthenticationType = "api_key" | "access_token"; - -// @public (undocumented) -export class OpenAIClient { - constructor(endpointParam: string, credential: KeyCredential | TokenCredential, options?: OpenAIClientOptionalParams); - generateSpeechFromText(deploymentId: string, body: SpeechGenerationOptions, options?: GenerateSpeechFromTextOptionalParams): Promise; - getAudioTranscriptionAsPlainText(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsPlainTextOptionalParams): Promise; - getAudioTranscriptionAsResponseObject(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsResponseObjectOptionalParams): Promise; - getAudioTranslationAsPlainText(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsPlainTextOptionalParams): Promise; - getAudioTranslationAsResponseObject(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsResponseObjectOptionalParams): Promise; - getChatCompletions(deploymentId: string, body: ChatCompletionsOptions, options?: GetChatCompletionsOptionalParams): Promise; - getCompletions(deploymentId: string, body: CompletionsOptions, options?: GetCompletionsOptionalParams): Promise; - getEmbeddings(deploymentId: string, body: EmbeddingsOptions, options?: GetEmbeddingsOptionalParams): Promise; - getImageGenerations(deploymentId: string, body: ImageGenerationOptions, options?: GetImageGenerationsOptionalParams): Promise; - readonly pipeline: Pipeline; -} - -// @public -export interface OpenAIClientOptionalParams extends ClientOptions { - apiVersion?: string; -} - -// @public -export interface PineconeChatExtensionConfiguration extends AzureChatExtensionConfiguration { - parameters: PineconeChatExtensionParameters; - type: "pinecone"; -} - -// @public -export interface PineconeChatExtensionParameters { - allowPartialResult?: boolean; - authentication?: OnYourDataAuthenticationOptionsUnion; - embeddingDependency: OnYourDataVectorizationSourceUnion; - environment: string; - fieldsMapping: PineconeFieldMappingOptions; - includeContexts?: OnYourDataContextProperty[]; - indexName: string; - inScope?: boolean; - maxSearchQueries?: number; - roleInformation?: string; - strictness?: number; - topNDocuments?: number; -} - -// @public -export interface PineconeFieldMappingOptions { - contentFields: string[]; - contentFieldsSeparator?: string; - filepathField?: string; - titleField?: string; - urlField?: string; -} - -// @public -export interface SpeechGenerationOptions { - input: string; - model?: string; - responseFormat?: SpeechGenerationResponseFormat; - speed?: number; - voice: SpeechVoice; -} - -// @public -export type SpeechGenerationResponseFormat = "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"; - -// @public -export type SpeechVoice = "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer"; - -// @public -export interface StopFinishDetails extends ChatFinishDetails { - stop: string; - type: "stop"; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts index 1c4edce4d8..24985414ac 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts @@ -5,7 +5,7 @@ export { createOpenAI, OpenAIContext, OpenAIClientOptionalParams, -} from "./openAIContext.js"; +} from "./openAiContext.js"; export { getAudioTranscriptionAsPlainText, getAudioTranscriptionAsResponseObject, diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts new file mode 100644 index 0000000000..53d95cbb55 --- /dev/null +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { KeyCredential, TokenCredential } from "@azure/core-auth"; + +export interface OpenAIContext extends Client {} + +/** Optional parameters for the client. */ +export interface OpenAIClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} + +export function createOpenAI( + endpointParam: string, + credential: KeyCredential | TokenCredential, + options: OpenAIClientOptionalParams = {}, +): OpenAIContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; + + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [ + "https://cognitiveservices.azure.com/.default", + ], + apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2024-06-01"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return clientContext; +} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts index 39d5026083..9234d159de 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export { OpenAIClient } from "./openAIClient.js"; +export { OpenAIClient } from "./openAiClient.js"; export { AudioTranscriptionOptions, AudioTranscriptionFormat, @@ -82,9 +82,9 @@ export { OnYourDataModelIdVectorizationSource, AzureMachineLearningIndexChatExtensionConfiguration, AzureMachineLearningIndexChatExtensionParameters, - AzureCosmosDBChatExtensionConfiguration, - AzureCosmosDBChatExtensionParameters, - AzureCosmosDBFieldMappingOptions, + AzureCosmosDbChatExtensionConfiguration, + AzureCosmosDbChatExtensionParameters, + AzureCosmosDbFieldMappingOptions, ElasticsearchChatExtensionConfiguration, ElasticsearchChatExtensionParameters, ElasticsearchIndexFieldMappingOptions, @@ -94,7 +94,7 @@ export { PineconeFieldMappingOptions, AzureChatEnhancementConfiguration, AzureChatGroundingEnhancementConfiguration, - AzureChatOCREnhancementConfiguration, + AzureChatOcrEnhancementConfiguration, ChatCompletionsResponseFormat, ChatCompletionsResponseFormatUnion, ChatCompletionsTextResponseFormat, diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts index 342178fda2..26d26f3d10 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts @@ -81,9 +81,9 @@ export { OnYourDataModelIdVectorizationSource, AzureMachineLearningIndexChatExtensionConfiguration, AzureMachineLearningIndexChatExtensionParameters, - AzureCosmosDBChatExtensionConfiguration, - AzureCosmosDBChatExtensionParameters, - AzureCosmosDBFieldMappingOptions, + AzureCosmosDbChatExtensionConfiguration, + AzureCosmosDbChatExtensionParameters, + AzureCosmosDbFieldMappingOptions, ElasticsearchChatExtensionConfiguration, ElasticsearchChatExtensionParameters, ElasticsearchIndexFieldMappingOptions, @@ -93,7 +93,7 @@ export { PineconeFieldMappingOptions, AzureChatEnhancementConfiguration, AzureChatGroundingEnhancementConfiguration, - AzureChatOCREnhancementConfiguration, + AzureChatOcrEnhancementConfiguration, ChatCompletionsResponseFormat, ChatCompletionsResponseFormatUnion, ChatCompletionsTextResponseFormat, diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts index 6be1576036..5a1d511af2 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts @@ -1548,7 +1548,7 @@ export function azureChatExtensionConfigurationSerializer( export type AzureChatExtensionConfigurationUnion = | AzureSearchChatExtensionConfiguration | AzureMachineLearningIndexChatExtensionConfiguration - | AzureCosmosDBChatExtensionConfiguration + | AzureCosmosDbChatExtensionConfiguration | ElasticsearchChatExtensionConfiguration | PineconeChatExtensionConfiguration | AzureChatExtensionConfiguration; @@ -2238,7 +2238,7 @@ export function azureMachineLearningIndexChatExtensionParametersSerializer( * A specific representation of configurable options for Azure Cosmos DB when using it as an Azure OpenAI chat * extension. */ -export interface AzureCosmosDBChatExtensionConfiguration +export interface AzureCosmosDbChatExtensionConfiguration extends AzureChatExtensionConfiguration { /** * The type label to use when configuring Azure OpenAI chat extensions. This should typically not be changed from its @@ -2246,15 +2246,15 @@ export interface AzureCosmosDBChatExtensionConfiguration */ type: "azure_cosmos_db"; /** The parameters to use when configuring Azure OpenAI CosmosDB chat extensions. */ - parameters: AzureCosmosDBChatExtensionParameters; + parameters: AzureCosmosDbChatExtensionParameters; } -export function azureCosmosDBChatExtensionConfigurationSerializer( - item: AzureCosmosDBChatExtensionConfiguration, +export function azureCosmosDbChatExtensionConfigurationSerializer( + item: AzureCosmosDbChatExtensionConfiguration, ): any { return { type: item["type"], - parameters: azureCosmosDBChatExtensionParametersSerializer( + parameters: azureCosmosDbChatExtensionParametersSerializer( item["parameters"], ), }; @@ -2264,7 +2264,7 @@ export function azureCosmosDBChatExtensionConfigurationSerializer( * Parameters to use when configuring Azure OpenAI On Your Data chat extensions when using Azure Cosmos DB for * MongoDB vCore. The supported authentication type is ConnectionString. */ -export interface AzureCosmosDBChatExtensionParameters { +export interface AzureCosmosDbChatExtensionParameters { /** * The authentication method to use when accessing the defined data source. * Each data source type supports a specific set of available authentication methods; please see the documentation of @@ -2300,13 +2300,13 @@ export interface AzureCosmosDBChatExtensionParameters { /** The MongoDB vCore index name to use with Azure Cosmos DB. */ indexName: string; /** Customized field mapping behavior to use when interacting with the search index. */ - fieldsMapping: AzureCosmosDBFieldMappingOptions; + fieldsMapping: AzureCosmosDbFieldMappingOptions; /** The embedding dependency for vector search. */ embeddingDependency: OnYourDataVectorizationSourceUnion; } -export function azureCosmosDBChatExtensionParametersSerializer( - item: AzureCosmosDBChatExtensionParameters, +export function azureCosmosDbChatExtensionParametersSerializer( + item: AzureCosmosDbChatExtensionParameters, ): any { return { authentication: !item["authentication"] @@ -2326,7 +2326,7 @@ export function azureCosmosDBChatExtensionParametersSerializer( database_name: item["databaseName"], container_name: item["containerName"], index_name: item["indexName"], - fields_mapping: azureCosmosDBFieldMappingOptionsSerializer( + fields_mapping: azureCosmosDbFieldMappingOptionsSerializer( item["fieldsMapping"], ), embedding_dependency: onYourDataVectorizationSourceUnionSerializer( @@ -2336,7 +2336,7 @@ export function azureCosmosDBChatExtensionParametersSerializer( } /** Optional settings to control how fields are processed when using a configured Azure Cosmos DB resource. */ -export interface AzureCosmosDBFieldMappingOptions { +export interface AzureCosmosDbFieldMappingOptions { /** The name of the index field to use as a title. */ titleField?: string; /** The name of the index field to use as a URL. */ @@ -2351,8 +2351,8 @@ export interface AzureCosmosDBFieldMappingOptions { vectorFields: string[]; } -export function azureCosmosDBFieldMappingOptionsSerializer( - item: AzureCosmosDBFieldMappingOptions, +export function azureCosmosDbFieldMappingOptionsSerializer( + item: AzureCosmosDbFieldMappingOptions, ): any { return { title_field: item["titleField"], @@ -2642,7 +2642,7 @@ export interface AzureChatEnhancementConfiguration { /** A representation of the available options for the Azure OpenAI grounding enhancement. */ grounding?: AzureChatGroundingEnhancementConfiguration; /** A representation of the available options for the Azure OpenAI optical character recognition (OCR) enhancement. */ - ocr?: AzureChatOCREnhancementConfiguration; + ocr?: AzureChatOcrEnhancementConfiguration; } export function azureChatEnhancementConfigurationSerializer( @@ -2654,7 +2654,7 @@ export function azureChatEnhancementConfigurationSerializer( : azureChatGroundingEnhancementConfigurationSerializer(item["grounding"]), ocr: !item["ocr"] ? item["ocr"] - : azureChatOCREnhancementConfigurationSerializer(item["ocr"]), + : azureChatOcrEnhancementConfigurationSerializer(item["ocr"]), }; } @@ -2671,13 +2671,13 @@ export function azureChatGroundingEnhancementConfigurationSerializer( } /** A representation of the available options for the Azure OpenAI optical character recognition (OCR) enhancement. */ -export interface AzureChatOCREnhancementConfiguration { +export interface AzureChatOcrEnhancementConfiguration { /** Specifies whether the enhancement is enabled. */ enabled: boolean; } -export function azureChatOCREnhancementConfigurationSerializer( - item: AzureChatOCREnhancementConfiguration, +export function azureChatOcrEnhancementConfigurationSerializer( + item: AzureChatOcrEnhancementConfiguration, ): any { return { enabled: item["enabled"] }; } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts index 822d86f5a4..f3741fb41c 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts @@ -42,7 +42,7 @@ import { import { Pipeline } from "@azure/core-rest-pipeline"; import { KeyCredential, TokenCredential } from "@azure/core-auth"; -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts new file mode 100644 index 0000000000..f3741fb41c --- /dev/null +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + createOpenAI, + OpenAIContext, + OpenAIClientOptionalParams, + getAudioTranscriptionAsPlainText, + getAudioTranscriptionAsResponseObject, + getAudioTranslationAsPlainText, + getAudioTranslationAsResponseObject, + getCompletions, + getChatCompletions, + getImageGenerations, + generateSpeechFromText, + getEmbeddings, + GetAudioTranscriptionAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetCompletionsOptionalParams, + GetChatCompletionsOptionalParams, + GetImageGenerationsOptionalParams, + GenerateSpeechFromTextOptionalParams, + GetEmbeddingsOptionalParams, +} from "./api/index.js"; +import { + AudioTranscriptionOptions, + AudioTranscription, + AudioTranslationOptions, + AudioTranslation, + CompletionsOptions, + Completions, + ChatCompletionsOptions, + ChatCompletions, + ImageGenerationOptions, + ImageGenerations, + SpeechGenerationOptions, + EmbeddingsOptions, + Embeddings, +} from "./models/models.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { KeyCredential, TokenCredential } from "@azure/core-auth"; + +export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; + +export class OpenAIClient { + private _client: OpenAIContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor( + endpointParam: string, + credential: KeyCredential | TokenCredential, + options: OpenAIClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : "azsdk-js-client"; + this._client = createOpenAI(endpointParam, credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + */ + getAudioTranscriptionAsPlainText( + deploymentId: string, + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranscriptionAsPlainText( + this._client, + deploymentId, + body, + options, + ); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + */ + getAudioTranscriptionAsResponseObject( + deploymentId: string, + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranscriptionAsResponseObject( + this._client, + deploymentId, + body, + options, + ); + } + + /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ + getAudioTranslationAsPlainText( + deploymentId: string, + body: AudioTranslationOptions, + options: GetAudioTranslationAsPlainTextOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranslationAsPlainText( + this._client, + deploymentId, + body, + options, + ); + } + + /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ + getAudioTranslationAsResponseObject( + deploymentId: string, + body: AudioTranslationOptions, + options: GetAudioTranslationAsResponseObjectOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranslationAsResponseObject( + this._client, + deploymentId, + body, + options, + ); + } + + /** + * Gets completions for the provided input prompts. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. + */ + getCompletions( + deploymentId: string, + body: CompletionsOptions, + options: GetCompletionsOptionalParams = { requestOptions: {} }, + ): Promise { + return getCompletions(this._client, deploymentId, body, options); + } + + /** + * Gets chat completions for the provided chat messages. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. + */ + getChatCompletions( + deploymentId: string, + body: ChatCompletionsOptions, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, + ): Promise { + return getChatCompletions(this._client, deploymentId, body, options); + } + + /** Creates an image given a prompt. */ + getImageGenerations( + deploymentId: string, + body: ImageGenerationOptions, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, + ): Promise { + return getImageGenerations(this._client, deploymentId, body, options); + } + + /** Generates text-to-speech audio from the input text. */ + generateSpeechFromText( + deploymentId: string, + body: SpeechGenerationOptions, + options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, + ): Promise { + return generateSpeechFromText(this._client, deploymentId, body, options); + } + + /** Return the embeddings for a given prompt. */ + getEmbeddings( + deploymentId: string, + body: EmbeddingsOptions, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, + ): Promise { + return getEmbeddings(this._client, deploymentId, body, options); + } +} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md index 9e1fd87315..29eb50efda 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md @@ -1,4 +1,4 @@ -# OpenAI client library for JavaScript +# OpenAi client library for JavaScript The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. @@ -14,7 +14,7 @@ Key links: ### Install the `@msinternal/openai-non-branded` package -Install the OpenAI client library for JavaScript with `npm`: +Install the OpenAi client library for JavaScript with `npm`: ```bash npm install @msinternal/openai-non-branded diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json index 1409040b6d..bf1f96bf14 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json @@ -1,7 +1,7 @@ { "name": "@msinternal/openai-non-branded", "version": "1.0.0-beta.1", - "description": "A generated SDK for OpenAIClient.", + "description": "A generated SDK for OpenAiClient.", "engines": { "node": ">=18.0.0" }, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index ba603f128a..2f23d5d97a 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -306,29 +306,29 @@ export interface CreateModerationResponse { flagged: boolean; categories: { hate: boolean; - "hate/threatening": boolean; + hateThreatening: boolean; harassment: boolean; - "harassment/threatening": boolean; + harassmentThreatening: boolean; selfHarm: boolean; - "selfHarm/intent": boolean; - "selfHarm/instructive": boolean; + selfHarmIntent: boolean; + selfHarmInstructive: boolean; sexual: boolean; - "sexual/minors": boolean; + sexualMinors: boolean; violence: boolean; - "violence/graphic": boolean; + violenceGraphic: boolean; }; categoryScores: { hate: number; - "hate/threatening": number; + hateThreatening: number; harassment: number; - "harassment/threatening": number; + harassmentThreatening: number; selfHarm: number; - "selfHarm/intent": number; - "selfHarm/instructive": number; + selfHarmIntent: number; + selfHarmInstructive: number; sexual: number; - "sexual/minors": number; + sexualMinors: number; violence: number; - "violence/graphic": number; + violenceGraphic: number; }; }[]; } @@ -450,14 +450,14 @@ export interface FilesListOptionalParams extends OperationOptions { // @public export interface FilesOperations { // (undocumented) - create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; delete: (fileId: string, options?: FilesDeleteOptionalParams) => Promise; // (undocumented) download: (fileId: string, options?: FilesDownloadOptionalParams) => Promise; // (undocumented) list: (options?: FilesListOptionalParams) => Promise; // (undocumented) - retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; } // @public @@ -482,11 +482,11 @@ export interface FineTune { model: string; object: "fine-tune"; organizationId: string; - resultFiles: OpenAIFile[]; + resultFiles: OpenAiFile[]; status: "created" | "running" | "succeeded" | "failed" | "cancelled"; - trainingFiles: OpenAIFile[]; + trainingFiles: OpenAiFile[]; updatedAt: Date; - validationFiles: OpenAIFile[]; + validationFiles: OpenAiFile[]; } // @public @@ -660,7 +660,7 @@ export interface ImagesResponse { // @public export interface ListFilesResponse { // (undocumented) - data: OpenAIFile[]; + data: OpenAiFile[]; // (undocumented) object: string; } @@ -768,7 +768,7 @@ export interface OpenAIClientOptionalParams extends ClientOptions { } // @public -export interface OpenAIFile { +export interface OpenAiFile { bytes: number; createdAt: Date; filename: string; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts index 8b00a519c6..7dd8987eb0 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts @@ -9,8 +9,8 @@ import { FilesRetrieveOptionalParams, } from "../index.js"; import { - OpenAIFile, - openAIFileDeserializer, + OpenAiFile, + openAiFileDeserializer, ListFilesResponse, listFilesResponseDeserializer, CreateFileRequest, @@ -69,20 +69,20 @@ export function _createSend( export async function _createDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return openAiFileDeserializer(result.body); } export async function create( context: Client, file: CreateFileRequest, options: FilesCreateOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _createSend(context, file, options); return _createDeserialize(result); } @@ -99,20 +99,20 @@ export function _retrieveSend( export async function _retrieveDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return openAiFileDeserializer(result.body); } export async function retrieve( context: Client, fileId: string, options: FilesRetrieveOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _retrieveSend(context, fileId, options); return _retrieveDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts index 0676bdf731..346c888b4f 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts @@ -4,7 +4,7 @@ export { createOpenAI, OpenAIContext, OpenAIClientOptionalParams, -} from "./openAIContext.js"; +} from "./openAiContext.js"; export { AudioTranscriptionsCreateOptionalParams, AudioTranslationsCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts new file mode 100644 index 0000000000..3b90d01f83 --- /dev/null +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts @@ -0,0 +1,51 @@ +// Licensed under the MIT License. + +import { + Client, + ClientOptions, + getClient, + KeyCredential, + isKeyCredential, +} from "@typespec/ts-http-runtime"; + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export interface OpenAIContext extends Client {} + +/** Optional parameters for the client. */ +export interface OpenAIClientOptionalParams extends ClientOptions {} + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export function createOpenAI( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, +): OpenAIContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; + + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + }; + const clientContext = getClient(endpointUrl, undefined, updatedOptions); + + if (isKeyCredential(credential)) { + clientContext.pipeline.addPolicy({ + name: "customKeyCredentialPolicy", + sendRequest(request, next) { + request.headers.set("Authorization", "Bearer " + credential.key); + return next(request); + }, + }); + } + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + console.warn( + "This client does not support client api-version, please change it at the operation level", + ); + } + return clientContext; +} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts index 9273df0eda..e0b5b1cbfe 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { AudioTranscriptionsOperations, getAudioTranscriptionsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts index 023ea12464..06114cad1b 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create } from "../../../api/audio/transcriptions/index.js"; import { AudioTranscriptionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts index a09457762e..729ceecdf1 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create } from "../../../api/audio/translations/index.js"; import { AudioTranslationsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts index b278f1fef9..1f06f689ba 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create } from "../../../api/chat/completions/index.js"; import { ChatCompletionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts index 12a97ef1a8..c87e57c82c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { ChatCompletionsOperations, getChatCompletionsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts index 04de4374c4..31c271d104 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/completions/index.js"; import { CompletionsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts index d69529a23b..a946f30b7b 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/edits/index.js"; import { EditsCreateOptionalParams } from "../../api/options.js"; import { CreateEditRequest, CreateEditResponse } from "../../models/models.js"; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts index dc9a1d3fb8..03469f22a3 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/embeddings/index.js"; import { EmbeddingsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts index af14b24f2d..5c35de25f9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { list, create, @@ -18,7 +18,7 @@ import { import { ListFilesResponse, CreateFileRequest, - OpenAIFile, + OpenAiFile, DeleteFileResponse, } from "../../models/models.js"; @@ -28,11 +28,11 @@ export interface FilesOperations { create: ( file: CreateFileRequest, options?: FilesCreateOptionalParams, - ) => Promise; + ) => Promise; retrieve: ( fileId: string, options?: FilesRetrieveOptionalParams, - ) => Promise; + ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts index 8cc61c010c..0b115fcfbd 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts index 601585f020..a976ebf4de 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { FineTuningJobsOperations, getFineTuningJobsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index daa86854a9..263685131d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAIContext.js"; +import { OpenAIContext } from "../../../api/openAiContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts index 928fd8975d..d16cb06974 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create, createEdit, createVariation } from "../../api/images/index.js"; import { ImagesCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts index e3ab15fc60..669ace90f6 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { list, retrieve, $delete } from "../../api/models/index.js"; import { ModelsListOptionalParams, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts index 17c69545e6..5763851792 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAIContext.js"; +import { OpenAIContext } from "../../api/openAiContext.js"; import { create } from "../../api/moderations/index.js"; import { ModerationsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts index a7763cb1ee..1c7d8bf0be 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -export { OpenAIClient } from "./openAIClient.js"; +export { OpenAIClient } from "./openAiClient.js"; export { CreateModerationRequest, CreateModerationResponse, @@ -16,7 +16,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAIFile, + OpenAiFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts index dd91a2687e..65f7601b0a 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts @@ -15,7 +15,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAIFile, + OpenAiFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index 984658af1a..7bd33c5031 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -54,29 +54,29 @@ export interface CreateModerationResponse { flagged: boolean; categories: { hate: boolean; - "hate/threatening": boolean; + hateThreatening: boolean; harassment: boolean; - "harassment/threatening": boolean; + harassmentThreatening: boolean; selfHarm: boolean; - "selfHarm/intent": boolean; - "selfHarm/instructive": boolean; + selfHarmIntent: boolean; + selfHarmInstructive: boolean; sexual: boolean; - "sexual/minors": boolean; + sexualMinors: boolean; violence: boolean; - "violence/graphic": boolean; + violenceGraphic: boolean; }; categoryScores: { hate: number; - "hate/threatening": number; + hateThreatening: number; harassment: number; - "harassment/threatening": number; + harassmentThreatening: number; selfHarm: number; - "selfHarm/intent": number; - "selfHarm/instructive": number; + selfHarmIntent: number; + selfHarmInstructive: number; sexual: number; - "sexual/minors": number; + sexualMinors: number; violence: number; - "violence/graphic": number; + violenceGraphic: number; }; }[]; } @@ -98,30 +98,30 @@ export interface _CreateModerationResponseResult { /** A list of the categories, and whether they are flagged or not. */ categories: { hate: boolean; - "hate/threatening": boolean; + hateThreatening: boolean; harassment: boolean; - "harassment/threatening": boolean; + harassmentThreatening: boolean; selfHarm: boolean; - "selfHarm/intent": boolean; - "selfHarm/instructive": boolean; + selfHarmIntent: boolean; + selfHarmInstructive: boolean; sexual: boolean; - "sexual/minors": boolean; + sexualMinors: boolean; violence: boolean; - "violence/graphic": boolean; + violenceGraphic: boolean; }; /** A list of the categories along with their scores as predicted by model. */ categoryScores: { hate: number; - "hate/threatening": number; + hateThreatening: number; harassment: number; - "harassment/threatening": number; + harassmentThreatening: number; selfHarm: number; - "selfHarm/intent": number; - "selfHarm/instructive": number; + selfHarmIntent: number; + selfHarmInstructive: number; sexual: number; - "sexual/minors": number; + sexualMinors: number; violence: number; - "violence/graphic": number; + violenceGraphic: number; }; } @@ -152,11 +152,11 @@ export interface _CreateModerationResponseResultCategories { * based on race, gender, ethnicity, religion, nationality, sexual orientation, disability * status, or caste. */ - "hate/threatening": boolean; + hateThreatening: boolean; /** Content that expresses, incites, or promotes harassing language towards any target. */ harassment: boolean; /** Harassment content that also includes violence or serious harm towards any target. */ - "harassment/threatening": boolean; + harassmentThreatening: boolean; /** * Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, * and eating disorders. @@ -166,23 +166,23 @@ export interface _CreateModerationResponseResultCategories { * Content where the speaker expresses that they are engaging or intend to engage in acts of * self-harm, such as suicide, cutting, and eating disorders. */ - "selfHarm/intent": boolean; + selfHarmIntent: boolean; /** * Content that encourages performing acts of self-harm, such as suicide, cutting, and eating * disorders, or that gives instructions or advice on how to commit such acts. */ - "selfHarm/instructive": boolean; + selfHarmInstructive: boolean; /** * Content meant to arouse sexual excitement, such as the description of sexual activity, or * that promotes sexual services (excluding sex education and wellness). */ sexual: boolean; /** Sexual content that includes an individual who is under 18 years old. */ - "sexual/minors": boolean; + sexualMinors: boolean; /** Content that depicts death, violence, or physical injury. */ violence: boolean; /** Content that depicts death, violence, or physical injury in graphic detail. */ - "violence/graphic": boolean; + violenceGraphic: boolean; } export function _createModerationResponseResultCategoriesDeserializer( @@ -190,16 +190,16 @@ export function _createModerationResponseResultCategoriesDeserializer( ): _CreateModerationResponseResultCategories { return { hate: item["hate"], - "hate/threatening": item["hate/threatening"], + hateThreatening: item["hate/threatening"], harassment: item["harassment"], - "harassment/threatening": item["harassment/threatening"], + harassmentThreatening: item["harassment/threatening"], selfHarm: item["self-harm"], - "selfHarm/intent": item["self-harm/intent"], - "selfHarm/instructive": item["self-harm/instructive"], + selfHarmIntent: item["self-harm/intent"], + selfHarmInstructive: item["self-harm/instructive"], sexual: item["sexual"], - "sexual/minors": item["sexual/minors"], + sexualMinors: item["sexual/minors"], violence: item["violence"], - "violence/graphic": item["violence/graphic"], + violenceGraphic: item["violence/graphic"], }; } @@ -208,25 +208,25 @@ export interface _CreateModerationResponseResultCategoryScores { /** The score for the category 'hate'. */ hate: number; /** The score for the category 'hate/threatening'. */ - "hate/threatening": number; + hateThreatening: number; /** The score for the category 'harassment'. */ harassment: number; /** The score for the category 'harassment/threatening'. */ - "harassment/threatening": number; + harassmentThreatening: number; /** The score for the category 'self-harm'. */ selfHarm: number; /** The score for the category 'self-harm/intent'. */ - "selfHarm/intent": number; + selfHarmIntent: number; /** The score for the category 'self-harm/instructive'. */ - "selfHarm/instructive": number; + selfHarmInstructive: number; /** The score for the category 'sexual'. */ sexual: number; /** The score for the category 'sexual/minors'. */ - "sexual/minors": number; + sexualMinors: number; /** The score for the category 'violence'. */ violence: number; /** The score for the category 'violence/graphic'. */ - "violence/graphic": number; + violenceGraphic: number; } export function _createModerationResponseResultCategoryScoresDeserializer( @@ -234,16 +234,16 @@ export function _createModerationResponseResultCategoryScoresDeserializer( ): _CreateModerationResponseResultCategoryScores { return { hate: item["hate"], - "hate/threatening": item["hate/threatening"], + hateThreatening: item["hate/threatening"], harassment: item["harassment"], - "harassment/threatening": item["harassment/threatening"], + harassmentThreatening: item["harassment/threatening"], selfHarm: item["self-harm"], - "selfHarm/intent": item["self-harm/intent"], - "selfHarm/instructive": item["self-harm/instructive"], + selfHarmIntent: item["self-harm/intent"], + selfHarmInstructive: item["self-harm/instructive"], sexual: item["sexual"], - "sexual/minors": item["sexual/minors"], + sexualMinors: item["sexual/minors"], violence: item["violence"], - "violence/graphic": item["violence/graphic"], + violenceGraphic: item["violence/graphic"], }; } @@ -638,11 +638,11 @@ export interface FineTune { classificationNClasses?: number; }; /** The list of files used for training. */ - trainingFiles: OpenAIFile[]; + trainingFiles: OpenAiFile[]; /** The list of files used for validation. */ - validationFiles: OpenAIFile[]; + validationFiles: OpenAiFile[]; /** The compiled results files for the fine-tuning job. */ - resultFiles: OpenAIFile[]; + resultFiles: OpenAiFile[]; /** The list of events that have been observed in the lifecycle of the FineTune job. */ events?: FineTuneEvent[]; } @@ -658,9 +658,9 @@ export function fineTuneDeserializer(item: any): FineTune { organizationId: item["organization_id"], status: item["status"], hyperparams: _fineTuneHyperparamsDeserializer(item["hyperparams"]), - trainingFiles: openAIFileArrayDeserializer(item["training_files"]), - validationFiles: openAIFileArrayDeserializer(item["validation_files"]), - resultFiles: openAIFileArrayDeserializer(item["result_files"]), + trainingFiles: openAiFileArrayDeserializer(item["training_files"]), + validationFiles: openAiFileArrayDeserializer(item["validation_files"]), + resultFiles: openAiFileArrayDeserializer(item["result_files"]), events: !item["events"] ? item["events"] : fineTuneEventArrayDeserializer(item["events"]), @@ -706,7 +706,7 @@ export function _fineTuneHyperparamsDeserializer( } /** The `File` object represents a document that has been uploaded to OpenAI. */ -export interface OpenAIFile { +export interface OpenAiFile { /** The file identifier, which can be referenced in the API endpoints. */ id: string; /** The object type, which is always "file". */ @@ -737,7 +737,7 @@ export interface OpenAIFile { statusDetails?: string | null; } -export function openAIFileDeserializer(item: any): OpenAIFile { +export function openAiFileDeserializer(item: any): OpenAiFile { return { id: item["id"], object: item["object"], @@ -750,9 +750,9 @@ export function openAIFileDeserializer(item: any): OpenAIFile { }; } -export function openAIFileArrayDeserializer(result: Array): any[] { +export function openAiFileArrayDeserializer(result: Array): any[] { return result.map((item) => { - return openAIFileDeserializer(item); + return openAiFileDeserializer(item); }); } @@ -820,13 +820,13 @@ export function listFineTuneEventsResponseDeserializer( /** model interface ListFilesResponse */ export interface ListFilesResponse { object: string; - data: OpenAIFile[]; + data: OpenAiFile[]; } export function listFilesResponseDeserializer(item: any): ListFilesResponse { return { object: item["object"], - data: openAIFileArrayDeserializer(item["data"]), + data: openAiFileArrayDeserializer(item["data"]), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts index 1f75c622e5..065172c518 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts @@ -39,7 +39,7 @@ import { } from "./api/index.js"; import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts new file mode 100644 index 0000000000..065172c518 --- /dev/null +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts @@ -0,0 +1,98 @@ +// Licensed under the MIT License. + +import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; +import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; +import { + getFineTuningOperations, + FineTuningOperations, +} from "./classic/fineTuning/index.js"; +import { + getCompletionsOperations, + CompletionsOperations, +} from "./classic/completions/index.js"; +import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; +import { + getEmbeddingsOperations, + EmbeddingsOperations, +} from "./classic/embeddings/index.js"; +import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; +import { + getFineTunesOperations, + FineTunesOperations, +} from "./classic/fineTunes/index.js"; +import { + getModelsOperations, + ModelsOperations, +} from "./classic/models/index.js"; +import { + getImagesOperations, + ImagesOperations, +} from "./classic/images/index.js"; +import { + getModerationsOperations, + ModerationsOperations, +} from "./classic/moderations/index.js"; +import { + createOpenAI, + OpenAIContext, + OpenAIClientOptionalParams, +} from "./api/index.js"; +import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; + +export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; + +export class OpenAIClient { + private _client: OpenAIContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ + constructor( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : "azsdk-js-client"; + this._client = createOpenAI(credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.audio = getAudioOperations(this._client); + this.chat = getChatOperations(this._client); + this.fineTuning = getFineTuningOperations(this._client); + this.completions = getCompletionsOperations(this._client); + this.edits = getEditsOperations(this._client); + this.embeddings = getEmbeddingsOperations(this._client); + this.files = getFilesOperations(this._client); + this.fineTunes = getFineTunesOperations(this._client); + this.models = getModelsOperations(this._client); + this.images = getImagesOperations(this._client); + this.moderations = getModerationsOperations(this._client); + } + + /** The operation groups for AudioTranscriptions */ + public readonly audio: AudioOperations; + /** The operation groups for ChatCompletions */ + public readonly chat: ChatOperations; + /** The operation groups for FineTuningJobs */ + public readonly fineTuning: FineTuningOperations; + /** The operation groups for Completions */ + public readonly completions: CompletionsOperations; + /** The operation groups for Edits */ + public readonly edits: EditsOperations; + /** The operation groups for Embeddings */ + public readonly embeddings: EmbeddingsOperations; + /** The operation groups for Files */ + public readonly files: FilesOperations; + /** The operation groups for FineTunes */ + public readonly fineTunes: FineTunesOperations; + /** The operation groups for Models */ + public readonly models: ModelsOperations; + /** The operation groups for Images */ + public readonly images: ImagesOperations; + /** The operation groups for Moderations */ + public readonly moderations: ModerationsOperations; +} From 73ed758f4d21708d220402f7f35f4c076eacfb41 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 31 Oct 2024 12:58:02 +0800 Subject: [PATCH 10/91] Update smoke testings --- packages/rlc-common/src/helpers/nameUtils.ts | 49 +- .../rlc-common/test/helpers/nameUtils.spec.ts | 26 +- .../review/arm-networkanalytics.api.md | 4 +- .../generated/typespec-ts/src/index.ts | 2 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 20 +- .../review/ai-anomaly-detector.api.md | 8 +- .../generated/typespec-ts/src/index.ts | 4 +- .../generated/typespec-ts/src/models/index.ts | 4 +- .../typespec-ts/src/models/models.ts | 18 +- .../generated/typespec-ts/review/batch.api.md | 56 +- .../typespec-ts/src/api/operations.ts | 20 +- .../generated/typespec-ts/src/batchClient.ts | 6 +- .../generated/typespec-ts/src/index.ts | 12 +- .../generated/typespec-ts/src/models/index.ts | 12 +- .../typespec-ts/src/models/models.ts | 158 +-- .../review/hierarchy-generic.api.md | 10 +- .../typespec-ts/src/api/b/c/index.ts | 8 +- .../typespec-ts/src/api/b/e/c/index.ts | 8 +- .../generated/typespec-ts/src/api/b/index.ts | 8 +- .../typespec-ts/src/classic/b/c/index.ts | 6 +- .../typespec-ts/src/classic/b/e/c/index.ts | 6 +- .../typespec-ts/src/classic/b/index.ts | 6 +- .../generated/typespec-ts/src/index.ts | 2 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 12 +- .../typespec-ts/review/load-testing.api.md | 36 +- .../generated/typespec-ts/src/models.ts | 26 +- .../generated/typespec-ts/src/outputModels.ts | 30 +- .../typespec-ts/review/load-testing.api.md | 38 +- .../generated/typespec-ts/src/index.ts | 20 +- .../generated/typespec-ts/src/models/index.ts | 20 +- .../typespec-ts/src/models/models.ts | 52 +- .../openai/generated/typespec-ts/README.md | 6 +- .../typespec-ts/review/openai.api.md | 10 +- .../beginAzureBatchImageGenerationSample.ts | 4 +- ...tchImageGenerationOperationStatusSample.ts | 4 +- .../samples-dev/getChatCompletionsSample.ts | 4 +- ...hatCompletionsWithAzureExtensionsSample.ts | 4 +- .../samples-dev/getCompletionsSample.ts | 4 +- .../samples-dev/getEmbeddingsSample.ts | 4 +- .../typespec-ts/src/clientDefinitions.ts | 2 +- .../openai/generated/typespec-ts/src/index.ts | 6 +- .../generated/typespec-ts/src/openAIClient.ts | 12 +- .../generated/typespec-ts/src/openAiClient.ts | 12 +- .../generated/typespec-ts/src/outputModels.ts | 4 +- .../generated/typespec-ts/README.md | 10 +- .../typespec-ts/review/openai-generic.api.md | 14 +- .../typespec-ts/src/api/files/index.ts | 16 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/classic/audio/index.ts | 2 +- .../src/classic/audio/transcriptions/index.ts | 2 +- .../src/classic/audio/translations/index.ts | 2 +- .../src/classic/chat/completions/index.ts | 2 +- .../typespec-ts/src/classic/chat/index.ts | 2 +- .../src/classic/completions/index.ts | 2 +- .../typespec-ts/src/classic/edits/index.ts | 2 +- .../src/classic/embeddings/index.ts | 2 +- .../typespec-ts/src/classic/files/index.ts | 8 +- .../src/classic/fineTunes/index.ts | 2 +- .../src/classic/fineTuning/index.ts | 2 +- .../src/classic/fineTuning/jobs/index.ts | 2 +- .../typespec-ts/src/classic/images/index.ts | 2 +- .../typespec-ts/src/classic/models/index.ts | 2 +- .../src/classic/moderations/index.ts | 2 +- .../generated/typespec-ts/src/index.ts | 4 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 24 +- .../generated/typespec-ts/src/openAIClient.ts | 2 +- .../generated/typespec-ts/src/openAiClient.ts | 2 +- .../generated/typespec-ts/README.md | 10 +- .../generated/typespec-ts/package.json | 89 +- .../typespec-ts/review/openai_modular.api.md | 1016 +++++++++++++++++ .../generated/typespec-ts/src/api/index.ts | 2 +- .../generated/typespec-ts/src/index.ts | 10 +- .../generated/typespec-ts/src/models/index.ts | 8 +- .../typespec-ts/src/models/models.ts | 38 +- .../generated/typespec-ts/src/openAIClient.ts | 2 +- .../generated/typespec-ts/src/openAiClient.ts | 2 +- .../generated/typespec-ts/README.md | 4 +- .../generated/typespec-ts/package.json | 2 +- .../review/openai-non-branded.api.md | 14 +- .../typespec-ts/src/api/files/index.ts | 16 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/classic/audio/index.ts | 2 +- .../src/classic/audio/transcriptions/index.ts | 2 +- .../src/classic/audio/translations/index.ts | 2 +- .../src/classic/chat/completions/index.ts | 2 +- .../typespec-ts/src/classic/chat/index.ts | 2 +- .../src/classic/completions/index.ts | 2 +- .../typespec-ts/src/classic/edits/index.ts | 2 +- .../src/classic/embeddings/index.ts | 2 +- .../typespec-ts/src/classic/files/index.ts | 8 +- .../src/classic/fineTunes/index.ts | 2 +- .../src/classic/fineTuning/index.ts | 2 +- .../src/classic/fineTuning/jobs/index.ts | 2 +- .../typespec-ts/src/classic/images/index.ts | 2 +- .../typespec-ts/src/classic/models/index.ts | 2 +- .../src/classic/moderations/index.ts | 2 +- .../generated/typespec-ts/src/index.ts | 4 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 24 +- .../generated/typespec-ts/src/openAIClient.ts | 2 +- .../generated/typespec-ts/src/openAiClient.ts | 2 +- .../typespec-ts/src/modular/emitModels.ts | 3 +- packages/typespec-ts/src/utils/casingUtils.ts | 12 +- .../generated/encode/duration/src/index.d.ts | 8 +- .../type/property/nullable/src/index.d.ts | 288 ++--- .../generated/type/union/src/index.d.ts | 16 +- .../generated/union-body/src/index.d.ts | 12 +- .../generated/client/naming/src/index.d.ts | 6 +- .../generated/encode/duration/src/index.d.ts | 4 +- .../repeatability/src/index.d.ts | 2 +- .../generated/type/union/src/index.d.ts | 8 +- 114 files changed, 1831 insertions(+), 692 deletions(-) create mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index ada61f3c9b..66ea8340ed 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -14,7 +14,8 @@ export enum NameType { Parameter, Operation, OperationGroup, - Method + Method, + EnumMemberName } const Newable = [NameType.Class, NameType.Interface, NameType.OperationGroup]; @@ -143,9 +144,16 @@ export function normalizeName( } const casingConvention = casingOverride ?? getCasingConvention(nameType); const parts = deconstruct(name); + // const parts = getNameParts(sanitizeName(name)); + console.log("parts", parts, name, getNameParts(sanitizeName(name))); const [firstPart, ...otherParts] = parts; if (parts.length === 0) { - console.log("parts.length < 1", parts, name, getNameParts(sanitizeName(name))); + console.log( + "parts.length < 1", + parts, + name, + getNameParts(sanitizeName(name)) + ); return name; } const normalizedFirstPart = toCasing(firstPart, casingConvention); @@ -161,9 +169,30 @@ export function normalizeName( : normalized; } -function deconstruct( +function isFullyUpperCase( identifier: string, -): Array { + maxUppercasePreserve: number = 6 +) { + const len = identifier.length; + if (len > 1) { + if ( + len <= maxUppercasePreserve && + identifier === identifier.toUpperCase() + ) { + return true; + } + + if (len <= maxUppercasePreserve + 1 && identifier.endsWith("s")) { + const i = identifier.substring(0, len - 1); + if (i.toUpperCase() === i) { + return true; + } + } + } + return false; +} + +function deconstruct(identifier: string): Array { const parts = `${identifier}` .replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar) .replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123 => foo123 bar) @@ -171,7 +200,8 @@ function deconstruct( .replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, "$1 $2$3") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) .replace(/«/g, "s") .trim() - .split(/[\W|_]+/); + .split(/[\W|_]+/) + .map((each) => (isFullyUpperCase(each) ? each : each.toLowerCase())); return parts.filter((part) => part.trim().length > 0); } @@ -206,6 +236,7 @@ function getCasingConvention(nameType: NameType) { case NameType.Class: case NameType.Interface: case NameType.OperationGroup: + case NameType.EnumMemberName: return CasingConvention.Pascal; case NameType.File: case NameType.Property: @@ -222,10 +253,10 @@ function getCasingConvention(nameType: NameType) { * on Modeler four namer for this once it is stable */ function toCasing(str: string, casing: CasingConvention): string { - let value = str; - if (value === value.toUpperCase()) { - value = str.toLowerCase(); - } + const value = str; + // if (value === value.toUpperCase()) { + // value = str.toLowerCase(); + // } const firstChar = casing === CasingConvention.Pascal diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 7f0006d245..9630593836 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -13,8 +13,22 @@ describe("#normalizeName", () => { ); }); - it("should normalize the name with camel case", () => { - expect(normalizeName("API_KEY", NameType.Parameter, true)).to.equal("apiKey"); + it.only("should normalize the name with camel case", () => { + expect(normalizeName("NodeVMExtension", NameType.Parameter, true)).to.equal("nodeVMExtension"); + expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName, true)).to.equal("AKVCertURI"); + expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName, true)).to.equal("AzureOpenAIOperationStateOutput"); + expect(normalizeName("TSModel", NameType.EnumMemberName, true)).to.equal("TSModel"); + expect(normalizeName("TSModel", NameType.Property, true)).to.equal("tSModel"); + expect(normalizeName("Base64urlArrayBytesProperty", NameType.Property, true)).to.equal("base64UrlArrayBytesProperty"); + expect(normalizeName("ISO8601DurationProperty", NameType.Property, true)).to.equal("iSO8601DurationProperty"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("ValidationNOTRequired"); + expect(normalizeName("ValidationNotRequired", NameType.EnumMemberName, true)).to.equal("ValidationNotRequired"); + expect(normalizeName("KnownPFTestResult", NameType.EnumMemberName, true)).to.equal("KnownPFTestResult"); + expect(normalizeName("repeatabilityRequestID", NameType.EnumMemberName, true)).to.equal("RepeatabilityRequestID"); + expect(normalizeName("C", NameType.EnumMemberName, true)).to.equal("C"); + expect(normalizeName("C", NameType.Parameter, true)).to.equal("c"); + expect(normalizeName("splitAllCSVs", NameType.EnumMemberName, true)).to.equal("SplitAllCSVs"); + expect(normalizeName("publicIPDisabled", NameType.EnumMemberName, true)).to.equal("PublicIPDisabled"); expect(normalizeName("pascalCase", NameType.Parameter, true)).to.equal( "pascalCase" ); @@ -27,11 +41,11 @@ describe("#normalizeName", () => { expect(normalizeName("_pascal_case", NameType.Parameter, true)).to.equal( "pascalCase" ); - expect(normalizeName("pascal, case", NameType.Parameter, true)).to.equal( - "pascalCase" - ); + // expect(normalizeName("pascal, case", NameType.Parameter, true)).to.equal( + // "pascalCase" + // ); expect(normalizeName("MAX_of_MLD", NameType.Parameter, true)).to.equal( - "maxOfMld" + "mAXOfMLD" ); expect(normalizeName("___pascal____case6666", NameType.Parameter, true)).to.equal( "pascalCase6666" diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md index 45f0a23e89..6a0b680bba 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md @@ -78,7 +78,7 @@ export interface DataProductInformation { export interface DataProductNetworkAcls { allowedQueryIpRangeList: string[]; defaultAction: DefaultAction; - ipRules: IpRules[]; + ipRules: IPRules[]; virtualNetworkRule: VirtualNetworkRule[]; } @@ -328,7 +328,7 @@ export interface ErrorResponse { } // @public -export interface IpRules { +export interface IPRules { action: string; value?: string; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts index db09958503..1207d6385b 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/index.ts @@ -19,7 +19,7 @@ export { EncryptionKeyDetails, DataProductNetworkAcls, VirtualNetworkRule, - IpRules, + IPRules, KnownDefaultAction, DefaultAction, ManagedResourceGroupConfiguration, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts index a8ebd500dc..63a064b63e 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/index.ts @@ -11,7 +11,7 @@ export { EncryptionKeyDetails, DataProductNetworkAcls, VirtualNetworkRule, - IpRules, + IPRules, KnownDefaultAction, DefaultAction, ManagedResourceGroupConfiguration, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts index a790661d84..803e2d74ff 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts @@ -257,7 +257,7 @@ export interface DataProductNetworkAcls { /** Virtual Network Rule */ virtualNetworkRule: VirtualNetworkRule[]; /** IP rule with specific IP or IP range in CIDR format. */ - ipRules: IpRules[]; + ipRules: IPRules[]; /** The list of query ips in the format of CIDR allowed to connect to query/visualization endpoint. */ allowedQueryIpRangeList: string[]; /** Default Action */ @@ -271,7 +271,7 @@ export function dataProductNetworkAclsSerializer( virtualNetworkRule: virtualNetworkRuleArraySerializer( item["virtualNetworkRule"], ), - ipRules: ipRulesArraySerializer(item["ipRules"]), + ipRules: iPRulesArraySerializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -286,7 +286,7 @@ export function dataProductNetworkAclsDeserializer( virtualNetworkRule: virtualNetworkRuleArrayDeserializer( item["virtualNetworkRule"], ), - ipRules: ipRulesArrayDeserializer(item["ipRules"]), + ipRules: iPRulesArrayDeserializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -333,33 +333,33 @@ export function virtualNetworkRuleArrayDeserializer( } /** IP rule with specific IP or IP range in CIDR format. */ -export interface IpRules { +export interface IPRules { /** IP Rules Value */ value?: string; /** The action of virtual network rule. */ action: string; } -export function ipRulesSerializer(item: IpRules): any { +export function iPRulesSerializer(item: IPRules): any { return { value: item["value"], action: item["action"] }; } -export function ipRulesDeserializer(item: any): IpRules { +export function iPRulesDeserializer(item: any): IPRules { return { value: item["value"], action: item["action"], }; } -export function ipRulesArraySerializer(result: Array): any[] { +export function iPRulesArraySerializer(result: Array): any[] { return result.map((item) => { - return ipRulesSerializer(item); + return iPRulesSerializer(item); }); } -export function ipRulesArrayDeserializer(result: Array): any[] { +export function iPRulesArrayDeserializer(result: Array): any[] { return result.map((item) => { - return ipRulesDeserializer(item); + return iPRulesDeserializer(item); }); } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index b0d0dcdcc2..637424c1d1 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -23,7 +23,7 @@ export interface AnomalyDetectorClientOptionalParams extends ClientOptions { } // @public -export type ApiVersion = "v1.1"; +export type APIVersion = "v1.1"; // @public export type ContinuablePage = TPage & { @@ -36,7 +36,7 @@ export type MultivariateAlignMode = "Inner" | "Outer"; // @public export interface MultivariateAlignPolicy { alignMode?: MultivariateAlignMode; - fillNaMethod?: MultivariateFillNaMethod; + fillNAMethod?: MultivariateFillNAMethod; paddingValue?: number; } @@ -103,7 +103,7 @@ export interface MultivariateErrorResponse { } // @public -export type MultivariateFillNaMethod = "Previous" | "Subsequent" | "Linear" | "Zero" | "Fixed"; +export type MultivariateFillNAMethod = "Previous" | "Subsequent" | "Linear" | "Zero" | "Fixed"; // @public export interface MultivariateGetMultivariateBatchDetectionResultOptionalParams extends OperationOptions { @@ -200,7 +200,7 @@ export interface MultivariateTrainMultivariateModelOptionalParams extends Operat // @public export interface MultivariateVariableState { effectiveCount?: number; - filledNaRatio?: number; + filledNARatio?: number; firstTimestamp?: Date; lastTimestamp?: Date; variable?: string; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts index da527da68d..d5a32173b2 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts @@ -23,7 +23,7 @@ export { MultivariateDataSchema, MultivariateAlignPolicy, MultivariateAlignMode, - MultivariateFillNaMethod, + MultivariateFillNAMethod, MultivariateModelStatus, MultivariateDiagnosticsInfo, MultivariateModelState, @@ -41,7 +41,7 @@ export { UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, UnivariateUnivariateChangePointDetectionResult, - ApiVersion, + APIVersion, } from "./models/index.js"; export { AnomalyDetectorClientOptionalParams, diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts index 2b8060f03e..c8bde9b187 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts @@ -16,7 +16,7 @@ export { MultivariateDataSchema, MultivariateAlignPolicy, MultivariateAlignMode, - MultivariateFillNaMethod, + MultivariateFillNAMethod, MultivariateModelStatus, MultivariateDiagnosticsInfo, MultivariateModelState, @@ -34,5 +34,5 @@ export { UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, UnivariateUnivariateChangePointDetectionResult, - ApiVersion, + APIVersion, } from "./models.js"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index 4147a6b874..999076c97d 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -92,7 +92,7 @@ export interface MultivariateVariableState { /** Variable name in variable states. */ variable?: string; /** Proportion of missing values that need to be filled by fillNAMethod. */ - filledNaRatio?: number; + filledNARatio?: number; /** Number of effective data points before applying fillNAMethod. */ effectiveCount?: number; /** First valid timestamp with value of input data. */ @@ -106,7 +106,7 @@ export function multivariateVariableStateSerializer( ): any { return { variable: item["variable"], - filledNARatio: item["filledNaRatio"], + filledNARatio: item["filledNARatio"], effectiveCount: item["effectiveCount"], firstTimestamp: item["firstTimestamp"]?.toISOString(), lastTimestamp: item["lastTimestamp"]?.toISOString(), @@ -118,7 +118,7 @@ export function multivariateVariableStateDeserializer( ): MultivariateVariableState { return { variable: item["variable"], - filledNaRatio: item["filledNARatio"], + filledNARatio: item["filledNARatio"], effectiveCount: item["effectiveCount"], firstTimestamp: !item["firstTimestamp"] ? item["firstTimestamp"] @@ -416,7 +416,7 @@ export interface MultivariateAlignPolicy { * An optional field, indicating how missing values will be filled. One of * Previous, Subsequent, Linear, Zero, Fixed. */ - fillNaMethod?: MultivariateFillNaMethod; + fillNAMethod?: MultivariateFillNAMethod; /** An optional field. Required when fillNAMethod is Fixed. */ paddingValue?: number; } @@ -426,7 +426,7 @@ export function multivariateAlignPolicySerializer( ): any { return { alignMode: item["alignMode"], - fillNAMethod: item["fillNaMethod"], + fillNAMethod: item["fillNAMethod"], paddingValue: item["paddingValue"], }; } @@ -436,7 +436,7 @@ export function multivariateAlignPolicyDeserializer( ): MultivariateAlignPolicy { return { alignMode: item["alignMode"], - fillNaMethod: item["fillNAMethod"], + fillNAMethod: item["fillNAMethod"], paddingValue: item["paddingValue"], }; } @@ -444,7 +444,7 @@ export function multivariateAlignPolicyDeserializer( /** Type of MultivariateAlignMode */ export type MultivariateAlignMode = "Inner" | "Outer"; /** An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. */ -export type MultivariateFillNaMethod = +export type MultivariateFillNAMethod = | "Previous" | "Subsequent" | "Linear" @@ -1071,5 +1071,5 @@ export function univariateUnivariateChangePointDetectionResultDeserializer( }; } -/** Type of ApiVersion */ -export type ApiVersion = "v1.1"; +/** Type of APIVersion */ +export type APIVersion = "v1.1"; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md index 28a94b383c..538ee7353d 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md @@ -139,7 +139,7 @@ export class BatchClient { getJobSchedule(jobScheduleId: string, options?: GetJobScheduleOptionalParams): Promise; getJobTaskCounts(jobId: string, options?: GetJobTaskCountsOptionalParams): Promise; getNode(poolId: string, nodeId: string, options?: GetNodeOptionalParams): Promise; - getNodeExtension(poolId: string, nodeId: string, extensionName: string, options?: GetNodeExtensionOptionalParams): Promise; + getNodeExtension(poolId: string, nodeId: string, extensionName: string, options?: GetNodeExtensionOptionalParams): Promise; getNodeFile(poolId: string, nodeId: string, filePath: string, options?: GetNodeFileOptionalParams): Promise; getNodeFileProperties(poolId: string, nodeId: string, filePath: string, options?: GetNodeFilePropertiesOptionalParams): Promise; getNodeRemoteDesktopFile(poolId: string, nodeId: string, options?: GetNodeRemoteDesktopFileOptionalParams): Promise; @@ -155,7 +155,7 @@ export class BatchClient { listJobs(options?: ListJobsOptionalParams): PagedAsyncIterableIterator; listJobSchedules(options?: ListJobSchedulesOptionalParams): PagedAsyncIterableIterator; listJobsFromSchedule(jobScheduleId: string, options?: ListJobsFromScheduleOptionalParams): PagedAsyncIterableIterator; - listNodeExtensions(poolId: string, nodeId: string, options?: ListNodeExtensionsOptionalParams): PagedAsyncIterableIterator; + listNodeExtensions(poolId: string, nodeId: string, options?: ListNodeExtensionsOptionalParams): PagedAsyncIterableIterator; listNodeFiles(poolId: string, nodeId: string, options?: ListNodeFilesOptionalParams): PagedAsyncIterableIterator; listNodes(poolId: string, options?: ListNodesOptionalParams): PagedAsyncIterableIterator; listPoolNodeCounts(options?: ListPoolNodeCountsOptionalParams): PagedAsyncIterableIterator; @@ -1077,7 +1077,7 @@ export interface ImageInformation { capabilities?: string[]; imageReference: ImageReference; nodeAgentSkuId: string; - osType: OsType; + osType: OSType; verificationType: VerificationType; } @@ -1097,7 +1097,7 @@ export interface InboundEndpoint { frontendPort: number; name: string; protocol: InboundEndpointProtocol; - publicFqdn?: string; + publicFQDN?: string; publicIpAddress?: string; } @@ -1105,7 +1105,7 @@ export interface InboundEndpoint { export type InboundEndpointProtocol = "tcp" | "udp"; // @public -export interface InboundNatPool { +export interface InboundNATPool { backendPort: number; frontendPortRangeEnd: number; frontendPortRangeStart: number; @@ -1258,19 +1258,19 @@ export type JobScheduleState = "active" | "completed" | "disabled" | "terminatin // @public export interface JobScheduleStatistics { - kernelCpuTime: string; + kernelCPUTime: string; lastUpdateTime: Date; numFailedTasks: number; numSucceededTasks: number; numTaskRetries: number; - readIoGiB: number; + readIOGiB: number; readIOps: number; startTime: Date; url: string; - userCpuTime: string; + userCPUTime: string; waitTime: string; wallClockTime: string; - writeIoGiB: number; + writeIOGiB: number; writeIOps: number; } @@ -1306,19 +1306,19 @@ export type JobState = "active" | "disabling" | "disabled" | "enabling" | "termi // @public export interface JobStatistics { - kernelCpuTime: string; + kernelCPUTime: string; lastUpdateTime: Date; numFailedTasks: number; numSucceededTasks: number; numTaskRetries: number; - readIoGiB: number; + readIOGiB: number; readIOps: number; startTime: Date; url: string; - userCpuTime: string; + userCPUTime: string; waitTime: string; wallClockTime: string; - writeIoGiB: number; + writeIOGiB: number; writeIOps: number; } @@ -1592,10 +1592,10 @@ export interface NodeRemoveOptions { } // @public -export interface NodeVmExtension { - instanceView?: VmExtensionInstanceView; +export interface NodeVMExtension { + instanceView?: VMExtensionInstanceView; provisioningState?: string; - vmExtension?: VmExtension; + vmExtension?: VMExtension; } // @public @@ -1605,12 +1605,12 @@ export type OnAllTasksComplete = "noaction" | "terminatejob"; export type OnTaskFailure = "noaction" | "performexitoptionsjobaction"; // @public -export interface OsDisk { - ephemeralOsDiskSettings?: DiffDiskSettings; +export interface OSDisk { + ephemeralOSDiskSettings?: DiffDiskSettings; } // @public -export type OsType = "linux" | "windows"; +export type OSType = "linux" | "windows"; // @public export interface OutputFile { @@ -1654,7 +1654,7 @@ export interface PageSettings { // @public export interface PoolEndpointConfiguration { - inboundNatPools: InboundNatPool[]; + inboundNatPools: InboundNATPool[]; } // @public @@ -2069,16 +2069,16 @@ export type TaskState = "active" | "preparing" | "running" | "completed"; // @public export interface TaskStatistics { - kernelCpuTime: string; + kernelCPUTime: string; lastUpdateTime: Date; - readIoGiB: number; + readIOGiB: number; readIOps: number; startTime: Date; url: string; - userCpuTime: string; + userCPUTime: string; waitTime: string; wallClockTime: string; - writeIoGiB: number; + writeIOGiB: number; writeIOps: number; } @@ -2205,12 +2205,12 @@ export interface VirtualMachineConfiguration { containerConfiguration?: ContainerConfiguration; dataDisks?: DataDisk[]; diskEncryptionConfiguration?: DiskEncryptionConfiguration; - extensions?: VmExtension[]; + extensions?: VMExtension[]; imageReference: ImageReference; licenseType?: string; nodeAgentSkuId: string; nodePlacementConfiguration?: NodePlacementConfiguration; - osDisk?: OsDisk; + osDisk?: OSDisk; windowsConfiguration?: WindowsConfiguration; } @@ -2220,7 +2220,7 @@ export interface VirtualMachineInfo { } // @public -export interface VmExtension { +export interface VMExtension { autoUpgradeMinorVersion?: boolean; enableAutomaticUpgrade?: boolean; name: string; @@ -2233,7 +2233,7 @@ export interface VmExtension { } // @public -export interface VmExtensionInstanceView { +export interface VMExtensionInstanceView { name?: string; statuses?: InstanceViewStatus[]; subStatuses?: InstanceViewStatus[]; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts index 5b4563bcb2..60ec0b4d0c 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts @@ -98,10 +98,10 @@ import { uploadBatchServiceLogsResultDeserializer, _BatchNodeListResult, _batchNodeListResultDeserializer, - NodeVmExtension, - nodeVmExtensionDeserializer, - _NodeVmExtensionList, - _nodeVmExtensionListDeserializer, + NodeVMExtension, + nodeVMExtensionDeserializer, + _NodeVMExtensionList, + _nodeVMExtensionListDeserializer, _NodeFileListResult, _nodeFileListResultDeserializer, NodeFile, @@ -4253,13 +4253,13 @@ export function _getNodeExtensionSend( export async function _getNodeExtensionDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return nodeVmExtensionDeserializer(result.body); + return nodeVMExtensionDeserializer(result.body); } /** Gets information about the specified Compute Node Extension. */ @@ -4269,7 +4269,7 @@ export async function getNodeExtension( nodeId: string, extensionName: string, options: GetNodeExtensionOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _getNodeExtensionSend( context, poolId, @@ -4304,13 +4304,13 @@ export function _listNodeExtensionsSend( export async function _listNodeExtensionsDeserialize( result: PathUncheckedResponse, -): Promise<_NodeVmExtensionList> { +): Promise<_NodeVMExtensionList> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _nodeVmExtensionListDeserializer(result.body); + return _nodeVMExtensionListDeserializer(result.body); } /** Lists the Compute Nodes Extensions in the specified Pool. */ @@ -4319,7 +4319,7 @@ export function listNodeExtensions( poolId: string, nodeId: string, options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, () => _listNodeExtensionsSend(context, poolId, nodeId, options), diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts index 4d2160babc..27778a6f04 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts @@ -165,7 +165,7 @@ import { BatchNodeRemoteLoginSettingsResult, UploadBatchServiceLogsOptions, UploadBatchServiceLogsResult, - NodeVmExtension, + NodeVMExtension, NodeFile, BatchTaskCreateOptions, BatchTask, @@ -1117,7 +1117,7 @@ export class BatchClient { nodeId: string, extensionName: string, options: GetNodeExtensionOptionalParams = { requestOptions: {} }, - ): Promise { + ): Promise { return getNodeExtension( this._client, poolId, @@ -1132,7 +1132,7 @@ export class BatchClient { poolId: string, nodeId: string, options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { + ): PagedAsyncIterableIterator { return listNodeExtensions(this._client, poolId, nodeId, options); } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts index 01604be491..f9b9845b5e 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts @@ -57,9 +57,9 @@ export { BatchNodeRemoteLoginSettingsResult, UploadBatchServiceLogsOptions, UploadBatchServiceLogsResult, - NodeVmExtension, - VmExtension, - VmExtensionInstanceView, + NodeVMExtension, + VMExtension, + VMExtensionInstanceView, InstanceViewStatus, StatusLevelTypes, NodeFile, @@ -122,7 +122,7 @@ export { DiskEncryptionTarget, NodePlacementConfiguration, NodePlacementPolicyType, - OsDisk, + OSDisk, DiffDiskSettings, DiffDiskPlacement, TaskSchedulingPolicy, @@ -130,7 +130,7 @@ export { NetworkConfiguration, DynamicVNetAssignmentScope, PoolEndpointConfiguration, - InboundNatPool, + InboundNATPool, NetworkSecurityGroupRule, NetworkSecurityGroupRuleAccess, PublicIpAddressConfiguration, @@ -174,7 +174,7 @@ export { TaskCounts, TaskSlotCounts, ImageInformation, - OsType, + OSType, VerificationType, PoolNodeCounts, NodeCounts, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts index 7508d64be4..dcbfd2ea4d 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts @@ -50,9 +50,9 @@ export { BatchNodeRemoteLoginSettingsResult, UploadBatchServiceLogsOptions, UploadBatchServiceLogsResult, - NodeVmExtension, - VmExtension, - VmExtensionInstanceView, + NodeVMExtension, + VMExtension, + VMExtensionInstanceView, InstanceViewStatus, StatusLevelTypes, NodeFile, @@ -115,7 +115,7 @@ export { DiskEncryptionTarget, NodePlacementConfiguration, NodePlacementPolicyType, - OsDisk, + OSDisk, DiffDiskSettings, DiffDiskPlacement, TaskSchedulingPolicy, @@ -123,7 +123,7 @@ export { NetworkConfiguration, DynamicVNetAssignmentScope, PoolEndpointConfiguration, - InboundNatPool, + InboundNATPool, NetworkSecurityGroupRule, NetworkSecurityGroupRuleAccess, PublicIpAddressConfiguration, @@ -167,7 +167,7 @@ export { TaskCounts, TaskSlotCounts, ImageInformation, - OsType, + OSType, VerificationType, PoolNodeCounts, NodeCounts, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts index 6b85d12127..4041b8d5e2 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts @@ -889,7 +889,7 @@ export interface InboundEndpoint { /** The public IP address of the Compute Node. */ publicIpAddress?: string; /** The public fully qualified domain name for the Compute Node. */ - publicFqdn?: string; + publicFQDN?: string; /** The public port number of the endpoint. */ frontendPort: number; /** The backend port number of the endpoint. */ @@ -901,7 +901,7 @@ export function inboundEndpointDeserializer(item: any): InboundEndpoint { name: item["name"], protocol: item["protocol"], publicIpAddress: item["publicIPAddress"], - publicFqdn: item["publicFQDN"], + publicFQDN: item["publicFQDN"], frontendPort: item["frontendPort"], backendPort: item["backendPort"], }; @@ -1130,29 +1130,29 @@ export function batchNodeArrayDeserializer(result: Array): any[] { } /** The configuration for virtual machine extension instance view. */ -export interface NodeVmExtension { +export interface NodeVMExtension { /** The provisioning state of the virtual machine extension. */ provisioningState?: string; /** The virtual machine extension. */ - vmExtension?: VmExtension; + vmExtension?: VMExtension; /** The vm extension instance view. */ - instanceView?: VmExtensionInstanceView; + instanceView?: VMExtensionInstanceView; } -export function nodeVmExtensionDeserializer(item: any): NodeVmExtension { +export function nodeVMExtensionDeserializer(item: any): NodeVMExtension { return { provisioningState: item["provisioningState"], vmExtension: !item["vmExtension"] ? item["vmExtension"] - : vmExtensionDeserializer(item["vmExtension"]), + : vMExtensionDeserializer(item["vmExtension"]), instanceView: !item["instanceView"] ? item["instanceView"] - : vmExtensionInstanceViewDeserializer(item["instanceView"]), + : vMExtensionInstanceViewDeserializer(item["instanceView"]), }; } /** The configuration for virtual machine extensions. */ -export interface VmExtension { +export interface VMExtension { /** The name of the virtual machine extension. */ name: string; /** The name of the extension handler publisher. */ @@ -1173,7 +1173,7 @@ export interface VmExtension { provisionAfterExtensions?: string[]; } -export function vmExtensionSerializer(item: VmExtension): any { +export function vMExtensionSerializer(item: VMExtension): any { return { name: item["name"], publisher: item["publisher"], @@ -1191,7 +1191,7 @@ export function vmExtensionSerializer(item: VmExtension): any { }; } -export function vmExtensionDeserializer(item: any): VmExtension { +export function vMExtensionDeserializer(item: any): VMExtension { return { name: item["name"], publisher: item["publisher"], @@ -1210,7 +1210,7 @@ export function vmExtensionDeserializer(item: any): VmExtension { } /** The vm extension instance view. */ -export interface VmExtensionInstanceView { +export interface VMExtensionInstanceView { /** The name of the vm extension instance view. */ name?: string; /** The resource status information. */ @@ -1219,9 +1219,9 @@ export interface VmExtensionInstanceView { subStatuses?: InstanceViewStatus[]; } -export function vmExtensionInstanceViewDeserializer( +export function vMExtensionInstanceViewDeserializer( item: any, -): VmExtensionInstanceView { +): VMExtensionInstanceView { return { name: item["name"], statuses: !item["statuses"] @@ -1269,29 +1269,29 @@ export function instanceViewStatusArrayDeserializer( } /** The result of listing the Compute Node extensions in a Node. */ -export interface _NodeVmExtensionList { +export interface _NodeVMExtensionList { /** The list of Compute Node extensions. */ - value?: NodeVmExtension[]; + value?: NodeVMExtension[]; /** The URL to get the next set of results. */ odataNextLink?: string; } -export function _nodeVmExtensionListDeserializer( +export function _nodeVMExtensionListDeserializer( item: any, -): _NodeVmExtensionList { +): _NodeVMExtensionList { return { value: !item["value"] ? item["value"] - : nodeVmExtensionArrayDeserializer(item["value"]), + : nodeVMExtensionArrayDeserializer(item["value"]), odataNextLink: item["odata.nextLink"], }; } -export function nodeVmExtensionArrayDeserializer( - result: Array, +export function nodeVMExtensionArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return nodeVmExtensionDeserializer(item); + return nodeVMExtensionDeserializer(item); }); } @@ -2238,9 +2238,9 @@ export interface TaskStatistics { /** The time at which the statistics were last updated. All statistics are limited to the range between startTime and lastUpdateTime. */ lastUpdateTime: Date; /** The total user mode CPU time (summed across all cores and all Compute Nodes) consumed by the Task. */ - userCpuTime: string; + userCPUTime: string; /** The total kernel mode CPU time (summed across all cores and all Compute Nodes) consumed by the Task. */ - kernelCpuTime: string; + kernelCPUTime: string; /** The total wall clock time of the Task. The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If the Task was retried, this includes the wall clock time of all the Task retries. */ wallClockTime: string; /** The total number of disk read operations made by the Task. */ @@ -2248,9 +2248,9 @@ export interface TaskStatistics { /** The total number of disk write operations made by the Task. */ writeIOps: number; /** The total gibibytes read from disk by the Task. */ - readIoGiB: number; + readIOGiB: number; /** The total gibibytes written to disk by the Task. */ - writeIoGiB: number; + writeIOGiB: number; /** The total wait time of the Task. The wait time for a Task is defined as the elapsed time between the creation of the Task and the start of Task execution. (If the Task is retried due to failures, the wait time is the time to the most recent Task execution.). */ waitTime: string; } @@ -2260,13 +2260,13 @@ export function taskStatisticsDeserializer(item: any): TaskStatistics { url: item["url"], startTime: new Date(item["startTime"]), lastUpdateTime: new Date(item["lastUpdateTime"]), - userCpuTime: item["userCPUTime"], - kernelCpuTime: item["kernelCPUTime"], + userCPUTime: item["userCPUTime"], + kernelCPUTime: item["kernelCPUTime"], wallClockTime: item["wallClockTime"], readIOps: item["readIOps"], writeIOps: item["writeIOps"], - readIoGiB: item["readIOGiB"], - writeIoGiB: item["writeIOGiB"], + readIOGiB: item["readIOGiB"], + writeIOGiB: item["writeIOGiB"], waitTime: item["waitTime"], }; } @@ -3345,9 +3345,9 @@ export interface VirtualMachineConfiguration { /** The node placement configuration for the pool. This configuration will specify rules on how nodes in the pool will be physically allocated. */ nodePlacementConfiguration?: NodePlacementConfiguration; /** The virtual machine extension for the pool. If specified, the extensions mentioned in this configuration will be installed on each node. */ - extensions?: VmExtension[]; + extensions?: VMExtension[]; /** Settings for the operating system disk of the Virtual Machine. */ - osDisk?: OsDisk; + osDisk?: OSDisk; } export function virtualMachineConfigurationSerializer( @@ -3378,8 +3378,8 @@ export function virtualMachineConfigurationSerializer( ), extensions: !item["extensions"] ? item["extensions"] - : vmExtensionArraySerializer(item["extensions"]), - osDisk: !item["osDisk"] ? item["osDisk"] : osDiskSerializer(item["osDisk"]), + : vMExtensionArraySerializer(item["extensions"]), + osDisk: !item["osDisk"] ? item["osDisk"] : oSDiskSerializer(item["osDisk"]), }; } @@ -3411,10 +3411,10 @@ export function virtualMachineConfigurationDeserializer( ), extensions: !item["extensions"] ? item["extensions"] - : vmExtensionArrayDeserializer(item["extensions"]), + : vMExtensionArrayDeserializer(item["extensions"]), osDisk: !item["osDisk"] ? item["osDisk"] - : osDiskDeserializer(item["osDisk"]), + : oSDiskDeserializer(item["osDisk"]), }; } @@ -3614,37 +3614,37 @@ export function nodePlacementConfigurationDeserializer( /** NodePlacementPolicyType enums */ export type NodePlacementPolicyType = "regional" | "zonal"; -export function vmExtensionArraySerializer(result: Array): any[] { +export function vMExtensionArraySerializer(result: Array): any[] { return result.map((item) => { - return vmExtensionSerializer(item); + return vMExtensionSerializer(item); }); } -export function vmExtensionArrayDeserializer( - result: Array, +export function vMExtensionArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return vmExtensionDeserializer(item); + return vMExtensionDeserializer(item); }); } /** Settings for the operating system disk of the compute node (VM). */ -export interface OsDisk { +export interface OSDisk { /** Specifies the ephemeral Disk Settings for the operating system disk used by the compute node (VM). */ - ephemeralOsDiskSettings?: DiffDiskSettings; + ephemeralOSDiskSettings?: DiffDiskSettings; } -export function osDiskSerializer(item: OsDisk): any { +export function oSDiskSerializer(item: OSDisk): any { return { - ephemeralOSDiskSettings: !item["ephemeralOsDiskSettings"] - ? item["ephemeralOsDiskSettings"] - : diffDiskSettingsSerializer(item["ephemeralOsDiskSettings"]), + ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] + ? item["ephemeralOSDiskSettings"] + : diffDiskSettingsSerializer(item["ephemeralOSDiskSettings"]), }; } -export function osDiskDeserializer(item: any): OsDisk { +export function oSDiskDeserializer(item: any): OSDisk { return { - ephemeralOsDiskSettings: !item["ephemeralOSDiskSettings"] + ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] : diffDiskSettingsDeserializer(item["ephemeralOSDiskSettings"]), }; @@ -3751,14 +3751,14 @@ export type DynamicVNetAssignmentScope = "none" | "job"; /** The endpoint configuration for a Pool. */ export interface PoolEndpointConfiguration { /** A list of inbound NAT Pools that can be used to address specific ports on an individual Compute Node externally. The maximum number of inbound NAT Pools per Batch Pool is 5. If the maximum number of inbound NAT Pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. */ - inboundNatPools: InboundNatPool[]; + inboundNatPools: InboundNATPool[]; } export function poolEndpointConfigurationSerializer( item: PoolEndpointConfiguration, ): any { return { - inboundNATPools: inboundNatPoolArraySerializer(item["inboundNatPools"]), + inboundNATPools: inboundNATPoolArraySerializer(item["inboundNatPools"]), }; } @@ -3766,7 +3766,7 @@ export function poolEndpointConfigurationDeserializer( item: any, ): PoolEndpointConfiguration { return { - inboundNatPools: inboundNatPoolArrayDeserializer(item["inboundNATPools"]), + inboundNatPools: inboundNATPoolArrayDeserializer(item["inboundNATPools"]), }; } @@ -3774,7 +3774,7 @@ export function poolEndpointConfigurationDeserializer( * A inbound NAT Pool that can be used to address specific ports on Compute Nodes * in a Batch Pool externally. */ -export interface InboundNatPool { +export interface InboundNATPool { /** The name of the endpoint. The name must be unique within a Batch Pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. */ name: string; /** The protocol of the endpoint. */ @@ -3789,7 +3789,7 @@ export interface InboundNatPool { networkSecurityGroupRules?: NetworkSecurityGroupRule[]; } -export function inboundNatPoolSerializer(item: InboundNatPool): any { +export function inboundNATPoolSerializer(item: InboundNATPool): any { return { name: item["name"], protocol: item["protocol"], @@ -3804,7 +3804,7 @@ export function inboundNatPoolSerializer(item: InboundNatPool): any { }; } -export function inboundNatPoolDeserializer(item: any): InboundNatPool { +export function inboundNATPoolDeserializer(item: any): InboundNATPool { return { name: item["name"], protocol: item["protocol"], @@ -3880,19 +3880,19 @@ export function networkSecurityGroupRuleArrayDeserializer( }); } -export function inboundNatPoolArraySerializer( - result: Array, +export function inboundNATPoolArraySerializer( + result: Array, ): any[] { return result.map((item) => { - return inboundNatPoolSerializer(item); + return inboundNATPoolSerializer(item); }); } -export function inboundNatPoolArrayDeserializer( - result: Array, +export function inboundNATPoolArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return inboundNatPoolDeserializer(item); + return inboundNATPoolDeserializer(item); }); } @@ -4366,9 +4366,9 @@ export interface JobScheduleStatistics { /** The time at which the statistics were last updated. All statistics are limited to the range between startTime and lastUpdateTime. */ lastUpdateTime: Date; /** The total user mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in all Jobs created under the schedule. */ - userCpuTime: string; + userCPUTime: string; /** The total kernel mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in all Jobs created under the schedule. */ - kernelCpuTime: string; + kernelCPUTime: string; /** The total wall clock time of all the Tasks in all the Jobs created under the schedule. The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If a Task was retried, this includes the wall clock time of all the Task retries. */ wallClockTime: string; /** The total number of disk read operations made by all Tasks in all Jobs created under the schedule. */ @@ -4376,9 +4376,9 @@ export interface JobScheduleStatistics { /** The total number of disk write operations made by all Tasks in all Jobs created under the schedule. */ writeIOps: number; /** The total gibibytes read from disk by all Tasks in all Jobs created under the schedule. */ - readIoGiB: number; + readIOGiB: number; /** The total gibibytes written to disk by all Tasks in all Jobs created under the schedule. */ - writeIoGiB: number; + writeIOGiB: number; /** The total number of Tasks successfully completed during the given time range in Jobs created under the schedule. A Task completes successfully if it returns exit code 0. */ numSucceededTasks: number; /** The total number of Tasks that failed during the given time range in Jobs created under the schedule. A Task fails if it exhausts its maximum retry count without returning exit code 0. */ @@ -4396,13 +4396,13 @@ export function jobScheduleStatisticsDeserializer( url: item["url"], startTime: new Date(item["startTime"]), lastUpdateTime: new Date(item["lastUpdateTime"]), - userCpuTime: item["userCPUTime"], - kernelCpuTime: item["kernelCPUTime"], + userCPUTime: item["userCPUTime"], + kernelCPUTime: item["kernelCPUTime"], wallClockTime: item["wallClockTime"], readIOps: item["readIOps"], writeIOps: item["writeIOps"], - readIoGiB: item["readIOGiB"], - writeIoGiB: item["writeIOGiB"], + readIOGiB: item["readIOGiB"], + writeIOGiB: item["writeIOGiB"], numSucceededTasks: item["numSucceededTasks"], numFailedTasks: item["numFailedTasks"], numTaskRetries: item["numTaskRetries"], @@ -4832,9 +4832,9 @@ export interface JobStatistics { /** The time at which the statistics were last updated. All statistics are limited to the range between startTime and lastUpdateTime. */ lastUpdateTime: Date; /** The total user mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in the Job. */ - userCpuTime: string; + userCPUTime: string; /** The total kernel mode CPU time (summed across all cores and all Compute Nodes) consumed by all Tasks in the Job. */ - kernelCpuTime: string; + kernelCPUTime: string; /** The total wall clock time of all Tasks in the Job. The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If a Task was retried, this includes the wall clock time of all the Task retries. */ wallClockTime: string; /** The total number of disk read operations made by all Tasks in the Job. */ @@ -4842,9 +4842,9 @@ export interface JobStatistics { /** The total number of disk write operations made by all Tasks in the Job. */ writeIOps: number; /** The total amount of data in GiB read from disk by all Tasks in the Job. */ - readIoGiB: number; + readIOGiB: number; /** The total amount of data in GiB written to disk by all Tasks in the Job. */ - writeIoGiB: number; + writeIOGiB: number; /** The total number of Tasks successfully completed in the Job during the given time range. A Task completes successfully if it returns exit code 0. */ numSucceededTasks: number; /** The total number of Tasks in the Job that failed during the given time range. A Task fails if it exhausts its maximum retry count without returning exit code 0. */ @@ -4860,13 +4860,13 @@ export function jobStatisticsDeserializer(item: any): JobStatistics { url: item["url"], startTime: new Date(item["startTime"]), lastUpdateTime: new Date(item["lastUpdateTime"]), - userCpuTime: item["userCPUTime"], - kernelCpuTime: item["kernelCPUTime"], + userCPUTime: item["userCPUTime"], + kernelCPUTime: item["kernelCPUTime"], wallClockTime: item["wallClockTime"], readIOps: item["readIOps"], writeIOps: item["writeIOps"], - readIoGiB: item["readIOGiB"], - writeIoGiB: item["writeIOGiB"], + readIOGiB: item["readIOGiB"], + writeIOGiB: item["writeIOGiB"], numSucceededTasks: item["numSucceededTasks"], numFailedTasks: item["numFailedTasks"], numTaskRetries: item["numTaskRetries"], @@ -5305,7 +5305,7 @@ export interface ImageInformation { /** The reference to the Azure Virtual Machine's Marketplace Image. */ imageReference: ImageReference; /** The type of operating system (e.g. Windows or Linux) of the Image. */ - osType: OsType; + osType: OSType; /** The capabilities or features which the Image supports. Not every capability of the Image is listed. Capabilities in this list are considered of special interest and are generally related to integration with other features in the Azure Batch service. */ capabilities?: string[]; /** The time when the Azure Batch service will stop accepting create Pool requests for the Image. */ @@ -5332,7 +5332,7 @@ export function imageInformationDeserializer(item: any): ImageInformation { } /** OSType enums */ -export type OsType = "linux" | "windows"; +export type OSType = "linux" | "windows"; /** VerificationType enums */ export type VerificationType = "verified" | "unverified"; diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md index 3f86be7cf8..eb2fa8be93 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md @@ -15,7 +15,7 @@ export interface A { } // @public -export interface Ba { +export interface BA { // (undocumented) prop2: string; } @@ -27,11 +27,11 @@ export interface BCOp1OptionalParams extends OperationOptions { // @public export interface BCOperations { // (undocumented) - op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; + op1: (body: BA, options?: BCOp1OptionalParams) => Promise; } // @public -export interface Bea { +export interface BEA { // (undocumented) prop3: string; } @@ -43,7 +43,7 @@ export interface BECOp1OptionalParams extends OperationOptions { // @public export interface BECOperations { // (undocumented) - op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; + op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; } // @public @@ -63,7 +63,7 @@ export interface BOperations { // (undocumented) e: BEOperations; // (undocumented) - op1: (body: Ba, options?: BOp1OptionalParams) => Promise; + op1: (body: BA, options?: BOp1OptionalParams) => Promise; } // @public diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts index ed37ae2eb6..2e6e7f1f6e 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BCOp1OptionalParams, FooContext as Client } from "../../index.js"; -import { Ba, baSerializer } from "../../../models/models.js"; +import { BA, bASerializer } from "../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,14 +12,14 @@ import { export function _op1Send( context: Client, - body: Ba, + body: BA, options: BCOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b/c") .post({ ...operationOptionsToRequestParameters(options), - body: baSerializer(body), + body: bASerializer(body), }); } @@ -36,7 +36,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: Ba, + body: BA, options: BCOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts index 5ce947d93f..a14c4483a7 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BECOp1OptionalParams, FooContext as Client } from "../../../index.js"; -import { Bea, beaSerializer } from "../../../../models/models.js"; +import { BEA, bEASerializer } from "../../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,14 +12,14 @@ import { export function _op1Send( context: Client, - body: Bea, + body: BEA, options: BECOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b/e") .post({ ...operationOptionsToRequestParameters(options), - body: beaSerializer(body), + body: bEASerializer(body), }); } @@ -36,7 +36,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: Bea, + body: BEA, options: BECOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts index 2a52876fa2..3a00aefffb 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BOp1OptionalParams, FooContext as Client } from "../index.js"; -import { Ba, baSerializer } from "../../models/models.js"; +import { BA, bASerializer } from "../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,14 +12,14 @@ import { export function _op1Send( context: Client, - body: Ba, + body: BA, options: BOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b") .post({ ...operationOptionsToRequestParameters(options), - body: baSerializer(body), + body: bASerializer(body), }); } @@ -36,7 +36,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: Ba, + body: BA, options: BOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts index 282ab4aac9..ed4e11e9b2 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts @@ -4,16 +4,16 @@ import { FooContext } from "../../../api/fooContext.js"; import { op1 } from "../../../api/b/c/index.js"; import { BCOp1OptionalParams } from "../../../api/options.js"; -import { Ba } from "../../../models/models.js"; +import { BA } from "../../../models/models.js"; /** Interface representing a BC operations. */ export interface BCOperations { - op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; + op1: (body: BA, options?: BCOp1OptionalParams) => Promise; } export function getBC(context: FooContext) { return { - op1: (body: Ba, options?: BCOp1OptionalParams) => + op1: (body: BA, options?: BCOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts index 2cafaaef56..0deea57233 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts @@ -4,16 +4,16 @@ import { FooContext } from "../../../../api/fooContext.js"; import { op1 } from "../../../../api/b/e/c/index.js"; import { BECOp1OptionalParams } from "../../../../api/options.js"; -import { Bea } from "../../../../models/models.js"; +import { BEA } from "../../../../models/models.js"; /** Interface representing a BEC operations. */ export interface BECOperations { - op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; + op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; } export function getBEC(context: FooContext) { return { - op1: (body: Bea, options?: BECOp1OptionalParams) => + op1: (body: BEA, options?: BECOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts index 4ed48d6010..93991e66f7 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts @@ -4,20 +4,20 @@ import { FooContext } from "../../api/fooContext.js"; import { op1 } from "../../api/b/index.js"; import { BOp1OptionalParams } from "../../api/options.js"; -import { Ba } from "../../models/models.js"; +import { BA } from "../../models/models.js"; import { BCOperations, getBCOperations } from "./c/index.js"; import { BEOperations, getBEOperations } from "./e/index.js"; /** Interface representing a B operations. */ export interface BOperations { - op1: (body: Ba, options?: BOp1OptionalParams) => Promise; + op1: (body: BA, options?: BOp1OptionalParams) => Promise; e: BEOperations; c: BCOperations; } export function getB(context: FooContext) { return { - op1: (body: Ba, options?: BOp1OptionalParams) => + op1: (body: BA, options?: BOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts index f07da1513d..2170b0a3c6 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. export { FooClient } from "./fooClient.js"; -export { A, Ba, Bea } from "./models/index.js"; +export { A, BA, BEA } from "./models/index.js"; export { FooClientOptionalParams, Op1OptionalParams, diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts index 8e00d409af..10352581f8 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export { A, Ba, Bea } from "./models.js"; +export { A, BA, BEA } from "./models.js"; diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts index 6ea4c3b715..a553429661 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts @@ -10,20 +10,20 @@ export function aSerializer(item: A): any { return { prop1: item["prop1"] }; } -/** model interface Ba */ -export interface Ba { +/** model interface BA */ +export interface BA { prop2: string; } -export function baSerializer(item: Ba): any { +export function bASerializer(item: BA): any { return { prop2: item["prop2"] }; } -/** model interface Bea */ -export interface Bea { +/** model interface BEA */ +export interface BEA { prop3: string; } -export function beaSerializer(item: Bea): any { +export function bEASerializer(item: BEA): any { return { prop3: item["prop3"] }; } diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md index ba6897ebc0..1e03938d8f 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md @@ -1373,9 +1373,9 @@ export interface PassFailCriteriaOutput { // @public export interface PassFailMetric { - action?: PfAction; - aggregate?: PfAgFunc; - clientMetric?: PfMetrics; + action?: PFAction; + aggregate?: PFAgFunc; + clientMetric?: PFMetrics; condition?: string; requestName?: string; value?: number; @@ -1383,45 +1383,45 @@ export interface PassFailMetric { // @public export interface PassFailMetricOutput { - action?: PfActionOutput; + action?: PFActionOutput; readonly actualValue?: number; - aggregate?: PfAgFuncOutput; - clientMetric?: PfMetricsOutput; + aggregate?: PFAgFuncOutput; + clientMetric?: PFMetricsOutput; condition?: string; requestName?: string; - readonly result?: PfResultOutput; + readonly result?: PFResultOutput; value?: number; } // @public -export type PfAction = "continue" | "stop"; +export type PFAction = "continue" | "stop"; // @public -export type PfActionOutput = "continue" | "stop"; +export type PFActionOutput = "continue" | "stop"; // @public -export type PfAgFunc = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; +export type PFAgFunc = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; // @public -export type PfAgFuncOutput = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; +export type PFAgFuncOutput = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; // @public -export type PfMetrics = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; +export type PFMetrics = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; // @public -export type PfMetricsOutput = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; +export type PFMetricsOutput = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; // @public -export type PfResult = "passed" | "undetermined" | "failed"; +export type PFResult = "passed" | "undetermined" | "failed"; // @public -export type PfResultOutput = "passed" | "undetermined" | "failed"; +export type PFResultOutput = "passed" | "undetermined" | "failed"; // @public -export type PfTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; // @public -export type PfTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +export type PFTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; // @public export interface ResourceMetric { @@ -1665,7 +1665,7 @@ export interface TestRunOutput { readonly subnetId?: string; readonly testArtifacts?: TestRunArtifactsOutput; testId?: string; - readonly testResult?: PfTestResultOutput; + readonly testResult?: PFTestResultOutput; readonly testRunId: string; readonly testRunStatistics?: Record; readonly virtualUsers?: number; diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts index f907d19836..06ea3de8a6 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts @@ -40,14 +40,14 @@ export interface PassFailCriteria { /** Pass fail metric */ export interface PassFailMetric { /** The client metric on which the criteria should be applied. */ - clientMetric?: PfMetrics; + clientMetric?: PFMetrics; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests */ - aggregate?: PfAgFunc; + aggregate?: PFAgFunc; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -58,7 +58,7 @@ export interface PassFailMetric { */ value?: number; /** Action taken after the threshold is met. Default is ‘continue’. */ - action?: PfAction; + action?: PFAction; } /** Secret */ @@ -299,15 +299,15 @@ export interface TestRunServerMetricConfig { metrics?: Record; } -/** Alias for PfMetrics */ -export type PfMetrics = +/** Alias for PFMetrics */ +export type PFMetrics = | "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; -/** Alias for PfAgFunc */ -export type PfAgFunc = +/** Alias for PFAgFunc */ +export type PFAgFunc = | "count" | "percentage" | "avg" @@ -317,10 +317,10 @@ export type PfAgFunc = | "p99" | "min" | "max"; -/** Alias for PfAction */ -export type PfAction = "continue" | "stop"; -/** Alias for PfResult */ -export type PfResult = "passed" | "undetermined" | "failed"; +/** Alias for PFAction */ +export type PFAction = "continue" | "stop"; +/** Alias for PFResult */ +export type PFResult = "passed" | "undetermined" | "failed"; /** Alias for SecretType */ export type SecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; /** Alias for CertificateType */ @@ -334,8 +334,8 @@ export type FileStatus = | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; -/** Alias for PfTestResult */ -export type PfTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for PFTestResult */ +export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; /** Alias for Status */ export type Status = | "ACCEPTED" diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts index 1305208978..69862f8718 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts @@ -52,14 +52,14 @@ export interface PassFailCriteriaOutput { /** Pass fail metric */ export interface PassFailMetricOutput { /** The client metric on which the criteria should be applied. */ - clientMetric?: PfMetricsOutput; + clientMetric?: PFMetricsOutput; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests */ - aggregate?: PfAgFuncOutput; + aggregate?: PFAgFuncOutput; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -70,11 +70,11 @@ export interface PassFailMetricOutput { */ value?: number; /** Action taken after the threshold is met. Default is ‘continue’. */ - action?: PfActionOutput; + action?: PFActionOutput; /** The actual value of the client metric for the test run. */ readonly actualValue?: number; /** Outcome of the test run. */ - readonly result?: PfResultOutput; + readonly result?: PFResultOutput; } /** Secret */ @@ -294,7 +294,7 @@ export interface TestRunOutput { /** Collection of test run artifacts */ readonly testArtifacts?: TestRunArtifactsOutput; /** Test result for pass/Fail criteria used during the test run. */ - readonly testResult?: PfTestResultOutput; + readonly testResult?: PFTestResultOutput; /** Number of virtual users, for which test has been run. */ readonly virtualUsers?: number; /** Display name of a testRun. */ @@ -547,15 +547,15 @@ export interface TestRunServerMetricConfigOutput { readonly lastModifiedBy?: string; } -/** Alias for PfMetricsOutput */ -export type PfMetricsOutput = +/** Alias for PFMetricsOutput */ +export type PFMetricsOutput = | "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; -/** Alias for PfAgFuncOutput */ -export type PfAgFuncOutput = +/** Alias for PFAgFuncOutput */ +export type PFAgFuncOutput = | "count" | "percentage" | "avg" @@ -565,10 +565,10 @@ export type PfAgFuncOutput = | "p99" | "min" | "max"; -/** Alias for PfActionOutput */ -export type PfActionOutput = "continue" | "stop"; -/** Alias for PfResultOutput */ -export type PfResultOutput = "passed" | "undetermined" | "failed"; +/** Alias for PFActionOutput */ +export type PFActionOutput = "continue" | "stop"; +/** Alias for PFResultOutput */ +export type PFResultOutput = "passed" | "undetermined" | "failed"; /** Alias for SecretTypeOutput */ export type SecretTypeOutput = "AKV_SECRET_URI" | "SECRET_VALUE"; /** Alias for CertificateTypeOutput */ @@ -585,8 +585,8 @@ export type FileStatusOutput = | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; -/** Alias for PfTestResultOutput */ -export type PfTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for PFTestResultOutput */ +export type PFTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; /** Alias for StatusOutput */ export type StatusOutput = | "ACCEPTED" diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index 10ace53285..4e6608bf0b 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -135,7 +135,7 @@ export type FileType = string; // @public export interface FunctionFlexConsumptionResourceConfiguration { httpConcurrency: number; - instanceMemoryMb: number; + instanceMemoryMB: number; } // @public @@ -230,13 +230,13 @@ export enum KnownMetricUnit { } // @public -export enum KnownPfAction { +export enum KnownPFAction { Continue = "continue", Stop = "stop" } // @public -export enum KnownPfAgFunc { +export enum KnownPFAgFunc { Avg = "avg", Count = "count", Max = "max", @@ -255,7 +255,7 @@ export enum KnownPfAgFunc { } // @public -export enum KnownPfMetrics { +export enum KnownPFMetrics { Error = "error", Latency = "latency", Requests = "requests", @@ -264,14 +264,14 @@ export enum KnownPfMetrics { } // @public -export enum KnownPfResult { +export enum KnownPFResult { Failed = "failed", Passed = "passed", Undetermined = "undetermined" } // @public -export enum KnownPfTestResult { +export enum KnownPFTestResult { FAILED = "FAILED", NOTApplicable = "NOT_APPLICABLE", PASSED = "PASSED" @@ -443,7 +443,7 @@ export interface LoadTestConfiguration { optionalLoadTestConfig?: OptionalLoadTestConfig; quickStartTest?: boolean; regionalLoadTestConfig?: RegionalConfiguration[]; - splitAllCsVs?: boolean; + splitAllCSVs?: boolean; } // @public (undocumented) @@ -571,30 +571,30 @@ export interface PassFailCriteria { // @public export interface PassFailMetric { - action?: PfAction; + action?: PFAction; readonly actualValue?: number; - aggregate?: PfAgFunc; - clientMetric?: PfMetrics; + aggregate?: PFAgFunc; + clientMetric?: PFMetrics; condition?: string; requestName?: string; - readonly result?: PfResult; + readonly result?: PFResult; value?: number; } // @public -export type PfAction = string; +export type PFAction = string; // @public -export type PfAgFunc = string; +export type PFAgFunc = string; // @public -export type PfMetrics = string; +export type PFMetrics = string; // @public -export type PfResult = string; +export type PFResult = string; // @public -export type PfTestResult = string; +export type PFTestResult = string; // @public export type RecommendationCategory = string; @@ -669,7 +669,7 @@ export interface Test { readonly lastModifiedDateTime?: Date; loadTestConfiguration?: LoadTestConfiguration; passFailCriteria?: PassFailCriteria; - publicIpDisabled?: boolean; + publicIPDisabled?: boolean; secrets?: Record; subnetId?: string; readonly testId: string; @@ -803,7 +803,7 @@ export interface TestRun { loadTestConfiguration?: LoadTestConfiguration; passFailCriteria?: PassFailCriteria; readonly portalUrl?: string; - readonly publicIpDisabled?: boolean; + readonly publicIPDisabled?: boolean; readonly regionalStatistics?: Record; requestDataLevel?: RequestDataLevel; secrets?: Record; @@ -812,7 +812,7 @@ export interface TestRun { readonly subnetId?: string; readonly testArtifacts?: TestRunArtifacts; testId?: string; - readonly testResult?: PfTestResult; + readonly testResult?: PFTestResult; readonly testRunId: string; readonly testRunStatistics?: Record; readonly virtualUsers?: number; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts index f8614d1dd4..2879d059ec 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts @@ -12,14 +12,14 @@ export { Test, PassFailCriteria, PassFailMetric, - KnownPfMetrics, - PfMetrics, - KnownPfAgFunc, - PfAgFunc, - KnownPfAction, - PfAction, - KnownPfResult, - PfResult, + KnownPFMetrics, + PFMetrics, + KnownPFAgFunc, + PFAgFunc, + KnownPFAction, + PFAction, + KnownPFResult, + PFResult, AutoStopCriteria, Secret, KnownSecretType, @@ -50,8 +50,8 @@ export { TestRunFileInfo, TestRunOutputArtifacts, ArtifactsContainerInfo, - KnownPfTestResult, - PfTestResult, + KnownPFTestResult, + PFTestResult, KnownStatus, Status, KnownRequestDataLevel, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts index 9c97d8d604..a50a8878e2 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/index.ts @@ -5,14 +5,14 @@ export { Test, PassFailCriteria, PassFailMetric, - KnownPfMetrics, - PfMetrics, - KnownPfAgFunc, - PfAgFunc, - KnownPfAction, - PfAction, - KnownPfResult, - PfResult, + KnownPFMetrics, + PFMetrics, + KnownPFAgFunc, + PFAgFunc, + KnownPFAction, + PFAction, + KnownPFResult, + PFResult, AutoStopCriteria, Secret, KnownSecretType, @@ -43,8 +43,8 @@ export { TestRunFileInfo, TestRunOutputArtifacts, ArtifactsContainerInfo, - KnownPfTestResult, - PfTestResult, + KnownPFTestResult, + PFTestResult, KnownStatus, Status, KnownRequestDataLevel, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts index 2a19c424fc..e6379b7146 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts @@ -36,7 +36,7 @@ export interface Test { /** Kind of test. */ kind?: TestKind; /** Inject load test engines without deploying public IP for outbound access */ - publicIpDisabled?: boolean; + publicIPDisabled?: boolean; /** Type of the managed identity referencing the Key vault. */ keyvaultReferenceIdentityType?: string; /** Resource Id of the managed identity referencing the Key vault. */ @@ -74,7 +74,7 @@ export function testSerializer(item: Test): any { displayName: item["displayName"], subnetId: item["subnetId"], kind: item["kind"], - publicIPDisabled: item["publicIpDisabled"], + publicIPDisabled: item["publicIPDisabled"], keyvaultReferenceIdentityType: item["keyvaultReferenceIdentityType"], keyvaultReferenceIdentityId: item["keyvaultReferenceIdentityId"], }; @@ -107,7 +107,7 @@ export function testDeserializer(item: any): Test { displayName: item["displayName"], subnetId: item["subnetId"], kind: item["kind"], - publicIpDisabled: item["publicIPDisabled"], + publicIPDisabled: item["publicIPDisabled"], keyvaultReferenceIdentityType: item["keyvaultReferenceIdentityType"], keyvaultReferenceIdentityId: item["keyvaultReferenceIdentityId"], createdDateTime: !item["createdDateTime"] @@ -146,14 +146,14 @@ export function passFailCriteriaDeserializer(item: any): PassFailCriteria { /** Pass fail metric */ export interface PassFailMetric { /** The client metric on which the criteria should be applied. */ - clientMetric?: PfMetrics; + clientMetric?: PFMetrics; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests */ - aggregate?: PfAgFunc; + aggregate?: PFAgFunc; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -164,11 +164,11 @@ export interface PassFailMetric { */ value?: number; /** Action taken after the threshold is met. Default is ‘continue’. */ - action?: PfAction; + action?: PFAction; /** The actual value of the client metric for the test run. */ readonly actualValue?: number; /** Outcome of the test run. */ - readonly result?: PfResult; + readonly result?: PFResult; } export function passFailMetricSerializer(item: PassFailMetric): any { @@ -196,7 +196,7 @@ export function passFailMetricDeserializer(item: any): PassFailMetric { } /** Metrics for pass/fail criteria. */ -export enum KnownPfMetrics { +export enum KnownPFMetrics { /** Pass fail criteria for response time metric in milliseconds. */ ResponseTimeMs = "response_time_ms", /** Pass fail criteria for latency metric in milliseconds. */ @@ -220,10 +220,10 @@ export enum KnownPfMetrics { * **requests**: Pass fail criteria for total requests. \ * **requests_per_sec**: Pass fail criteria for request per second. */ -export type PfMetrics = string; +export type PFMetrics = string; /** Aggregation functions for pass/fail criteria. */ -export enum KnownPfAgFunc { +export enum KnownPFAgFunc { /** Criteria applies for count value. */ Count = "count", /** Criteria applies for given percentage value. */ @@ -277,10 +277,10 @@ export enum KnownPfAgFunc { * **min**: Criteria applies for minimum value. \ * **max**: Criteria applies for maximum value. */ -export type PfAgFunc = string; +export type PFAgFunc = string; /** Action to take on failure of pass/fail criteria. */ -export enum KnownPfAction { +export enum KnownPFAction { /** Test will continue to run even if pass fail metric criteria metric gets failed. */ Continue = "continue", /** Test run will stop if pass fail criteria metric is not passed. */ @@ -295,10 +295,10 @@ export enum KnownPfAction { * **continue**: Test will continue to run even if pass fail metric criteria metric gets failed. \ * **stop**: Test run will stop if pass fail criteria metric is not passed. */ -export type PfAction = string; +export type PFAction = string; /** Pass/fail criteria result. */ -export enum KnownPfResult { +export enum KnownPFResult { /** Given pass fail criteria metric has passed. */ Passed = "passed", /** Given pass fail criteria metric couldn't determine. */ @@ -316,7 +316,7 @@ export enum KnownPfResult { * **undetermined**: Given pass fail criteria metric couldn't determine. \ * **failed**: Given pass fail criteria metric has failed. */ -export type PfResult = string; +export type PFResult = string; export function passFailMetricRecordSerializer( item: Record, @@ -472,7 +472,7 @@ export interface LoadTestConfiguration { * input data evenly across all engine instances. If you provide multiple CSV * files, each file will be split evenly. */ - splitAllCsVs?: boolean; + splitAllCSVs?: boolean; /** * If true, optionalLoadTestConfig is required and JMX script for the load test is * not required to upload. @@ -489,7 +489,7 @@ export function loadTestConfigurationSerializer( ): any { return { engineInstances: item["engineInstances"], - splitAllCSVs: item["splitAllCsVs"], + splitAllCSVs: item["splitAllCSVs"], quickStartTest: item["quickStartTest"], optionalLoadTestConfig: !item["optionalLoadTestConfig"] ? item["optionalLoadTestConfig"] @@ -505,7 +505,7 @@ export function loadTestConfigurationDeserializer( ): LoadTestConfiguration { return { engineInstances: item["engineInstances"], - splitAllCsVs: item["splitAllCSVs"], + splitAllCSVs: item["splitAllCSVs"], quickStartTest: item["quickStartTest"], optionalLoadTestConfig: !item["optionalLoadTestConfig"] ? item["optionalLoadTestConfig"] @@ -1006,7 +1006,7 @@ export interface TestRun { /** Collection of test run artifacts */ readonly testArtifacts?: TestRunArtifacts; /** Test result for pass/Fail criteria used during the test run. */ - readonly testResult?: PfTestResult; + readonly testResult?: PFTestResult; /** Number of virtual users, for which test has been run. */ readonly virtualUsers?: number; /** Display name of a testRun. */ @@ -1036,7 +1036,7 @@ export interface TestRun { /** Enable or disable debug level logging. True if debug logs are enabled for the test run. False otherwise */ debugLogsEnabled?: boolean; /** Inject load test engines without deploying public IP for outbound access */ - readonly publicIpDisabled?: boolean; + readonly publicIPDisabled?: boolean; /** The creation datetime(RFC 3339 literal format). */ readonly createdDateTime?: Date; /** The user that created. */ @@ -1125,7 +1125,7 @@ export function testRunDeserializer(item: any): TestRun { kind: item["kind"], requestDataLevel: item["requestDataLevel"], debugLogsEnabled: item["debugLogsEnabled"], - publicIpDisabled: item["publicIPDisabled"], + publicIPDisabled: item["publicIPDisabled"], createdDateTime: !item["createdDateTime"] ? item["createdDateTime"] : new Date(item["createdDateTime"]), @@ -1386,7 +1386,7 @@ export function artifactsContainerInfoDeserializer( } /** Test result based on pass/fail criteria. */ -export enum KnownPfTestResult { +export enum KnownPFTestResult { /** Pass/fail criteria has passed. */ PASSED = "PASSED", /** Pass/fail criteria is not applicable. */ @@ -1404,7 +1404,7 @@ export enum KnownPfTestResult { * **NOT_APPLICABLE**: Pass\/fail criteria is not applicable. \ * **FAILED**: Pass\/fail criteria has failed. */ -export type PfTestResult = string; +export type PFTestResult = string; /** Test run status. */ export enum KnownStatus { @@ -2170,7 +2170,7 @@ export function functionFlexConsumptionTargetResourceConfigurationsDeserializer( /** Resource configuration instance for a Flex Consumption based Azure Function App. */ export interface FunctionFlexConsumptionResourceConfiguration { /** Memory size of the instance. Supported values are 2048, 4096. */ - instanceMemoryMb: number; + instanceMemoryMB: number; /** HTTP Concurrency for the function app. */ httpConcurrency: number; } @@ -2179,7 +2179,7 @@ export function functionFlexConsumptionResourceConfigurationSerializer( item: FunctionFlexConsumptionResourceConfiguration, ): any { return { - instanceMemoryMB: item["instanceMemoryMb"], + instanceMemoryMB: item["instanceMemoryMB"], httpConcurrency: item["httpConcurrency"], }; } @@ -2188,7 +2188,7 @@ export function functionFlexConsumptionResourceConfigurationDeserializer( item: any, ): FunctionFlexConsumptionResourceConfiguration { return { - instanceMemoryMb: item["instanceMemoryMB"], + instanceMemoryMB: item["instanceMemoryMB"], httpConcurrency: item["httpConcurrency"], }; } diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/README.md b/packages/typespec-test/test/openai/generated/typespec-ts/README.md index 7e2ce03990..60ce9bff07 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai/generated/typespec-ts/README.md @@ -1,4 +1,4 @@ -# OpenAi REST client library for JavaScript +# OpenAI REST client library for JavaScript Azure OpenAI APIs for completions and search @@ -20,13 +20,13 @@ Key links: ### Install the `@msinternal/openai` package -Install the OpenAi REST client REST client library for JavaScript with `npm`: +Install the OpenAI REST client REST client library for JavaScript with `npm`: ```bash npm install @msinternal/openai ``` -### Create and authenticate a `OpenAiClient` +### Create and authenticate a `OpenAIClient` To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), provide an instance of the desired credential type obtained from the diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md b/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md index ba9983f71f..c99e745d38 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md +++ b/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md @@ -39,7 +39,7 @@ export interface AzureChatExtensionsMessageContextOutput { export type AzureChatExtensionType = "AzureCognitiveSearch"; // @public -export type AzureOpenAiOperationStateOutput = "notRunning" | "running" | "succeeded" | "canceled" | "failed"; +export type AzureOpenAIOperationStateOutput = "notRunning" | "running" | "succeeded" | "canceled" | "failed"; // @public export interface BatchImageGenerationOperationResponseOutput { @@ -48,7 +48,7 @@ export interface BatchImageGenerationOperationResponseOutput { expires?: number; id: string; result?: ImageGenerationsOutput; - status: AzureOpenAiOperationStateOutput; + status: AzureOpenAIOperationStateOutput; } // @public (undocumented) @@ -237,7 +237,7 @@ export interface ContentFilterResultsOutput { export type ContentFilterSeverityOutput = "safe" | "low" | "medium" | "high"; // @public -function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: OpenAiClientOptions): OpenAiClient; +function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: OpenAIClientOptions): OpenAIClient; export default createClient; // @public @@ -524,12 +524,12 @@ export function isUnexpected(response: GetAzureBatchImageGenerationOperationStat export function isUnexpected(response: BeginAzureBatchImageGeneration202Response | BeginAzureBatchImageGenerationLogicalResponse | BeginAzureBatchImageGenerationDefaultResponse): response is BeginAzureBatchImageGenerationDefaultResponse; // @public (undocumented) -export type OpenAiClient = Client & { +export type OpenAIClient = Client & { path: Routes; }; // @public -export interface OpenAiClientOptions extends ClientOptions { +export interface OpenAIClientOptions extends ClientOptions { apiVersion?: string; } diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts index 5b2459225e..585ce76238 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/beginAzureBatchImageGenerationSample.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { AzureKeyCredential } from "@azure/core-auth"; -import createOpenAiClient, { getLongRunningPoller } from "@msinternal/openai"; +import createOpenAIClient, { getLongRunningPoller } from "@msinternal/openai"; import * as dotenv from "dotenv"; dotenv.config(); @@ -15,7 +15,7 @@ dotenv.config(); async function beginAzureBatchImageGenerationSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAiClient(endpointParam, credential); + const client = createOpenAIClient(endpointParam, credential); const initialResponse = await client .path("/images/generations:submit") .post({ diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts index f7ab71df66..9c1727997e 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getAzureBatchImageGenerationOperationStatusSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAiClient from "@msinternal/openai"; +import createOpenAIClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getAzureBatchImageGenerationOperationStatusSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAiClient(endpointParam, credential); + const client = createOpenAIClient(endpointParam, credential); const operationId = "{Your operationId}"; const result = await client .path("/operations/images/{operationId}", operationId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts index adf8ba85ee..6fa9865c47 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAiClient from "@msinternal/openai"; +import createOpenAIClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getChatCompletionsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAiClient(endpointParam, credential); + const client = createOpenAIClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path("/deployments/{deploymentId}/chat/completions", deploymentId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts index 473f3171af..e1af95330f 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getChatCompletionsWithAzureExtensionsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAiClient from "@msinternal/openai"; +import createOpenAIClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getChatCompletionsWithAzureExtensionsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAiClient(endpointParam, credential); + const client = createOpenAIClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path( diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts index 1fa59d2e14..a460a3c466 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getCompletionsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAiClient from "@msinternal/openai"; +import createOpenAIClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getCompletionsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAiClient(endpointParam, credential); + const client = createOpenAIClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path("/deployments/{deploymentId}/completions", deploymentId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts index 95b94c049b..b066f2a051 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/samples-dev/getEmbeddingsSample.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import createOpenAiClient from "@msinternal/openai"; +import createOpenAIClient from "@msinternal/openai"; import { AzureKeyCredential } from "@azure/core-auth"; import * as dotenv from "dotenv"; @@ -15,7 +15,7 @@ dotenv.config(); async function getEmbeddingsSample() { const endpointParam = "{Your endpointParam}"; const credential = new AzureKeyCredential("{Your API key}"); - const client = createOpenAiClient(endpointParam, credential); + const client = createOpenAIClient(endpointParam, credential); const deploymentId = "{Your deploymentId}"; const result = await client .path("/deployments/{deploymentId}/embeddings", deploymentId) diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts index 847d4e4bcd..6f5a60af22 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/clientDefinitions.ts @@ -122,6 +122,6 @@ export interface Routes { (path: "/images/generations:submit"): BeginAzureBatchImageGeneration; } -export type OpenAiClient = Client & { +export type OpenAIClient = Client & { path: Routes; }; diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts index 91f1cf8d67..d46bbd7f21 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import OpenAiClient from "./openAiClient.js"; +import OpenAIClient from "./openAIClient.js"; -export * from "./openAiClient.js"; +export * from "./openAIClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; @@ -12,4 +12,4 @@ export * from "./models.js"; export * from "./outputModels.js"; export * from "./pollingHelper.js"; -export default OpenAiClient; +export default OpenAIClient; diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts index f3f971f2e3..b690a0f57e 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts @@ -4,16 +4,16 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { TokenCredential, KeyCredential } from "@azure/core-auth"; -import { OpenAiClient } from "./clientDefinitions.js"; +import { OpenAIClient } from "./clientDefinitions.js"; /** The optional parameters for the client */ -export interface OpenAiClientOptions extends ClientOptions { +export interface OpenAIClientOptions extends ClientOptions { /** The api version option of the client */ apiVersion?: string; } /** - * Initialize a new instance of `OpenAiClient` + * Initialize a new instance of `OpenAIClient` * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: * https://westus.api.cognitive.microsoft.com). * @param credentials - uniquely identify client credential @@ -22,8 +22,8 @@ export interface OpenAiClientOptions extends ClientOptions { export default function createClient( endpointParam: string, credentials: TokenCredential | KeyCredential, - { apiVersion = "2023-08-01-preview", ...options }: OpenAiClientOptions = {}, -): OpenAiClient { + { apiVersion = "2023-08-01-preview", ...options }: OpenAIClientOptions = {}, +): OpenAIClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; const userAgentInfo = `azsdk-js-openai-rest/1.0.0-beta.1`; @@ -46,7 +46,7 @@ export default function createClient( apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", }, }; - const client = getClient(endpointUrl, credentials, options) as OpenAiClient; + const client = getClient(endpointUrl, credentials, options) as OpenAIClient; client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); client.pipeline.addPolicy({ diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts index f3f971f2e3..b690a0f57e 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts @@ -4,16 +4,16 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { TokenCredential, KeyCredential } from "@azure/core-auth"; -import { OpenAiClient } from "./clientDefinitions.js"; +import { OpenAIClient } from "./clientDefinitions.js"; /** The optional parameters for the client */ -export interface OpenAiClientOptions extends ClientOptions { +export interface OpenAIClientOptions extends ClientOptions { /** The api version option of the client */ apiVersion?: string; } /** - * Initialize a new instance of `OpenAiClient` + * Initialize a new instance of `OpenAIClient` * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: * https://westus.api.cognitive.microsoft.com). * @param credentials - uniquely identify client credential @@ -22,8 +22,8 @@ export interface OpenAiClientOptions extends ClientOptions { export default function createClient( endpointParam: string, credentials: TokenCredential | KeyCredential, - { apiVersion = "2023-08-01-preview", ...options }: OpenAiClientOptions = {}, -): OpenAiClient { + { apiVersion = "2023-08-01-preview", ...options }: OpenAIClientOptions = {}, +): OpenAIClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; const userAgentInfo = `azsdk-js-openai-rest/1.0.0-beta.1`; @@ -46,7 +46,7 @@ export default function createClient( apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", }, }; - const client = getClient(endpointUrl, credentials, options) as OpenAiClient; + const client = getClient(endpointUrl, credentials, options) as OpenAIClient; client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); client.pipeline.addPolicy({ diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts index 719bca87f1..c271d6a8ce 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/outputModels.ts @@ -267,7 +267,7 @@ export interface BatchImageGenerationOperationResponseOutput { /** The result of the operation if the operation succeeded. */ result?: ImageGenerationsOutput; /** The status of the operation */ - status: AzureOpenAiOperationStateOutput; + status: AzureOpenAIOperationStateOutput; /** The error if the operation failed. */ error?: ErrorModel; } @@ -308,7 +308,7 @@ export type ChatRoleOutput = | "function" | "tool"; /** The state of a job or item. */ -export type AzureOpenAiOperationStateOutput = +export type AzureOpenAIOperationStateOutput = | "notRunning" | "running" | "succeeded" diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md b/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md index 75ab58cc13..b8a3dcc345 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/README.md @@ -1,6 +1,6 @@ -# OpenAi client library for JavaScript +# OpenAI client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAi client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAI client. The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. @@ -18,7 +18,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@msinternal/openai-generic` package -Install the OpenAi client library for JavaScript with `npm`: +Install the OpenAI client library for JavaScript with `npm`: ```bash npm install @msinternal/openai-generic @@ -31,7 +31,7 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### OpenAiClient +### OpenAIClient -`OpenAiClient` is the primary interface for developers using the OpenAi client library. Explore the methods on this client object to understand the different features of the OpenAi service that you can access. +`OpenAIClient` is the primary interface for developers using the OpenAI client library. Explore the methods on this client object to understand the different features of the OpenAI service that you can access. diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md index 529a468cf8..880f949032 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md @@ -450,14 +450,14 @@ export interface FilesListOptionalParams extends OperationOptions { // @public export interface FilesOperations { // (undocumented) - create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; delete: (fileId: string, options?: FilesDeleteOptionalParams) => Promise; // (undocumented) download: (fileId: string, options?: FilesDownloadOptionalParams) => Promise; // (undocumented) list: (options?: FilesListOptionalParams) => Promise; // (undocumented) - retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; } // @public @@ -482,11 +482,11 @@ export interface FineTune { model: string; object: "fine-tune"; organization_id: string; - result_files: OpenAiFile[]; + result_files: OpenAIFile[]; status: "created" | "running" | "succeeded" | "failed" | "cancelled"; - training_files: OpenAiFile[]; + training_files: OpenAIFile[]; updated_at: Date; - validation_files: OpenAiFile[]; + validation_files: OpenAIFile[]; } // @public @@ -660,7 +660,7 @@ export interface ImagesResponse { // @public export interface ListFilesResponse { // (undocumented) - data: OpenAiFile[]; + data: OpenAIFile[]; // (undocumented) object: string; } @@ -768,7 +768,7 @@ export interface OpenAIClientOptionalParams extends ClientOptions { } // @public -export interface OpenAiFile { +export interface OpenAIFile { bytes: number; createdAt: Date; filename: string; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts index 738d52cd1a..899412257a 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts @@ -10,8 +10,8 @@ import { FilesRetrieveOptionalParams, } from "../index.js"; import { - OpenAiFile, - openAiFileDeserializer, + OpenAIFile, + openAIFileDeserializer, ListFilesResponse, listFilesResponseDeserializer, CreateFileRequest, @@ -70,20 +70,20 @@ export function _createSend( export async function _createDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAiFileDeserializer(result.body); + return openAIFileDeserializer(result.body); } export async function create( context: Client, file: CreateFileRequest, options: FilesCreateOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _createSend(context, file, options); return _createDeserialize(result); } @@ -100,20 +100,20 @@ export function _retrieveSend( export async function _retrieveDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAiFileDeserializer(result.body); + return openAIFileDeserializer(result.body); } export async function retrieve( context: Client, fileId: string, options: FilesRetrieveOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _retrieveSend(context, fileId, options); return _retrieveDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts index 56ab77acd4..2f0d3bb507 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts @@ -5,7 +5,7 @@ export { createOpenAI, OpenAIContext, OpenAIClientOptionalParams, -} from "./openAiContext.js"; +} from "./openAIContext.js"; export { AudioTranscriptionsCreateOptionalParams, AudioTranslationsCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts index 4972ed1d97..a86bb79fc7 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { AudioTranscriptionsOperations, getAudioTranscriptionsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts index fa7c53455f..8bcb7743fa 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create } from "../../../api/audio/transcriptions/index.js"; import { AudioTranscriptionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts index 0a32c79d14..33b7b2498e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create } from "../../../api/audio/translations/index.js"; import { AudioTranslationsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts index a48e72c807..65541432b4 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create } from "../../../api/chat/completions/index.js"; import { ChatCompletionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts index fb7d29c7a2..6fa08609e1 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { ChatCompletionsOperations, getChatCompletionsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts index 6b9a4ee9ea..55c2aa082d 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/completions/index.js"; import { CompletionsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts index 7082f8456c..e56d78ba9f 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/edits/index.js"; import { EditsCreateOptionalParams } from "../../api/options.js"; import { CreateEditRequest, CreateEditResponse } from "../../models/models.js"; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts index 9b076d37eb..6c35f0a9d8 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/embeddings/index.js"; import { EmbeddingsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts index a5b8b9a4b9..d7996abe49 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { list, create, @@ -19,7 +19,7 @@ import { import { ListFilesResponse, CreateFileRequest, - OpenAiFile, + OpenAIFile, DeleteFileResponse, } from "../../models/models.js"; @@ -29,11 +29,11 @@ export interface FilesOperations { create: ( file: CreateFileRequest, options?: FilesCreateOptionalParams, - ) => Promise; + ) => Promise; retrieve: ( fileId: string, options?: FilesRetrieveOptionalParams, - ) => Promise; + ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts index 69e114a0bb..17c0cc5071 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts index cca13e74d2..59fe849ce8 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { FineTuningJobsOperations, getFineTuningJobsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index df45d41a3f..f31081a07b 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts index 221fd9ac4b..fc1d3b2aa9 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create, createEdit, createVariation } from "../../api/images/index.js"; import { ImagesCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts index 05c6050f89..c0556a1b74 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { list, retrieve, $delete } from "../../api/models/index.js"; import { ModelsListOptionalParams, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts index 8ba5e9ed2b..f89bec51a9 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/moderations/index.js"; import { ModerationsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts index e78cc38b12..f313205ae6 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export { OpenAIClient } from "./openAiClient.js"; +export { OpenAIClient } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, @@ -17,7 +17,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAiFile, + OpenAIFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts index f77a8d29bd..c6775fe0ff 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts @@ -16,7 +16,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAiFile, + OpenAIFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts index b4131931b4..c19c8565ed 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts @@ -636,11 +636,11 @@ export interface FineTune { classification_n_classes?: number; }; /** The list of files used for training. */ - training_files: OpenAiFile[]; + training_files: OpenAIFile[]; /** The list of files used for validation. */ - validation_files: OpenAiFile[]; + validation_files: OpenAIFile[]; /** The compiled results files for the fine-tuning job. */ - result_files: OpenAiFile[]; + result_files: OpenAIFile[]; /** The list of events that have been observed in the lifecycle of the FineTune job. */ events?: FineTuneEvent[]; } @@ -656,9 +656,9 @@ export function fineTuneDeserializer(item: any): FineTune { organization_id: item["organization_id"], status: item["status"], hyperparams: _fineTuneHyperparamsDeserializer(item["hyperparams"]), - training_files: openAiFileArrayDeserializer(item["training_files"]), - validation_files: openAiFileArrayDeserializer(item["validation_files"]), - result_files: openAiFileArrayDeserializer(item["result_files"]), + training_files: openAIFileArrayDeserializer(item["training_files"]), + validation_files: openAIFileArrayDeserializer(item["validation_files"]), + result_files: openAIFileArrayDeserializer(item["result_files"]), events: !item["events"] ? item["events"] : fineTuneEventArrayDeserializer(item["events"]), @@ -704,7 +704,7 @@ export function _fineTuneHyperparamsDeserializer( } /** The `File` object represents a document that has been uploaded to OpenAI. */ -export interface OpenAiFile { +export interface OpenAIFile { /** The file identifier, which can be referenced in the API endpoints. */ id: string; /** The object type, which is always "file". */ @@ -735,7 +735,7 @@ export interface OpenAiFile { status_details?: string | null; } -export function openAiFileDeserializer(item: any): OpenAiFile { +export function openAIFileDeserializer(item: any): OpenAIFile { return { id: item["id"], object: item["object"], @@ -748,9 +748,9 @@ export function openAiFileDeserializer(item: any): OpenAiFile { }; } -export function openAiFileArrayDeserializer(result: Array): any[] { +export function openAIFileArrayDeserializer(result: Array): any[] { return result.map((item) => { - return openAiFileDeserializer(item); + return openAIFileDeserializer(item); }); } @@ -818,13 +818,13 @@ export function listFineTuneEventsResponseDeserializer( /** model interface ListFilesResponse */ export interface ListFilesResponse { object: string; - data: OpenAiFile[]; + data: OpenAIFile[]; } export function listFilesResponseDeserializer(item: any): ListFilesResponse { return { object: item["object"], - data: openAiFileArrayDeserializer(item["data"]), + data: openAIFileArrayDeserializer(item["data"]), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts index be7580d846..2b85b3f2f6 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts @@ -41,7 +41,7 @@ import { import { Pipeline } from "@azure/core-rest-pipeline"; import { KeyCredential } from "@azure/core-auth"; -export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts index be7580d846..2b85b3f2f6 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts @@ -41,7 +41,7 @@ import { import { Pipeline } from "@azure/core-rest-pipeline"; import { KeyCredential } from "@azure/core-auth"; -export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md index b961e5cbcd..c87d4724a4 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/README.md @@ -1,6 +1,6 @@ -# OpenAi client library for JavaScript +# OpenAI client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAi client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for OpenAI client. Azure OpenAI APIs for completions and search @@ -18,7 +18,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@msinternal/openai_modular` package -Install the OpenAi client library for JavaScript with `npm`: +Install the OpenAI client library for JavaScript with `npm`: ```bash npm install @msinternal/openai_modular @@ -31,7 +31,7 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### OpenAiClient +### OpenAIClient -`OpenAiClient` is the primary interface for developers using the OpenAi client library. Explore the methods on this client object to understand the different features of the OpenAi service that you can access. +`OpenAIClient` is the primary interface for developers using the OpenAI client library. Explore the methods on this client object to understand the different features of the OpenAI service that you can access. diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json index 49f60ee835..fe97d3a2b2 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json @@ -14,15 +14,34 @@ "./models": "./src/models/index.ts", "./api": "./src/api/index.ts" }, - "dialects": ["esm", "commonjs"], - "esmDialects": ["browser", "react-native"], + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], "selfLink": false }, "type": "module", - "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], "author": "Microsoft Corporation", "license": "MIT", - "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], + "files": [ + "dist", + "README.md", + "LICENSE", + "review/*", + "CHANGELOG.md" + ], "dependencies": { "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.3.1", @@ -64,5 +83,65 @@ "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tshy && npm run unit-test:node && npm run unit-test:browser && npm run integration-test", "build": "npm run clean && tshy && npm run extract-api" - } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md new file mode 100644 index 0000000000..6925fd7c7a --- /dev/null +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md @@ -0,0 +1,1016 @@ +## API Report File for "@msinternal/openai_modular" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ClientOptions } from '@azure-rest/core-client'; +import { ErrorModel } from '@azure-rest/core-client'; +import { KeyCredential } from '@azure/core-auth'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export type AudioTaskLabel = "transcribe" | "translate"; + +// @public +export interface AudioTranscription { + duration?: number; + language?: string; + segments?: AudioTranscriptionSegment[]; + task?: AudioTaskLabel; + text: string; + words?: AudioTranscriptionWord[]; +} + +// @public +export type AudioTranscriptionFormat = "json" | "verbose_json" | "text" | "srt" | "vtt"; + +// @public +export interface AudioTranscriptionOptions { + file: Uint8Array; + filename?: string; + language?: string; + model?: string; + prompt?: string; + responseFormat?: AudioTranscriptionFormat; + temperature?: number; + timestampGranularities?: AudioTranscriptionTimestampGranularity[]; +} + +// @public +export interface AudioTranscriptionSegment { + avgLogprob: number; + compressionRatio: number; + end: number; + id: number; + noSpeechProb: number; + seek: number; + start: number; + temperature: number; + text: string; + tokens: number[]; +} + +// @public +export type AudioTranscriptionTimestampGranularity = "word" | "segment"; + +// @public +export interface AudioTranscriptionWord { + end: number; + start: number; + word: string; +} + +// @public +export interface AudioTranslation { + duration?: number; + language?: string; + segments?: AudioTranslationSegment[]; + task?: AudioTaskLabel; + text: string; +} + +// @public +export type AudioTranslationFormat = "json" | "verbose_json" | "text" | "srt" | "vtt"; + +// @public +export interface AudioTranslationOptions { + file: Uint8Array; + filename?: string; + model?: string; + prompt?: string; + responseFormat?: AudioTranslationFormat; + temperature?: number; +} + +// @public +export interface AudioTranslationSegment { + avgLogprob: number; + compressionRatio: number; + end: number; + id: number; + noSpeechProb: number; + seek: number; + start: number; + temperature: number; + text: string; + tokens: number[]; +} + +// @public +export interface AzureChatEnhancementConfiguration { + grounding?: AzureChatGroundingEnhancementConfiguration; + ocr?: AzureChatOCREnhancementConfiguration; +} + +// @public +export interface AzureChatEnhancements { + grounding?: AzureGroundingEnhancement; +} + +// @public +export interface AzureChatExtensionConfiguration { + type: AzureChatExtensionType; +} + +// @public +export type AzureChatExtensionConfigurationUnion = AzureSearchChatExtensionConfiguration | AzureMachineLearningIndexChatExtensionConfiguration | AzureCosmosDBChatExtensionConfiguration | ElasticsearchChatExtensionConfiguration | PineconeChatExtensionConfiguration | AzureChatExtensionConfiguration; + +// @public +export interface AzureChatExtensionDataSourceResponseCitation { + chunkId?: string; + content: string; + filepath?: string; + title?: string; + url?: string; +} + +// @public +export interface AzureChatExtensionRetrievedDocument { + chunkId?: string; + content: string; + dataSourceIndex: number; + filepath?: string; + filterReason?: AzureChatExtensionRetrieveDocumentFilterReason; + originalSearchScore?: number; + rerankScore?: number; + searchQueries: string[]; + title?: string; + url?: string; +} + +// @public +export type AzureChatExtensionRetrieveDocumentFilterReason = "score" | "rerank"; + +// @public +export interface AzureChatExtensionsMessageContext { + allRetrievedDocuments?: AzureChatExtensionRetrievedDocument[]; + citations?: AzureChatExtensionDataSourceResponseCitation[]; + intent?: string; +} + +// @public +export type AzureChatExtensionType = "azure_search" | "azure_ml_index" | "azure_cosmos_db" | "elasticsearch" | "pinecone"; + +// @public +export interface AzureChatGroundingEnhancementConfiguration { + enabled: boolean; +} + +// @public +export interface AzureChatOCREnhancementConfiguration { + enabled: boolean; +} + +// @public +export interface AzureCosmosDBChatExtensionConfiguration extends AzureChatExtensionConfiguration { + parameters: AzureCosmosDBChatExtensionParameters; + type: "azure_cosmos_db"; +} + +// @public +export interface AzureCosmosDBChatExtensionParameters { + allowPartialResult?: boolean; + authentication?: OnYourDataAuthenticationOptionsUnion; + containerName: string; + databaseName: string; + embeddingDependency: OnYourDataVectorizationSourceUnion; + fieldsMapping: AzureCosmosDBFieldMappingOptions; + includeContexts?: OnYourDataContextProperty[]; + indexName: string; + inScope?: boolean; + maxSearchQueries?: number; + roleInformation?: string; + strictness?: number; + topNDocuments?: number; +} + +// @public +export interface AzureCosmosDBFieldMappingOptions { + contentFields: string[]; + contentFieldsSeparator?: string; + filepathField?: string; + titleField?: string; + urlField?: string; + vectorFields: string[]; +} + +// @public +export interface AzureGroundingEnhancement { + lines: AzureGroundingEnhancementLine[]; +} + +// @public +export interface AzureGroundingEnhancementCoordinatePoint { + x: number; + y: number; +} + +// @public +export interface AzureGroundingEnhancementLine { + spans: AzureGroundingEnhancementLineSpan[]; + text: string; +} + +// @public +export interface AzureGroundingEnhancementLineSpan { + length: number; + offset: number; + polygon: AzureGroundingEnhancementCoordinatePoint[]; + text: string; +} + +// @public +export interface AzureMachineLearningIndexChatExtensionConfiguration extends AzureChatExtensionConfiguration { + parameters: AzureMachineLearningIndexChatExtensionParameters; + type: "azure_ml_index"; +} + +// @public +export interface AzureMachineLearningIndexChatExtensionParameters { + allowPartialResult?: boolean; + authentication?: OnYourDataAuthenticationOptionsUnion; + filter?: string; + includeContexts?: OnYourDataContextProperty[]; + inScope?: boolean; + maxSearchQueries?: number; + name: string; + projectResourceId: string; + roleInformation?: string; + strictness?: number; + topNDocuments?: number; + version: string; +} + +// @public +export interface AzureSearchChatExtensionConfiguration extends AzureChatExtensionConfiguration { + parameters: AzureSearchChatExtensionParameters; + type: "azure_search"; +} + +// @public +export interface AzureSearchChatExtensionParameters { + allowPartialResult?: boolean; + authentication?: OnYourDataAuthenticationOptionsUnion; + embeddingDependency?: OnYourDataVectorizationSourceUnion; + endpoint: string; + fieldsMapping?: AzureSearchIndexFieldMappingOptions; + filter?: string; + includeContexts?: OnYourDataContextProperty[]; + indexName: string; + inScope?: boolean; + maxSearchQueries?: number; + queryType?: AzureSearchQueryType; + roleInformation?: string; + semanticConfiguration?: string; + strictness?: number; + topNDocuments?: number; +} + +// @public +export interface AzureSearchIndexFieldMappingOptions { + contentFields?: string[]; + contentFieldsSeparator?: string; + filepathField?: string; + imageVectorFields?: string[]; + titleField?: string; + urlField?: string; + vectorFields?: string[]; +} + +// @public +export type AzureSearchQueryType = "simple" | "semantic" | "vector" | "vector_simple_hybrid" | "vector_semantic_hybrid"; + +// @public +export interface ChatChoice { + contentFilterResults?: ContentFilterResultsForChoice; + delta?: ChatResponseMessage; + enhancements?: AzureChatEnhancements; + finishDetails?: ChatFinishDetailsUnion; + finishReason: CompletionsFinishReason | null; + index: number; + logprobs: ChatChoiceLogProbabilityInfo | null; + message?: ChatResponseMessage; +} + +// @public +export interface ChatChoiceLogProbabilityInfo { + content: ChatTokenLogProbabilityResult[] | null; +} + +// @public +export interface ChatCompletions { + choices: ChatChoice[]; + created: Date; + id: string; + model?: string; + promptFilterResults?: ContentFilterResultsForPrompt[]; + systemFingerprint?: string; + usage: CompletionsUsage; +} + +// @public +export interface ChatCompletionsFunctionToolCall extends ChatCompletionsToolCall { + function: FunctionCall; + type: "function"; +} + +// @public +export interface ChatCompletionsFunctionToolDefinition extends ChatCompletionsToolDefinition { + function: FunctionDefinition; + type: "function"; +} + +// @public +export interface ChatCompletionsFunctionToolSelection { + name: string; +} + +// @public +export interface ChatCompletionsJsonResponseFormat extends ChatCompletionsResponseFormat { + type: "json_object"; +} + +// @public +export interface ChatCompletionsNamedFunctionToolSelection extends ChatCompletionsNamedToolSelection { + function: ChatCompletionsFunctionToolSelection; + type: "function"; +} + +// @public +export interface ChatCompletionsNamedToolSelection { + type: string; +} + +// @public +export type ChatCompletionsNamedToolSelectionUnion = ChatCompletionsNamedFunctionToolSelection | ChatCompletionsNamedToolSelection; + +// @public +export interface ChatCompletionsOptions { + dataSources?: AzureChatExtensionConfigurationUnion[]; + enhancements?: AzureChatEnhancementConfiguration; + frequencyPenalty?: number; + functionCall?: FunctionCallPreset | FunctionName; + functions?: FunctionDefinition[]; + logitBias?: Record; + logprobs?: boolean | null; + maxTokens?: number; + messages: ChatRequestMessageUnion[]; + model?: string; + n?: number; + presencePenalty?: number; + responseFormat?: ChatCompletionsResponseFormatUnion; + seed?: number; + stop?: string[]; + stream?: boolean; + temperature?: number; + toolChoice?: ChatCompletionsToolSelectionPreset | ChatCompletionsNamedToolSelectionUnion; + tools?: ChatCompletionsToolDefinitionUnion[]; + topLogprobs?: number | null; + topP?: number; + user?: string; +} + +// @public +export interface ChatCompletionsResponseFormat { + type: string; +} + +// @public +export type ChatCompletionsResponseFormatUnion = ChatCompletionsTextResponseFormat | ChatCompletionsJsonResponseFormat | ChatCompletionsResponseFormat; + +// @public +export interface ChatCompletionsTextResponseFormat extends ChatCompletionsResponseFormat { + type: "text"; +} + +// @public +export interface ChatCompletionsToolCall { + id: string; + type: string; +} + +// @public +export type ChatCompletionsToolCallUnion = ChatCompletionsFunctionToolCall | ChatCompletionsToolCall; + +// @public +export interface ChatCompletionsToolDefinition { + type: string; +} + +// @public +export type ChatCompletionsToolDefinitionUnion = ChatCompletionsFunctionToolDefinition | ChatCompletionsToolDefinition; + +// @public +export type ChatCompletionsToolSelectionPreset = "auto" | "none"; + +// @public +export interface ChatFinishDetails { + type: string; +} + +// @public +export type ChatFinishDetailsUnion = StopFinishDetails | MaxTokensFinishDetails | ChatFinishDetails; + +// @public +export interface ChatMessageContentItem { + type: string; +} + +// @public +export type ChatMessageContentItemUnion = ChatMessageTextContentItem | ChatMessageImageContentItem | ChatMessageContentItem; + +// @public +export interface ChatMessageImageContentItem extends ChatMessageContentItem { + imageUrl: ChatMessageImageUrl; + type: "image_url"; +} + +// @public +export type ChatMessageImageDetailLevel = "auto" | "low" | "high"; + +// @public +export interface ChatMessageImageUrl { + detail?: ChatMessageImageDetailLevel; + url: string; +} + +// @public +export interface ChatMessageTextContentItem extends ChatMessageContentItem { + text: string; + type: "text"; +} + +// @public +export interface ChatRequestAssistantMessage extends ChatRequestMessage { + content: string | null; + functionCall?: FunctionCall; + name?: string; + role: "assistant"; + toolCalls?: ChatCompletionsToolCallUnion[]; +} + +// @public +export interface ChatRequestFunctionMessage extends ChatRequestMessage { + content: string | null; + name: string; + role: "function"; +} + +// @public +export interface ChatRequestMessage { + role: ChatRole; +} + +// @public +export type ChatRequestMessageUnion = ChatRequestSystemMessage | ChatRequestUserMessage | ChatRequestAssistantMessage | ChatRequestToolMessage | ChatRequestFunctionMessage | ChatRequestMessage; + +// @public +export interface ChatRequestSystemMessage extends ChatRequestMessage { + content: string; + name?: string; + role: "system"; +} + +// @public +export interface ChatRequestToolMessage extends ChatRequestMessage { + content: string | null; + role: "tool"; + toolCallId: string; +} + +// @public +export interface ChatRequestUserMessage extends ChatRequestMessage { + content: string | ChatMessageContentItemUnion[]; + name?: string; + role: "user"; +} + +// @public +export interface ChatResponseMessage { + content: string | null; + context?: AzureChatExtensionsMessageContext; + functionCall?: FunctionCall; + role: ChatRole; + toolCalls?: ChatCompletionsToolCallUnion[]; +} + +// @public +export type ChatRole = "system" | "assistant" | "user" | "function" | "tool"; + +// @public +export interface ChatTokenLogProbabilityInfo { + bytes: number[] | null; + logprob: number; + token: string; +} + +// @public +export interface ChatTokenLogProbabilityResult { + bytes: number[] | null; + logprob: number; + token: string; + topLogprobs: ChatTokenLogProbabilityInfo[] | null; +} + +// @public +export interface Choice { + contentFilterResults?: ContentFilterResultsForChoice; + finishReason: CompletionsFinishReason | null; + index: number; + logprobs: CompletionsLogProbabilityModel | null; + text: string; +} + +// @public +export interface Completions { + choices: Choice[]; + created: Date; + id: string; + promptFilterResults?: ContentFilterResultsForPrompt[]; + usage: CompletionsUsage; +} + +// @public +export type CompletionsFinishReason = "stop" | "length" | "content_filter" | "function_call" | "tool_calls"; + +// @public +export interface CompletionsLogProbabilityModel { + textOffset: number[]; + tokenLogprobs: (number | null)[]; + tokens: string[]; + topLogprobs: Record[]; +} + +// @public +export interface CompletionsOptions { + bestOf?: number; + echo?: boolean; + frequencyPenalty?: number; + logitBias?: Record; + logprobs?: number; + maxTokens?: number; + model?: string; + n?: number; + presencePenalty?: number; + prompt: string[]; + stop?: string[]; + stream?: boolean; + suffix?: string; + temperature?: number; + topP?: number; + user?: string; +} + +// @public +export interface CompletionsUsage { + completionTokens: number; + promptTokens: number; + totalTokens: number; +} + +// @public +export interface ContentFilterBlocklistIdResult { + filtered: boolean; + id: string; +} + +// @public +export interface ContentFilterCitedDetectionResult { + detected: boolean; + filtered: boolean; + license: string; + url?: string; +} + +// @public +export interface ContentFilterDetailedResults { + details: ContentFilterBlocklistIdResult[]; + filtered: boolean; +} + +// @public +export interface ContentFilterDetectionResult { + detected: boolean; + filtered: boolean; +} + +// @public +export interface ContentFilterResult { + filtered: boolean; + severity: ContentFilterSeverity; +} + +// @public +export interface ContentFilterResultDetailsForPrompt { + customBlocklists?: ContentFilterDetailedResults; + error?: ErrorModel; + hate?: ContentFilterResult; + indirectAttack?: ContentFilterDetectionResult; + jailbreak?: ContentFilterDetectionResult; + profanity?: ContentFilterDetectionResult; + selfHarm?: ContentFilterResult; + sexual?: ContentFilterResult; + violence?: ContentFilterResult; +} + +// @public +export interface ContentFilterResultsForChoice { + customBlocklists?: ContentFilterDetailedResults; + error?: ErrorModel; + hate?: ContentFilterResult; + profanity?: ContentFilterDetectionResult; + protectedMaterialCode?: ContentFilterCitedDetectionResult; + protectedMaterialText?: ContentFilterDetectionResult; + selfHarm?: ContentFilterResult; + sexual?: ContentFilterResult; + violence?: ContentFilterResult; +} + +// @public +export interface ContentFilterResultsForPrompt { + contentFilterResults: ContentFilterResultDetailsForPrompt; + promptIndex: number; +} + +// @public +export type ContentFilterSeverity = "safe" | "low" | "medium" | "high"; + +// @public +export interface ElasticsearchChatExtensionConfiguration extends AzureChatExtensionConfiguration { + parameters: ElasticsearchChatExtensionParameters; + type: "elasticsearch"; +} + +// @public +export interface ElasticsearchChatExtensionParameters { + allowPartialResult?: boolean; + authentication?: OnYourDataAuthenticationOptionsUnion; + embeddingDependency?: OnYourDataVectorizationSourceUnion; + endpoint: string; + fieldsMapping?: ElasticsearchIndexFieldMappingOptions; + includeContexts?: OnYourDataContextProperty[]; + indexName: string; + inScope?: boolean; + maxSearchQueries?: number; + queryType?: ElasticsearchQueryType; + roleInformation?: string; + strictness?: number; + topNDocuments?: number; +} + +// @public +export interface ElasticsearchIndexFieldMappingOptions { + contentFields?: string[]; + contentFieldsSeparator?: string; + filepathField?: string; + titleField?: string; + urlField?: string; + vectorFields?: string[]; +} + +// @public +export type ElasticsearchQueryType = "simple" | "vector"; + +// @public +export type EmbeddingEncodingFormat = "float" | "base64"; + +// @public +export interface EmbeddingItem { + embedding: number[]; + index: number; +} + +// @public +export interface Embeddings { + data: EmbeddingItem[]; + usage: EmbeddingsUsage; +} + +// @public +export interface EmbeddingsOptions { + dimensions?: number; + encodingFormat?: EmbeddingEncodingFormat; + input: string[]; + inputType?: string; + model?: string; + user?: string; +} + +// @public +export interface EmbeddingsUsage { + promptTokens: number; + totalTokens: number; +} + +// @public +export interface FunctionCall { + arguments: string; + name: string; +} + +// @public +export type FunctionCallPreset = "auto" | "none"; + +// @public +export interface FunctionDefinition { + description?: string; + name: string; + parameters?: any; +} + +// @public +export interface FunctionName { + name: string; +} + +// @public +export interface GenerateSpeechFromTextOptionalParams extends OperationOptions { +} + +// @public +export interface GetAudioTranscriptionAsPlainTextOptionalParams extends OperationOptions { + contentType?: string; +} + +// @public +export interface GetAudioTranscriptionAsResponseObjectOptionalParams extends OperationOptions { + contentType?: string; +} + +// @public +export interface GetAudioTranslationAsPlainTextOptionalParams extends OperationOptions { + contentType?: string; +} + +// @public +export interface GetAudioTranslationAsResponseObjectOptionalParams extends OperationOptions { + contentType?: string; +} + +// @public +export interface GetChatCompletionsOptionalParams extends OperationOptions { +} + +// @public +export interface GetCompletionsOptionalParams extends OperationOptions { +} + +// @public +export interface GetEmbeddingsOptionalParams extends OperationOptions { +} + +// @public +export interface GetImageGenerationsOptionalParams extends OperationOptions { +} + +// @public +export interface ImageGenerationContentFilterResults { + hate?: ContentFilterResult; + selfHarm?: ContentFilterResult; + sexual?: ContentFilterResult; + violence?: ContentFilterResult; +} + +// @public +export interface ImageGenerationData { + base64Data?: string; + contentFilterResults?: ImageGenerationContentFilterResults; + promptFilterResults?: ImageGenerationPromptFilterResults; + revisedPrompt?: string; + url?: string; +} + +// @public +export interface ImageGenerationOptions { + model?: string; + n?: number; + prompt: string; + quality?: ImageGenerationQuality; + responseFormat?: ImageGenerationResponseFormat; + size?: ImageSize; + style?: ImageGenerationStyle; + user?: string; +} + +// @public +export interface ImageGenerationPromptFilterResults { + customBlocklists?: ContentFilterDetailedResults; + hate?: ContentFilterResult; + jailbreak?: ContentFilterDetectionResult; + profanity?: ContentFilterDetectionResult; + selfHarm?: ContentFilterResult; + sexual?: ContentFilterResult; + violence?: ContentFilterResult; +} + +// @public +export type ImageGenerationQuality = "standard" | "hd"; + +// @public +export type ImageGenerationResponseFormat = "url" | "b64_json"; + +// @public +export interface ImageGenerations { + created: Date; + data: ImageGenerationData[]; +} + +// @public +export type ImageGenerationStyle = "natural" | "vivid"; + +// @public +export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792"; + +// @public +export interface MaxTokensFinishDetails extends ChatFinishDetails { + type: "max_tokens"; +} + +// @public +export interface OnYourDataAccessTokenAuthenticationOptions extends OnYourDataAuthenticationOptions { + accessToken: string; + type: "access_token"; +} + +// @public +export interface OnYourDataApiKeyAuthenticationOptions extends OnYourDataAuthenticationOptions { + key: string; + type: "api_key"; +} + +// @public +export interface OnYourDataAuthenticationOptions { + type: OnYourDataAuthenticationType; +} + +// @public +export type OnYourDataAuthenticationOptionsUnion = OnYourDataApiKeyAuthenticationOptions | OnYourDataConnectionStringAuthenticationOptions | OnYourDataKeyAndKeyIdAuthenticationOptions | OnYourDataEncodedApiKeyAuthenticationOptions | OnYourDataAccessTokenAuthenticationOptions | OnYourDataSystemAssignedManagedIdentityAuthenticationOptions | OnYourDataUserAssignedManagedIdentityAuthenticationOptions | OnYourDataAuthenticationOptions; + +// @public +export type OnYourDataAuthenticationType = "api_key" | "connection_string" | "key_and_key_id" | "encoded_api_key" | "access_token" | "system_assigned_managed_identity" | "user_assigned_managed_identity"; + +// @public +export interface OnYourDataConnectionStringAuthenticationOptions extends OnYourDataAuthenticationOptions { + connectionString: string; + type: "connection_string"; +} + +// @public +export type OnYourDataContextProperty = "citations" | "intent" | "all_retrieved_documents"; + +// @public +export interface OnYourDataDeploymentNameVectorizationSource extends OnYourDataVectorizationSource { + deploymentName: string; + dimensions?: number; + type: "deployment_name"; +} + +// @public +export interface OnYourDataEncodedApiKeyAuthenticationOptions extends OnYourDataAuthenticationOptions { + encodedApiKey: string; + type: "encoded_api_key"; +} + +// @public +export interface OnYourDataEndpointVectorizationSource extends OnYourDataVectorizationSource { + authentication: OnYourDataVectorSearchAuthenticationOptionsUnion; + endpoint: string; + type: "endpoint"; +} + +// @public +export interface OnYourDataKeyAndKeyIdAuthenticationOptions extends OnYourDataAuthenticationOptions { + key: string; + keyId: string; + type: "key_and_key_id"; +} + +// @public +export interface OnYourDataModelIdVectorizationSource extends OnYourDataVectorizationSource { + modelId: string; + type: "model_id"; +} + +// @public +export interface OnYourDataSystemAssignedManagedIdentityAuthenticationOptions extends OnYourDataAuthenticationOptions { + type: "system_assigned_managed_identity"; +} + +// @public +export interface OnYourDataUserAssignedManagedIdentityAuthenticationOptions extends OnYourDataAuthenticationOptions { + managedIdentityResourceId: string; + type: "user_assigned_managed_identity"; +} + +// @public +export interface OnYourDataVectorizationSource { + type: OnYourDataVectorizationSourceType; +} + +// @public +export type OnYourDataVectorizationSourceType = "endpoint" | "deployment_name" | "model_id"; + +// @public +export type OnYourDataVectorizationSourceUnion = OnYourDataEndpointVectorizationSource | OnYourDataDeploymentNameVectorizationSource | OnYourDataModelIdVectorizationSource | OnYourDataVectorizationSource; + +// @public +export interface OnYourDataVectorSearchAccessTokenAuthenticationOptions extends OnYourDataVectorSearchAuthenticationOptions { + accessToken: string; + type: "access_token"; +} + +// @public +export interface OnYourDataVectorSearchApiKeyAuthenticationOptions extends OnYourDataVectorSearchAuthenticationOptions { + key: string; + type: "api_key"; +} + +// @public +export interface OnYourDataVectorSearchAuthenticationOptions { + type: OnYourDataVectorSearchAuthenticationType; +} + +// @public +export type OnYourDataVectorSearchAuthenticationOptionsUnion = OnYourDataVectorSearchApiKeyAuthenticationOptions | OnYourDataVectorSearchAccessTokenAuthenticationOptions | OnYourDataVectorSearchAuthenticationOptions; + +// @public +export type OnYourDataVectorSearchAuthenticationType = "api_key" | "access_token"; + +// @public (undocumented) +export class OpenAIClient { + constructor(endpointParam: string, credential: KeyCredential | TokenCredential, options?: OpenAIClientOptionalParams); + generateSpeechFromText(deploymentId: string, body: SpeechGenerationOptions, options?: GenerateSpeechFromTextOptionalParams): Promise; + getAudioTranscriptionAsPlainText(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsPlainTextOptionalParams): Promise; + getAudioTranscriptionAsResponseObject(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsResponseObjectOptionalParams): Promise; + getAudioTranslationAsPlainText(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsPlainTextOptionalParams): Promise; + getAudioTranslationAsResponseObject(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsResponseObjectOptionalParams): Promise; + getChatCompletions(deploymentId: string, body: ChatCompletionsOptions, options?: GetChatCompletionsOptionalParams): Promise; + getCompletions(deploymentId: string, body: CompletionsOptions, options?: GetCompletionsOptionalParams): Promise; + getEmbeddings(deploymentId: string, body: EmbeddingsOptions, options?: GetEmbeddingsOptionalParams): Promise; + getImageGenerations(deploymentId: string, body: ImageGenerationOptions, options?: GetImageGenerationsOptionalParams): Promise; + readonly pipeline: Pipeline; +} + +// @public +export interface OpenAIClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface PineconeChatExtensionConfiguration extends AzureChatExtensionConfiguration { + parameters: PineconeChatExtensionParameters; + type: "pinecone"; +} + +// @public +export interface PineconeChatExtensionParameters { + allowPartialResult?: boolean; + authentication?: OnYourDataAuthenticationOptionsUnion; + embeddingDependency: OnYourDataVectorizationSourceUnion; + environment: string; + fieldsMapping: PineconeFieldMappingOptions; + includeContexts?: OnYourDataContextProperty[]; + indexName: string; + inScope?: boolean; + maxSearchQueries?: number; + roleInformation?: string; + strictness?: number; + topNDocuments?: number; +} + +// @public +export interface PineconeFieldMappingOptions { + contentFields: string[]; + contentFieldsSeparator?: string; + filepathField?: string; + titleField?: string; + urlField?: string; +} + +// @public +export interface SpeechGenerationOptions { + input: string; + model?: string; + responseFormat?: SpeechGenerationResponseFormat; + speed?: number; + voice: SpeechVoice; +} + +// @public +export type SpeechGenerationResponseFormat = "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"; + +// @public +export type SpeechVoice = "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer"; + +// @public +export interface StopFinishDetails extends ChatFinishDetails { + stop: string; + type: "stop"; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts index 24985414ac..1c4edce4d8 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts @@ -5,7 +5,7 @@ export { createOpenAI, OpenAIContext, OpenAIClientOptionalParams, -} from "./openAiContext.js"; +} from "./openAIContext.js"; export { getAudioTranscriptionAsPlainText, getAudioTranscriptionAsResponseObject, diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts index 9234d159de..39d5026083 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export { OpenAIClient } from "./openAiClient.js"; +export { OpenAIClient } from "./openAIClient.js"; export { AudioTranscriptionOptions, AudioTranscriptionFormat, @@ -82,9 +82,9 @@ export { OnYourDataModelIdVectorizationSource, AzureMachineLearningIndexChatExtensionConfiguration, AzureMachineLearningIndexChatExtensionParameters, - AzureCosmosDbChatExtensionConfiguration, - AzureCosmosDbChatExtensionParameters, - AzureCosmosDbFieldMappingOptions, + AzureCosmosDBChatExtensionConfiguration, + AzureCosmosDBChatExtensionParameters, + AzureCosmosDBFieldMappingOptions, ElasticsearchChatExtensionConfiguration, ElasticsearchChatExtensionParameters, ElasticsearchIndexFieldMappingOptions, @@ -94,7 +94,7 @@ export { PineconeFieldMappingOptions, AzureChatEnhancementConfiguration, AzureChatGroundingEnhancementConfiguration, - AzureChatOcrEnhancementConfiguration, + AzureChatOCREnhancementConfiguration, ChatCompletionsResponseFormat, ChatCompletionsResponseFormatUnion, ChatCompletionsTextResponseFormat, diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts index 26d26f3d10..342178fda2 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts @@ -81,9 +81,9 @@ export { OnYourDataModelIdVectorizationSource, AzureMachineLearningIndexChatExtensionConfiguration, AzureMachineLearningIndexChatExtensionParameters, - AzureCosmosDbChatExtensionConfiguration, - AzureCosmosDbChatExtensionParameters, - AzureCosmosDbFieldMappingOptions, + AzureCosmosDBChatExtensionConfiguration, + AzureCosmosDBChatExtensionParameters, + AzureCosmosDBFieldMappingOptions, ElasticsearchChatExtensionConfiguration, ElasticsearchChatExtensionParameters, ElasticsearchIndexFieldMappingOptions, @@ -93,7 +93,7 @@ export { PineconeFieldMappingOptions, AzureChatEnhancementConfiguration, AzureChatGroundingEnhancementConfiguration, - AzureChatOcrEnhancementConfiguration, + AzureChatOCREnhancementConfiguration, ChatCompletionsResponseFormat, ChatCompletionsResponseFormatUnion, ChatCompletionsTextResponseFormat, diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts index 5a1d511af2..6be1576036 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts @@ -1548,7 +1548,7 @@ export function azureChatExtensionConfigurationSerializer( export type AzureChatExtensionConfigurationUnion = | AzureSearchChatExtensionConfiguration | AzureMachineLearningIndexChatExtensionConfiguration - | AzureCosmosDbChatExtensionConfiguration + | AzureCosmosDBChatExtensionConfiguration | ElasticsearchChatExtensionConfiguration | PineconeChatExtensionConfiguration | AzureChatExtensionConfiguration; @@ -2238,7 +2238,7 @@ export function azureMachineLearningIndexChatExtensionParametersSerializer( * A specific representation of configurable options for Azure Cosmos DB when using it as an Azure OpenAI chat * extension. */ -export interface AzureCosmosDbChatExtensionConfiguration +export interface AzureCosmosDBChatExtensionConfiguration extends AzureChatExtensionConfiguration { /** * The type label to use when configuring Azure OpenAI chat extensions. This should typically not be changed from its @@ -2246,15 +2246,15 @@ export interface AzureCosmosDbChatExtensionConfiguration */ type: "azure_cosmos_db"; /** The parameters to use when configuring Azure OpenAI CosmosDB chat extensions. */ - parameters: AzureCosmosDbChatExtensionParameters; + parameters: AzureCosmosDBChatExtensionParameters; } -export function azureCosmosDbChatExtensionConfigurationSerializer( - item: AzureCosmosDbChatExtensionConfiguration, +export function azureCosmosDBChatExtensionConfigurationSerializer( + item: AzureCosmosDBChatExtensionConfiguration, ): any { return { type: item["type"], - parameters: azureCosmosDbChatExtensionParametersSerializer( + parameters: azureCosmosDBChatExtensionParametersSerializer( item["parameters"], ), }; @@ -2264,7 +2264,7 @@ export function azureCosmosDbChatExtensionConfigurationSerializer( * Parameters to use when configuring Azure OpenAI On Your Data chat extensions when using Azure Cosmos DB for * MongoDB vCore. The supported authentication type is ConnectionString. */ -export interface AzureCosmosDbChatExtensionParameters { +export interface AzureCosmosDBChatExtensionParameters { /** * The authentication method to use when accessing the defined data source. * Each data source type supports a specific set of available authentication methods; please see the documentation of @@ -2300,13 +2300,13 @@ export interface AzureCosmosDbChatExtensionParameters { /** The MongoDB vCore index name to use with Azure Cosmos DB. */ indexName: string; /** Customized field mapping behavior to use when interacting with the search index. */ - fieldsMapping: AzureCosmosDbFieldMappingOptions; + fieldsMapping: AzureCosmosDBFieldMappingOptions; /** The embedding dependency for vector search. */ embeddingDependency: OnYourDataVectorizationSourceUnion; } -export function azureCosmosDbChatExtensionParametersSerializer( - item: AzureCosmosDbChatExtensionParameters, +export function azureCosmosDBChatExtensionParametersSerializer( + item: AzureCosmosDBChatExtensionParameters, ): any { return { authentication: !item["authentication"] @@ -2326,7 +2326,7 @@ export function azureCosmosDbChatExtensionParametersSerializer( database_name: item["databaseName"], container_name: item["containerName"], index_name: item["indexName"], - fields_mapping: azureCosmosDbFieldMappingOptionsSerializer( + fields_mapping: azureCosmosDBFieldMappingOptionsSerializer( item["fieldsMapping"], ), embedding_dependency: onYourDataVectorizationSourceUnionSerializer( @@ -2336,7 +2336,7 @@ export function azureCosmosDbChatExtensionParametersSerializer( } /** Optional settings to control how fields are processed when using a configured Azure Cosmos DB resource. */ -export interface AzureCosmosDbFieldMappingOptions { +export interface AzureCosmosDBFieldMappingOptions { /** The name of the index field to use as a title. */ titleField?: string; /** The name of the index field to use as a URL. */ @@ -2351,8 +2351,8 @@ export interface AzureCosmosDbFieldMappingOptions { vectorFields: string[]; } -export function azureCosmosDbFieldMappingOptionsSerializer( - item: AzureCosmosDbFieldMappingOptions, +export function azureCosmosDBFieldMappingOptionsSerializer( + item: AzureCosmosDBFieldMappingOptions, ): any { return { title_field: item["titleField"], @@ -2642,7 +2642,7 @@ export interface AzureChatEnhancementConfiguration { /** A representation of the available options for the Azure OpenAI grounding enhancement. */ grounding?: AzureChatGroundingEnhancementConfiguration; /** A representation of the available options for the Azure OpenAI optical character recognition (OCR) enhancement. */ - ocr?: AzureChatOcrEnhancementConfiguration; + ocr?: AzureChatOCREnhancementConfiguration; } export function azureChatEnhancementConfigurationSerializer( @@ -2654,7 +2654,7 @@ export function azureChatEnhancementConfigurationSerializer( : azureChatGroundingEnhancementConfigurationSerializer(item["grounding"]), ocr: !item["ocr"] ? item["ocr"] - : azureChatOcrEnhancementConfigurationSerializer(item["ocr"]), + : azureChatOCREnhancementConfigurationSerializer(item["ocr"]), }; } @@ -2671,13 +2671,13 @@ export function azureChatGroundingEnhancementConfigurationSerializer( } /** A representation of the available options for the Azure OpenAI optical character recognition (OCR) enhancement. */ -export interface AzureChatOcrEnhancementConfiguration { +export interface AzureChatOCREnhancementConfiguration { /** Specifies whether the enhancement is enabled. */ enabled: boolean; } -export function azureChatOcrEnhancementConfigurationSerializer( - item: AzureChatOcrEnhancementConfiguration, +export function azureChatOCREnhancementConfigurationSerializer( + item: AzureChatOCREnhancementConfiguration, ): any { return { enabled: item["enabled"] }; } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts index f3741fb41c..822d86f5a4 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts @@ -42,7 +42,7 @@ import { import { Pipeline } from "@azure/core-rest-pipeline"; import { KeyCredential, TokenCredential } from "@azure/core-auth"; -export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts index f3741fb41c..822d86f5a4 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts @@ -42,7 +42,7 @@ import { import { Pipeline } from "@azure/core-rest-pipeline"; import { KeyCredential, TokenCredential } from "@azure/core-auth"; -export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md index 29eb50efda..9e1fd87315 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/README.md @@ -1,4 +1,4 @@ -# OpenAi client library for JavaScript +# OpenAI client library for JavaScript The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. @@ -14,7 +14,7 @@ Key links: ### Install the `@msinternal/openai-non-branded` package -Install the OpenAi client library for JavaScript with `npm`: +Install the OpenAI client library for JavaScript with `npm`: ```bash npm install @msinternal/openai-non-branded diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json index bf1f96bf14..1409040b6d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json @@ -1,7 +1,7 @@ { "name": "@msinternal/openai-non-branded", "version": "1.0.0-beta.1", - "description": "A generated SDK for OpenAiClient.", + "description": "A generated SDK for OpenAIClient.", "engines": { "node": ">=18.0.0" }, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index 2f23d5d97a..7b47a8b6d7 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -450,14 +450,14 @@ export interface FilesListOptionalParams extends OperationOptions { // @public export interface FilesOperations { // (undocumented) - create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; delete: (fileId: string, options?: FilesDeleteOptionalParams) => Promise; // (undocumented) download: (fileId: string, options?: FilesDownloadOptionalParams) => Promise; // (undocumented) list: (options?: FilesListOptionalParams) => Promise; // (undocumented) - retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; } // @public @@ -482,11 +482,11 @@ export interface FineTune { model: string; object: "fine-tune"; organizationId: string; - resultFiles: OpenAiFile[]; + resultFiles: OpenAIFile[]; status: "created" | "running" | "succeeded" | "failed" | "cancelled"; - trainingFiles: OpenAiFile[]; + trainingFiles: OpenAIFile[]; updatedAt: Date; - validationFiles: OpenAiFile[]; + validationFiles: OpenAIFile[]; } // @public @@ -660,7 +660,7 @@ export interface ImagesResponse { // @public export interface ListFilesResponse { // (undocumented) - data: OpenAiFile[]; + data: OpenAIFile[]; // (undocumented) object: string; } @@ -768,7 +768,7 @@ export interface OpenAIClientOptionalParams extends ClientOptions { } // @public -export interface OpenAiFile { +export interface OpenAIFile { bytes: number; createdAt: Date; filename: string; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts index 7dd8987eb0..8b00a519c6 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts @@ -9,8 +9,8 @@ import { FilesRetrieveOptionalParams, } from "../index.js"; import { - OpenAiFile, - openAiFileDeserializer, + OpenAIFile, + openAIFileDeserializer, ListFilesResponse, listFilesResponseDeserializer, CreateFileRequest, @@ -69,20 +69,20 @@ export function _createSend( export async function _createDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAiFileDeserializer(result.body); + return openAIFileDeserializer(result.body); } export async function create( context: Client, file: CreateFileRequest, options: FilesCreateOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _createSend(context, file, options); return _createDeserialize(result); } @@ -99,20 +99,20 @@ export function _retrieveSend( export async function _retrieveDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAiFileDeserializer(result.body); + return openAIFileDeserializer(result.body); } export async function retrieve( context: Client, fileId: string, options: FilesRetrieveOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _retrieveSend(context, fileId, options); return _retrieveDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts index 346c888b4f..0676bdf731 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts @@ -4,7 +4,7 @@ export { createOpenAI, OpenAIContext, OpenAIClientOptionalParams, -} from "./openAiContext.js"; +} from "./openAIContext.js"; export { AudioTranscriptionsCreateOptionalParams, AudioTranslationsCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts index e0b5b1cbfe..9273df0eda 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { AudioTranscriptionsOperations, getAudioTranscriptionsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts index 06114cad1b..023ea12464 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create } from "../../../api/audio/transcriptions/index.js"; import { AudioTranscriptionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts index 729ceecdf1..a09457762e 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create } from "../../../api/audio/translations/index.js"; import { AudioTranslationsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts index 1f06f689ba..b278f1fef9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create } from "../../../api/chat/completions/index.js"; import { ChatCompletionsCreateOptionalParams } from "../../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts index c87e57c82c..12a97ef1a8 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { ChatCompletionsOperations, getChatCompletionsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts index 31c271d104..04de4374c4 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/completions/index.js"; import { CompletionsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts index a946f30b7b..d69529a23b 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/edits/index.js"; import { EditsCreateOptionalParams } from "../../api/options.js"; import { CreateEditRequest, CreateEditResponse } from "../../models/models.js"; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts index 03469f22a3..dc9a1d3fb8 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/embeddings/index.js"; import { EmbeddingsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts index 5c35de25f9..af14b24f2d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { list, create, @@ -18,7 +18,7 @@ import { import { ListFilesResponse, CreateFileRequest, - OpenAiFile, + OpenAIFile, DeleteFileResponse, } from "../../models/models.js"; @@ -28,11 +28,11 @@ export interface FilesOperations { create: ( file: CreateFileRequest, options?: FilesCreateOptionalParams, - ) => Promise; + ) => Promise; retrieve: ( fileId: string, options?: FilesRetrieveOptionalParams, - ) => Promise; + ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts index 0b115fcfbd..8cc61c010c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts index a976ebf4de..601585f020 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { FineTuningJobsOperations, getFineTuningJobsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index 263685131d..daa86854a9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../../api/openAiContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { create, list, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts index d16cb06974..928fd8975d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create, createEdit, createVariation } from "../../api/images/index.js"; import { ImagesCreateOptionalParams, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts index 669ace90f6..e3ab15fc60 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { list, retrieve, $delete } from "../../api/models/index.js"; import { ModelsListOptionalParams, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts index 5763851792..17c69545e6 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -import { OpenAIContext } from "../../api/openAiContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { create } from "../../api/moderations/index.js"; import { ModerationsCreateOptionalParams } from "../../api/options.js"; import { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts index 1c7d8bf0be..a7763cb1ee 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT License. -export { OpenAIClient } from "./openAiClient.js"; +export { OpenAIClient } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, @@ -16,7 +16,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAiFile, + OpenAIFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts index 65f7601b0a..dd91a2687e 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts @@ -15,7 +15,7 @@ export { DeleteModelResponse, CreateFineTuneRequest, FineTune, - OpenAiFile, + OpenAIFile, FineTuneEvent, ListFineTunesResponse, ListFineTuneEventsResponse, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index 7bd33c5031..cd80803552 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -638,11 +638,11 @@ export interface FineTune { classificationNClasses?: number; }; /** The list of files used for training. */ - trainingFiles: OpenAiFile[]; + trainingFiles: OpenAIFile[]; /** The list of files used for validation. */ - validationFiles: OpenAiFile[]; + validationFiles: OpenAIFile[]; /** The compiled results files for the fine-tuning job. */ - resultFiles: OpenAiFile[]; + resultFiles: OpenAIFile[]; /** The list of events that have been observed in the lifecycle of the FineTune job. */ events?: FineTuneEvent[]; } @@ -658,9 +658,9 @@ export function fineTuneDeserializer(item: any): FineTune { organizationId: item["organization_id"], status: item["status"], hyperparams: _fineTuneHyperparamsDeserializer(item["hyperparams"]), - trainingFiles: openAiFileArrayDeserializer(item["training_files"]), - validationFiles: openAiFileArrayDeserializer(item["validation_files"]), - resultFiles: openAiFileArrayDeserializer(item["result_files"]), + trainingFiles: openAIFileArrayDeserializer(item["training_files"]), + validationFiles: openAIFileArrayDeserializer(item["validation_files"]), + resultFiles: openAIFileArrayDeserializer(item["result_files"]), events: !item["events"] ? item["events"] : fineTuneEventArrayDeserializer(item["events"]), @@ -706,7 +706,7 @@ export function _fineTuneHyperparamsDeserializer( } /** The `File` object represents a document that has been uploaded to OpenAI. */ -export interface OpenAiFile { +export interface OpenAIFile { /** The file identifier, which can be referenced in the API endpoints. */ id: string; /** The object type, which is always "file". */ @@ -737,7 +737,7 @@ export interface OpenAiFile { statusDetails?: string | null; } -export function openAiFileDeserializer(item: any): OpenAiFile { +export function openAIFileDeserializer(item: any): OpenAIFile { return { id: item["id"], object: item["object"], @@ -750,9 +750,9 @@ export function openAiFileDeserializer(item: any): OpenAiFile { }; } -export function openAiFileArrayDeserializer(result: Array): any[] { +export function openAIFileArrayDeserializer(result: Array): any[] { return result.map((item) => { - return openAiFileDeserializer(item); + return openAIFileDeserializer(item); }); } @@ -820,13 +820,13 @@ export function listFineTuneEventsResponseDeserializer( /** model interface ListFilesResponse */ export interface ListFilesResponse { object: string; - data: OpenAiFile[]; + data: OpenAIFile[]; } export function listFilesResponseDeserializer(item: any): ListFilesResponse { return { object: item["object"], - data: openAiFileArrayDeserializer(item["data"]), + data: openAIFileArrayDeserializer(item["data"]), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts index 065172c518..1f75c622e5 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts @@ -39,7 +39,7 @@ import { } from "./api/index.js"; import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; -export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts index 065172c518..1f75c622e5 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts @@ -39,7 +39,7 @@ import { } from "./api/index.js"; import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; -export { OpenAIClientOptionalParams } from "./api/openAiContext.js"; +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index da3bffc08d..53832b28db 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -50,7 +50,6 @@ import { isDiscriminatedUnion } from "./serialization/serializeUtils.js"; import { reportDiagnostic } from "../lib.js"; import { NoTarget } from "@typespec/compiler"; import { getTypeExpression, normalizeModelPropertyName } from "./type-expressions/get-type-expression.js"; -import { pascal } from "../utils/casingUtils.js"; type InterfaceStructure = OptionalKind & { extends?: string[]; @@ -309,7 +308,7 @@ function getExtensibleEnumDescription(model: SdkEnumType): string | undefined { function emitEnumMember(member: SdkEnumValueType): EnumMemberStructure { const memberStructure: EnumMemberStructure = { kind: StructureKind.EnumMember, - name: pascal(member.name), + name: normalizeName(member.name, NameType.EnumMemberName), value: member.value }; diff --git a/packages/typespec-ts/src/utils/casingUtils.ts b/packages/typespec-ts/src/utils/casingUtils.ts index d49e092758..839a290875 100644 --- a/packages/typespec-ts/src/utils/casingUtils.ts +++ b/packages/typespec-ts/src/utils/casingUtils.ts @@ -47,7 +47,7 @@ export function toPascalCase(name: string): string { return str.charAt(0).toUpperCase() + str.slice(1); } -function IsFullyUpperCase(identifier: string, maxUppercasePreserve: number) { +function isFullyUpperCase(identifier: string, maxUppercasePreserve: number = 10) { const len = identifier.length; if (len > 1) { if ( @@ -80,7 +80,7 @@ function deconstruct( .trim() .split(/[\W|_]+/) .map((each) => - IsFullyUpperCase(each, maxUppercasePreserve) ? each : each.toLowerCase() + isFullyUpperCase(each, maxUppercasePreserve) ? each : each.toLowerCase() ); } @@ -130,10 +130,10 @@ function normalize( } return typeof identifier === "string" ? normalize( - deconstruct(identifier, maxUppercasePreserve), - removeDuplicates, - maxUppercasePreserve - ) + deconstruct(identifier, maxUppercasePreserve), + removeDuplicates, + maxUppercasePreserve + ) : removeDuplicates ? removeSequentialDuplicates(identifier) : identifier; diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts index ef3592aaf7..59c15bb80b 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts @@ -165,11 +165,11 @@ export declare interface Int32SecondsDurationPropertyOutput { value: number; } -export declare interface Iso8601DurationProperty { +export declare interface ISO8601DurationProperty { value: string; } -export declare interface Iso8601DurationPropertyOutput { +export declare interface ISO8601DurationPropertyOutput { value: string; } @@ -254,11 +254,11 @@ export declare interface PropertyIso8601 { export declare interface PropertyIso8601200Response extends HttpResponse { status: "200"; - body: Iso8601DurationPropertyOutput; + body: ISO8601DurationPropertyOutput; } export declare interface PropertyIso8601BodyParam { - body: Iso8601DurationProperty; + body: ISO8601DurationProperty; } export declare type PropertyIso8601Parameters = PropertyIso8601BodyParam & RequestParameters; diff --git a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts index 293723062c..efb6c64c02 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts @@ -4,57 +4,57 @@ import { HttpResponse } from '@azure-rest/core-client'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; -export declare interface BytesGetNonNull { - get(options?: BytesGetNonNullParameters): StreamableMethod; - patch(options: BytesPatchNonNullParameters): StreamableMethod; +export declare interface BytesGetNonnull { + get(options?: BytesGetNonnullParameters): StreamableMethod; + patch(options: BytesPatchNonnullParameters): StreamableMethod; } -export declare interface BytesGetNonNull200Response extends HttpResponse { +export declare interface BytesGetNonnull200Response extends HttpResponse { status: "200"; body: BytesPropertyOutput; } -export declare type BytesGetNonNullParameters = RequestParameters; +export declare type BytesGetNonnullParameters = RequestParameters; -export declare interface BytesGetNull { - get(options?: BytesGetNullParameters): StreamableMethod; - patch(options: BytesPatchNullParameters): StreamableMethod; +export declare interface BytesGetnull { + get(options?: BytesGetnullParameters): StreamableMethod; + patch(options: BytesPatchnullParameters): StreamableMethod; } -export declare interface BytesGetNull200Response extends HttpResponse { +export declare interface BytesGetnull200Response extends HttpResponse { status: "200"; body: BytesPropertyOutput; } -export declare type BytesGetNullParameters = RequestParameters; +export declare type BytesGetnullParameters = RequestParameters; -export declare interface BytesPatchNonNull204Response extends HttpResponse { +export declare interface BytesPatchNonnull204Response extends HttpResponse { status: "204"; } -export declare interface BytesPatchNonNullBodyParam { +export declare interface BytesPatchNonnullBodyParam { body: BytesPropertyResourceMergeAndPatch; } -export declare interface BytesPatchNonNullMediaTypesParam { +export declare interface BytesPatchNonnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type BytesPatchNonNullParameters = BytesPatchNonNullMediaTypesParam & BytesPatchNonNullBodyParam & RequestParameters; +export declare type BytesPatchNonnullParameters = BytesPatchNonnullMediaTypesParam & BytesPatchNonnullBodyParam & RequestParameters; -export declare interface BytesPatchNull204Response extends HttpResponse { +export declare interface BytesPatchnull204Response extends HttpResponse { status: "204"; } -export declare interface BytesPatchNullBodyParam { +export declare interface BytesPatchnullBodyParam { body: BytesPropertyResourceMergeAndPatch; } -export declare interface BytesPatchNullMediaTypesParam { +export declare interface BytesPatchnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type BytesPatchNullParameters = BytesPatchNullMediaTypesParam & BytesPatchNullBodyParam & RequestParameters; +export declare type BytesPatchnullParameters = BytesPatchnullMediaTypesParam & BytesPatchnullBodyParam & RequestParameters; export declare interface BytesProperty { requiredProperty: string; @@ -68,57 +68,57 @@ export declare interface BytesPropertyOutput { export declare type BytesPropertyResourceMergeAndPatch = Partial; -export declare interface CollectionsByteGetNonNull { - get(options?: CollectionsByteGetNonNullParameters): StreamableMethod; - patch(options: CollectionsBytePatchNonNullParameters): StreamableMethod; +export declare interface CollectionsByteGetNonnull { + get(options?: CollectionsByteGetNonnullParameters): StreamableMethod; + patch(options: CollectionsBytePatchNonnullParameters): StreamableMethod; } -export declare interface CollectionsByteGetNonNull200Response extends HttpResponse { +export declare interface CollectionsByteGetNonnull200Response extends HttpResponse { status: "200"; body: CollectionsBytePropertyOutput; } -export declare type CollectionsByteGetNonNullParameters = RequestParameters; +export declare type CollectionsByteGetNonnullParameters = RequestParameters; -export declare interface CollectionsByteGetNull { - get(options?: CollectionsByteGetNullParameters): StreamableMethod; - patch(options: CollectionsBytePatchNullParameters): StreamableMethod; +export declare interface CollectionsByteGetnull { + get(options?: CollectionsByteGetnullParameters): StreamableMethod; + patch(options: CollectionsBytePatchnullParameters): StreamableMethod; } -export declare interface CollectionsByteGetNull200Response extends HttpResponse { +export declare interface CollectionsByteGetnull200Response extends HttpResponse { status: "200"; body: CollectionsBytePropertyOutput; } -export declare type CollectionsByteGetNullParameters = RequestParameters; +export declare type CollectionsByteGetnullParameters = RequestParameters; -export declare interface CollectionsBytePatchNonNull204Response extends HttpResponse { +export declare interface CollectionsBytePatchNonnull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsBytePatchNonNullBodyParam { +export declare interface CollectionsBytePatchNonnullBodyParam { body: CollectionsBytePropertyResourceMergeAndPatch; } -export declare interface CollectionsBytePatchNonNullMediaTypesParam { +export declare interface CollectionsBytePatchNonnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsBytePatchNonNullParameters = CollectionsBytePatchNonNullMediaTypesParam & CollectionsBytePatchNonNullBodyParam & RequestParameters; +export declare type CollectionsBytePatchNonnullParameters = CollectionsBytePatchNonnullMediaTypesParam & CollectionsBytePatchNonnullBodyParam & RequestParameters; -export declare interface CollectionsBytePatchNull204Response extends HttpResponse { +export declare interface CollectionsBytePatchnull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsBytePatchNullBodyParam { +export declare interface CollectionsBytePatchnullBodyParam { body: CollectionsBytePropertyResourceMergeAndPatch; } -export declare interface CollectionsBytePatchNullMediaTypesParam { +export declare interface CollectionsBytePatchnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsBytePatchNullParameters = CollectionsBytePatchNullMediaTypesParam & CollectionsBytePatchNullBodyParam & RequestParameters; +export declare type CollectionsBytePatchnullParameters = CollectionsBytePatchnullMediaTypesParam & CollectionsBytePatchnullBodyParam & RequestParameters; export declare interface CollectionsByteProperty { requiredProperty: string; @@ -132,57 +132,57 @@ export declare interface CollectionsBytePropertyOutput { export declare type CollectionsBytePropertyResourceMergeAndPatch = Partial; -export declare interface CollectionsModelGetNonNull { - get(options?: CollectionsModelGetNonNullParameters): StreamableMethod; - patch(options: CollectionsModelPatchNonNullParameters): StreamableMethod; +export declare interface CollectionsModelGetNonnull { + get(options?: CollectionsModelGetNonnullParameters): StreamableMethod; + patch(options: CollectionsModelPatchNonnullParameters): StreamableMethod; } -export declare interface CollectionsModelGetNonNull200Response extends HttpResponse { +export declare interface CollectionsModelGetNonnull200Response extends HttpResponse { status: "200"; body: CollectionsModelPropertyOutput; } -export declare type CollectionsModelGetNonNullParameters = RequestParameters; +export declare type CollectionsModelGetNonnullParameters = RequestParameters; -export declare interface CollectionsModelGetNull { - get(options?: CollectionsModelGetNullParameters): StreamableMethod; - patch(options: CollectionsModelPatchNullParameters): StreamableMethod; +export declare interface CollectionsModelGetnull { + get(options?: CollectionsModelGetnullParameters): StreamableMethod; + patch(options: CollectionsModelPatchnullParameters): StreamableMethod; } -export declare interface CollectionsModelGetNull200Response extends HttpResponse { +export declare interface CollectionsModelGetnull200Response extends HttpResponse { status: "200"; body: CollectionsModelPropertyOutput; } -export declare type CollectionsModelGetNullParameters = RequestParameters; +export declare type CollectionsModelGetnullParameters = RequestParameters; -export declare interface CollectionsModelPatchNonNull204Response extends HttpResponse { +export declare interface CollectionsModelPatchNonnull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsModelPatchNonNullBodyParam { +export declare interface CollectionsModelPatchNonnullBodyParam { body: CollectionsModelPropertyResourceMergeAndPatch; } -export declare interface CollectionsModelPatchNonNullMediaTypesParam { +export declare interface CollectionsModelPatchNonnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsModelPatchNonNullParameters = CollectionsModelPatchNonNullMediaTypesParam & CollectionsModelPatchNonNullBodyParam & RequestParameters; +export declare type CollectionsModelPatchNonnullParameters = CollectionsModelPatchNonnullMediaTypesParam & CollectionsModelPatchNonnullBodyParam & RequestParameters; -export declare interface CollectionsModelPatchNull204Response extends HttpResponse { +export declare interface CollectionsModelPatchnull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsModelPatchNullBodyParam { +export declare interface CollectionsModelPatchnullBodyParam { body: CollectionsModelPropertyResourceMergeAndPatch; } -export declare interface CollectionsModelPatchNullMediaTypesParam { +export declare interface CollectionsModelPatchnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsModelPatchNullParameters = CollectionsModelPatchNullMediaTypesParam & CollectionsModelPatchNullBodyParam & RequestParameters; +export declare type CollectionsModelPatchnullParameters = CollectionsModelPatchnullMediaTypesParam & CollectionsModelPatchnullBodyParam & RequestParameters; export declare interface CollectionsModelProperty { requiredProperty: string; @@ -196,57 +196,57 @@ export declare interface CollectionsModelPropertyOutput { export declare type CollectionsModelPropertyResourceMergeAndPatch = Partial; -export declare interface CollectionsStringGetNonNull { - get(options?: CollectionsStringGetNonNullParameters): StreamableMethod; - patch(options: CollectionsStringPatchNonNullParameters): StreamableMethod; +export declare interface CollectionsStringGetNonnull { + get(options?: CollectionsStringGetNonnullParameters): StreamableMethod; + patch(options: CollectionsStringPatchNonnullParameters): StreamableMethod; } -export declare interface CollectionsStringGetNonNull200Response extends HttpResponse { +export declare interface CollectionsStringGetNonnull200Response extends HttpResponse { status: "200"; body: CollectionsStringPropertyOutput; } -export declare type CollectionsStringGetNonNullParameters = RequestParameters; +export declare type CollectionsStringGetNonnullParameters = RequestParameters; -export declare interface CollectionsStringGetNull { - get(options?: CollectionsStringGetNullParameters): StreamableMethod; - patch(options: CollectionsStringPatchNullParameters): StreamableMethod; +export declare interface CollectionsStringGetnull { + get(options?: CollectionsStringGetnullParameters): StreamableMethod; + patch(options: CollectionsStringPatchnullParameters): StreamableMethod; } -export declare interface CollectionsStringGetNull200Response extends HttpResponse { +export declare interface CollectionsStringGetnull200Response extends HttpResponse { status: "200"; body: CollectionsStringPropertyOutput; } -export declare type CollectionsStringGetNullParameters = RequestParameters; +export declare type CollectionsStringGetnullParameters = RequestParameters; -export declare interface CollectionsStringPatchNonNull204Response extends HttpResponse { +export declare interface CollectionsStringPatchNonnull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsStringPatchNonNullBodyParam { +export declare interface CollectionsStringPatchNonnullBodyParam { body: CollectionsStringPropertyResourceMergeAndPatch; } -export declare interface CollectionsStringPatchNonNullMediaTypesParam { +export declare interface CollectionsStringPatchNonnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsStringPatchNonNullParameters = CollectionsStringPatchNonNullMediaTypesParam & CollectionsStringPatchNonNullBodyParam & RequestParameters; +export declare type CollectionsStringPatchNonnullParameters = CollectionsStringPatchNonnullMediaTypesParam & CollectionsStringPatchNonnullBodyParam & RequestParameters; -export declare interface CollectionsStringPatchNull204Response extends HttpResponse { +export declare interface CollectionsStringPatchnull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsStringPatchNullBodyParam { +export declare interface CollectionsStringPatchnullBodyParam { body: CollectionsStringPropertyResourceMergeAndPatch; } -export declare interface CollectionsStringPatchNullMediaTypesParam { +export declare interface CollectionsStringPatchnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsStringPatchNullParameters = CollectionsStringPatchNullMediaTypesParam & CollectionsStringPatchNullBodyParam & RequestParameters; +export declare type CollectionsStringPatchnullParameters = CollectionsStringPatchnullMediaTypesParam & CollectionsStringPatchnullBodyParam & RequestParameters; export declare interface CollectionsStringProperty { requiredProperty: string; @@ -263,57 +263,57 @@ export declare type CollectionsStringPropertyResourceMergeAndPatch = Partial; - patch(options: DatetimePatchNonNullParameters): StreamableMethod; +export declare interface DatetimeGetNonnull { + get(options?: DatetimeGetNonnullParameters): StreamableMethod; + patch(options: DatetimePatchNonnullParameters): StreamableMethod; } -export declare interface DatetimeGetNonNull200Response extends HttpResponse { +export declare interface DatetimeGetNonnull200Response extends HttpResponse { status: "200"; body: DatetimePropertyOutput; } -export declare type DatetimeGetNonNullParameters = RequestParameters; +export declare type DatetimeGetNonnullParameters = RequestParameters; -export declare interface DatetimeGetNull { - get(options?: DatetimeGetNullParameters): StreamableMethod; - patch(options: DatetimePatchNullParameters): StreamableMethod; +export declare interface DatetimeGetnull { + get(options?: DatetimeGetnullParameters): StreamableMethod; + patch(options: DatetimePatchnullParameters): StreamableMethod; } -export declare interface DatetimeGetNull200Response extends HttpResponse { +export declare interface DatetimeGetnull200Response extends HttpResponse { status: "200"; body: DatetimePropertyOutput; } -export declare type DatetimeGetNullParameters = RequestParameters; +export declare type DatetimeGetnullParameters = RequestParameters; -export declare interface DatetimePatchNonNull204Response extends HttpResponse { +export declare interface DatetimePatchNonnull204Response extends HttpResponse { status: "204"; } -export declare interface DatetimePatchNonNullBodyParam { +export declare interface DatetimePatchNonnullBodyParam { body: DatetimePropertyResourceMergeAndPatch; } -export declare interface DatetimePatchNonNullMediaTypesParam { +export declare interface DatetimePatchNonnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DatetimePatchNonNullParameters = DatetimePatchNonNullMediaTypesParam & DatetimePatchNonNullBodyParam & RequestParameters; +export declare type DatetimePatchNonnullParameters = DatetimePatchNonnullMediaTypesParam & DatetimePatchNonnullBodyParam & RequestParameters; -export declare interface DatetimePatchNull204Response extends HttpResponse { +export declare interface DatetimePatchnull204Response extends HttpResponse { status: "204"; } -export declare interface DatetimePatchNullBodyParam { +export declare interface DatetimePatchnullBodyParam { body: DatetimePropertyResourceMergeAndPatch; } -export declare interface DatetimePatchNullMediaTypesParam { +export declare interface DatetimePatchnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DatetimePatchNullParameters = DatetimePatchNullMediaTypesParam & DatetimePatchNullBodyParam & RequestParameters; +export declare type DatetimePatchnullParameters = DatetimePatchnullMediaTypesParam & DatetimePatchnullBodyParam & RequestParameters; export declare interface DatetimeProperty { requiredProperty: string; @@ -327,57 +327,57 @@ export declare interface DatetimePropertyOutput { export declare type DatetimePropertyResourceMergeAndPatch = Partial; -export declare interface DurationGetNonNull { - get(options?: DurationGetNonNullParameters): StreamableMethod; - patch(options: DurationPatchNonNullParameters): StreamableMethod; +export declare interface DurationGetNonnull { + get(options?: DurationGetNonnullParameters): StreamableMethod; + patch(options: DurationPatchNonnullParameters): StreamableMethod; } -export declare interface DurationGetNonNull200Response extends HttpResponse { +export declare interface DurationGetNonnull200Response extends HttpResponse { status: "200"; body: DurationPropertyOutput; } -export declare type DurationGetNonNullParameters = RequestParameters; +export declare type DurationGetNonnullParameters = RequestParameters; -export declare interface DurationGetNull { - get(options?: DurationGetNullParameters): StreamableMethod; - patch(options: DurationPatchNullParameters): StreamableMethod; +export declare interface DurationGetnull { + get(options?: DurationGetnullParameters): StreamableMethod; + patch(options: DurationPatchnullParameters): StreamableMethod; } -export declare interface DurationGetNull200Response extends HttpResponse { +export declare interface DurationGetnull200Response extends HttpResponse { status: "200"; body: DurationPropertyOutput; } -export declare type DurationGetNullParameters = RequestParameters; +export declare type DurationGetnullParameters = RequestParameters; -export declare interface DurationPatchNonNull204Response extends HttpResponse { +export declare interface DurationPatchNonnull204Response extends HttpResponse { status: "204"; } -export declare interface DurationPatchNonNullBodyParam { +export declare interface DurationPatchNonnullBodyParam { body: DurationPropertyResourceMergeAndPatch; } -export declare interface DurationPatchNonNullMediaTypesParam { +export declare interface DurationPatchNonnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DurationPatchNonNullParameters = DurationPatchNonNullMediaTypesParam & DurationPatchNonNullBodyParam & RequestParameters; +export declare type DurationPatchNonnullParameters = DurationPatchNonnullMediaTypesParam & DurationPatchNonnullBodyParam & RequestParameters; -export declare interface DurationPatchNull204Response extends HttpResponse { +export declare interface DurationPatchnull204Response extends HttpResponse { status: "204"; } -export declare interface DurationPatchNullBodyParam { +export declare interface DurationPatchnullBodyParam { body: DurationPropertyResourceMergeAndPatch; } -export declare interface DurationPatchNullMediaTypesParam { +export declare interface DurationPatchnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DurationPatchNullParameters = DurationPatchNullMediaTypesParam & DurationPatchNullBodyParam & RequestParameters; +export declare type DurationPatchnullParameters = DurationPatchnullMediaTypesParam & DurationPatchnullBodyParam & RequestParameters; export declare interface DurationProperty { requiredProperty: string; @@ -407,73 +407,73 @@ export declare interface NullableClientOptions extends ClientOptions { } export declare interface Routes { - (path: "/type/property/nullable/string/non-null"): StringModelGetNonNull; - (path: "/type/property/nullable/string/null"): StringModelGetNull; - (path: "/type/property/nullable/bytes/non-null"): BytesGetNonNull; - (path: "/type/property/nullable/bytes/null"): BytesGetNull; - (path: "/type/property/nullable/datetime/non-null"): DatetimeGetNonNull; - (path: "/type/property/nullable/datetime/null"): DatetimeGetNull; - (path: "/type/property/nullable/duration/non-null"): DurationGetNonNull; - (path: "/type/property/nullable/duration/null"): DurationGetNull; - (path: "/type/property/nullable/collections/bytes/non-null"): CollectionsByteGetNonNull; - (path: "/type/property/nullable/collections/bytes/null"): CollectionsByteGetNull; - (path: "/type/property/nullable/collections/model/non-null"): CollectionsModelGetNonNull; - (path: "/type/property/nullable/collections/model/null"): CollectionsModelGetNull; - (path: "/type/property/nullable/collections/string/non-null"): CollectionsStringGetNonNull; - (path: "/type/property/nullable/collections/string/null"): CollectionsStringGetNull; -} - -export declare interface StringModelGetNonNull { - get(options?: StringModelGetNonNullParameters): StreamableMethod; - patch(options: StringModelPatchNonNullParameters): StreamableMethod; -} - -export declare interface StringModelGetNonNull200Response extends HttpResponse { + (path: "/type/property/nullable/string/non-null"): StringModelGetNonnull; + (path: "/type/property/nullable/string/null"): StringModelGetnull; + (path: "/type/property/nullable/bytes/non-null"): BytesGetNonnull; + (path: "/type/property/nullable/bytes/null"): BytesGetnull; + (path: "/type/property/nullable/datetime/non-null"): DatetimeGetNonnull; + (path: "/type/property/nullable/datetime/null"): DatetimeGetnull; + (path: "/type/property/nullable/duration/non-null"): DurationGetNonnull; + (path: "/type/property/nullable/duration/null"): DurationGetnull; + (path: "/type/property/nullable/collections/bytes/non-null"): CollectionsByteGetNonnull; + (path: "/type/property/nullable/collections/bytes/null"): CollectionsByteGetnull; + (path: "/type/property/nullable/collections/model/non-null"): CollectionsModelGetNonnull; + (path: "/type/property/nullable/collections/model/null"): CollectionsModelGetnull; + (path: "/type/property/nullable/collections/string/non-null"): CollectionsStringGetNonnull; + (path: "/type/property/nullable/collections/string/null"): CollectionsStringGetnull; +} + +export declare interface StringModelGetNonnull { + get(options?: StringModelGetNonnullParameters): StreamableMethod; + patch(options: StringModelPatchNonnullParameters): StreamableMethod; +} + +export declare interface StringModelGetNonnull200Response extends HttpResponse { status: "200"; body: StringPropertyOutput; } -export declare type StringModelGetNonNullParameters = RequestParameters; +export declare type StringModelGetNonnullParameters = RequestParameters; -export declare interface StringModelGetNull { - get(options?: StringModelGetNullParameters): StreamableMethod; - patch(options: StringModelPatchNullParameters): StreamableMethod; +export declare interface StringModelGetnull { + get(options?: StringModelGetnullParameters): StreamableMethod; + patch(options: StringModelPatchnullParameters): StreamableMethod; } -export declare interface StringModelGetNull200Response extends HttpResponse { +export declare interface StringModelGetnull200Response extends HttpResponse { status: "200"; body: StringPropertyOutput; } -export declare type StringModelGetNullParameters = RequestParameters; +export declare type StringModelGetnullParameters = RequestParameters; -export declare interface StringModelPatchNonNull204Response extends HttpResponse { +export declare interface StringModelPatchNonnull204Response extends HttpResponse { status: "204"; } -export declare interface StringModelPatchNonNullBodyParam { +export declare interface StringModelPatchNonnullBodyParam { body: StringPropertyResourceMergeAndPatch; } -export declare interface StringModelPatchNonNullMediaTypesParam { +export declare interface StringModelPatchNonnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type StringModelPatchNonNullParameters = StringModelPatchNonNullMediaTypesParam & StringModelPatchNonNullBodyParam & RequestParameters; +export declare type StringModelPatchNonnullParameters = StringModelPatchNonnullMediaTypesParam & StringModelPatchNonnullBodyParam & RequestParameters; -export declare interface StringModelPatchNull204Response extends HttpResponse { +export declare interface StringModelPatchnull204Response extends HttpResponse { status: "204"; } -export declare interface StringModelPatchNullBodyParam { +export declare interface StringModelPatchnullBodyParam { body: StringPropertyResourceMergeAndPatch; } -export declare interface StringModelPatchNullMediaTypesParam { +export declare interface StringModelPatchnullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type StringModelPatchNullParameters = StringModelPatchNullMediaTypesParam & StringModelPatchNullBodyParam & RequestParameters; +export declare type StringModelPatchnullParameters = StringModelPatchnullMediaTypesParam & StringModelPatchnullBodyParam & RequestParameters; export declare interface StringProperty { requiredProperty: string; diff --git a/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts index 86db2bfebf..1dfcbcfd5c 100644 --- a/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts @@ -24,13 +24,13 @@ export declare interface DogOutput { } export declare interface EnumsOnlyCases { - lr: Lr | Ud; - ud: Ud | Ud; + lr: LR | UD; + ud: UD | UD; } export declare interface EnumsOnlyCasesOutput { - lr: LrOutput | UdOutput; - ud: UdOutput | UdOutput; + lr: LROutput | UDOutput; + ud: UDOutput | UDOutput; } export declare interface EnumsOnlyGet { @@ -111,9 +111,9 @@ export declare interface IntsOnlySendBodyParam { export declare type IntsOnlySendParameters = IntsOnlySendBodyParam & RequestParameters; -export declare type Lr = "left" | "right"; +export declare type LR = "left" | "right"; -export declare type LrOutput = "left" | "right"; +export declare type LROutput = "left" | "right"; export declare interface MixedLiteralsCases { stringLiteral: "a" | 2 | 3.3 | true; @@ -354,9 +354,9 @@ export declare interface StringsOnlySendBodyParam { export declare type StringsOnlySendParameters = StringsOnlySendBodyParam & RequestParameters; -export declare type Ud = "up" | "down"; +export declare type UD = "up" | "down"; -export declare type UdOutput = "up" | "down"; +export declare type UDOutput = "up" | "down"; export declare type UnionsClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts index 75e3945338..a17e3f37d4 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts @@ -19,19 +19,19 @@ export declare type PaymentMethods = "01"; export declare type PaymentMethodsOutput = "01"; -export declare interface RequestRegisterCc extends CommonRegistrationRequest { +export declare interface RequestRegisterCC extends CommonRegistrationRequest { payMethod: "01"; } -export declare interface RequestRegisterCcOutput extends CommonRegistrationRequestOutput { +export declare interface RequestRegisterCCOutput extends CommonRegistrationRequestOutput { payMethod: "01"; } -export declare interface RequestRegisterVa { +export declare interface RequestRegisterVA { prop: string; } -export declare interface RequestRegisterVaOutput { +export declare interface RequestRegisterVAOutput { prop: string; } @@ -45,7 +45,7 @@ export declare interface RequestUnionBody200Response extends HttpResponse { } export declare interface RequestUnionBodyBodyParam { - body: RequestRegisterCc | RequestRegisterVa; + body: RequestRegisterCC | RequestRegisterVA; } export declare type RequestUnionBodyParameters = RequestUnionBodyBodyParam & RequestParameters; @@ -56,7 +56,7 @@ export declare interface ResponseUnionBody { export declare interface ResponseUnionBody200Response extends HttpResponse { status: "200"; - body: RequestRegisterCcOutput | RequestRegisterVaOutput; + body: RequestRegisterCCOutput | RequestRegisterVAOutput; } export declare type ResponseUnionBodyParameters = RequestParameters; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts index a36f1361fb..6588f5f6d6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts @@ -16,7 +16,7 @@ export declare interface ClientModelLanguageOptionalParams extends OperationOpti export declare interface ClientModelOperations { client: (body: ClientModel, options?: ClientModelClientOptionalParams) => Promise; - language: (body: TsModel, options?: ClientModelLanguageOptionalParams) => Promise; + language: (body: TSModel, options?: ClientModelLanguageOptionalParams) => Promise; } export declare interface ClientNameAndJsonEncodedNameModel { @@ -39,7 +39,7 @@ export declare interface CompatibleWithEncodedNameOptionalParams extends Operati export declare type ExtensibleEnum = "value1" | "value2"; export declare interface LanguageClientNameModel { - tsName: boolean; + tSName: boolean; } export declare interface LanguageOptionalParams extends OperationOptions { @@ -72,7 +72,7 @@ export declare interface RequestOptionalParams extends OperationOptions { export declare interface ResponseOptionalParams extends OperationOptions { } -export declare interface TsModel { +export declare interface TSModel { defaultName: boolean; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts index 39d87c823d..d5d531d085 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts @@ -61,7 +61,7 @@ export declare interface Int32SecondsDurationProperty { value: number; } -export declare interface Iso8601DurationProperty { +export declare interface ISO8601DurationProperty { value: string; } @@ -85,7 +85,7 @@ export declare interface PropertyIso8601OptionalParams extends OperationOptions export declare interface PropertyOperations { default: (body: DefaultDurationProperty, options?: PropertyDefaultOptionalParams) => Promise; - iso8601: (body: Iso8601DurationProperty, options?: PropertyIso8601OptionalParams) => Promise; + iso8601: (body: ISO8601DurationProperty, options?: PropertyIso8601OptionalParams) => Promise; int32Seconds: (body: Int32SecondsDurationProperty, options?: PropertyInt32SecondsOptionalParams) => Promise; floatSeconds: (body: FloatSecondsDurationProperty, options?: PropertyFloatSecondsOptionalParams) => Promise; float64Seconds: (body: Float64SecondsDurationProperty, options?: PropertyFloat64SecondsOptionalParams) => Promise; diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts index 0b4736e016..21e9bdb2f7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts @@ -9,7 +9,7 @@ export declare class RepeatabilityClient { private _client; readonly pipeline: Pipeline; constructor(options?: RepeatabilityClientOptionalParams); - immediateSuccess(repeatabilityRequestId: string, repeatabilityFirstSent: Date, options?: ImmediateSuccessOptionalParams): Promise; + immediateSuccess(repeatabilityRequestID: string, repeatabilityFirstSent: Date, options?: ImmediateSuccessOptionalParams): Promise; } export declare interface RepeatabilityClientOptionalParams extends ClientOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts index 83cc4f64eb..a40fdd9e5b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts @@ -11,8 +11,8 @@ export declare interface Dog { } export declare interface EnumsOnlyCases { - lr: Lr | Ud; - ud: Ud; + lr: LR | UD; + ud: UD; } export declare interface EnumsOnlyGetOptionalParams extends OperationOptions { @@ -59,7 +59,7 @@ export declare enum KnownStringExtensibleNamedUnion { C = "c" } -export declare type Lr = "left" | "right"; +export declare type LR = "left" | "right"; export declare interface MixedLiteralsCases { stringLiteral: "a" | 2 | 3.3 | true; @@ -174,7 +174,7 @@ export declare interface StringsOnlyOperations { export declare interface StringsOnlySendOptionalParams extends OperationOptions { } -export declare type Ud = "up" | "down"; +export declare type UD = "up" | "down"; export declare class UnionClient { private _client; From 434d615e8308a91f53fb260df0585bd830d36ee2 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 31 Oct 2024 13:41:45 +0800 Subject: [PATCH 11/91] Remove useless codes --- packages/rlc-common/src/helpers/nameUtils.ts | 20 ---- .../rlc-common/test/helpers/nameUtils.spec.ts | 33 +++--- .../typespec-ts/src/modular/emitModels.ts | 5 +- packages/typespec-ts/src/utils/casingUtils.ts | 102 ------------------ 4 files changed, 22 insertions(+), 138 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 66ea8340ed..911fbed022 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -144,18 +144,7 @@ export function normalizeName( } const casingConvention = casingOverride ?? getCasingConvention(nameType); const parts = deconstruct(name); - // const parts = getNameParts(sanitizeName(name)); - console.log("parts", parts, name, getNameParts(sanitizeName(name))); const [firstPart, ...otherParts] = parts; - if (parts.length === 0) { - console.log( - "parts.length < 1", - parts, - name, - getNameParts(sanitizeName(name)) - ); - return name; - } const normalizedFirstPart = toCasing(firstPart, casingConvention); const normalizedParts = (otherParts || []) .map((part) => @@ -212,15 +201,6 @@ function checkBeginning(name: string): string { return name; } -function sanitizeName(name: string): string { - // Remove \, " and ' from name string - return name.replace(/["'\\]+/g, ""); -} - -function isNumericLiteralName(name: string) { - return (+name).toString() === name; -} - export function getModelsName(title: string): string { const spaceRemovedTitle = title.replace(/ /g, ""); return `${spaceRemovedTitle.replace("Client", "")}Models`; diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 9630593836..1e1a4bebeb 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -3,6 +3,20 @@ import "mocha"; import { NameType, normalizeName } from "../../src/helpers/nameUtils.js"; describe("#normalizeName", () => { + describe("for enum member name", () => { + it("should normalize the name with pascal case", () => { + expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName, true)).to.equal("AKVCertURI"); + expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName, true)).to.equal("AzureOpenAIOperationStateOutput"); + expect(normalizeName("TSModel", NameType.EnumMemberName, true)).to.equal("TSModel"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("ValidationNOTRequired"); + expect(normalizeName("ValidationNotRequired", NameType.EnumMemberName, true)).to.equal("ValidationNotRequired"); + expect(normalizeName("KnownPFTestResult", NameType.EnumMemberName, true)).to.equal("KnownPFTestResult"); + expect(normalizeName("repeatabilityRequestID", NameType.EnumMemberName, true)).to.equal("RepeatabilityRequestID"); + expect(normalizeName("C", NameType.EnumMemberName, true)).to.equal("C"); + expect(normalizeName("splitAllCSVs", NameType.EnumMemberName, true)).to.equal("SplitAllCSVs"); + expect(normalizeName("publicIPDisabled", NameType.EnumMemberName, true)).to.equal("PublicIPDisabled"); + }); + }); describe("for parameter", () => { it("should return the name with the suffix 'Param' if the name is a reserved name", () => { expect(normalizeName("static", NameType.Parameter, true)).to.equal( @@ -13,22 +27,12 @@ describe("#normalizeName", () => { ); }); - it.only("should normalize the name with camel case", () => { + it("should normalize the name with camel case", () => { expect(normalizeName("NodeVMExtension", NameType.Parameter, true)).to.equal("nodeVMExtension"); - expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName, true)).to.equal("AKVCertURI"); - expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName, true)).to.equal("AzureOpenAIOperationStateOutput"); - expect(normalizeName("TSModel", NameType.EnumMemberName, true)).to.equal("TSModel"); expect(normalizeName("TSModel", NameType.Property, true)).to.equal("tSModel"); expect(normalizeName("Base64urlArrayBytesProperty", NameType.Property, true)).to.equal("base64UrlArrayBytesProperty"); expect(normalizeName("ISO8601DurationProperty", NameType.Property, true)).to.equal("iSO8601DurationProperty"); - expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("ValidationNOTRequired"); - expect(normalizeName("ValidationNotRequired", NameType.EnumMemberName, true)).to.equal("ValidationNotRequired"); - expect(normalizeName("KnownPFTestResult", NameType.EnumMemberName, true)).to.equal("KnownPFTestResult"); - expect(normalizeName("repeatabilityRequestID", NameType.EnumMemberName, true)).to.equal("RepeatabilityRequestID"); - expect(normalizeName("C", NameType.EnumMemberName, true)).to.equal("C"); expect(normalizeName("C", NameType.Parameter, true)).to.equal("c"); - expect(normalizeName("splitAllCSVs", NameType.EnumMemberName, true)).to.equal("SplitAllCSVs"); - expect(normalizeName("publicIPDisabled", NameType.EnumMemberName, true)).to.equal("PublicIPDisabled"); expect(normalizeName("pascalCase", NameType.Parameter, true)).to.equal( "pascalCase" ); @@ -41,16 +45,15 @@ describe("#normalizeName", () => { expect(normalizeName("_pascal_case", NameType.Parameter, true)).to.equal( "pascalCase" ); - // expect(normalizeName("pascal, case", NameType.Parameter, true)).to.equal( - // "pascalCase" - // ); + expect(normalizeName("pascal, case", NameType.Parameter, true)).to.equal( + "pascalCase" + ); expect(normalizeName("MAX_of_MLD", NameType.Parameter, true)).to.equal( "mAXOfMLD" ); expect(normalizeName("___pascal____case6666", NameType.Parameter, true)).to.equal( "pascalCase6666" ); - expect(normalizeName("_10Pascal", NameType.Parameter, true)).to.equal( "10Pascal" ); diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 53832b28db..fcf0991bba 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -49,7 +49,10 @@ import { isExtensibleEnum } from "./type-expressions/get-enum-expression.js"; import { isDiscriminatedUnion } from "./serialization/serializeUtils.js"; import { reportDiagnostic } from "../lib.js"; import { NoTarget } from "@typespec/compiler"; -import { getTypeExpression, normalizeModelPropertyName } from "./type-expressions/get-type-expression.js"; +import { + getTypeExpression, + normalizeModelPropertyName +} from "./type-expressions/get-type-expression.js"; type InterfaceStructure = OptionalKind & { extends?: string[]; diff --git a/packages/typespec-ts/src/utils/casingUtils.ts b/packages/typespec-ts/src/utils/casingUtils.ts index 839a290875..7b67bfcfa3 100644 --- a/packages/typespec-ts/src/utils/casingUtils.ts +++ b/packages/typespec-ts/src/utils/casingUtils.ts @@ -46,105 +46,3 @@ export function toPascalCase(name: string): string { // Lowercase the first character return str.charAt(0).toUpperCase() + str.slice(1); } - -function isFullyUpperCase(identifier: string, maxUppercasePreserve: number = 10) { - const len = identifier.length; - if (len > 1) { - if ( - len <= maxUppercasePreserve && - identifier === identifier.toUpperCase() - ) { - return true; - } - - if (len <= maxUppercasePreserve + 1 && identifier.endsWith("s")) { - const i = identifier.substring(0, len - 1); - if (i.toUpperCase() === i) { - return true; - } - } - } - return false; -} - -function deconstruct( - identifier: string | Array, - maxUppercasePreserve: number -): Array { - return `${identifier}` - .replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar) - .replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123 => foo123 bar) - .replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, "$1$2« $3$4") // Add a space after a plural uppper cased word(e.g. MBsFoo => MBs Foo) - .replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, "$1 $2$3") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) - .replace(/«/g, "s") - .trim() - .split(/[\W|_]+/) - .map((each) => - isFullyUpperCase(each, maxUppercasePreserve) ? each : each.toLowerCase() - ); -} - -function isEqual(s1: string, s2: string): boolean { - // when s2 is undefined and s1 is the string 'undefined', it returns 0, making this true. - // To prevent that, first we need to check if s2 is undefined. - return ( - s2 !== undefined && - !!s1 && - !s1.localeCompare(s2, undefined, { sensitivity: "base" }) - ); -} - -function removeSequentialDuplicates(identifier: Iterable) { - const ids = [...identifier].filter((each) => !!each); - for (let i = 0; i < ids.length; i++) { - while (isEqual(ids[i]!, ids[i - 1]!)) { - ids.splice(i, 1); - } - while (isEqual(ids[i]!, ids[i - 2]!) && isEqual(ids[i + 1]!, ids[i - 1]!)) { - ids.splice(i, 2); - } - } - - return ids; -} -function applyFormat( - normalizedContent: Array, - overrides: Record = {}, - separator = "", - formatter: (s: string, i: number) => string = (s) => s -) { - return normalizedContent - .map( - (each, index) => overrides[each.toLowerCase()] || formatter(each, index) - ) - .join(separator); -} - -function normalize( - identifier: string | Array, - removeDuplicates = true, - maxUppercasePreserve = 0 -): Array { - if (!identifier || identifier.length === 0) { - return [""]; - } - return typeof identifier === "string" - ? normalize( - deconstruct(identifier, maxUppercasePreserve), - removeDuplicates, - maxUppercasePreserve - ) - : removeDuplicates - ? removeSequentialDuplicates(identifier) - : identifier; -} - -export function pascal(name: string) { - const words = normalize(deconstruct(name, 6), false, 6); - const form = applyFormat(words, {}, "", (each) => capitalize(each)); - return form; -} - -function capitalize(s: string): string { - return s ? `${s.charAt(0).toUpperCase()}${s.slice(1)}` : s; -} From 994156c4bfa3883ebfe2088b7df238b8587b561b Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 31 Oct 2024 13:49:36 +0800 Subject: [PATCH 12/91] Push un-necessary changes --- .../generated/typespec-ts/src/openAIClient.ts | 69 ------- .../generated/typespec-ts/src/openAiClient.ts | 69 ------- .../typespec-ts/src/api/openAIContext.ts | 49 ----- .../typespec-ts/src/api/openAiContext.ts | 49 ----- .../generated/typespec-ts/src/openAIClient.ts | 100 --------- .../generated/typespec-ts/src/openAiClient.ts | 100 --------- .../typespec-ts/src/api/openAIContext.ts | 58 ------ .../typespec-ts/src/api/openAiContext.ts | 58 ------ .../generated/typespec-ts/src/openAIClient.ts | 190 ------------------ .../generated/typespec-ts/src/openAiClient.ts | 190 ------------------ .../typespec-ts/src/api/openAIContext.ts | 51 ----- .../typespec-ts/src/api/openAiContext.ts | 51 ----- .../generated/typespec-ts/src/openAIClient.ts | 98 --------- .../generated/typespec-ts/src/openAiClient.ts | 98 --------- 14 files changed, 1230 deletions(-) delete mode 100644 packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts delete mode 100644 packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts delete mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts delete mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts delete mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts delete mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts delete mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts delete mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts delete mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts delete mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts delete mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts delete mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts delete mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts delete mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts deleted file mode 100644 index b690a0f57e..0000000000 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "./logger.js"; -import { TokenCredential, KeyCredential } from "@azure/core-auth"; -import { OpenAIClient } from "./clientDefinitions.js"; - -/** The optional parameters for the client */ -export interface OpenAIClientOptions extends ClientOptions { - /** The api version option of the client */ - apiVersion?: string; -} - -/** - * Initialize a new instance of `OpenAIClient` - * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus.api.cognitive.microsoft.com). - * @param credentials - uniquely identify client credential - * @param options - the parameter for all optional parameters - */ -export default function createClient( - endpointParam: string, - credentials: TokenCredential | KeyCredential, - { apiVersion = "2023-08-01-preview", ...options }: OpenAIClientOptions = {}, -): OpenAIClient { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; - const userAgentInfo = `azsdk-js-openai-rest/1.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - credentials: { - scopes: options.credentials?.scopes ?? [ - "https://cognitiveservices.azure.com/.default", - ], - apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", - }, - }; - const client = getClient(endpointUrl, credentials, options) as OpenAIClient; - - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - client.pipeline.addPolicy({ - name: "ClientApiVersionPolicy", - sendRequest: (req, next) => { - // Use the apiVersion defined in request url directly - // Append one if there is no apiVersion and we have one at client options - const url = new URL(req.url); - if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; - } - - return next(req); - }, - }); - - return client; -} diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts deleted file mode 100644 index b690a0f57e..0000000000 --- a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAiClient.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "./logger.js"; -import { TokenCredential, KeyCredential } from "@azure/core-auth"; -import { OpenAIClient } from "./clientDefinitions.js"; - -/** The optional parameters for the client */ -export interface OpenAIClientOptions extends ClientOptions { - /** The api version option of the client */ - apiVersion?: string; -} - -/** - * Initialize a new instance of `OpenAIClient` - * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus.api.cognitive.microsoft.com). - * @param credentials - uniquely identify client credential - * @param options - the parameter for all optional parameters - */ -export default function createClient( - endpointParam: string, - credentials: TokenCredential | KeyCredential, - { apiVersion = "2023-08-01-preview", ...options }: OpenAIClientOptions = {}, -): OpenAIClient { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; - const userAgentInfo = `azsdk-js-openai-rest/1.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - credentials: { - scopes: options.credentials?.scopes ?? [ - "https://cognitiveservices.azure.com/.default", - ], - apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", - }, - }; - const client = getClient(endpointUrl, credentials, options) as OpenAIClient; - - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - client.pipeline.addPolicy({ - name: "ClientApiVersionPolicy", - sendRequest: (req, next) => { - // Use the apiVersion defined in request url directly - // Append one if there is no apiVersion and we have one at client options - const url = new URL(req.url); - if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; - } - - return next(req); - }, - }); - - return client; -} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts deleted file mode 100644 index c3fd4009de..0000000000 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { logger } from "../logger.js"; -import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; -import { KeyCredential, isKeyCredential } from "@azure/core-auth"; - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export interface OpenAIContext extends Client {} - -/** Optional parameters for the client. */ -export interface OpenAIClientOptionalParams extends ClientOptions {} - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export function createOpenAI( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, -): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; - - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api` - : "azsdk-js-api"; - const { apiVersion: _, ...updatedOptions } = { - ...options, - userAgentOptions: { userAgentPrefix }, - loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, - }; - const clientContext = getClient(endpointUrl, undefined, updatedOptions); - - if (isKeyCredential(credential)) { - clientContext.pipeline.addPolicy({ - name: "customKeyCredentialPolicy", - sendRequest(request, next) { - request.headers.set("Authorization", "Bearer " + credential.key); - return next(request); - }, - }); - } - clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - logger.warning( - "This client does not support client api-version, please change it at the operation level", - ); - } - return clientContext; -} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts deleted file mode 100644 index c3fd4009de..0000000000 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAiContext.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { logger } from "../logger.js"; -import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; -import { KeyCredential, isKeyCredential } from "@azure/core-auth"; - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export interface OpenAIContext extends Client {} - -/** Optional parameters for the client. */ -export interface OpenAIClientOptionalParams extends ClientOptions {} - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export function createOpenAI( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, -): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; - - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api` - : "azsdk-js-api"; - const { apiVersion: _, ...updatedOptions } = { - ...options, - userAgentOptions: { userAgentPrefix }, - loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, - }; - const clientContext = getClient(endpointUrl, undefined, updatedOptions); - - if (isKeyCredential(credential)) { - clientContext.pipeline.addPolicy({ - name: "customKeyCredentialPolicy", - sendRequest(request, next) { - request.headers.set("Authorization", "Bearer " + credential.key); - return next(request); - }, - }); - } - clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - logger.warning( - "This client does not support client api-version, please change it at the operation level", - ); - } - return clientContext; -} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts deleted file mode 100644 index 2b85b3f2f6..0000000000 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; -import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; -import { - getFineTuningOperations, - FineTuningOperations, -} from "./classic/fineTuning/index.js"; -import { - getCompletionsOperations, - CompletionsOperations, -} from "./classic/completions/index.js"; -import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; -import { - getEmbeddingsOperations, - EmbeddingsOperations, -} from "./classic/embeddings/index.js"; -import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; -import { - getFineTunesOperations, - FineTunesOperations, -} from "./classic/fineTunes/index.js"; -import { - getModelsOperations, - ModelsOperations, -} from "./classic/models/index.js"; -import { - getImagesOperations, - ImagesOperations, -} from "./classic/images/index.js"; -import { - getModerationsOperations, - ModerationsOperations, -} from "./classic/moderations/index.js"; -import { - createOpenAI, - OpenAIContext, - OpenAIClientOptionalParams, -} from "./api/index.js"; -import { Pipeline } from "@azure/core-rest-pipeline"; -import { KeyCredential } from "@azure/core-auth"; - -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; - -export class OpenAIClient { - private _client: OpenAIContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ - constructor( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; - this._client = createOpenAI(credential, { - ...options, - userAgentOptions: { userAgentPrefix }, - }); - this.pipeline = this._client.pipeline; - this.audio = getAudioOperations(this._client); - this.chat = getChatOperations(this._client); - this.fineTuning = getFineTuningOperations(this._client); - this.completions = getCompletionsOperations(this._client); - this.edits = getEditsOperations(this._client); - this.embeddings = getEmbeddingsOperations(this._client); - this.files = getFilesOperations(this._client); - this.fineTunes = getFineTunesOperations(this._client); - this.models = getModelsOperations(this._client); - this.images = getImagesOperations(this._client); - this.moderations = getModerationsOperations(this._client); - } - - /** The operation groups for AudioTranscriptions */ - public readonly audio: AudioOperations; - /** The operation groups for ChatCompletions */ - public readonly chat: ChatOperations; - /** The operation groups for FineTuningJobs */ - public readonly fineTuning: FineTuningOperations; - /** The operation groups for Completions */ - public readonly completions: CompletionsOperations; - /** The operation groups for Edits */ - public readonly edits: EditsOperations; - /** The operation groups for Embeddings */ - public readonly embeddings: EmbeddingsOperations; - /** The operation groups for Files */ - public readonly files: FilesOperations; - /** The operation groups for FineTunes */ - public readonly fineTunes: FineTunesOperations; - /** The operation groups for Models */ - public readonly models: ModelsOperations; - /** The operation groups for Images */ - public readonly images: ImagesOperations; - /** The operation groups for Moderations */ - public readonly moderations: ModerationsOperations; -} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts deleted file mode 100644 index 2b85b3f2f6..0000000000 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAiClient.ts +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; -import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; -import { - getFineTuningOperations, - FineTuningOperations, -} from "./classic/fineTuning/index.js"; -import { - getCompletionsOperations, - CompletionsOperations, -} from "./classic/completions/index.js"; -import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; -import { - getEmbeddingsOperations, - EmbeddingsOperations, -} from "./classic/embeddings/index.js"; -import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; -import { - getFineTunesOperations, - FineTunesOperations, -} from "./classic/fineTunes/index.js"; -import { - getModelsOperations, - ModelsOperations, -} from "./classic/models/index.js"; -import { - getImagesOperations, - ImagesOperations, -} from "./classic/images/index.js"; -import { - getModerationsOperations, - ModerationsOperations, -} from "./classic/moderations/index.js"; -import { - createOpenAI, - OpenAIContext, - OpenAIClientOptionalParams, -} from "./api/index.js"; -import { Pipeline } from "@azure/core-rest-pipeline"; -import { KeyCredential } from "@azure/core-auth"; - -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; - -export class OpenAIClient { - private _client: OpenAIContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ - constructor( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; - this._client = createOpenAI(credential, { - ...options, - userAgentOptions: { userAgentPrefix }, - }); - this.pipeline = this._client.pipeline; - this.audio = getAudioOperations(this._client); - this.chat = getChatOperations(this._client); - this.fineTuning = getFineTuningOperations(this._client); - this.completions = getCompletionsOperations(this._client); - this.edits = getEditsOperations(this._client); - this.embeddings = getEmbeddingsOperations(this._client); - this.files = getFilesOperations(this._client); - this.fineTunes = getFineTunesOperations(this._client); - this.models = getModelsOperations(this._client); - this.images = getImagesOperations(this._client); - this.moderations = getModerationsOperations(this._client); - } - - /** The operation groups for AudioTranscriptions */ - public readonly audio: AudioOperations; - /** The operation groups for ChatCompletions */ - public readonly chat: ChatOperations; - /** The operation groups for FineTuningJobs */ - public readonly fineTuning: FineTuningOperations; - /** The operation groups for Completions */ - public readonly completions: CompletionsOperations; - /** The operation groups for Edits */ - public readonly edits: EditsOperations; - /** The operation groups for Embeddings */ - public readonly embeddings: EmbeddingsOperations; - /** The operation groups for Files */ - public readonly files: FilesOperations; - /** The operation groups for FineTunes */ - public readonly fineTunes: FineTunesOperations; - /** The operation groups for Models */ - public readonly models: ModelsOperations; - /** The operation groups for Images */ - public readonly images: ImagesOperations; - /** The operation groups for Moderations */ - public readonly moderations: ModerationsOperations; -} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts deleted file mode 100644 index 53d95cbb55..0000000000 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { logger } from "../logger.js"; -import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; -import { KeyCredential, TokenCredential } from "@azure/core-auth"; - -export interface OpenAIContext extends Client {} - -/** Optional parameters for the client. */ -export interface OpenAIClientOptionalParams extends ClientOptions { - /** The API version to use for this operation. */ - apiVersion?: string; -} - -export function createOpenAI( - endpointParam: string, - credential: KeyCredential | TokenCredential, - options: OpenAIClientOptionalParams = {}, -): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; - - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api` - : "azsdk-js-api"; - const { apiVersion: _, ...updatedOptions } = { - ...options, - userAgentOptions: { userAgentPrefix }, - loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, - credentials: { - scopes: options.credentials?.scopes ?? [ - "https://cognitiveservices.azure.com/.default", - ], - apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", - }, - }; - const clientContext = getClient(endpointUrl, credential, updatedOptions); - clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - const apiVersion = options.apiVersion ?? "2024-06-01"; - clientContext.pipeline.addPolicy({ - name: "ClientApiVersionPolicy", - sendRequest: (req, next) => { - // Use the apiVersion defined in request url directly - // Append one if there is no apiVersion and we have one at client options - const url = new URL(req.url); - if (!url.searchParams.get("api-version")) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; - } - - return next(req); - }, - }); - return clientContext; -} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts deleted file mode 100644 index 53d95cbb55..0000000000 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAiContext.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { logger } from "../logger.js"; -import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; -import { KeyCredential, TokenCredential } from "@azure/core-auth"; - -export interface OpenAIContext extends Client {} - -/** Optional parameters for the client. */ -export interface OpenAIClientOptionalParams extends ClientOptions { - /** The API version to use for this operation. */ - apiVersion?: string; -} - -export function createOpenAI( - endpointParam: string, - credential: KeyCredential | TokenCredential, - options: OpenAIClientOptionalParams = {}, -): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; - - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api` - : "azsdk-js-api"; - const { apiVersion: _, ...updatedOptions } = { - ...options, - userAgentOptions: { userAgentPrefix }, - loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, - credentials: { - scopes: options.credentials?.scopes ?? [ - "https://cognitiveservices.azure.com/.default", - ], - apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", - }, - }; - const clientContext = getClient(endpointUrl, credential, updatedOptions); - clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - const apiVersion = options.apiVersion ?? "2024-06-01"; - clientContext.pipeline.addPolicy({ - name: "ClientApiVersionPolicy", - sendRequest: (req, next) => { - // Use the apiVersion defined in request url directly - // Append one if there is no apiVersion and we have one at client options - const url = new URL(req.url); - if (!url.searchParams.get("api-version")) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; - } - - return next(req); - }, - }); - return clientContext; -} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts deleted file mode 100644 index 822d86f5a4..0000000000 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - createOpenAI, - OpenAIContext, - OpenAIClientOptionalParams, - getAudioTranscriptionAsPlainText, - getAudioTranscriptionAsResponseObject, - getAudioTranslationAsPlainText, - getAudioTranslationAsResponseObject, - getCompletions, - getChatCompletions, - getImageGenerations, - generateSpeechFromText, - getEmbeddings, - GetAudioTranscriptionAsPlainTextOptionalParams, - GetAudioTranscriptionAsResponseObjectOptionalParams, - GetAudioTranslationAsPlainTextOptionalParams, - GetAudioTranslationAsResponseObjectOptionalParams, - GetCompletionsOptionalParams, - GetChatCompletionsOptionalParams, - GetImageGenerationsOptionalParams, - GenerateSpeechFromTextOptionalParams, - GetEmbeddingsOptionalParams, -} from "./api/index.js"; -import { - AudioTranscriptionOptions, - AudioTranscription, - AudioTranslationOptions, - AudioTranslation, - CompletionsOptions, - Completions, - ChatCompletionsOptions, - ChatCompletions, - ImageGenerationOptions, - ImageGenerations, - SpeechGenerationOptions, - EmbeddingsOptions, - Embeddings, -} from "./models/models.js"; -import { Pipeline } from "@azure/core-rest-pipeline"; -import { KeyCredential, TokenCredential } from "@azure/core-auth"; - -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; - -export class OpenAIClient { - private _client: OpenAIContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - constructor( - endpointParam: string, - credential: KeyCredential | TokenCredential, - options: OpenAIClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; - this._client = createOpenAI(endpointParam, credential, { - ...options, - userAgentOptions: { userAgentPrefix }, - }); - this.pipeline = this._client.pipeline; - } - - /** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. - */ - getAudioTranscriptionAsPlainText( - deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranscriptionAsPlainText( - this._client, - deploymentId, - body, - options, - ); - } - - /** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. - */ - getAudioTranscriptionAsResponseObject( - deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranscriptionAsResponseObject( - this._client, - deploymentId, - body, - options, - ); - } - - /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ - getAudioTranslationAsPlainText( - deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsPlainTextOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranslationAsPlainText( - this._client, - deploymentId, - body, - options, - ); - } - - /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ - getAudioTranslationAsResponseObject( - deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranslationAsResponseObject( - this._client, - deploymentId, - body, - options, - ); - } - - /** - * Gets completions for the provided input prompts. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. - */ - getCompletions( - deploymentId: string, - body: CompletionsOptions, - options: GetCompletionsOptionalParams = { requestOptions: {} }, - ): Promise { - return getCompletions(this._client, deploymentId, body, options); - } - - /** - * Gets chat completions for the provided chat messages. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. - */ - getChatCompletions( - deploymentId: string, - body: ChatCompletionsOptions, - options: GetChatCompletionsOptionalParams = { requestOptions: {} }, - ): Promise { - return getChatCompletions(this._client, deploymentId, body, options); - } - - /** Creates an image given a prompt. */ - getImageGenerations( - deploymentId: string, - body: ImageGenerationOptions, - options: GetImageGenerationsOptionalParams = { requestOptions: {} }, - ): Promise { - return getImageGenerations(this._client, deploymentId, body, options); - } - - /** Generates text-to-speech audio from the input text. */ - generateSpeechFromText( - deploymentId: string, - body: SpeechGenerationOptions, - options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, - ): Promise { - return generateSpeechFromText(this._client, deploymentId, body, options); - } - - /** Return the embeddings for a given prompt. */ - getEmbeddings( - deploymentId: string, - body: EmbeddingsOptions, - options: GetEmbeddingsOptionalParams = { requestOptions: {} }, - ): Promise { - return getEmbeddings(this._client, deploymentId, body, options); - } -} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts deleted file mode 100644 index 822d86f5a4..0000000000 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAiClient.ts +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - createOpenAI, - OpenAIContext, - OpenAIClientOptionalParams, - getAudioTranscriptionAsPlainText, - getAudioTranscriptionAsResponseObject, - getAudioTranslationAsPlainText, - getAudioTranslationAsResponseObject, - getCompletions, - getChatCompletions, - getImageGenerations, - generateSpeechFromText, - getEmbeddings, - GetAudioTranscriptionAsPlainTextOptionalParams, - GetAudioTranscriptionAsResponseObjectOptionalParams, - GetAudioTranslationAsPlainTextOptionalParams, - GetAudioTranslationAsResponseObjectOptionalParams, - GetCompletionsOptionalParams, - GetChatCompletionsOptionalParams, - GetImageGenerationsOptionalParams, - GenerateSpeechFromTextOptionalParams, - GetEmbeddingsOptionalParams, -} from "./api/index.js"; -import { - AudioTranscriptionOptions, - AudioTranscription, - AudioTranslationOptions, - AudioTranslation, - CompletionsOptions, - Completions, - ChatCompletionsOptions, - ChatCompletions, - ImageGenerationOptions, - ImageGenerations, - SpeechGenerationOptions, - EmbeddingsOptions, - Embeddings, -} from "./models/models.js"; -import { Pipeline } from "@azure/core-rest-pipeline"; -import { KeyCredential, TokenCredential } from "@azure/core-auth"; - -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; - -export class OpenAIClient { - private _client: OpenAIContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - constructor( - endpointParam: string, - credential: KeyCredential | TokenCredential, - options: OpenAIClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; - this._client = createOpenAI(endpointParam, credential, { - ...options, - userAgentOptions: { userAgentPrefix }, - }); - this.pipeline = this._client.pipeline; - } - - /** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. - */ - getAudioTranscriptionAsPlainText( - deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranscriptionAsPlainText( - this._client, - deploymentId, - body, - options, - ); - } - - /** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. - */ - getAudioTranscriptionAsResponseObject( - deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranscriptionAsResponseObject( - this._client, - deploymentId, - body, - options, - ); - } - - /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ - getAudioTranslationAsPlainText( - deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsPlainTextOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranslationAsPlainText( - this._client, - deploymentId, - body, - options, - ); - } - - /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ - getAudioTranslationAsResponseObject( - deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranslationAsResponseObject( - this._client, - deploymentId, - body, - options, - ); - } - - /** - * Gets completions for the provided input prompts. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. - */ - getCompletions( - deploymentId: string, - body: CompletionsOptions, - options: GetCompletionsOptionalParams = { requestOptions: {} }, - ): Promise { - return getCompletions(this._client, deploymentId, body, options); - } - - /** - * Gets chat completions for the provided chat messages. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. - */ - getChatCompletions( - deploymentId: string, - body: ChatCompletionsOptions, - options: GetChatCompletionsOptionalParams = { requestOptions: {} }, - ): Promise { - return getChatCompletions(this._client, deploymentId, body, options); - } - - /** Creates an image given a prompt. */ - getImageGenerations( - deploymentId: string, - body: ImageGenerationOptions, - options: GetImageGenerationsOptionalParams = { requestOptions: {} }, - ): Promise { - return getImageGenerations(this._client, deploymentId, body, options); - } - - /** Generates text-to-speech audio from the input text. */ - generateSpeechFromText( - deploymentId: string, - body: SpeechGenerationOptions, - options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, - ): Promise { - return generateSpeechFromText(this._client, deploymentId, body, options); - } - - /** Return the embeddings for a given prompt. */ - getEmbeddings( - deploymentId: string, - body: EmbeddingsOptions, - options: GetEmbeddingsOptionalParams = { requestOptions: {} }, - ): Promise { - return getEmbeddings(this._client, deploymentId, body, options); - } -} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts deleted file mode 100644 index 3b90d01f83..0000000000 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed under the MIT License. - -import { - Client, - ClientOptions, - getClient, - KeyCredential, - isKeyCredential, -} from "@typespec/ts-http-runtime"; - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export interface OpenAIContext extends Client {} - -/** Optional parameters for the client. */ -export interface OpenAIClientOptionalParams extends ClientOptions {} - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export function createOpenAI( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, -): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; - - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api` - : "azsdk-js-api"; - const { apiVersion: _, ...updatedOptions } = { - ...options, - userAgentOptions: { userAgentPrefix }, - }; - const clientContext = getClient(endpointUrl, undefined, updatedOptions); - - if (isKeyCredential(credential)) { - clientContext.pipeline.addPolicy({ - name: "customKeyCredentialPolicy", - sendRequest(request, next) { - request.headers.set("Authorization", "Bearer " + credential.key); - return next(request); - }, - }); - } - clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - console.warn( - "This client does not support client api-version, please change it at the operation level", - ); - } - return clientContext; -} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts deleted file mode 100644 index 3b90d01f83..0000000000 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAiContext.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed under the MIT License. - -import { - Client, - ClientOptions, - getClient, - KeyCredential, - isKeyCredential, -} from "@typespec/ts-http-runtime"; - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export interface OpenAIContext extends Client {} - -/** Optional parameters for the client. */ -export interface OpenAIClientOptionalParams extends ClientOptions {} - -/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ -export function createOpenAI( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, -): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; - - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api` - : "azsdk-js-api"; - const { apiVersion: _, ...updatedOptions } = { - ...options, - userAgentOptions: { userAgentPrefix }, - }; - const clientContext = getClient(endpointUrl, undefined, updatedOptions); - - if (isKeyCredential(credential)) { - clientContext.pipeline.addPolicy({ - name: "customKeyCredentialPolicy", - sendRequest(request, next) { - request.headers.set("Authorization", "Bearer " + credential.key); - return next(request); - }, - }); - } - clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - console.warn( - "This client does not support client api-version, please change it at the operation level", - ); - } - return clientContext; -} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts deleted file mode 100644 index 1f75c622e5..0000000000 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed under the MIT License. - -import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; -import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; -import { - getFineTuningOperations, - FineTuningOperations, -} from "./classic/fineTuning/index.js"; -import { - getCompletionsOperations, - CompletionsOperations, -} from "./classic/completions/index.js"; -import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; -import { - getEmbeddingsOperations, - EmbeddingsOperations, -} from "./classic/embeddings/index.js"; -import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; -import { - getFineTunesOperations, - FineTunesOperations, -} from "./classic/fineTunes/index.js"; -import { - getModelsOperations, - ModelsOperations, -} from "./classic/models/index.js"; -import { - getImagesOperations, - ImagesOperations, -} from "./classic/images/index.js"; -import { - getModerationsOperations, - ModerationsOperations, -} from "./classic/moderations/index.js"; -import { - createOpenAI, - OpenAIContext, - OpenAIClientOptionalParams, -} from "./api/index.js"; -import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; - -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; - -export class OpenAIClient { - private _client: OpenAIContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ - constructor( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; - this._client = createOpenAI(credential, { - ...options, - userAgentOptions: { userAgentPrefix }, - }); - this.pipeline = this._client.pipeline; - this.audio = getAudioOperations(this._client); - this.chat = getChatOperations(this._client); - this.fineTuning = getFineTuningOperations(this._client); - this.completions = getCompletionsOperations(this._client); - this.edits = getEditsOperations(this._client); - this.embeddings = getEmbeddingsOperations(this._client); - this.files = getFilesOperations(this._client); - this.fineTunes = getFineTunesOperations(this._client); - this.models = getModelsOperations(this._client); - this.images = getImagesOperations(this._client); - this.moderations = getModerationsOperations(this._client); - } - - /** The operation groups for AudioTranscriptions */ - public readonly audio: AudioOperations; - /** The operation groups for ChatCompletions */ - public readonly chat: ChatOperations; - /** The operation groups for FineTuningJobs */ - public readonly fineTuning: FineTuningOperations; - /** The operation groups for Completions */ - public readonly completions: CompletionsOperations; - /** The operation groups for Edits */ - public readonly edits: EditsOperations; - /** The operation groups for Embeddings */ - public readonly embeddings: EmbeddingsOperations; - /** The operation groups for Files */ - public readonly files: FilesOperations; - /** The operation groups for FineTunes */ - public readonly fineTunes: FineTunesOperations; - /** The operation groups for Models */ - public readonly models: ModelsOperations; - /** The operation groups for Images */ - public readonly images: ImagesOperations; - /** The operation groups for Moderations */ - public readonly moderations: ModerationsOperations; -} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts deleted file mode 100644 index 1f75c622e5..0000000000 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAiClient.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed under the MIT License. - -import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; -import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; -import { - getFineTuningOperations, - FineTuningOperations, -} from "./classic/fineTuning/index.js"; -import { - getCompletionsOperations, - CompletionsOperations, -} from "./classic/completions/index.js"; -import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; -import { - getEmbeddingsOperations, - EmbeddingsOperations, -} from "./classic/embeddings/index.js"; -import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; -import { - getFineTunesOperations, - FineTunesOperations, -} from "./classic/fineTunes/index.js"; -import { - getModelsOperations, - ModelsOperations, -} from "./classic/models/index.js"; -import { - getImagesOperations, - ImagesOperations, -} from "./classic/images/index.js"; -import { - getModerationsOperations, - ModerationsOperations, -} from "./classic/moderations/index.js"; -import { - createOpenAI, - OpenAIContext, - OpenAIClientOptionalParams, -} from "./api/index.js"; -import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; - -export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; - -export class OpenAIClient { - private _client: OpenAIContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ - constructor( - credential: KeyCredential, - options: OpenAIClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; - this._client = createOpenAI(credential, { - ...options, - userAgentOptions: { userAgentPrefix }, - }); - this.pipeline = this._client.pipeline; - this.audio = getAudioOperations(this._client); - this.chat = getChatOperations(this._client); - this.fineTuning = getFineTuningOperations(this._client); - this.completions = getCompletionsOperations(this._client); - this.edits = getEditsOperations(this._client); - this.embeddings = getEmbeddingsOperations(this._client); - this.files = getFilesOperations(this._client); - this.fineTunes = getFineTunesOperations(this._client); - this.models = getModelsOperations(this._client); - this.images = getImagesOperations(this._client); - this.moderations = getModerationsOperations(this._client); - } - - /** The operation groups for AudioTranscriptions */ - public readonly audio: AudioOperations; - /** The operation groups for ChatCompletions */ - public readonly chat: ChatOperations; - /** The operation groups for FineTuningJobs */ - public readonly fineTuning: FineTuningOperations; - /** The operation groups for Completions */ - public readonly completions: CompletionsOperations; - /** The operation groups for Edits */ - public readonly edits: EditsOperations; - /** The operation groups for Embeddings */ - public readonly embeddings: EmbeddingsOperations; - /** The operation groups for Files */ - public readonly files: FilesOperations; - /** The operation groups for FineTunes */ - public readonly fineTunes: FineTunesOperations; - /** The operation groups for Models */ - public readonly models: ModelsOperations; - /** The operation groups for Images */ - public readonly images: ImagesOperations; - /** The operation groups for Moderations */ - public readonly moderations: ModerationsOperations; -} From ce76162175252acdc8b1956f69dfb7ddf5b7e596 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 31 Oct 2024 13:51:34 +0800 Subject: [PATCH 13/91] Refactor useless codes --- packages/rlc-common/src/helpers/nameUtils.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 911fbed022..182be058eb 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -234,10 +234,6 @@ function getCasingConvention(nameType: NameType) { */ function toCasing(str: string, casing: CasingConvention): string { const value = str; - // if (value === value.toUpperCase()) { - // value = str.toLowerCase(); - // } - const firstChar = casing === CasingConvention.Pascal ? value.charAt(0).toUpperCase() @@ -245,12 +241,6 @@ function toCasing(str: string, casing: CasingConvention): string { return `${firstChar}${value.substring(1)}`; } -function getNameParts(name: string) { - const parts = name.split(/[-._ ]+/).filter((part) => part.trim().length > 0); - - return parts.length > 0 ? parts : [name]; -} - export function pascalCase(str: string) { return str.charAt(0).toUpperCase() + str.slice(1); } From 30aa59731c10cbf932943264ee3fe7db554b9478 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:22:41 +0800 Subject: [PATCH 14/91] fix ci RLC generation --- .../bodyComplexRest/src/clientDefinitions.ts | 8 +- .../bodyComplexRest/src/parameters.ts | 4 +- .../bodyComplexRest/src/responses.ts | 8 +- .../bodyStringRest/src/clientDefinitions.ts | 8 +- .../bodyStringRest/src/parameters.ts | 12 +- .../generated/bodyStringRest/src/responses.ts | 12 +- .../generated/lroRest/src/parameters.ts | 46 +++---- .../generated/pagingRest/src/parameters.ts | 2 +- .../generated/pagingRest/src/responses.ts | 4 +- .../urlRest/src/clientDefinitions.ts | 114 +++++++-------- .../generated/urlRest/src/parameters.ts | 130 +++++++++--------- .../generated/urlRest/src/responses.ts | 76 +++++----- .../generated/urlRest/src/urlRestClient.ts | 38 ++--- 13 files changed, 231 insertions(+), 231 deletions(-) diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts index 93b1ac5e2b..167db5c891 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts @@ -198,7 +198,7 @@ export interface BasicGetEmpty { ): StreamableMethod; } -export interface BasicGetNull { +export interface BasicGetnull { /** Get a basic complex type whose properties are null */ get( options?: BasicGetNullParameters, @@ -442,7 +442,7 @@ export interface DictionaryGetEmpty { >; } -export interface DictionaryGetNull { +export interface DictionaryGetnull { /** Get complex types with dictionary property which is null */ get( options?: DictionaryGetNullParameters, @@ -606,7 +606,7 @@ export interface Routes { /** Resource for '/complex/basic/empty' has methods for the following verbs: get */ (path: "/complex/basic/empty"): BasicGetEmpty; /** Resource for '/complex/basic/null' has methods for the following verbs: get */ - (path: "/complex/basic/null"): BasicGetNull; + (path: "/complex/basic/null"): BasicGetnull; /** Resource for '/complex/basic/notprovided' has methods for the following verbs: get */ (path: "/complex/basic/notprovided"): BasicGetNotProvided; /** Resource for '/complex/primitive/integer' has methods for the following verbs: get, put */ @@ -642,7 +642,7 @@ export interface Routes { /** Resource for '/complex/dictionary/typed/empty' has methods for the following verbs: get, put */ (path: "/complex/dictionary/typed/empty"): DictionaryGetEmpty; /** Resource for '/complex/dictionary/typed/null' has methods for the following verbs: get */ - (path: "/complex/dictionary/typed/null"): DictionaryGetNull; + (path: "/complex/dictionary/typed/null"): DictionaryGetnull; /** Resource for '/complex/dictionary/typed/notprovided' has methods for the following verbs: get */ (path: "/complex/dictionary/typed/notprovided"): DictionaryGetNotProvided; /** Resource for '/complex/inheritance/valid' has methods for the following verbs: get, put */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts index 85dc564c3a..b353407061 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts @@ -40,7 +40,7 @@ export type BasicPutValidParameters = BasicPutValidMediaTypesParam & RequestParameters; export type BasicGetInvalidParameters = RequestParameters; export type BasicGetEmptyParameters = RequestParameters; -export type BasicGetNullParameters = RequestParameters; +export type BasicGetnullParameters = RequestParameters; export type BasicGetNotProvidedParameters = RequestParameters; export type PrimitiveGetIntParameters = RequestParameters; @@ -271,7 +271,7 @@ export interface DictionaryPutEmptyMediaTypesParam { export type DictionaryPutEmptyParameters = DictionaryPutEmptyMediaTypesParam & DictionaryPutEmptyBodyParam & RequestParameters; -export type DictionaryGetNullParameters = RequestParameters; +export type DictionaryGetnullParameters = RequestParameters; export type DictionaryGetNotProvidedParameters = RequestParameters; export type InheritanceGetValidParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts index e825007a74..b050aa8534 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts @@ -75,13 +75,13 @@ export interface BasicGetEmptyDefaultResponse extends HttpResponse { } /** Get a basic complex type whose properties are null */ -export interface BasicGetNull200Response extends HttpResponse { +export interface BasicGetnull200Response extends HttpResponse { status: "200"; body: BasicDefOutput; } /** Get a basic complex type whose properties are null */ -export interface BasicGetNullDefaultResponse extends HttpResponse { +export interface BasicGetnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -458,13 +458,13 @@ export interface DictionaryPutEmptyDefaultResponse extends HttpResponse { } /** Get complex types with dictionary property which is null */ -export interface DictionaryGetNull200Response extends HttpResponse { +export interface DictionaryGetnull200Response extends HttpResponse { status: "200"; body: DictionaryWrapperOutput; } /** Get complex types with dictionary property which is null */ -export interface DictionaryGetNullDefaultResponse extends HttpResponse { +export interface DictionaryGetnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts index a168f2c590..fe72ea614f 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts @@ -64,7 +64,7 @@ import { } from "./responses"; import { Client, StreamableMethod } from "@azure-rest/core-client"; -export interface StringGetNull { +export interface StringGetnull { /** Get null string value value */ get( options?: StringGetNullParameters, @@ -151,7 +151,7 @@ export interface StringGetBase64UrlEncoded { >; } -export interface StringGetNullBase64UrlEncoded { +export interface StringGetnullBase64UrlEncoded { /** Get null value that is expected to be base64url encoded */ get( options?: StringGetNullBase64UrlEncodedParameters, @@ -210,7 +210,7 @@ export interface EnumGetReferencedConstant { export interface Routes { /** Resource for '/string/null' has methods for the following verbs: get, put */ - (path: "/string/null"): StringGetNull; + (path: "/string/null"): StringGetnull; /** Resource for '/string/empty' has methods for the following verbs: get, put */ (path: "/string/empty"): StringGetEmpty; /** Resource for '/string/mbcs' has methods for the following verbs: get, put */ @@ -224,7 +224,7 @@ export interface Routes { /** Resource for '/string/base64UrlEncoding' has methods for the following verbs: get, put */ (path: "/string/base64UrlEncoding"): StringGetBase64UrlEncoded; /** Resource for '/string/nullBase64UrlEncoding' has methods for the following verbs: get */ - (path: "/string/nullBase64UrlEncoding"): StringGetNullBase64UrlEncoded; + (path: "/string/nullBase64UrlEncoding"): StringGetnullBase64UrlEncoded; /** Resource for '/string/enum/notExpandable' has methods for the following verbs: get, put */ (path: "/string/enum/notExpandable"): EnumGetNotExpandable; /** Resource for '/string/enum/Referenced' has methods for the following verbs: get, put */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts index bffaa32b09..61f08ea8f6 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts @@ -4,20 +4,20 @@ import { RequestParameters } from "@azure-rest/core-client"; import { RefColorConstant } from "./models"; -export type StringGetNullParameters = RequestParameters; +export type StringGetnullParameters = RequestParameters; -export interface StringPutNullBodyParam { +export interface StringPutnullBodyParam { /** string body */ body?: string; } -export interface StringPutNullMediaTypesParam { +export interface StringPutnullMediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type StringPutNullParameters = StringPutNullMediaTypesParam & - StringPutNullBodyParam & +export type StringPutnullParameters = StringPutnullMediaTypesParam & + StringPutnullBodyParam & RequestParameters; export type StringGetEmptyParameters = RequestParameters; @@ -86,7 +86,7 @@ export type StringPutBase64UrlEncodedParameters = StringPutBase64UrlEncodedMediaTypesParam & StringPutBase64UrlEncodedBodyParam & RequestParameters; -export type StringGetNullBase64UrlEncodedParameters = RequestParameters; +export type StringGetnullBase64UrlEncodedParameters = RequestParameters; export type EnumGetNotExpandableParameters = RequestParameters; export interface EnumPutNotExpandableBodyParam { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts index 0d3376423a..8a4f8362c1 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts @@ -5,24 +5,24 @@ import { HttpResponse } from "@azure-rest/core-client"; import { ErrorModelOutput, RefColorConstantOutput } from "./outputModels"; /** Get null string value value */ -export interface StringGetNull200Response extends HttpResponse { +export interface StringGetnull200Response extends HttpResponse { status: "200"; body: string; } /** Get null string value value */ -export interface StringGetNullDefaultResponse extends HttpResponse { +export interface StringGetnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } /** Set string value null */ -export interface StringPutNull200Response extends HttpResponse { +export interface StringPutnull200Response extends HttpResponse { status: "200"; } /** Set string value null */ -export interface StringPutNullDefaultResponse extends HttpResponse { +export interface StringPutnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -146,14 +146,14 @@ export interface StringPutBase64UrlEncodedDefaultResponse extends HttpResponse { } /** Get null value that is expected to be base64url encoded */ -export interface StringGetNullBase64UrlEncoded200Response extends HttpResponse { +export interface StringGetnullBase64UrlEncoded200Response extends HttpResponse { status: "200"; /** Value may contain base64 encoded characters */ body: string; } /** Get null value that is expected to be base64url encoded */ -export interface StringGetNullBase64UrlEncodedDefaultResponse +export interface StringGetnullBase64UrlEncodedDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts index ed1b92edce..87ea45250c 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts @@ -425,69 +425,69 @@ export type LROsPostAsyncRetrycanceledParameters = LROsPostAsyncRetrycanceledBodyParam & RequestParameters; -export interface LRORetrysPut201CreatingSucceeded200BodyParam { +export interface LroretrysPut201CreatingSucceeded200BodyParam { /** Product to put */ body?: Product; } -export interface LRORetrysPut201CreatingSucceeded200MediaTypesParam { +export interface LroretrysPut201CreatingSucceeded200MediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LRORetrysPut201CreatingSucceeded200Parameters = - LRORetrysPut201CreatingSucceeded200MediaTypesParam & - LRORetrysPut201CreatingSucceeded200BodyParam & +export type LroretrysPut201CreatingSucceeded200Parameters = + LroretrysPut201CreatingSucceeded200MediaTypesParam & + LroretrysPut201CreatingSucceeded200BodyParam & RequestParameters; -export interface LRORetrysPutAsyncRelativeRetrySucceededBodyParam { +export interface LroretrysPutAsyncRelativeRetrySucceededBodyParam { /** Product to put */ body?: Product; } -export interface LRORetrysPutAsyncRelativeRetrySucceededMediaTypesParam { +export interface LroretrysPutAsyncRelativeRetrySucceededMediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LRORetrysPutAsyncRelativeRetrySucceededParameters = - LRORetrysPutAsyncRelativeRetrySucceededMediaTypesParam & - LRORetrysPutAsyncRelativeRetrySucceededBodyParam & +export type LroretrysPutAsyncRelativeRetrySucceededParameters = + LroretrysPutAsyncRelativeRetrySucceededMediaTypesParam & + LroretrysPutAsyncRelativeRetrySucceededBodyParam & RequestParameters; -export type LRORetrysDeleteProvisioning202Accepted200SucceededParameters = +export type LroretrysDeleteProvisioning202Accepted200SucceededParameters = RequestParameters; -export type LRORetrysDelete202Retry200Parameters = RequestParameters; -export type LRORetrysDeleteAsyncRelativeRetrySucceededParameters = +export type LroretrysDelete202Retry200Parameters = RequestParameters; +export type LroretrysDeleteAsyncRelativeRetrySucceededParameters = RequestParameters; -export interface LRORetrysPost202Retry200BodyParam { +export interface LroretrysPost202Retry200BodyParam { /** Product to put */ body?: Product; } -export interface LRORetrysPost202Retry200MediaTypesParam { +export interface LroretrysPost202Retry200MediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LRORetrysPost202Retry200Parameters = - LRORetrysPost202Retry200MediaTypesParam & - LRORetrysPost202Retry200BodyParam & +export type LroretrysPost202Retry200Parameters = + LroretrysPost202Retry200MediaTypesParam & + LroretrysPost202Retry200BodyParam & RequestParameters; -export interface LRORetrysPostAsyncRelativeRetrySucceededBodyParam { +export interface LroretrysPostAsyncRelativeRetrySucceededBodyParam { /** Product to put */ body?: Product; } -export interface LRORetrysPostAsyncRelativeRetrySucceededMediaTypesParam { +export interface LroretrysPostAsyncRelativeRetrySucceededMediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LRORetrysPostAsyncRelativeRetrySucceededParameters = - LRORetrysPostAsyncRelativeRetrySucceededMediaTypesParam & - LRORetrysPostAsyncRelativeRetrySucceededBodyParam & +export type LroretrysPostAsyncRelativeRetrySucceededParameters = + LroretrysPostAsyncRelativeRetrySucceededMediaTypesParam & + LroretrysPostAsyncRelativeRetrySucceededBodyParam & RequestParameters; export interface LrosaDsPutNonRetry400BodyParam { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts index acc58555bc..28315a0cd3 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts @@ -7,7 +7,7 @@ import { BodyParam } from "./models"; export type PagingGetNoItemNamePagesParameters = RequestParameters; export type PagingGetEmptyNextLinkNamePagesParameters = RequestParameters; -export type PagingGetNullNextLinkNamePagesParameters = RequestParameters; +export type PagingGetnullNextLinkNamePagesParameters = RequestParameters; export type PagingGetSinglePagesParameters = RequestParameters; export interface PagingGetSinglePagesWithBodyParamsBodyParam { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts index 0e5ee7a131..0cb0cf22f9 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts @@ -34,14 +34,14 @@ export interface PagingGetEmptyNextLinkNamePagesDefaultResponse } /** A paging operation that must ignore any kind of nextLink, and stop after page 1. */ -export interface PagingGetNullNextLinkNamePages200Response +export interface PagingGetnullNextLinkNamePages200Response extends HttpResponse { status: "200"; body: ProductResultOutput; } /** A paging operation that must ignore any kind of nextLink, and stop after page 1. */ -export interface PagingGetNullNextLinkNamePagesDefaultResponse +export interface PagingGetnullNextLinkNamePagesDefaultResponse extends HttpResponse { status: string; } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts index 90de748e6f..db20eac07a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts @@ -313,7 +313,7 @@ export interface PathsOperations { PathsStringEmpty200Response | PathsStringEmptyDefaultResponse >; /** Get null (should throw) */ - stringNull( + stringnull( stringPath: string, options?: PathsStringNullParameters, ): StreamableMethod< @@ -327,7 +327,7 @@ export interface PathsOperations { PathsEnumValid200Response | PathsEnumValidDefaultResponse >; /** Get null (should throw on the client before the request is sent on wire) */ - enumNull( + enumnull( enumPath: "red color" | "green color" | "blue color", options?: PathsEnumNullParameters, ): StreamableMethod; @@ -346,7 +346,7 @@ export interface PathsOperations { PathsByteEmpty200Response | PathsByteEmptyDefaultResponse >; /** Get null as byte array (should throw) */ - byteNull( + bytenull( bytePath: string, options?: PathsByteNullParameters, ): StreamableMethod; @@ -358,7 +358,7 @@ export interface PathsOperations { PathsDateValid200Response | PathsDateValidDefaultResponse >; /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ - dateNull( + datenull( datePath: Date | string, options?: PathsDateNullParameters, ): StreamableMethod; @@ -370,7 +370,7 @@ export interface PathsOperations { PathsDateTimeValid200Response | PathsDateTimeValidDefaultResponse >; /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ - dateTimeNull( + dateTimenull( dateTimePath: Date | string, options?: PathsDateTimeNullParameters, ): StreamableMethod< @@ -414,7 +414,7 @@ export interface QueriesOperations { QueriesGetBooleanFalse200Response | QueriesGetBooleanFalseDefaultResponse >; /** Get null Boolean value on query (query string should be absent) */ - getBooleanNull( + getBooleannull( options?: QueriesGetBooleanNullParameters, ): StreamableMethod< QueriesGetBooleanNull200Response | QueriesGetBooleanNullDefaultResponse @@ -433,7 +433,7 @@ export interface QueriesOperations { | QueriesGetIntNegativeOneMillionDefaultResponse >; /** Get null integer value (no query parameter) */ - getIntNull( + getIntnull( options?: QueriesGetIntNullParameters, ): StreamableMethod< QueriesGetIntNull200Response | QueriesGetIntNullDefaultResponse @@ -452,7 +452,7 @@ export interface QueriesOperations { | QueriesGetNegativeTenBillionDefaultResponse >; /** Get 'null 64 bit integer value (no query param in uri) */ - getLongNull( + getLongnull( options?: QueriesGetLongNullParameters, ): StreamableMethod< QueriesGetLongNull200Response | QueriesGetLongNullDefaultResponse @@ -472,7 +472,7 @@ export interface QueriesOperations { | QueriesFloatScientificNegativeDefaultResponse >; /** Get null numeric value (no query parameter) */ - floatNull( + floatnull( options?: QueriesFloatNullParameters, ): StreamableMethod< QueriesFloatNull200Response | QueriesFloatNullDefaultResponse @@ -492,7 +492,7 @@ export interface QueriesOperations { | QueriesDoubleDecimalNegativeDefaultResponse >; /** Get null numeric value (no query parameter) */ - doubleNull( + doublenull( options?: QueriesDoubleNullParameters, ): StreamableMethod< QueriesDoubleNull200Response | QueriesDoubleNullDefaultResponse @@ -516,7 +516,7 @@ export interface QueriesOperations { QueriesStringEmpty200Response | QueriesStringEmptyDefaultResponse >; /** Get null (no query parameter in url) */ - stringNull( + stringnull( options?: QueriesStringNullParameters, ): StreamableMethod< QueriesStringNull200Response | QueriesStringNullDefaultResponse @@ -528,7 +528,7 @@ export interface QueriesOperations { QueriesEnumValid200Response | QueriesEnumValidDefaultResponse >; /** Get null (no query parameter in url) */ - enumNull( + enumnull( options?: QueriesEnumNullParameters, ): StreamableMethod< QueriesEnumNull200Response | QueriesEnumNullDefaultResponse @@ -546,7 +546,7 @@ export interface QueriesOperations { QueriesByteEmpty200Response | QueriesByteEmptyDefaultResponse >; /** Get null as byte array (no query parameters in uri) */ - byteNull( + bytenull( options?: QueriesByteNullParameters, ): StreamableMethod< QueriesByteNull200Response | QueriesByteNullDefaultResponse @@ -558,7 +558,7 @@ export interface QueriesOperations { QueriesDateValid200Response | QueriesDateValidDefaultResponse >; /** Get null as date - this should result in no query parameters in uri */ - dateNull( + datenull( options?: QueriesDateNullParameters, ): StreamableMethod< QueriesDateNull200Response | QueriesDateNullDefaultResponse @@ -570,7 +570,7 @@ export interface QueriesOperations { QueriesDateTimeValid200Response | QueriesDateTimeValidDefaultResponse >; /** Get null as date-time, should result in no query parameters in uri */ - dateTimeNull( + dateTimenull( options?: QueriesDateTimeNullParameters, ): StreamableMethod< QueriesDateTimeNull200Response | QueriesDateTimeNullDefaultResponse @@ -583,7 +583,7 @@ export interface QueriesOperations { | QueriesArrayStringCsvValidDefaultResponse >; /** Get a null array of string using the csv-array format */ - arrayStringCsvNull( + arrayStringCsvnull( options?: QueriesArrayStringCsvNullParameters, ): StreamableMethod< | QueriesArrayStringCsvNull200Response @@ -639,7 +639,7 @@ export interface PathItemsOperations { | PathItemsGetAllWithValuesDefaultResponse >; /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ - getGlobalQueryNull( + getGlobalQuerynull( globalStringPath: string, pathItemStringPath: string, localStringPath: string, @@ -649,7 +649,7 @@ export interface PathItemsOperations { | PathItemsGetGlobalQueryNullDefaultResponse >; /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ - getGlobalAndLocalQueryNull( + getGlobalAndLocalQuerynull( globalStringPath: string, pathItemStringPath: string, localStringPath: string, @@ -659,7 +659,7 @@ export interface PathItemsOperations { | PathItemsGetGlobalAndLocalQueryNullDefaultResponse >; /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ - getLocalPathItemQueryNull( + getLocalPathItemQuerynull( globalStringPath: string, pathItemStringPath: string, localStringPath: string, @@ -803,7 +803,7 @@ export interface PathsStringEmpty { >; } -export interface PathsStringNull { +export interface PathsStringnull { /** Get null (should throw) */ get( options?: PathsStringNullParameters, @@ -821,7 +821,7 @@ export interface PathsEnumValid { >; } -export interface PathsEnumNull { +export interface PathsEnumnull { /** Get null (should throw on the client before the request is sent on wire) */ get( options?: PathsEnumNullParameters, @@ -846,7 +846,7 @@ export interface PathsByteEmpty { >; } -export interface PathsByteNull { +export interface PathsBytenull { /** Get null as byte array (should throw) */ get( options?: PathsByteNullParameters, @@ -862,7 +862,7 @@ export interface PathsDateValid { >; } -export interface PathsDateNull { +export interface PathsDatenull { /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ get( options?: PathsDateNullParameters, @@ -878,7 +878,7 @@ export interface PathsDateTimeValid { >; } -export interface PathsDateTimeNull { +export interface PathsDateTimenull { /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ get( options?: PathsDateTimeNullParameters, @@ -932,7 +932,7 @@ export interface QueriesGetBooleanFalse { >; } -export interface QueriesGetBooleanNull { +export interface QueriesGetBooleannull { /** Get null Boolean value on query (query string should be absent) */ get( options?: QueriesGetBooleanNullParameters, @@ -960,7 +960,7 @@ export interface QueriesGetIntNegativeOneMillion { >; } -export interface QueriesGetIntNull { +export interface QueriesGetIntnull { /** Get null integer value (no query parameter) */ get( options?: QueriesGetIntNullParameters, @@ -988,7 +988,7 @@ export interface QueriesGetNegativeTenBillion { >; } -export interface QueriesGetLongNull { +export interface QueriesGetLongnull { /** Get 'null 64 bit integer value (no query param in uri) */ get( options?: QueriesGetLongNullParameters, @@ -1017,7 +1017,7 @@ export interface QueriesFloatScientificNegative { >; } -export interface QueriesFloatNull { +export interface QueriesFloatnull { /** Get null numeric value (no query parameter) */ get( options?: QueriesFloatNullParameters, @@ -1046,7 +1046,7 @@ export interface QueriesDoubleDecimalNegative { >; } -export interface QueriesDoubleNull { +export interface QueriesDoublenull { /** Get null numeric value (no query parameter) */ get( options?: QueriesDoubleNullParameters, @@ -1082,7 +1082,7 @@ export interface QueriesStringEmpty { >; } -export interface QueriesStringNull { +export interface QueriesStringnull { /** Get null (no query parameter in url) */ get( options?: QueriesStringNullParameters, @@ -1100,7 +1100,7 @@ export interface QueriesEnumValid { >; } -export interface QueriesEnumNull { +export interface QueriesEnumnull { /** Get null (no query parameter in url) */ get( options?: QueriesEnumNullParameters, @@ -1127,7 +1127,7 @@ export interface QueriesByteEmpty { >; } -export interface QueriesByteNull { +export interface QueriesBytenull { /** Get null as byte array (no query parameters in uri) */ get( options?: QueriesByteNullParameters, @@ -1145,7 +1145,7 @@ export interface QueriesDateValid { >; } -export interface QueriesDateNull { +export interface QueriesDatenull { /** Get null as date - this should result in no query parameters in uri */ get( options?: QueriesDateNullParameters, @@ -1163,7 +1163,7 @@ export interface QueriesDateTimeValid { >; } -export interface QueriesDateTimeNull { +export interface QueriesDateTimenull { /** Get null as date-time, should result in no query parameters in uri */ get( options?: QueriesDateTimeNullParameters, @@ -1182,7 +1182,7 @@ export interface QueriesArrayStringCsvValid { >; } -export interface QueriesArrayStringCsvNull { +export interface QueriesArrayStringCsvnull { /** Get a null array of string using the csv-array format */ get( options?: QueriesArrayStringCsvNullParameters, @@ -1252,7 +1252,7 @@ export interface PathItemsGetAllWithValues { >; } -export interface PathItemsGetGlobalQueryNull { +export interface PathItemsGetGlobalQuerynull { /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ get( options?: PathItemsGetGlobalQueryNullParameters, @@ -1262,7 +1262,7 @@ export interface PathItemsGetGlobalQueryNull { >; } -export interface PathItemsGetGlobalAndLocalQueryNull { +export interface PathItemsGetGlobalAndLocalQuerynull { /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ get( options?: PathItemsGetGlobalAndLocalQueryNullParameters, @@ -1272,7 +1272,7 @@ export interface PathItemsGetGlobalAndLocalQueryNull { >; } -export interface PathItemsGetLocalPathItemQueryNull { +export interface PathItemsGetLocalPathItemQuerynull { /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ get( options?: PathItemsGetLocalPathItemQueryNullParameters, @@ -1348,7 +1348,7 @@ export interface Routes { ( path: "/paths/string/null/{stringPath}", stringPath: string, - ): PathsStringNull; + ): PathsStringnull; /** Resource for '/paths/enum/green%20color/\{enumPath\}' has methods for the following verbs: get */ ( path: "/paths/enum/green%20color/{enumPath}", @@ -1358,7 +1358,7 @@ export interface Routes { ( path: "/paths/string/null/{enumPath}", enumPath: "red color" | "green color" | "blue color", - ): PathsEnumNull; + ): PathsEnumnull; /** Resource for '/paths/byte/multibyte/\{bytePath\}' has methods for the following verbs: get */ ( path: "/paths/byte/multibyte/{bytePath}", @@ -1367,14 +1367,14 @@ export interface Routes { /** Resource for '/paths/byte/empty/\{bytePath\}' has methods for the following verbs: get */ (path: "/paths/byte/empty/{bytePath}", bytePath: ""): PathsByteEmpty; /** Resource for '/paths/byte/null/\{bytePath\}' has methods for the following verbs: get */ - (path: "/paths/byte/null/{bytePath}", bytePath: string): PathsByteNull; + (path: "/paths/byte/null/{bytePath}", bytePath: string): PathsBytenull; /** Resource for '/paths/date/2012-01-01/\{datePath\}' has methods for the following verbs: get */ ( path: "/paths/date/2012-01-01/{datePath}", datePath: "2012-01-01", ): PathsDateValid; /** Resource for '/paths/date/null/\{datePath\}' has methods for the following verbs: get */ - (path: "/paths/date/null/{datePath}", datePath: Date | string): PathsDateNull; + (path: "/paths/date/null/{datePath}", datePath: Date | string): PathsDatenull; /** Resource for '/paths/datetime/2012-01-01T01%3A01%3A01Z/\{dateTimePath\}' has methods for the following verbs: get */ ( path: "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}", @@ -1384,7 +1384,7 @@ export interface Routes { ( path: "/paths/datetime/null/{dateTimePath}", dateTimePath: Date | string, - ): PathsDateTimeNull; + ): PathsDateTimenull; /** Resource for '/paths/string/bG9yZW0/\{base64UrlPath\}' has methods for the following verbs: get */ ( path: "/paths/string/bG9yZW0/{base64UrlPath}", @@ -1405,31 +1405,31 @@ export interface Routes { /** Resource for '/queries/bool/false' has methods for the following verbs: get */ (path: "/queries/bool/false"): QueriesGetBooleanFalse; /** Resource for '/queries/bool/null' has methods for the following verbs: get */ - (path: "/queries/bool/null"): QueriesGetBooleanNull; + (path: "/queries/bool/null"): QueriesGetBooleannull; /** Resource for '/queries/int/1000000' has methods for the following verbs: get */ (path: "/queries/int/1000000"): QueriesGetIntOneMillion; /** Resource for '/queries/int/-1000000' has methods for the following verbs: get */ (path: "/queries/int/-1000000"): QueriesGetIntNegativeOneMillion; /** Resource for '/queries/int/null' has methods for the following verbs: get */ - (path: "/queries/int/null"): QueriesGetIntNull; + (path: "/queries/int/null"): QueriesGetIntnull; /** Resource for '/queries/long/10000000000' has methods for the following verbs: get */ (path: "/queries/long/10000000000"): QueriesGetTenBillion; /** Resource for '/queries/long/-10000000000' has methods for the following verbs: get */ (path: "/queries/long/-10000000000"): QueriesGetNegativeTenBillion; /** Resource for '/queries/long/null' has methods for the following verbs: get */ - (path: "/queries/long/null"): QueriesGetLongNull; + (path: "/queries/long/null"): QueriesGetLongnull; /** Resource for '/queries/float/1.034E+20' has methods for the following verbs: get */ (path: "/queries/float/1.034E+20"): QueriesFloatScientificPositive; /** Resource for '/queries/float/-1.034E-20' has methods for the following verbs: get */ (path: "/queries/float/-1.034E-20"): QueriesFloatScientificNegative; /** Resource for '/queries/float/null' has methods for the following verbs: get */ - (path: "/queries/float/null"): QueriesFloatNull; + (path: "/queries/float/null"): QueriesFloatnull; /** Resource for '/queries/double/9999999.999' has methods for the following verbs: get */ (path: "/queries/double/9999999.999"): QueriesDoubleDecimalPositive; /** Resource for '/queries/double/-9999999.999' has methods for the following verbs: get */ (path: "/queries/double/-9999999.999"): QueriesDoubleDecimalNegative; /** Resource for '/queries/double/null' has methods for the following verbs: get */ - (path: "/queries/double/null"): QueriesDoubleNull; + (path: "/queries/double/null"): QueriesDoublenull; /** Resource for '/queries/string/unicode/' has methods for the following verbs: get */ (path: "/queries/string/unicode/"): QueriesStringUnicode; /** Resource for '/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend' has methods for the following verbs: get */ @@ -1439,29 +1439,29 @@ export interface Routes { /** Resource for '/queries/string/empty' has methods for the following verbs: get */ (path: "/queries/string/empty"): QueriesStringEmpty; /** Resource for '/queries/string/null' has methods for the following verbs: get */ - (path: "/queries/string/null"): QueriesStringNull; + (path: "/queries/string/null"): QueriesStringnull; /** Resource for '/queries/enum/green%20color' has methods for the following verbs: get */ (path: "/queries/enum/green%20color"): QueriesEnumValid; /** Resource for '/queries/enum/null' has methods for the following verbs: get */ - (path: "/queries/enum/null"): QueriesEnumNull; + (path: "/queries/enum/null"): QueriesEnumnull; /** Resource for '/queries/byte/multibyte' has methods for the following verbs: get */ (path: "/queries/byte/multibyte"): QueriesByteMultiByte; /** Resource for '/queries/byte/empty' has methods for the following verbs: get */ (path: "/queries/byte/empty"): QueriesByteEmpty; /** Resource for '/queries/byte/null' has methods for the following verbs: get */ - (path: "/queries/byte/null"): QueriesByteNull; + (path: "/queries/byte/null"): QueriesBytenull; /** Resource for '/queries/date/2012-01-01' has methods for the following verbs: get */ (path: "/queries/date/2012-01-01"): QueriesDateValid; /** Resource for '/queries/date/null' has methods for the following verbs: get */ - (path: "/queries/date/null"): QueriesDateNull; + (path: "/queries/date/null"): QueriesDatenull; /** Resource for '/queries/datetime/2012-01-01T01%3A01%3A01Z' has methods for the following verbs: get */ (path: "/queries/datetime/2012-01-01T01%3A01%3A01Z"): QueriesDateTimeValid; /** Resource for '/queries/datetime/null' has methods for the following verbs: get */ - (path: "/queries/datetime/null"): QueriesDateTimeNull; + (path: "/queries/datetime/null"): QueriesDateTimenull; /** Resource for '/queries/array/csv/string/valid' has methods for the following verbs: get */ (path: "/queries/array/csv/string/valid"): QueriesArrayStringCsvValid; /** Resource for '/queries/array/csv/string/null' has methods for the following verbs: get */ - (path: "/queries/array/csv/string/null"): QueriesArrayStringCsvNull; + (path: "/queries/array/csv/string/null"): QueriesArrayStringCsvnull; /** Resource for '/queries/array/csv/string/empty' has methods for the following verbs: get */ (path: "/queries/array/csv/string/empty"): QueriesArrayStringCsvEmpty; /** Resource for '/queries/array/none/string/empty' has methods for the following verbs: get */ @@ -1487,21 +1487,21 @@ export interface Routes { globalStringPath: string, pathItemStringPath: string, localStringPath: string, - ): PathItemsGetGlobalQueryNull; + ): PathItemsGetGlobalQuerynull; /** Resource for '/pathitem/nullable/globalStringPath/\{globalStringPath\}/pathItemStringPath/\{pathItemStringPath\}/localStringPath/\{localStringPath\}/null/pathItemStringQuery/null' has methods for the following verbs: get */ ( path: "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null", globalStringPath: string, pathItemStringPath: string, localStringPath: string, - ): PathItemsGetGlobalAndLocalQueryNull; + ): PathItemsGetGlobalAndLocalQuerynull; /** Resource for '/pathitem/nullable/globalStringPath/\{globalStringPath\}/pathItemStringPath/\{pathItemStringPath\}/localStringPath/\{localStringPath\}/globalStringQuery/null/null' has methods for the following verbs: get */ ( path: "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null", globalStringPath: string, pathItemStringPath: string, localStringPath: string, - ): PathItemsGetLocalPathItemQueryNull; + ): PathItemsGetLocalPathItemQuerynull; } export type UrlRestClient = Client & { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts index 0a4f94a1ed..96f53925ff 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts @@ -17,16 +17,16 @@ export type PathsStringUnicodeParameters = RequestParameters; export type PathsStringUrlEncodedParameters = RequestParameters; export type PathsStringUrlNonEncodedParameters = RequestParameters; export type PathsStringEmptyParameters = RequestParameters; -export type PathsStringNullParameters = RequestParameters; +export type PathsStringnullParameters = RequestParameters; export type PathsEnumValidParameters = RequestParameters; -export type PathsEnumNullParameters = RequestParameters; +export type PathsEnumnullParameters = RequestParameters; export type PathsByteMultiByteParameters = RequestParameters; export type PathsByteEmptyParameters = RequestParameters; -export type PathsByteNullParameters = RequestParameters; +export type PathsBytenullParameters = RequestParameters; export type PathsDateValidParameters = RequestParameters; -export type PathsDateNullParameters = RequestParameters; +export type PathsDatenullParameters = RequestParameters; export type PathsDateTimeValidParameters = RequestParameters; -export type PathsDateTimeNullParameters = RequestParameters; +export type PathsDateTimenullParameters = RequestParameters; export type PathsBase64UrlParameters = RequestParameters; export type PathsArrayCsvInPathParameters = RequestParameters; export type PathsUnixTimeUrlParameters = RequestParameters; @@ -55,16 +55,16 @@ export interface QueriesGetBooleanFalseQueryParam { export type QueriesGetBooleanFalseParameters = QueriesGetBooleanFalseQueryParam & RequestParameters; -export interface QueriesGetBooleanNullQueryParamProperties { +export interface QueriesGetBooleannullQueryParamProperties { /** null boolean value */ boolQuery?: boolean; } -export interface QueriesGetBooleanNullQueryParam { - queryParameters?: QueriesGetBooleanNullQueryParamProperties; +export interface QueriesGetBooleannullQueryParam { + queryParameters?: QueriesGetBooleannullQueryParamProperties; } -export type QueriesGetBooleanNullParameters = QueriesGetBooleanNullQueryParam & +export type QueriesGetBooleannullParameters = QueriesGetBooleannullQueryParam & RequestParameters; export interface QueriesGetIntOneMillionQueryParamProperties { @@ -91,16 +91,16 @@ export interface QueriesGetIntNegativeOneMillionQueryParam { export type QueriesGetIntNegativeOneMillionParameters = QueriesGetIntNegativeOneMillionQueryParam & RequestParameters; -export interface QueriesGetIntNullQueryParamProperties { +export interface QueriesGetIntnullQueryParamProperties { /** null integer value */ intQuery?: number; } -export interface QueriesGetIntNullQueryParam { - queryParameters?: QueriesGetIntNullQueryParamProperties; +export interface QueriesGetIntnullQueryParam { + queryParameters?: QueriesGetIntnullQueryParamProperties; } -export type QueriesGetIntNullParameters = QueriesGetIntNullQueryParam & +export type QueriesGetIntnullParameters = QueriesGetIntnullQueryParam & RequestParameters; export interface QueriesGetTenBillionQueryParamProperties { @@ -127,16 +127,16 @@ export interface QueriesGetNegativeTenBillionQueryParam { export type QueriesGetNegativeTenBillionParameters = QueriesGetNegativeTenBillionQueryParam & RequestParameters; -export interface QueriesGetLongNullQueryParamProperties { +export interface QueriesGetLongnullQueryParamProperties { /** null 64 bit integer value */ longQuery?: number; } -export interface QueriesGetLongNullQueryParam { - queryParameters?: QueriesGetLongNullQueryParamProperties; +export interface QueriesGetLongnullQueryParam { + queryParameters?: QueriesGetLongnullQueryParamProperties; } -export type QueriesGetLongNullParameters = QueriesGetLongNullQueryParam & +export type QueriesGetLongnullParameters = QueriesGetLongnullQueryParam & RequestParameters; export interface QueriesFloatScientificPositiveQueryParamProperties { @@ -163,16 +163,16 @@ export interface QueriesFloatScientificNegativeQueryParam { export type QueriesFloatScientificNegativeParameters = QueriesFloatScientificNegativeQueryParam & RequestParameters; -export interface QueriesFloatNullQueryParamProperties { +export interface QueriesFloatnullQueryParamProperties { /** null numeric value */ floatQuery?: number; } -export interface QueriesFloatNullQueryParam { - queryParameters?: QueriesFloatNullQueryParamProperties; +export interface QueriesFloatnullQueryParam { + queryParameters?: QueriesFloatnullQueryParamProperties; } -export type QueriesFloatNullParameters = QueriesFloatNullQueryParam & +export type QueriesFloatnullParameters = QueriesFloatnullQueryParam & RequestParameters; export interface QueriesDoubleDecimalPositiveQueryParamProperties { @@ -199,16 +199,16 @@ export interface QueriesDoubleDecimalNegativeQueryParam { export type QueriesDoubleDecimalNegativeParameters = QueriesDoubleDecimalNegativeQueryParam & RequestParameters; -export interface QueriesDoubleNullQueryParamProperties { +export interface QueriesDoublenullQueryParamProperties { /** null numeric value */ doubleQuery?: number; } -export interface QueriesDoubleNullQueryParam { - queryParameters?: QueriesDoubleNullQueryParamProperties; +export interface QueriesDoublenullQueryParam { + queryParameters?: QueriesDoublenullQueryParamProperties; } -export type QueriesDoubleNullParameters = QueriesDoubleNullQueryParam & +export type QueriesDoublenullParameters = QueriesDoublenullQueryParam & RequestParameters; export interface QueriesStringUnicodeQueryParamProperties { @@ -247,16 +247,16 @@ export interface QueriesStringEmptyQueryParam { export type QueriesStringEmptyParameters = QueriesStringEmptyQueryParam & RequestParameters; -export interface QueriesStringNullQueryParamProperties { +export interface QueriesStringnullQueryParamProperties { /** null string value */ stringQuery?: string; } -export interface QueriesStringNullQueryParam { - queryParameters?: QueriesStringNullQueryParamProperties; +export interface QueriesStringnullQueryParam { + queryParameters?: QueriesStringnullQueryParamProperties; } -export type QueriesStringNullParameters = QueriesStringNullQueryParam & +export type QueriesStringnullParameters = QueriesStringnullQueryParam & RequestParameters; export interface QueriesEnumValidQueryParamProperties { @@ -271,16 +271,16 @@ export interface QueriesEnumValidQueryParam { export type QueriesEnumValidParameters = QueriesEnumValidQueryParam & RequestParameters; -export interface QueriesEnumNullQueryParamProperties { +export interface QueriesEnumnullQueryParamProperties { /** null string value */ enumQuery?: "red color" | "green color" | "blue color"; } -export interface QueriesEnumNullQueryParam { - queryParameters?: QueriesEnumNullQueryParamProperties; +export interface QueriesEnumnullQueryParam { + queryParameters?: QueriesEnumnullQueryParamProperties; } -export type QueriesEnumNullParameters = QueriesEnumNullQueryParam & +export type QueriesEnumnullParameters = QueriesEnumnullQueryParam & RequestParameters; export interface QueriesByteMultiByteQueryParamProperties { @@ -311,7 +311,7 @@ export interface QueriesByteEmptyQueryParam { export type QueriesByteEmptyParameters = QueriesByteEmptyQueryParam & RequestParameters; -export interface QueriesByteNullQueryParamProperties { +export interface QueriesBytenullQueryParamProperties { /** * null as byte array (no query parameters in uri) * @@ -320,11 +320,11 @@ export interface QueriesByteNullQueryParamProperties { byteQuery?: string; } -export interface QueriesByteNullQueryParam { - queryParameters?: QueriesByteNullQueryParamProperties; +export interface QueriesBytenullQueryParam { + queryParameters?: QueriesBytenullQueryParamProperties; } -export type QueriesByteNullParameters = QueriesByteNullQueryParam & +export type QueriesBytenullParameters = QueriesBytenullQueryParam & RequestParameters; export interface QueriesDateValidQueryParamProperties { @@ -339,16 +339,16 @@ export interface QueriesDateValidQueryParam { export type QueriesDateValidParameters = QueriesDateValidQueryParam & RequestParameters; -export interface QueriesDateNullQueryParamProperties { +export interface QueriesDatenullQueryParamProperties { /** null as date (no query parameters in uri) */ dateQuery?: Date | string; } -export interface QueriesDateNullQueryParam { - queryParameters?: QueriesDateNullQueryParamProperties; +export interface QueriesDatenullQueryParam { + queryParameters?: QueriesDatenullQueryParamProperties; } -export type QueriesDateNullParameters = QueriesDateNullQueryParam & +export type QueriesDatenullParameters = QueriesDatenullQueryParam & RequestParameters; export interface QueriesDateTimeValidQueryParamProperties { @@ -363,16 +363,16 @@ export interface QueriesDateTimeValidQueryParam { export type QueriesDateTimeValidParameters = QueriesDateTimeValidQueryParam & RequestParameters; -export interface QueriesDateTimeNullQueryParamProperties { +export interface QueriesDateTimenullQueryParamProperties { /** null as date-time (no query parameters) */ dateTimeQuery?: Date | string; } -export interface QueriesDateTimeNullQueryParam { - queryParameters?: QueriesDateTimeNullQueryParamProperties; +export interface QueriesDateTimenullQueryParam { + queryParameters?: QueriesDateTimenullQueryParamProperties; } -export type QueriesDateTimeNullParameters = QueriesDateTimeNullQueryParam & +export type QueriesDateTimenullParameters = QueriesDateTimenullQueryParam & RequestParameters; export interface QueriesArrayStringCsvValidQueryParamProperties { @@ -387,17 +387,17 @@ export interface QueriesArrayStringCsvValidQueryParam { export type QueriesArrayStringCsvValidParameters = QueriesArrayStringCsvValidQueryParam & RequestParameters; -export interface QueriesArrayStringCsvNullQueryParamProperties { +export interface QueriesArrayStringCsvnullQueryParamProperties { /** a null array of string using the csv-array format */ arrayQuery?: Array; } -export interface QueriesArrayStringCsvNullQueryParam { - queryParameters?: QueriesArrayStringCsvNullQueryParamProperties; +export interface QueriesArrayStringCsvnullQueryParam { + queryParameters?: QueriesArrayStringCsvnullQueryParamProperties; } -export type QueriesArrayStringCsvNullParameters = - QueriesArrayStringCsvNullQueryParam & RequestParameters; +export type QueriesArrayStringCsvnullParameters = + QueriesArrayStringCsvnullQueryParam & RequestParameters; export interface QueriesArrayStringCsvEmptyQueryParamProperties { /** an empty array [] of string using the csv-array format */ @@ -473,44 +473,44 @@ export interface PathItemsGetAllWithValuesQueryParam { export type PathItemsGetAllWithValuesParameters = PathItemsGetAllWithValuesQueryParam & RequestParameters; -export interface PathItemsGetGlobalQueryNullQueryParamProperties { +export interface PathItemsGetGlobalQuerynullQueryParamProperties { /** A string value 'pathItemStringQuery' that appears as a query parameter */ pathItemStringQuery?: string; /** should contain value 'localStringQuery' */ localStringQuery?: string; } -export interface PathItemsGetGlobalQueryNullQueryParam { - queryParameters?: PathItemsGetGlobalQueryNullQueryParamProperties; +export interface PathItemsGetGlobalQuerynullQueryParam { + queryParameters?: PathItemsGetGlobalQuerynullQueryParamProperties; } -export type PathItemsGetGlobalQueryNullParameters = - PathItemsGetGlobalQueryNullQueryParam & RequestParameters; +export type PathItemsGetGlobalQuerynullParameters = + PathItemsGetGlobalQuerynullQueryParam & RequestParameters; -export interface PathItemsGetGlobalAndLocalQueryNullQueryParamProperties { +export interface PathItemsGetGlobalAndLocalQuerynullQueryParamProperties { /** A string value 'pathItemStringQuery' that appears as a query parameter */ pathItemStringQuery?: string; /** should contain null value */ localStringQuery?: string; } -export interface PathItemsGetGlobalAndLocalQueryNullQueryParam { - queryParameters?: PathItemsGetGlobalAndLocalQueryNullQueryParamProperties; +export interface PathItemsGetGlobalAndLocalQuerynullQueryParam { + queryParameters?: PathItemsGetGlobalAndLocalQuerynullQueryParamProperties; } -export type PathItemsGetGlobalAndLocalQueryNullParameters = - PathItemsGetGlobalAndLocalQueryNullQueryParam & RequestParameters; +export type PathItemsGetGlobalAndLocalQuerynullParameters = + PathItemsGetGlobalAndLocalQuerynullQueryParam & RequestParameters; -export interface PathItemsGetLocalPathItemQueryNullQueryParamProperties { +export interface PathItemsGetLocalPathItemQuerynullQueryParamProperties { /** should contain value null */ pathItemStringQuery?: string; /** should contain value null */ localStringQuery?: string; } -export interface PathItemsGetLocalPathItemQueryNullQueryParam { - queryParameters?: PathItemsGetLocalPathItemQueryNullQueryParamProperties; +export interface PathItemsGetLocalPathItemQuerynullQueryParam { + queryParameters?: PathItemsGetLocalPathItemQuerynullQueryParamProperties; } -export type PathItemsGetLocalPathItemQueryNullParameters = - PathItemsGetLocalPathItemQueryNullQueryParam & RequestParameters; +export type PathItemsGetLocalPathItemQuerynullParameters = + PathItemsGetLocalPathItemQuerynullQueryParam & RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts index cc4be8315b..f960928c25 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts @@ -165,12 +165,12 @@ export interface PathsStringEmptyDefaultResponse extends HttpResponse { } /** Get null (should throw) */ -export interface PathsStringNull400Response extends HttpResponse { +export interface PathsStringnull400Response extends HttpResponse { status: "400"; } /** Get null (should throw) */ -export interface PathsStringNullDefaultResponse extends HttpResponse { +export interface PathsStringnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -187,12 +187,12 @@ export interface PathsEnumValidDefaultResponse extends HttpResponse { } /** Get null (should throw on the client before the request is sent on wire) */ -export interface PathsEnumNull400Response extends HttpResponse { +export interface PathsEnumnull400Response extends HttpResponse { status: "400"; } /** Get null (should throw on the client before the request is sent on wire) */ -export interface PathsEnumNullDefaultResponse extends HttpResponse { +export interface PathsEnumnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -220,12 +220,12 @@ export interface PathsByteEmptyDefaultResponse extends HttpResponse { } /** Get null as byte array (should throw) */ -export interface PathsByteNull400Response extends HttpResponse { +export interface PathsBytenull400Response extends HttpResponse { status: "400"; } /** Get null as byte array (should throw) */ -export interface PathsByteNullDefaultResponse extends HttpResponse { +export interface PathsBytenullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -242,12 +242,12 @@ export interface PathsDateValidDefaultResponse extends HttpResponse { } /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ -export interface PathsDateNull400Response extends HttpResponse { +export interface PathsDatenull400Response extends HttpResponse { status: "400"; } /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ -export interface PathsDateNullDefaultResponse extends HttpResponse { +export interface PathsDatenullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -264,12 +264,12 @@ export interface PathsDateTimeValidDefaultResponse extends HttpResponse { } /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ -export interface PathsDateTimeNull400Response extends HttpResponse { +export interface PathsDateTimenull400Response extends HttpResponse { status: "400"; } /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ -export interface PathsDateTimeNullDefaultResponse extends HttpResponse { +export interface PathsDateTimenullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -330,12 +330,12 @@ export interface QueriesGetBooleanFalseDefaultResponse extends HttpResponse { } /** Get null Boolean value on query (query string should be absent) */ -export interface QueriesGetBooleanNull200Response extends HttpResponse { +export interface QueriesGetBooleannull200Response extends HttpResponse { status: "200"; } /** Get null Boolean value on query (query string should be absent) */ -export interface QueriesGetBooleanNullDefaultResponse extends HttpResponse { +export interface QueriesGetBooleannullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -365,12 +365,12 @@ export interface QueriesGetIntNegativeOneMillionDefaultResponse } /** Get null integer value (no query parameter) */ -export interface QueriesGetIntNull200Response extends HttpResponse { +export interface QueriesGetIntnull200Response extends HttpResponse { status: "200"; } /** Get null integer value (no query parameter) */ -export interface QueriesGetIntNullDefaultResponse extends HttpResponse { +export interface QueriesGetIntnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -399,12 +399,12 @@ export interface QueriesGetNegativeTenBillionDefaultResponse } /** Get 'null 64 bit integer value (no query param in uri) */ -export interface QueriesGetLongNull200Response extends HttpResponse { +export interface QueriesGetLongnull200Response extends HttpResponse { status: "200"; } /** Get 'null 64 bit integer value (no query param in uri) */ -export interface QueriesGetLongNullDefaultResponse extends HttpResponse { +export interface QueriesGetLongnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -436,12 +436,12 @@ export interface QueriesFloatScientificNegativeDefaultResponse } /** Get null numeric value (no query parameter) */ -export interface QueriesFloatNull200Response extends HttpResponse { +export interface QueriesFloatnull200Response extends HttpResponse { status: "200"; } /** Get null numeric value (no query parameter) */ -export interface QueriesFloatNullDefaultResponse extends HttpResponse { +export interface QueriesFloatnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -471,12 +471,12 @@ export interface QueriesDoubleDecimalNegativeDefaultResponse } /** Get null numeric value (no query parameter) */ -export interface QueriesDoubleNull200Response extends HttpResponse { +export interface QueriesDoublenull200Response extends HttpResponse { status: "200"; } /** Get null numeric value (no query parameter) */ -export interface QueriesDoubleNullDefaultResponse extends HttpResponse { +export interface QueriesDoublenullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -515,12 +515,12 @@ export interface QueriesStringEmptyDefaultResponse extends HttpResponse { } /** Get null (no query parameter in url) */ -export interface QueriesStringNull200Response extends HttpResponse { +export interface QueriesStringnull200Response extends HttpResponse { status: "200"; } /** Get null (no query parameter in url) */ -export interface QueriesStringNullDefaultResponse extends HttpResponse { +export interface QueriesStringnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -537,12 +537,12 @@ export interface QueriesEnumValidDefaultResponse extends HttpResponse { } /** Get null (no query parameter in url) */ -export interface QueriesEnumNull200Response extends HttpResponse { +export interface QueriesEnumnull200Response extends HttpResponse { status: "200"; } /** Get null (no query parameter in url) */ -export interface QueriesEnumNullDefaultResponse extends HttpResponse { +export interface QueriesEnumnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -570,12 +570,12 @@ export interface QueriesByteEmptyDefaultResponse extends HttpResponse { } /** Get null as byte array (no query parameters in uri) */ -export interface QueriesByteNull200Response extends HttpResponse { +export interface QueriesBytenull200Response extends HttpResponse { status: "200"; } /** Get null as byte array (no query parameters in uri) */ -export interface QueriesByteNullDefaultResponse extends HttpResponse { +export interface QueriesBytenullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -592,12 +592,12 @@ export interface QueriesDateValidDefaultResponse extends HttpResponse { } /** Get null as date - this should result in no query parameters in uri */ -export interface QueriesDateNull200Response extends HttpResponse { +export interface QueriesDatenull200Response extends HttpResponse { status: "200"; } /** Get null as date - this should result in no query parameters in uri */ -export interface QueriesDateNullDefaultResponse extends HttpResponse { +export interface QueriesDatenullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -614,12 +614,12 @@ export interface QueriesDateTimeValidDefaultResponse extends HttpResponse { } /** Get null as date-time, should result in no query parameters in uri */ -export interface QueriesDateTimeNull200Response extends HttpResponse { +export interface QueriesDateTimenull200Response extends HttpResponse { status: "200"; } /** Get null as date-time, should result in no query parameters in uri */ -export interface QueriesDateTimeNullDefaultResponse extends HttpResponse { +export interface QueriesDateTimenullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -637,12 +637,12 @@ export interface QueriesArrayStringCsvValidDefaultResponse } /** Get a null array of string using the csv-array format */ -export interface QueriesArrayStringCsvNull200Response extends HttpResponse { +export interface QueriesArrayStringCsvnull200Response extends HttpResponse { status: "200"; } /** Get a null array of string using the csv-array format */ -export interface QueriesArrayStringCsvNullDefaultResponse extends HttpResponse { +export interface QueriesArrayStringCsvnullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -720,38 +720,38 @@ export interface PathItemsGetAllWithValuesDefaultResponse extends HttpResponse { } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ -export interface PathItemsGetGlobalQueryNull200Response extends HttpResponse { +export interface PathItemsGetGlobalQuerynull200Response extends HttpResponse { status: "200"; } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ -export interface PathItemsGetGlobalQueryNullDefaultResponse +export interface PathItemsGetGlobalQuerynullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ -export interface PathItemsGetGlobalAndLocalQueryNull200Response +export interface PathItemsGetGlobalAndLocalQuerynull200Response extends HttpResponse { status: "200"; } /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ -export interface PathItemsGetGlobalAndLocalQueryNullDefaultResponse +export interface PathItemsGetGlobalAndLocalQuerynullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ -export interface PathItemsGetLocalPathItemQueryNull200Response +export interface PathItemsGetLocalPathItemQuerynull200Response extends HttpResponse { status: "200"; } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ -export interface PathItemsGetLocalPathItemQueryNullDefaultResponse +export interface PathItemsGetLocalPathItemQuerynullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts index f375654b51..384c6b7e72 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts @@ -116,7 +116,7 @@ export default function createClient( .path("/paths/string/empty/{stringPath}", stringPath) .get(options); }, - stringNull: (stringPath, options) => { + stringnull: (stringPath, options) => { return client .path("/paths/string/null/{stringPath}", stringPath) .get(options); @@ -126,7 +126,7 @@ export default function createClient( .path("/paths/enum/green%20color/{enumPath}", enumPath) .get(options); }, - enumNull: (enumPath, options) => { + enumnull: (enumPath, options) => { return client .path("/paths/string/null/{enumPath}", enumPath) .get(options); @@ -141,7 +141,7 @@ export default function createClient( .path("/paths/byte/empty/{bytePath}", bytePath) .get(options); }, - byteNull: (bytePath, options) => { + bytenull: (bytePath, options) => { return client .path("/paths/byte/null/{bytePath}", bytePath) .get(options); @@ -151,7 +151,7 @@ export default function createClient( .path("/paths/date/2012-01-01/{datePath}", datePath) .get(options); }, - dateNull: (datePath, options) => { + datenull: (datePath, options) => { return client .path("/paths/date/null/{datePath}", datePath) .get(options); @@ -164,7 +164,7 @@ export default function createClient( ) .get(options); }, - dateTimeNull: (dateTimePath, options) => { + dateTimenull: (dateTimePath, options) => { return client .path("/paths/datetime/null/{dateTimePath}", dateTimePath) .get(options); @@ -195,7 +195,7 @@ export default function createClient( getBooleanFalse: (options) => { return client.path("/queries/bool/false").get(options); }, - getBooleanNull: (options) => { + getBooleannull: (options) => { return client.path("/queries/bool/null").get(options); }, getIntOneMillion: (options) => { @@ -204,7 +204,7 @@ export default function createClient( getIntNegativeOneMillion: (options) => { return client.path("/queries/int/-1000000").get(options); }, - getIntNull: (options) => { + getIntnull: (options) => { return client.path("/queries/int/null").get(options); }, getTenBillion: (options) => { @@ -213,7 +213,7 @@ export default function createClient( getNegativeTenBillion: (options) => { return client.path("/queries/long/-10000000000").get(options); }, - getLongNull: (options) => { + getLongnull: (options) => { return client.path("/queries/long/null").get(options); }, floatScientificPositive: (options) => { @@ -222,7 +222,7 @@ export default function createClient( floatScientificNegative: (options) => { return client.path("/queries/float/-1.034E-20").get(options); }, - floatNull: (options) => { + floatnull: (options) => { return client.path("/queries/float/null").get(options); }, doubleDecimalPositive: (options) => { @@ -231,7 +231,7 @@ export default function createClient( doubleDecimalNegative: (options) => { return client.path("/queries/double/-9999999.999").get(options); }, - doubleNull: (options) => { + doublenull: (options) => { return client.path("/queries/double/null").get(options); }, stringUnicode: (options) => { @@ -247,13 +247,13 @@ export default function createClient( stringEmpty: (options) => { return client.path("/queries/string/empty").get(options); }, - stringNull: (options) => { + stringnull: (options) => { return client.path("/queries/string/null").get(options); }, enumValid: (options) => { return client.path("/queries/enum/green%20color").get(options); }, - enumNull: (options) => { + enumnull: (options) => { return client.path("/queries/enum/null").get(options); }, byteMultiByte: (options) => { @@ -262,13 +262,13 @@ export default function createClient( byteEmpty: (options) => { return client.path("/queries/byte/empty").get(options); }, - byteNull: (options) => { + bytenull: (options) => { return client.path("/queries/byte/null").get(options); }, dateValid: (options) => { return client.path("/queries/date/2012-01-01").get(options); }, - dateNull: (options) => { + datenull: (options) => { return client.path("/queries/date/null").get(options); }, dateTimeValid: (options) => { @@ -276,13 +276,13 @@ export default function createClient( .path("/queries/datetime/2012-01-01T01%3A01%3A01Z") .get(options); }, - dateTimeNull: (options) => { + dateTimenull: (options) => { return client.path("/queries/datetime/null").get(options); }, arrayStringCsvValid: (options) => { return client.path("/queries/array/csv/string/valid").get(options); }, - arrayStringCsvNull: (options) => { + arrayStringCsvnull: (options) => { return client.path("/queries/array/csv/string/null").get(options); }, arrayStringCsvEmpty: (options) => { @@ -317,7 +317,7 @@ export default function createClient( ) .get(options); }, - getGlobalQueryNull: ( + getGlobalQuerynull: ( globalStringPath, pathItemStringPath, localStringPath, @@ -332,7 +332,7 @@ export default function createClient( ) .get(options); }, - getGlobalAndLocalQueryNull: ( + getGlobalAndLocalQuerynull: ( globalStringPath, pathItemStringPath, localStringPath, @@ -347,7 +347,7 @@ export default function createClient( ) .get(options); }, - getLocalPathItemQueryNull: ( + getLocalPathItemQuerynull: ( globalStringPath, pathItemStringPath, localStringPath, From 5489ed9878f2390e091ad16ce58fb1849437133e Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 31 Oct 2024 14:35:03 +0800 Subject: [PATCH 15/91] Fix the failure cases --- packages/rlc-common/src/helpers/nameUtils.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 182be058eb..b520755a2e 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -144,6 +144,9 @@ export function normalizeName( } const casingConvention = casingOverride ?? getCasingConvention(nameType); const parts = deconstruct(name); + if (parts.length === 0) { + return name; + } const [firstPart, ...otherParts] = parts; const normalizedFirstPart = toCasing(firstPart, casingConvention); const normalizedParts = (otherParts || []) @@ -233,12 +236,11 @@ function getCasingConvention(nameType: NameType) { * on Modeler four namer for this once it is stable */ function toCasing(str: string, casing: CasingConvention): string { - const value = str; const firstChar = casing === CasingConvention.Pascal - ? value.charAt(0).toUpperCase() - : value.charAt(0).toLowerCase(); - return `${firstChar}${value.substring(1)}`; + ? str.charAt(0).toUpperCase() + : str.charAt(0).toLowerCase(); + return `${firstChar}${str.substring(1)}`; } export function pascalCase(str: string) { From e65005842e278b694da445c608401ddaa20ec462 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:54:51 +0800 Subject: [PATCH 16/91] regen smoke --- .../generated/typespec-ts/src/openAIClient.ts | 69 +++++++ .../typespec-ts/src/api/openAIContext.ts | 49 +++++ .../generated/typespec-ts/src/openAIClient.ts | 100 +++++++++ .../typespec-ts/src/api/openAIContext.ts | 58 ++++++ .../generated/typespec-ts/src/openAIClient.ts | 190 ++++++++++++++++++ .../typespec-ts/src/api/openAIContext.ts | 51 +++++ .../generated/typespec-ts/src/openAIClient.ts | 98 +++++++++ 7 files changed, 615 insertions(+) create mode 100644 packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts create mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts create mode 100644 packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts create mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts create mode 100644 packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts create mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts create mode 100644 packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts new file mode 100644 index 0000000000..b690a0f57e --- /dev/null +++ b/packages/typespec-test/test/openai/generated/typespec-ts/src/openAIClient.ts @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "./logger.js"; +import { TokenCredential, KeyCredential } from "@azure/core-auth"; +import { OpenAIClient } from "./clientDefinitions.js"; + +/** The optional parameters for the client */ +export interface OpenAIClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} + +/** + * Initialize a new instance of `OpenAIClient` + * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export default function createClient( + endpointParam: string, + credentials: TokenCredential | KeyCredential, + { apiVersion = "2023-08-01-preview", ...options }: OpenAIClientOptions = {}, +): OpenAIClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; + const userAgentInfo = `azsdk-js-openai-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + scopes: options.credentials?.scopes ?? [ + "https://cognitiveservices.azure.com/.default", + ], + apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", + }, + }; + const client = getClient(endpointUrl, credentials, options) as OpenAIClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + + return client; +} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts new file mode 100644 index 0000000000..c3fd4009de --- /dev/null +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { KeyCredential, isKeyCredential } from "@azure/core-auth"; + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export interface OpenAIContext extends Client {} + +/** Optional parameters for the client. */ +export interface OpenAIClientOptionalParams extends ClientOptions {} + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export function createOpenAI( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, +): OpenAIContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; + + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + }; + const clientContext = getClient(endpointUrl, undefined, updatedOptions); + + if (isKeyCredential(credential)) { + clientContext.pipeline.addPolicy({ + name: "customKeyCredentialPolicy", + sendRequest(request, next) { + request.headers.set("Authorization", "Bearer " + credential.key); + return next(request); + }, + }); + } + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + return clientContext; +} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts new file mode 100644 index 0000000000..2b85b3f2f6 --- /dev/null +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; +import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; +import { + getFineTuningOperations, + FineTuningOperations, +} from "./classic/fineTuning/index.js"; +import { + getCompletionsOperations, + CompletionsOperations, +} from "./classic/completions/index.js"; +import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; +import { + getEmbeddingsOperations, + EmbeddingsOperations, +} from "./classic/embeddings/index.js"; +import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; +import { + getFineTunesOperations, + FineTunesOperations, +} from "./classic/fineTunes/index.js"; +import { + getModelsOperations, + ModelsOperations, +} from "./classic/models/index.js"; +import { + getImagesOperations, + ImagesOperations, +} from "./classic/images/index.js"; +import { + getModerationsOperations, + ModerationsOperations, +} from "./classic/moderations/index.js"; +import { + createOpenAI, + OpenAIContext, + OpenAIClientOptionalParams, +} from "./api/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { KeyCredential } from "@azure/core-auth"; + +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; + +export class OpenAIClient { + private _client: OpenAIContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ + constructor( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : "azsdk-js-client"; + this._client = createOpenAI(credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.audio = getAudioOperations(this._client); + this.chat = getChatOperations(this._client); + this.fineTuning = getFineTuningOperations(this._client); + this.completions = getCompletionsOperations(this._client); + this.edits = getEditsOperations(this._client); + this.embeddings = getEmbeddingsOperations(this._client); + this.files = getFilesOperations(this._client); + this.fineTunes = getFineTunesOperations(this._client); + this.models = getModelsOperations(this._client); + this.images = getImagesOperations(this._client); + this.moderations = getModerationsOperations(this._client); + } + + /** The operation groups for AudioTranscriptions */ + public readonly audio: AudioOperations; + /** The operation groups for ChatCompletions */ + public readonly chat: ChatOperations; + /** The operation groups for FineTuningJobs */ + public readonly fineTuning: FineTuningOperations; + /** The operation groups for Completions */ + public readonly completions: CompletionsOperations; + /** The operation groups for Edits */ + public readonly edits: EditsOperations; + /** The operation groups for Embeddings */ + public readonly embeddings: EmbeddingsOperations; + /** The operation groups for Files */ + public readonly files: FilesOperations; + /** The operation groups for FineTunes */ + public readonly fineTunes: FineTunesOperations; + /** The operation groups for Models */ + public readonly models: ModelsOperations; + /** The operation groups for Images */ + public readonly images: ImagesOperations; + /** The operation groups for Moderations */ + public readonly moderations: ModerationsOperations; +} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts new file mode 100644 index 0000000000..53d95cbb55 --- /dev/null +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { KeyCredential, TokenCredential } from "@azure/core-auth"; + +export interface OpenAIContext extends Client {} + +/** Optional parameters for the client. */ +export interface OpenAIClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} + +export function createOpenAI( + endpointParam: string, + credential: KeyCredential | TokenCredential, + options: OpenAIClientOptionalParams = {}, +): OpenAIContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `${endpointParam}/openai`; + + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [ + "https://cognitiveservices.azure.com/.default", + ], + apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2024-06-01"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return clientContext; +} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts new file mode 100644 index 0000000000..822d86f5a4 --- /dev/null +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + createOpenAI, + OpenAIContext, + OpenAIClientOptionalParams, + getAudioTranscriptionAsPlainText, + getAudioTranscriptionAsResponseObject, + getAudioTranslationAsPlainText, + getAudioTranslationAsResponseObject, + getCompletions, + getChatCompletions, + getImageGenerations, + generateSpeechFromText, + getEmbeddings, + GetAudioTranscriptionAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetCompletionsOptionalParams, + GetChatCompletionsOptionalParams, + GetImageGenerationsOptionalParams, + GenerateSpeechFromTextOptionalParams, + GetEmbeddingsOptionalParams, +} from "./api/index.js"; +import { + AudioTranscriptionOptions, + AudioTranscription, + AudioTranslationOptions, + AudioTranslation, + CompletionsOptions, + Completions, + ChatCompletionsOptions, + ChatCompletions, + ImageGenerationOptions, + ImageGenerations, + SpeechGenerationOptions, + EmbeddingsOptions, + Embeddings, +} from "./models/models.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { KeyCredential, TokenCredential } from "@azure/core-auth"; + +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; + +export class OpenAIClient { + private _client: OpenAIContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor( + endpointParam: string, + credential: KeyCredential | TokenCredential, + options: OpenAIClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : "azsdk-js-client"; + this._client = createOpenAI(endpointParam, credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + */ + getAudioTranscriptionAsPlainText( + deploymentId: string, + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranscriptionAsPlainText( + this._client, + deploymentId, + body, + options, + ); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + */ + getAudioTranscriptionAsResponseObject( + deploymentId: string, + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranscriptionAsResponseObject( + this._client, + deploymentId, + body, + options, + ); + } + + /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ + getAudioTranslationAsPlainText( + deploymentId: string, + body: AudioTranslationOptions, + options: GetAudioTranslationAsPlainTextOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranslationAsPlainText( + this._client, + deploymentId, + body, + options, + ); + } + + /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ + getAudioTranslationAsResponseObject( + deploymentId: string, + body: AudioTranslationOptions, + options: GetAudioTranslationAsResponseObjectOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranslationAsResponseObject( + this._client, + deploymentId, + body, + options, + ); + } + + /** + * Gets completions for the provided input prompts. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. + */ + getCompletions( + deploymentId: string, + body: CompletionsOptions, + options: GetCompletionsOptionalParams = { requestOptions: {} }, + ): Promise { + return getCompletions(this._client, deploymentId, body, options); + } + + /** + * Gets chat completions for the provided chat messages. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. + */ + getChatCompletions( + deploymentId: string, + body: ChatCompletionsOptions, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, + ): Promise { + return getChatCompletions(this._client, deploymentId, body, options); + } + + /** Creates an image given a prompt. */ + getImageGenerations( + deploymentId: string, + body: ImageGenerationOptions, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, + ): Promise { + return getImageGenerations(this._client, deploymentId, body, options); + } + + /** Generates text-to-speech audio from the input text. */ + generateSpeechFromText( + deploymentId: string, + body: SpeechGenerationOptions, + options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, + ): Promise { + return generateSpeechFromText(this._client, deploymentId, body, options); + } + + /** Return the embeddings for a given prompt. */ + getEmbeddings( + deploymentId: string, + body: EmbeddingsOptions, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, + ): Promise { + return getEmbeddings(this._client, deploymentId, body, options); + } +} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts new file mode 100644 index 0000000000..3b90d01f83 --- /dev/null +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts @@ -0,0 +1,51 @@ +// Licensed under the MIT License. + +import { + Client, + ClientOptions, + getClient, + KeyCredential, + isKeyCredential, +} from "@typespec/ts-http-runtime"; + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export interface OpenAIContext extends Client {} + +/** Optional parameters for the client. */ +export interface OpenAIClientOptionalParams extends ClientOptions {} + +/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ +export function createOpenAI( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, +): OpenAIContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; + + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + }; + const clientContext = getClient(endpointUrl, undefined, updatedOptions); + + if (isKeyCredential(credential)) { + clientContext.pipeline.addPolicy({ + name: "customKeyCredentialPolicy", + sendRequest(request, next) { + request.headers.set("Authorization", "Bearer " + credential.key); + return next(request); + }, + }); + } + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + console.warn( + "This client does not support client api-version, please change it at the operation level", + ); + } + return clientContext; +} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts new file mode 100644 index 0000000000..1f75c622e5 --- /dev/null +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts @@ -0,0 +1,98 @@ +// Licensed under the MIT License. + +import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; +import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; +import { + getFineTuningOperations, + FineTuningOperations, +} from "./classic/fineTuning/index.js"; +import { + getCompletionsOperations, + CompletionsOperations, +} from "./classic/completions/index.js"; +import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; +import { + getEmbeddingsOperations, + EmbeddingsOperations, +} from "./classic/embeddings/index.js"; +import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; +import { + getFineTunesOperations, + FineTunesOperations, +} from "./classic/fineTunes/index.js"; +import { + getModelsOperations, + ModelsOperations, +} from "./classic/models/index.js"; +import { + getImagesOperations, + ImagesOperations, +} from "./classic/images/index.js"; +import { + getModerationsOperations, + ModerationsOperations, +} from "./classic/moderations/index.js"; +import { + createOpenAI, + OpenAIContext, + OpenAIClientOptionalParams, +} from "./api/index.js"; +import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; + +export { OpenAIClientOptionalParams } from "./api/openAIContext.js"; + +export class OpenAIClient { + private _client: OpenAIContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */ + constructor( + credential: KeyCredential, + options: OpenAIClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : "azsdk-js-client"; + this._client = createOpenAI(credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.audio = getAudioOperations(this._client); + this.chat = getChatOperations(this._client); + this.fineTuning = getFineTuningOperations(this._client); + this.completions = getCompletionsOperations(this._client); + this.edits = getEditsOperations(this._client); + this.embeddings = getEmbeddingsOperations(this._client); + this.files = getFilesOperations(this._client); + this.fineTunes = getFineTunesOperations(this._client); + this.models = getModelsOperations(this._client); + this.images = getImagesOperations(this._client); + this.moderations = getModerationsOperations(this._client); + } + + /** The operation groups for AudioTranscriptions */ + public readonly audio: AudioOperations; + /** The operation groups for ChatCompletions */ + public readonly chat: ChatOperations; + /** The operation groups for FineTuningJobs */ + public readonly fineTuning: FineTuningOperations; + /** The operation groups for Completions */ + public readonly completions: CompletionsOperations; + /** The operation groups for Edits */ + public readonly edits: EditsOperations; + /** The operation groups for Embeddings */ + public readonly embeddings: EmbeddingsOperations; + /** The operation groups for Files */ + public readonly files: FilesOperations; + /** The operation groups for FineTunes */ + public readonly fineTunes: FineTunesOperations; + /** The operation groups for Models */ + public readonly models: ModelsOperations; + /** The operation groups for Images */ + public readonly images: ImagesOperations; + /** The operation groups for Moderations */ + public readonly moderations: ModerationsOperations; +} From 3594c8c0c3674d6c623861f3b02bce16d1b2c33a Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:40:23 +0800 Subject: [PATCH 17/91] update unit test --- .../typespec-ts/test/modularUnit/enumUnion.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts index ab9fe6ff2a..e926643db6 100644 --- a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts +++ b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts @@ -1188,27 +1188,27 @@ describe("model type", () => { * Very small image size of 256x256 pixels. * Only supported with dall-e-2 models. */ - size256x256 = "256x256", + Size256X256 = "256x256", /** * A smaller image size of 512x512 pixels. * Only supported with dall-e-2 models. */ - size512x512 = "512x512", + Size512X512 = "512x512", /** * A standard, square image size of 1024x1024 pixels. * Supported by both dall-e-2 and dall-e-3 models. */ - size1024x1024 = "1024x1024", + Size1024X1024 = "1024x1024", /** * A wider image size of 1024x1792 pixels. * Only supported with dall-e-3 models. */ - size1792x1024 = "1792x1024", + Size1792X1024 = "1792x1024", /** * A taller image size of 1792x1024 pixels. * Only supported with dall-e-3 models. */ - size1024x1792 = "1024x1792", + Size1024X1792 = "1024x1792", } ` ); @@ -1236,7 +1236,7 @@ describe("model type", () => { ` /** model interface Test */ export interface Test { - color: Lr | Ud; + color: LR | UD; } ` ); From 1f3f77a62d48046b57bd12539babce5ad697081f Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 31 Oct 2024 17:12:31 +0800 Subject: [PATCH 18/91] Fix the autorest issue --- packages/rlc-common/src/helpers/nameUtils.ts | 2 +- packages/rlc-common/test/helpers/nameUtils.spec.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index b520755a2e..3986d2b4d3 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -151,7 +151,7 @@ export function normalizeName( const normalizedFirstPart = toCasing(firstPart, casingConvention); const normalizedParts = (otherParts || []) .map((part) => - part === "null" ? part : toCasing(part, CasingConvention.Pascal) + toCasing(part, CasingConvention.Pascal) ) .join(""); diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 1e1a4bebeb..612e28dd26 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -5,6 +5,9 @@ import { NameType, normalizeName } from "../../src/helpers/nameUtils.js"; describe("#normalizeName", () => { describe("for enum member name", () => { it("should normalize the name with pascal case", () => { + expect(normalizeName("BasicGetNull", NameType.EnumMemberName, true)).to.equal("BasicGetNull"); + expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName, true)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); + expect(normalizeName("PagingGetNullNextLinkNamePagesParameters", NameType.EnumMemberName, true)).to.equal("PagingGetNullNextLinkNamePagesParameters"); expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName, true)).to.equal("AKVCertURI"); expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName, true)).to.equal("AzureOpenAIOperationStateOutput"); expect(normalizeName("TSModel", NameType.EnumMemberName, true)).to.equal("TSModel"); From dc36cfdb0a64153616c5267029e0bf7b7fb3d227 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:29:36 +0800 Subject: [PATCH 19/91] fix rlc generation --- .../bodyComplexRest/src/clientDefinitions.ts | 8 +- .../bodyComplexRest/src/parameters.ts | 4 +- .../bodyComplexRest/src/responses.ts | 8 +- .../bodyStringRest/src/clientDefinitions.ts | 8 +- .../bodyStringRest/src/parameters.ts | 12 +- .../generated/bodyStringRest/src/responses.ts | 12 +- .../generated/pagingRest/src/parameters.ts | 2 +- .../generated/pagingRest/src/responses.ts | 4 +- .../urlRest/src/clientDefinitions.ts | 114 +++++++-------- .../generated/urlRest/src/parameters.ts | 130 +++++++++--------- .../generated/urlRest/src/responses.ts | 76 +++++----- .../generated/urlRest/src/urlRestClient.ts | 38 ++--- packages/rlc-common/src/helpers/nameUtils.ts | 4 +- 13 files changed, 209 insertions(+), 211 deletions(-) diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts index 167db5c891..93b1ac5e2b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts @@ -198,7 +198,7 @@ export interface BasicGetEmpty { ): StreamableMethod; } -export interface BasicGetnull { +export interface BasicGetNull { /** Get a basic complex type whose properties are null */ get( options?: BasicGetNullParameters, @@ -442,7 +442,7 @@ export interface DictionaryGetEmpty { >; } -export interface DictionaryGetnull { +export interface DictionaryGetNull { /** Get complex types with dictionary property which is null */ get( options?: DictionaryGetNullParameters, @@ -606,7 +606,7 @@ export interface Routes { /** Resource for '/complex/basic/empty' has methods for the following verbs: get */ (path: "/complex/basic/empty"): BasicGetEmpty; /** Resource for '/complex/basic/null' has methods for the following verbs: get */ - (path: "/complex/basic/null"): BasicGetnull; + (path: "/complex/basic/null"): BasicGetNull; /** Resource for '/complex/basic/notprovided' has methods for the following verbs: get */ (path: "/complex/basic/notprovided"): BasicGetNotProvided; /** Resource for '/complex/primitive/integer' has methods for the following verbs: get, put */ @@ -642,7 +642,7 @@ export interface Routes { /** Resource for '/complex/dictionary/typed/empty' has methods for the following verbs: get, put */ (path: "/complex/dictionary/typed/empty"): DictionaryGetEmpty; /** Resource for '/complex/dictionary/typed/null' has methods for the following verbs: get */ - (path: "/complex/dictionary/typed/null"): DictionaryGetnull; + (path: "/complex/dictionary/typed/null"): DictionaryGetNull; /** Resource for '/complex/dictionary/typed/notprovided' has methods for the following verbs: get */ (path: "/complex/dictionary/typed/notprovided"): DictionaryGetNotProvided; /** Resource for '/complex/inheritance/valid' has methods for the following verbs: get, put */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts index b353407061..85dc564c3a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts @@ -40,7 +40,7 @@ export type BasicPutValidParameters = BasicPutValidMediaTypesParam & RequestParameters; export type BasicGetInvalidParameters = RequestParameters; export type BasicGetEmptyParameters = RequestParameters; -export type BasicGetnullParameters = RequestParameters; +export type BasicGetNullParameters = RequestParameters; export type BasicGetNotProvidedParameters = RequestParameters; export type PrimitiveGetIntParameters = RequestParameters; @@ -271,7 +271,7 @@ export interface DictionaryPutEmptyMediaTypesParam { export type DictionaryPutEmptyParameters = DictionaryPutEmptyMediaTypesParam & DictionaryPutEmptyBodyParam & RequestParameters; -export type DictionaryGetnullParameters = RequestParameters; +export type DictionaryGetNullParameters = RequestParameters; export type DictionaryGetNotProvidedParameters = RequestParameters; export type InheritanceGetValidParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts index b050aa8534..e825007a74 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts @@ -75,13 +75,13 @@ export interface BasicGetEmptyDefaultResponse extends HttpResponse { } /** Get a basic complex type whose properties are null */ -export interface BasicGetnull200Response extends HttpResponse { +export interface BasicGetNull200Response extends HttpResponse { status: "200"; body: BasicDefOutput; } /** Get a basic complex type whose properties are null */ -export interface BasicGetnullDefaultResponse extends HttpResponse { +export interface BasicGetNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -458,13 +458,13 @@ export interface DictionaryPutEmptyDefaultResponse extends HttpResponse { } /** Get complex types with dictionary property which is null */ -export interface DictionaryGetnull200Response extends HttpResponse { +export interface DictionaryGetNull200Response extends HttpResponse { status: "200"; body: DictionaryWrapperOutput; } /** Get complex types with dictionary property which is null */ -export interface DictionaryGetnullDefaultResponse extends HttpResponse { +export interface DictionaryGetNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts index fe72ea614f..a168f2c590 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts @@ -64,7 +64,7 @@ import { } from "./responses"; import { Client, StreamableMethod } from "@azure-rest/core-client"; -export interface StringGetnull { +export interface StringGetNull { /** Get null string value value */ get( options?: StringGetNullParameters, @@ -151,7 +151,7 @@ export interface StringGetBase64UrlEncoded { >; } -export interface StringGetnullBase64UrlEncoded { +export interface StringGetNullBase64UrlEncoded { /** Get null value that is expected to be base64url encoded */ get( options?: StringGetNullBase64UrlEncodedParameters, @@ -210,7 +210,7 @@ export interface EnumGetReferencedConstant { export interface Routes { /** Resource for '/string/null' has methods for the following verbs: get, put */ - (path: "/string/null"): StringGetnull; + (path: "/string/null"): StringGetNull; /** Resource for '/string/empty' has methods for the following verbs: get, put */ (path: "/string/empty"): StringGetEmpty; /** Resource for '/string/mbcs' has methods for the following verbs: get, put */ @@ -224,7 +224,7 @@ export interface Routes { /** Resource for '/string/base64UrlEncoding' has methods for the following verbs: get, put */ (path: "/string/base64UrlEncoding"): StringGetBase64UrlEncoded; /** Resource for '/string/nullBase64UrlEncoding' has methods for the following verbs: get */ - (path: "/string/nullBase64UrlEncoding"): StringGetnullBase64UrlEncoded; + (path: "/string/nullBase64UrlEncoding"): StringGetNullBase64UrlEncoded; /** Resource for '/string/enum/notExpandable' has methods for the following verbs: get, put */ (path: "/string/enum/notExpandable"): EnumGetNotExpandable; /** Resource for '/string/enum/Referenced' has methods for the following verbs: get, put */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts index 61f08ea8f6..bffaa32b09 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts @@ -4,20 +4,20 @@ import { RequestParameters } from "@azure-rest/core-client"; import { RefColorConstant } from "./models"; -export type StringGetnullParameters = RequestParameters; +export type StringGetNullParameters = RequestParameters; -export interface StringPutnullBodyParam { +export interface StringPutNullBodyParam { /** string body */ body?: string; } -export interface StringPutnullMediaTypesParam { +export interface StringPutNullMediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type StringPutnullParameters = StringPutnullMediaTypesParam & - StringPutnullBodyParam & +export type StringPutNullParameters = StringPutNullMediaTypesParam & + StringPutNullBodyParam & RequestParameters; export type StringGetEmptyParameters = RequestParameters; @@ -86,7 +86,7 @@ export type StringPutBase64UrlEncodedParameters = StringPutBase64UrlEncodedMediaTypesParam & StringPutBase64UrlEncodedBodyParam & RequestParameters; -export type StringGetnullBase64UrlEncodedParameters = RequestParameters; +export type StringGetNullBase64UrlEncodedParameters = RequestParameters; export type EnumGetNotExpandableParameters = RequestParameters; export interface EnumPutNotExpandableBodyParam { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts index 8a4f8362c1..0d3376423a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts @@ -5,24 +5,24 @@ import { HttpResponse } from "@azure-rest/core-client"; import { ErrorModelOutput, RefColorConstantOutput } from "./outputModels"; /** Get null string value value */ -export interface StringGetnull200Response extends HttpResponse { +export interface StringGetNull200Response extends HttpResponse { status: "200"; body: string; } /** Get null string value value */ -export interface StringGetnullDefaultResponse extends HttpResponse { +export interface StringGetNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } /** Set string value null */ -export interface StringPutnull200Response extends HttpResponse { +export interface StringPutNull200Response extends HttpResponse { status: "200"; } /** Set string value null */ -export interface StringPutnullDefaultResponse extends HttpResponse { +export interface StringPutNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -146,14 +146,14 @@ export interface StringPutBase64UrlEncodedDefaultResponse extends HttpResponse { } /** Get null value that is expected to be base64url encoded */ -export interface StringGetnullBase64UrlEncoded200Response extends HttpResponse { +export interface StringGetNullBase64UrlEncoded200Response extends HttpResponse { status: "200"; /** Value may contain base64 encoded characters */ body: string; } /** Get null value that is expected to be base64url encoded */ -export interface StringGetnullBase64UrlEncodedDefaultResponse +export interface StringGetNullBase64UrlEncodedDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts index 28315a0cd3..acc58555bc 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts @@ -7,7 +7,7 @@ import { BodyParam } from "./models"; export type PagingGetNoItemNamePagesParameters = RequestParameters; export type PagingGetEmptyNextLinkNamePagesParameters = RequestParameters; -export type PagingGetnullNextLinkNamePagesParameters = RequestParameters; +export type PagingGetNullNextLinkNamePagesParameters = RequestParameters; export type PagingGetSinglePagesParameters = RequestParameters; export interface PagingGetSinglePagesWithBodyParamsBodyParam { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts index 0cb0cf22f9..0e5ee7a131 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts @@ -34,14 +34,14 @@ export interface PagingGetEmptyNextLinkNamePagesDefaultResponse } /** A paging operation that must ignore any kind of nextLink, and stop after page 1. */ -export interface PagingGetnullNextLinkNamePages200Response +export interface PagingGetNullNextLinkNamePages200Response extends HttpResponse { status: "200"; body: ProductResultOutput; } /** A paging operation that must ignore any kind of nextLink, and stop after page 1. */ -export interface PagingGetnullNextLinkNamePagesDefaultResponse +export interface PagingGetNullNextLinkNamePagesDefaultResponse extends HttpResponse { status: string; } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts index db20eac07a..90de748e6f 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts @@ -313,7 +313,7 @@ export interface PathsOperations { PathsStringEmpty200Response | PathsStringEmptyDefaultResponse >; /** Get null (should throw) */ - stringnull( + stringNull( stringPath: string, options?: PathsStringNullParameters, ): StreamableMethod< @@ -327,7 +327,7 @@ export interface PathsOperations { PathsEnumValid200Response | PathsEnumValidDefaultResponse >; /** Get null (should throw on the client before the request is sent on wire) */ - enumnull( + enumNull( enumPath: "red color" | "green color" | "blue color", options?: PathsEnumNullParameters, ): StreamableMethod; @@ -346,7 +346,7 @@ export interface PathsOperations { PathsByteEmpty200Response | PathsByteEmptyDefaultResponse >; /** Get null as byte array (should throw) */ - bytenull( + byteNull( bytePath: string, options?: PathsByteNullParameters, ): StreamableMethod; @@ -358,7 +358,7 @@ export interface PathsOperations { PathsDateValid200Response | PathsDateValidDefaultResponse >; /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ - datenull( + dateNull( datePath: Date | string, options?: PathsDateNullParameters, ): StreamableMethod; @@ -370,7 +370,7 @@ export interface PathsOperations { PathsDateTimeValid200Response | PathsDateTimeValidDefaultResponse >; /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ - dateTimenull( + dateTimeNull( dateTimePath: Date | string, options?: PathsDateTimeNullParameters, ): StreamableMethod< @@ -414,7 +414,7 @@ export interface QueriesOperations { QueriesGetBooleanFalse200Response | QueriesGetBooleanFalseDefaultResponse >; /** Get null Boolean value on query (query string should be absent) */ - getBooleannull( + getBooleanNull( options?: QueriesGetBooleanNullParameters, ): StreamableMethod< QueriesGetBooleanNull200Response | QueriesGetBooleanNullDefaultResponse @@ -433,7 +433,7 @@ export interface QueriesOperations { | QueriesGetIntNegativeOneMillionDefaultResponse >; /** Get null integer value (no query parameter) */ - getIntnull( + getIntNull( options?: QueriesGetIntNullParameters, ): StreamableMethod< QueriesGetIntNull200Response | QueriesGetIntNullDefaultResponse @@ -452,7 +452,7 @@ export interface QueriesOperations { | QueriesGetNegativeTenBillionDefaultResponse >; /** Get 'null 64 bit integer value (no query param in uri) */ - getLongnull( + getLongNull( options?: QueriesGetLongNullParameters, ): StreamableMethod< QueriesGetLongNull200Response | QueriesGetLongNullDefaultResponse @@ -472,7 +472,7 @@ export interface QueriesOperations { | QueriesFloatScientificNegativeDefaultResponse >; /** Get null numeric value (no query parameter) */ - floatnull( + floatNull( options?: QueriesFloatNullParameters, ): StreamableMethod< QueriesFloatNull200Response | QueriesFloatNullDefaultResponse @@ -492,7 +492,7 @@ export interface QueriesOperations { | QueriesDoubleDecimalNegativeDefaultResponse >; /** Get null numeric value (no query parameter) */ - doublenull( + doubleNull( options?: QueriesDoubleNullParameters, ): StreamableMethod< QueriesDoubleNull200Response | QueriesDoubleNullDefaultResponse @@ -516,7 +516,7 @@ export interface QueriesOperations { QueriesStringEmpty200Response | QueriesStringEmptyDefaultResponse >; /** Get null (no query parameter in url) */ - stringnull( + stringNull( options?: QueriesStringNullParameters, ): StreamableMethod< QueriesStringNull200Response | QueriesStringNullDefaultResponse @@ -528,7 +528,7 @@ export interface QueriesOperations { QueriesEnumValid200Response | QueriesEnumValidDefaultResponse >; /** Get null (no query parameter in url) */ - enumnull( + enumNull( options?: QueriesEnumNullParameters, ): StreamableMethod< QueriesEnumNull200Response | QueriesEnumNullDefaultResponse @@ -546,7 +546,7 @@ export interface QueriesOperations { QueriesByteEmpty200Response | QueriesByteEmptyDefaultResponse >; /** Get null as byte array (no query parameters in uri) */ - bytenull( + byteNull( options?: QueriesByteNullParameters, ): StreamableMethod< QueriesByteNull200Response | QueriesByteNullDefaultResponse @@ -558,7 +558,7 @@ export interface QueriesOperations { QueriesDateValid200Response | QueriesDateValidDefaultResponse >; /** Get null as date - this should result in no query parameters in uri */ - datenull( + dateNull( options?: QueriesDateNullParameters, ): StreamableMethod< QueriesDateNull200Response | QueriesDateNullDefaultResponse @@ -570,7 +570,7 @@ export interface QueriesOperations { QueriesDateTimeValid200Response | QueriesDateTimeValidDefaultResponse >; /** Get null as date-time, should result in no query parameters in uri */ - dateTimenull( + dateTimeNull( options?: QueriesDateTimeNullParameters, ): StreamableMethod< QueriesDateTimeNull200Response | QueriesDateTimeNullDefaultResponse @@ -583,7 +583,7 @@ export interface QueriesOperations { | QueriesArrayStringCsvValidDefaultResponse >; /** Get a null array of string using the csv-array format */ - arrayStringCsvnull( + arrayStringCsvNull( options?: QueriesArrayStringCsvNullParameters, ): StreamableMethod< | QueriesArrayStringCsvNull200Response @@ -639,7 +639,7 @@ export interface PathItemsOperations { | PathItemsGetAllWithValuesDefaultResponse >; /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ - getGlobalQuerynull( + getGlobalQueryNull( globalStringPath: string, pathItemStringPath: string, localStringPath: string, @@ -649,7 +649,7 @@ export interface PathItemsOperations { | PathItemsGetGlobalQueryNullDefaultResponse >; /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ - getGlobalAndLocalQuerynull( + getGlobalAndLocalQueryNull( globalStringPath: string, pathItemStringPath: string, localStringPath: string, @@ -659,7 +659,7 @@ export interface PathItemsOperations { | PathItemsGetGlobalAndLocalQueryNullDefaultResponse >; /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ - getLocalPathItemQuerynull( + getLocalPathItemQueryNull( globalStringPath: string, pathItemStringPath: string, localStringPath: string, @@ -803,7 +803,7 @@ export interface PathsStringEmpty { >; } -export interface PathsStringnull { +export interface PathsStringNull { /** Get null (should throw) */ get( options?: PathsStringNullParameters, @@ -821,7 +821,7 @@ export interface PathsEnumValid { >; } -export interface PathsEnumnull { +export interface PathsEnumNull { /** Get null (should throw on the client before the request is sent on wire) */ get( options?: PathsEnumNullParameters, @@ -846,7 +846,7 @@ export interface PathsByteEmpty { >; } -export interface PathsBytenull { +export interface PathsByteNull { /** Get null as byte array (should throw) */ get( options?: PathsByteNullParameters, @@ -862,7 +862,7 @@ export interface PathsDateValid { >; } -export interface PathsDatenull { +export interface PathsDateNull { /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ get( options?: PathsDateNullParameters, @@ -878,7 +878,7 @@ export interface PathsDateTimeValid { >; } -export interface PathsDateTimenull { +export interface PathsDateTimeNull { /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ get( options?: PathsDateTimeNullParameters, @@ -932,7 +932,7 @@ export interface QueriesGetBooleanFalse { >; } -export interface QueriesGetBooleannull { +export interface QueriesGetBooleanNull { /** Get null Boolean value on query (query string should be absent) */ get( options?: QueriesGetBooleanNullParameters, @@ -960,7 +960,7 @@ export interface QueriesGetIntNegativeOneMillion { >; } -export interface QueriesGetIntnull { +export interface QueriesGetIntNull { /** Get null integer value (no query parameter) */ get( options?: QueriesGetIntNullParameters, @@ -988,7 +988,7 @@ export interface QueriesGetNegativeTenBillion { >; } -export interface QueriesGetLongnull { +export interface QueriesGetLongNull { /** Get 'null 64 bit integer value (no query param in uri) */ get( options?: QueriesGetLongNullParameters, @@ -1017,7 +1017,7 @@ export interface QueriesFloatScientificNegative { >; } -export interface QueriesFloatnull { +export interface QueriesFloatNull { /** Get null numeric value (no query parameter) */ get( options?: QueriesFloatNullParameters, @@ -1046,7 +1046,7 @@ export interface QueriesDoubleDecimalNegative { >; } -export interface QueriesDoublenull { +export interface QueriesDoubleNull { /** Get null numeric value (no query parameter) */ get( options?: QueriesDoubleNullParameters, @@ -1082,7 +1082,7 @@ export interface QueriesStringEmpty { >; } -export interface QueriesStringnull { +export interface QueriesStringNull { /** Get null (no query parameter in url) */ get( options?: QueriesStringNullParameters, @@ -1100,7 +1100,7 @@ export interface QueriesEnumValid { >; } -export interface QueriesEnumnull { +export interface QueriesEnumNull { /** Get null (no query parameter in url) */ get( options?: QueriesEnumNullParameters, @@ -1127,7 +1127,7 @@ export interface QueriesByteEmpty { >; } -export interface QueriesBytenull { +export interface QueriesByteNull { /** Get null as byte array (no query parameters in uri) */ get( options?: QueriesByteNullParameters, @@ -1145,7 +1145,7 @@ export interface QueriesDateValid { >; } -export interface QueriesDatenull { +export interface QueriesDateNull { /** Get null as date - this should result in no query parameters in uri */ get( options?: QueriesDateNullParameters, @@ -1163,7 +1163,7 @@ export interface QueriesDateTimeValid { >; } -export interface QueriesDateTimenull { +export interface QueriesDateTimeNull { /** Get null as date-time, should result in no query parameters in uri */ get( options?: QueriesDateTimeNullParameters, @@ -1182,7 +1182,7 @@ export interface QueriesArrayStringCsvValid { >; } -export interface QueriesArrayStringCsvnull { +export interface QueriesArrayStringCsvNull { /** Get a null array of string using the csv-array format */ get( options?: QueriesArrayStringCsvNullParameters, @@ -1252,7 +1252,7 @@ export interface PathItemsGetAllWithValues { >; } -export interface PathItemsGetGlobalQuerynull { +export interface PathItemsGetGlobalQueryNull { /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ get( options?: PathItemsGetGlobalQueryNullParameters, @@ -1262,7 +1262,7 @@ export interface PathItemsGetGlobalQuerynull { >; } -export interface PathItemsGetGlobalAndLocalQuerynull { +export interface PathItemsGetGlobalAndLocalQueryNull { /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ get( options?: PathItemsGetGlobalAndLocalQueryNullParameters, @@ -1272,7 +1272,7 @@ export interface PathItemsGetGlobalAndLocalQuerynull { >; } -export interface PathItemsGetLocalPathItemQuerynull { +export interface PathItemsGetLocalPathItemQueryNull { /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ get( options?: PathItemsGetLocalPathItemQueryNullParameters, @@ -1348,7 +1348,7 @@ export interface Routes { ( path: "/paths/string/null/{stringPath}", stringPath: string, - ): PathsStringnull; + ): PathsStringNull; /** Resource for '/paths/enum/green%20color/\{enumPath\}' has methods for the following verbs: get */ ( path: "/paths/enum/green%20color/{enumPath}", @@ -1358,7 +1358,7 @@ export interface Routes { ( path: "/paths/string/null/{enumPath}", enumPath: "red color" | "green color" | "blue color", - ): PathsEnumnull; + ): PathsEnumNull; /** Resource for '/paths/byte/multibyte/\{bytePath\}' has methods for the following verbs: get */ ( path: "/paths/byte/multibyte/{bytePath}", @@ -1367,14 +1367,14 @@ export interface Routes { /** Resource for '/paths/byte/empty/\{bytePath\}' has methods for the following verbs: get */ (path: "/paths/byte/empty/{bytePath}", bytePath: ""): PathsByteEmpty; /** Resource for '/paths/byte/null/\{bytePath\}' has methods for the following verbs: get */ - (path: "/paths/byte/null/{bytePath}", bytePath: string): PathsBytenull; + (path: "/paths/byte/null/{bytePath}", bytePath: string): PathsByteNull; /** Resource for '/paths/date/2012-01-01/\{datePath\}' has methods for the following verbs: get */ ( path: "/paths/date/2012-01-01/{datePath}", datePath: "2012-01-01", ): PathsDateValid; /** Resource for '/paths/date/null/\{datePath\}' has methods for the following verbs: get */ - (path: "/paths/date/null/{datePath}", datePath: Date | string): PathsDatenull; + (path: "/paths/date/null/{datePath}", datePath: Date | string): PathsDateNull; /** Resource for '/paths/datetime/2012-01-01T01%3A01%3A01Z/\{dateTimePath\}' has methods for the following verbs: get */ ( path: "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}", @@ -1384,7 +1384,7 @@ export interface Routes { ( path: "/paths/datetime/null/{dateTimePath}", dateTimePath: Date | string, - ): PathsDateTimenull; + ): PathsDateTimeNull; /** Resource for '/paths/string/bG9yZW0/\{base64UrlPath\}' has methods for the following verbs: get */ ( path: "/paths/string/bG9yZW0/{base64UrlPath}", @@ -1405,31 +1405,31 @@ export interface Routes { /** Resource for '/queries/bool/false' has methods for the following verbs: get */ (path: "/queries/bool/false"): QueriesGetBooleanFalse; /** Resource for '/queries/bool/null' has methods for the following verbs: get */ - (path: "/queries/bool/null"): QueriesGetBooleannull; + (path: "/queries/bool/null"): QueriesGetBooleanNull; /** Resource for '/queries/int/1000000' has methods for the following verbs: get */ (path: "/queries/int/1000000"): QueriesGetIntOneMillion; /** Resource for '/queries/int/-1000000' has methods for the following verbs: get */ (path: "/queries/int/-1000000"): QueriesGetIntNegativeOneMillion; /** Resource for '/queries/int/null' has methods for the following verbs: get */ - (path: "/queries/int/null"): QueriesGetIntnull; + (path: "/queries/int/null"): QueriesGetIntNull; /** Resource for '/queries/long/10000000000' has methods for the following verbs: get */ (path: "/queries/long/10000000000"): QueriesGetTenBillion; /** Resource for '/queries/long/-10000000000' has methods for the following verbs: get */ (path: "/queries/long/-10000000000"): QueriesGetNegativeTenBillion; /** Resource for '/queries/long/null' has methods for the following verbs: get */ - (path: "/queries/long/null"): QueriesGetLongnull; + (path: "/queries/long/null"): QueriesGetLongNull; /** Resource for '/queries/float/1.034E+20' has methods for the following verbs: get */ (path: "/queries/float/1.034E+20"): QueriesFloatScientificPositive; /** Resource for '/queries/float/-1.034E-20' has methods for the following verbs: get */ (path: "/queries/float/-1.034E-20"): QueriesFloatScientificNegative; /** Resource for '/queries/float/null' has methods for the following verbs: get */ - (path: "/queries/float/null"): QueriesFloatnull; + (path: "/queries/float/null"): QueriesFloatNull; /** Resource for '/queries/double/9999999.999' has methods for the following verbs: get */ (path: "/queries/double/9999999.999"): QueriesDoubleDecimalPositive; /** Resource for '/queries/double/-9999999.999' has methods for the following verbs: get */ (path: "/queries/double/-9999999.999"): QueriesDoubleDecimalNegative; /** Resource for '/queries/double/null' has methods for the following verbs: get */ - (path: "/queries/double/null"): QueriesDoublenull; + (path: "/queries/double/null"): QueriesDoubleNull; /** Resource for '/queries/string/unicode/' has methods for the following verbs: get */ (path: "/queries/string/unicode/"): QueriesStringUnicode; /** Resource for '/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend' has methods for the following verbs: get */ @@ -1439,29 +1439,29 @@ export interface Routes { /** Resource for '/queries/string/empty' has methods for the following verbs: get */ (path: "/queries/string/empty"): QueriesStringEmpty; /** Resource for '/queries/string/null' has methods for the following verbs: get */ - (path: "/queries/string/null"): QueriesStringnull; + (path: "/queries/string/null"): QueriesStringNull; /** Resource for '/queries/enum/green%20color' has methods for the following verbs: get */ (path: "/queries/enum/green%20color"): QueriesEnumValid; /** Resource for '/queries/enum/null' has methods for the following verbs: get */ - (path: "/queries/enum/null"): QueriesEnumnull; + (path: "/queries/enum/null"): QueriesEnumNull; /** Resource for '/queries/byte/multibyte' has methods for the following verbs: get */ (path: "/queries/byte/multibyte"): QueriesByteMultiByte; /** Resource for '/queries/byte/empty' has methods for the following verbs: get */ (path: "/queries/byte/empty"): QueriesByteEmpty; /** Resource for '/queries/byte/null' has methods for the following verbs: get */ - (path: "/queries/byte/null"): QueriesBytenull; + (path: "/queries/byte/null"): QueriesByteNull; /** Resource for '/queries/date/2012-01-01' has methods for the following verbs: get */ (path: "/queries/date/2012-01-01"): QueriesDateValid; /** Resource for '/queries/date/null' has methods for the following verbs: get */ - (path: "/queries/date/null"): QueriesDatenull; + (path: "/queries/date/null"): QueriesDateNull; /** Resource for '/queries/datetime/2012-01-01T01%3A01%3A01Z' has methods for the following verbs: get */ (path: "/queries/datetime/2012-01-01T01%3A01%3A01Z"): QueriesDateTimeValid; /** Resource for '/queries/datetime/null' has methods for the following verbs: get */ - (path: "/queries/datetime/null"): QueriesDateTimenull; + (path: "/queries/datetime/null"): QueriesDateTimeNull; /** Resource for '/queries/array/csv/string/valid' has methods for the following verbs: get */ (path: "/queries/array/csv/string/valid"): QueriesArrayStringCsvValid; /** Resource for '/queries/array/csv/string/null' has methods for the following verbs: get */ - (path: "/queries/array/csv/string/null"): QueriesArrayStringCsvnull; + (path: "/queries/array/csv/string/null"): QueriesArrayStringCsvNull; /** Resource for '/queries/array/csv/string/empty' has methods for the following verbs: get */ (path: "/queries/array/csv/string/empty"): QueriesArrayStringCsvEmpty; /** Resource for '/queries/array/none/string/empty' has methods for the following verbs: get */ @@ -1487,21 +1487,21 @@ export interface Routes { globalStringPath: string, pathItemStringPath: string, localStringPath: string, - ): PathItemsGetGlobalQuerynull; + ): PathItemsGetGlobalQueryNull; /** Resource for '/pathitem/nullable/globalStringPath/\{globalStringPath\}/pathItemStringPath/\{pathItemStringPath\}/localStringPath/\{localStringPath\}/null/pathItemStringQuery/null' has methods for the following verbs: get */ ( path: "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null", globalStringPath: string, pathItemStringPath: string, localStringPath: string, - ): PathItemsGetGlobalAndLocalQuerynull; + ): PathItemsGetGlobalAndLocalQueryNull; /** Resource for '/pathitem/nullable/globalStringPath/\{globalStringPath\}/pathItemStringPath/\{pathItemStringPath\}/localStringPath/\{localStringPath\}/globalStringQuery/null/null' has methods for the following verbs: get */ ( path: "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null", globalStringPath: string, pathItemStringPath: string, localStringPath: string, - ): PathItemsGetLocalPathItemQuerynull; + ): PathItemsGetLocalPathItemQueryNull; } export type UrlRestClient = Client & { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts index 96f53925ff..0a4f94a1ed 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts @@ -17,16 +17,16 @@ export type PathsStringUnicodeParameters = RequestParameters; export type PathsStringUrlEncodedParameters = RequestParameters; export type PathsStringUrlNonEncodedParameters = RequestParameters; export type PathsStringEmptyParameters = RequestParameters; -export type PathsStringnullParameters = RequestParameters; +export type PathsStringNullParameters = RequestParameters; export type PathsEnumValidParameters = RequestParameters; -export type PathsEnumnullParameters = RequestParameters; +export type PathsEnumNullParameters = RequestParameters; export type PathsByteMultiByteParameters = RequestParameters; export type PathsByteEmptyParameters = RequestParameters; -export type PathsBytenullParameters = RequestParameters; +export type PathsByteNullParameters = RequestParameters; export type PathsDateValidParameters = RequestParameters; -export type PathsDatenullParameters = RequestParameters; +export type PathsDateNullParameters = RequestParameters; export type PathsDateTimeValidParameters = RequestParameters; -export type PathsDateTimenullParameters = RequestParameters; +export type PathsDateTimeNullParameters = RequestParameters; export type PathsBase64UrlParameters = RequestParameters; export type PathsArrayCsvInPathParameters = RequestParameters; export type PathsUnixTimeUrlParameters = RequestParameters; @@ -55,16 +55,16 @@ export interface QueriesGetBooleanFalseQueryParam { export type QueriesGetBooleanFalseParameters = QueriesGetBooleanFalseQueryParam & RequestParameters; -export interface QueriesGetBooleannullQueryParamProperties { +export interface QueriesGetBooleanNullQueryParamProperties { /** null boolean value */ boolQuery?: boolean; } -export interface QueriesGetBooleannullQueryParam { - queryParameters?: QueriesGetBooleannullQueryParamProperties; +export interface QueriesGetBooleanNullQueryParam { + queryParameters?: QueriesGetBooleanNullQueryParamProperties; } -export type QueriesGetBooleannullParameters = QueriesGetBooleannullQueryParam & +export type QueriesGetBooleanNullParameters = QueriesGetBooleanNullQueryParam & RequestParameters; export interface QueriesGetIntOneMillionQueryParamProperties { @@ -91,16 +91,16 @@ export interface QueriesGetIntNegativeOneMillionQueryParam { export type QueriesGetIntNegativeOneMillionParameters = QueriesGetIntNegativeOneMillionQueryParam & RequestParameters; -export interface QueriesGetIntnullQueryParamProperties { +export interface QueriesGetIntNullQueryParamProperties { /** null integer value */ intQuery?: number; } -export interface QueriesGetIntnullQueryParam { - queryParameters?: QueriesGetIntnullQueryParamProperties; +export interface QueriesGetIntNullQueryParam { + queryParameters?: QueriesGetIntNullQueryParamProperties; } -export type QueriesGetIntnullParameters = QueriesGetIntnullQueryParam & +export type QueriesGetIntNullParameters = QueriesGetIntNullQueryParam & RequestParameters; export interface QueriesGetTenBillionQueryParamProperties { @@ -127,16 +127,16 @@ export interface QueriesGetNegativeTenBillionQueryParam { export type QueriesGetNegativeTenBillionParameters = QueriesGetNegativeTenBillionQueryParam & RequestParameters; -export interface QueriesGetLongnullQueryParamProperties { +export interface QueriesGetLongNullQueryParamProperties { /** null 64 bit integer value */ longQuery?: number; } -export interface QueriesGetLongnullQueryParam { - queryParameters?: QueriesGetLongnullQueryParamProperties; +export interface QueriesGetLongNullQueryParam { + queryParameters?: QueriesGetLongNullQueryParamProperties; } -export type QueriesGetLongnullParameters = QueriesGetLongnullQueryParam & +export type QueriesGetLongNullParameters = QueriesGetLongNullQueryParam & RequestParameters; export interface QueriesFloatScientificPositiveQueryParamProperties { @@ -163,16 +163,16 @@ export interface QueriesFloatScientificNegativeQueryParam { export type QueriesFloatScientificNegativeParameters = QueriesFloatScientificNegativeQueryParam & RequestParameters; -export interface QueriesFloatnullQueryParamProperties { +export interface QueriesFloatNullQueryParamProperties { /** null numeric value */ floatQuery?: number; } -export interface QueriesFloatnullQueryParam { - queryParameters?: QueriesFloatnullQueryParamProperties; +export interface QueriesFloatNullQueryParam { + queryParameters?: QueriesFloatNullQueryParamProperties; } -export type QueriesFloatnullParameters = QueriesFloatnullQueryParam & +export type QueriesFloatNullParameters = QueriesFloatNullQueryParam & RequestParameters; export interface QueriesDoubleDecimalPositiveQueryParamProperties { @@ -199,16 +199,16 @@ export interface QueriesDoubleDecimalNegativeQueryParam { export type QueriesDoubleDecimalNegativeParameters = QueriesDoubleDecimalNegativeQueryParam & RequestParameters; -export interface QueriesDoublenullQueryParamProperties { +export interface QueriesDoubleNullQueryParamProperties { /** null numeric value */ doubleQuery?: number; } -export interface QueriesDoublenullQueryParam { - queryParameters?: QueriesDoublenullQueryParamProperties; +export interface QueriesDoubleNullQueryParam { + queryParameters?: QueriesDoubleNullQueryParamProperties; } -export type QueriesDoublenullParameters = QueriesDoublenullQueryParam & +export type QueriesDoubleNullParameters = QueriesDoubleNullQueryParam & RequestParameters; export interface QueriesStringUnicodeQueryParamProperties { @@ -247,16 +247,16 @@ export interface QueriesStringEmptyQueryParam { export type QueriesStringEmptyParameters = QueriesStringEmptyQueryParam & RequestParameters; -export interface QueriesStringnullQueryParamProperties { +export interface QueriesStringNullQueryParamProperties { /** null string value */ stringQuery?: string; } -export interface QueriesStringnullQueryParam { - queryParameters?: QueriesStringnullQueryParamProperties; +export interface QueriesStringNullQueryParam { + queryParameters?: QueriesStringNullQueryParamProperties; } -export type QueriesStringnullParameters = QueriesStringnullQueryParam & +export type QueriesStringNullParameters = QueriesStringNullQueryParam & RequestParameters; export interface QueriesEnumValidQueryParamProperties { @@ -271,16 +271,16 @@ export interface QueriesEnumValidQueryParam { export type QueriesEnumValidParameters = QueriesEnumValidQueryParam & RequestParameters; -export interface QueriesEnumnullQueryParamProperties { +export interface QueriesEnumNullQueryParamProperties { /** null string value */ enumQuery?: "red color" | "green color" | "blue color"; } -export interface QueriesEnumnullQueryParam { - queryParameters?: QueriesEnumnullQueryParamProperties; +export interface QueriesEnumNullQueryParam { + queryParameters?: QueriesEnumNullQueryParamProperties; } -export type QueriesEnumnullParameters = QueriesEnumnullQueryParam & +export type QueriesEnumNullParameters = QueriesEnumNullQueryParam & RequestParameters; export interface QueriesByteMultiByteQueryParamProperties { @@ -311,7 +311,7 @@ export interface QueriesByteEmptyQueryParam { export type QueriesByteEmptyParameters = QueriesByteEmptyQueryParam & RequestParameters; -export interface QueriesBytenullQueryParamProperties { +export interface QueriesByteNullQueryParamProperties { /** * null as byte array (no query parameters in uri) * @@ -320,11 +320,11 @@ export interface QueriesBytenullQueryParamProperties { byteQuery?: string; } -export interface QueriesBytenullQueryParam { - queryParameters?: QueriesBytenullQueryParamProperties; +export interface QueriesByteNullQueryParam { + queryParameters?: QueriesByteNullQueryParamProperties; } -export type QueriesBytenullParameters = QueriesBytenullQueryParam & +export type QueriesByteNullParameters = QueriesByteNullQueryParam & RequestParameters; export interface QueriesDateValidQueryParamProperties { @@ -339,16 +339,16 @@ export interface QueriesDateValidQueryParam { export type QueriesDateValidParameters = QueriesDateValidQueryParam & RequestParameters; -export interface QueriesDatenullQueryParamProperties { +export interface QueriesDateNullQueryParamProperties { /** null as date (no query parameters in uri) */ dateQuery?: Date | string; } -export interface QueriesDatenullQueryParam { - queryParameters?: QueriesDatenullQueryParamProperties; +export interface QueriesDateNullQueryParam { + queryParameters?: QueriesDateNullQueryParamProperties; } -export type QueriesDatenullParameters = QueriesDatenullQueryParam & +export type QueriesDateNullParameters = QueriesDateNullQueryParam & RequestParameters; export interface QueriesDateTimeValidQueryParamProperties { @@ -363,16 +363,16 @@ export interface QueriesDateTimeValidQueryParam { export type QueriesDateTimeValidParameters = QueriesDateTimeValidQueryParam & RequestParameters; -export interface QueriesDateTimenullQueryParamProperties { +export interface QueriesDateTimeNullQueryParamProperties { /** null as date-time (no query parameters) */ dateTimeQuery?: Date | string; } -export interface QueriesDateTimenullQueryParam { - queryParameters?: QueriesDateTimenullQueryParamProperties; +export interface QueriesDateTimeNullQueryParam { + queryParameters?: QueriesDateTimeNullQueryParamProperties; } -export type QueriesDateTimenullParameters = QueriesDateTimenullQueryParam & +export type QueriesDateTimeNullParameters = QueriesDateTimeNullQueryParam & RequestParameters; export interface QueriesArrayStringCsvValidQueryParamProperties { @@ -387,17 +387,17 @@ export interface QueriesArrayStringCsvValidQueryParam { export type QueriesArrayStringCsvValidParameters = QueriesArrayStringCsvValidQueryParam & RequestParameters; -export interface QueriesArrayStringCsvnullQueryParamProperties { +export interface QueriesArrayStringCsvNullQueryParamProperties { /** a null array of string using the csv-array format */ arrayQuery?: Array; } -export interface QueriesArrayStringCsvnullQueryParam { - queryParameters?: QueriesArrayStringCsvnullQueryParamProperties; +export interface QueriesArrayStringCsvNullQueryParam { + queryParameters?: QueriesArrayStringCsvNullQueryParamProperties; } -export type QueriesArrayStringCsvnullParameters = - QueriesArrayStringCsvnullQueryParam & RequestParameters; +export type QueriesArrayStringCsvNullParameters = + QueriesArrayStringCsvNullQueryParam & RequestParameters; export interface QueriesArrayStringCsvEmptyQueryParamProperties { /** an empty array [] of string using the csv-array format */ @@ -473,44 +473,44 @@ export interface PathItemsGetAllWithValuesQueryParam { export type PathItemsGetAllWithValuesParameters = PathItemsGetAllWithValuesQueryParam & RequestParameters; -export interface PathItemsGetGlobalQuerynullQueryParamProperties { +export interface PathItemsGetGlobalQueryNullQueryParamProperties { /** A string value 'pathItemStringQuery' that appears as a query parameter */ pathItemStringQuery?: string; /** should contain value 'localStringQuery' */ localStringQuery?: string; } -export interface PathItemsGetGlobalQuerynullQueryParam { - queryParameters?: PathItemsGetGlobalQuerynullQueryParamProperties; +export interface PathItemsGetGlobalQueryNullQueryParam { + queryParameters?: PathItemsGetGlobalQueryNullQueryParamProperties; } -export type PathItemsGetGlobalQuerynullParameters = - PathItemsGetGlobalQuerynullQueryParam & RequestParameters; +export type PathItemsGetGlobalQueryNullParameters = + PathItemsGetGlobalQueryNullQueryParam & RequestParameters; -export interface PathItemsGetGlobalAndLocalQuerynullQueryParamProperties { +export interface PathItemsGetGlobalAndLocalQueryNullQueryParamProperties { /** A string value 'pathItemStringQuery' that appears as a query parameter */ pathItemStringQuery?: string; /** should contain null value */ localStringQuery?: string; } -export interface PathItemsGetGlobalAndLocalQuerynullQueryParam { - queryParameters?: PathItemsGetGlobalAndLocalQuerynullQueryParamProperties; +export interface PathItemsGetGlobalAndLocalQueryNullQueryParam { + queryParameters?: PathItemsGetGlobalAndLocalQueryNullQueryParamProperties; } -export type PathItemsGetGlobalAndLocalQuerynullParameters = - PathItemsGetGlobalAndLocalQuerynullQueryParam & RequestParameters; +export type PathItemsGetGlobalAndLocalQueryNullParameters = + PathItemsGetGlobalAndLocalQueryNullQueryParam & RequestParameters; -export interface PathItemsGetLocalPathItemQuerynullQueryParamProperties { +export interface PathItemsGetLocalPathItemQueryNullQueryParamProperties { /** should contain value null */ pathItemStringQuery?: string; /** should contain value null */ localStringQuery?: string; } -export interface PathItemsGetLocalPathItemQuerynullQueryParam { - queryParameters?: PathItemsGetLocalPathItemQuerynullQueryParamProperties; +export interface PathItemsGetLocalPathItemQueryNullQueryParam { + queryParameters?: PathItemsGetLocalPathItemQueryNullQueryParamProperties; } -export type PathItemsGetLocalPathItemQuerynullParameters = - PathItemsGetLocalPathItemQuerynullQueryParam & RequestParameters; +export type PathItemsGetLocalPathItemQueryNullParameters = + PathItemsGetLocalPathItemQueryNullQueryParam & RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts index f960928c25..cc4be8315b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts @@ -165,12 +165,12 @@ export interface PathsStringEmptyDefaultResponse extends HttpResponse { } /** Get null (should throw) */ -export interface PathsStringnull400Response extends HttpResponse { +export interface PathsStringNull400Response extends HttpResponse { status: "400"; } /** Get null (should throw) */ -export interface PathsStringnullDefaultResponse extends HttpResponse { +export interface PathsStringNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -187,12 +187,12 @@ export interface PathsEnumValidDefaultResponse extends HttpResponse { } /** Get null (should throw on the client before the request is sent on wire) */ -export interface PathsEnumnull400Response extends HttpResponse { +export interface PathsEnumNull400Response extends HttpResponse { status: "400"; } /** Get null (should throw on the client before the request is sent on wire) */ -export interface PathsEnumnullDefaultResponse extends HttpResponse { +export interface PathsEnumNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -220,12 +220,12 @@ export interface PathsByteEmptyDefaultResponse extends HttpResponse { } /** Get null as byte array (should throw) */ -export interface PathsBytenull400Response extends HttpResponse { +export interface PathsByteNull400Response extends HttpResponse { status: "400"; } /** Get null as byte array (should throw) */ -export interface PathsBytenullDefaultResponse extends HttpResponse { +export interface PathsByteNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -242,12 +242,12 @@ export interface PathsDateValidDefaultResponse extends HttpResponse { } /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ -export interface PathsDatenull400Response extends HttpResponse { +export interface PathsDateNull400Response extends HttpResponse { status: "400"; } /** Get null as date - this should throw or be unusable on the client side, depending on date representation */ -export interface PathsDatenullDefaultResponse extends HttpResponse { +export interface PathsDateNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -264,12 +264,12 @@ export interface PathsDateTimeValidDefaultResponse extends HttpResponse { } /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ -export interface PathsDateTimenull400Response extends HttpResponse { +export interface PathsDateTimeNull400Response extends HttpResponse { status: "400"; } /** Get null as date-time, should be disallowed or throw depending on representation of date-time */ -export interface PathsDateTimenullDefaultResponse extends HttpResponse { +export interface PathsDateTimeNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -330,12 +330,12 @@ export interface QueriesGetBooleanFalseDefaultResponse extends HttpResponse { } /** Get null Boolean value on query (query string should be absent) */ -export interface QueriesGetBooleannull200Response extends HttpResponse { +export interface QueriesGetBooleanNull200Response extends HttpResponse { status: "200"; } /** Get null Boolean value on query (query string should be absent) */ -export interface QueriesGetBooleannullDefaultResponse extends HttpResponse { +export interface QueriesGetBooleanNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -365,12 +365,12 @@ export interface QueriesGetIntNegativeOneMillionDefaultResponse } /** Get null integer value (no query parameter) */ -export interface QueriesGetIntnull200Response extends HttpResponse { +export interface QueriesGetIntNull200Response extends HttpResponse { status: "200"; } /** Get null integer value (no query parameter) */ -export interface QueriesGetIntnullDefaultResponse extends HttpResponse { +export interface QueriesGetIntNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -399,12 +399,12 @@ export interface QueriesGetNegativeTenBillionDefaultResponse } /** Get 'null 64 bit integer value (no query param in uri) */ -export interface QueriesGetLongnull200Response extends HttpResponse { +export interface QueriesGetLongNull200Response extends HttpResponse { status: "200"; } /** Get 'null 64 bit integer value (no query param in uri) */ -export interface QueriesGetLongnullDefaultResponse extends HttpResponse { +export interface QueriesGetLongNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -436,12 +436,12 @@ export interface QueriesFloatScientificNegativeDefaultResponse } /** Get null numeric value (no query parameter) */ -export interface QueriesFloatnull200Response extends HttpResponse { +export interface QueriesFloatNull200Response extends HttpResponse { status: "200"; } /** Get null numeric value (no query parameter) */ -export interface QueriesFloatnullDefaultResponse extends HttpResponse { +export interface QueriesFloatNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -471,12 +471,12 @@ export interface QueriesDoubleDecimalNegativeDefaultResponse } /** Get null numeric value (no query parameter) */ -export interface QueriesDoublenull200Response extends HttpResponse { +export interface QueriesDoubleNull200Response extends HttpResponse { status: "200"; } /** Get null numeric value (no query parameter) */ -export interface QueriesDoublenullDefaultResponse extends HttpResponse { +export interface QueriesDoubleNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -515,12 +515,12 @@ export interface QueriesStringEmptyDefaultResponse extends HttpResponse { } /** Get null (no query parameter in url) */ -export interface QueriesStringnull200Response extends HttpResponse { +export interface QueriesStringNull200Response extends HttpResponse { status: "200"; } /** Get null (no query parameter in url) */ -export interface QueriesStringnullDefaultResponse extends HttpResponse { +export interface QueriesStringNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -537,12 +537,12 @@ export interface QueriesEnumValidDefaultResponse extends HttpResponse { } /** Get null (no query parameter in url) */ -export interface QueriesEnumnull200Response extends HttpResponse { +export interface QueriesEnumNull200Response extends HttpResponse { status: "200"; } /** Get null (no query parameter in url) */ -export interface QueriesEnumnullDefaultResponse extends HttpResponse { +export interface QueriesEnumNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -570,12 +570,12 @@ export interface QueriesByteEmptyDefaultResponse extends HttpResponse { } /** Get null as byte array (no query parameters in uri) */ -export interface QueriesBytenull200Response extends HttpResponse { +export interface QueriesByteNull200Response extends HttpResponse { status: "200"; } /** Get null as byte array (no query parameters in uri) */ -export interface QueriesBytenullDefaultResponse extends HttpResponse { +export interface QueriesByteNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -592,12 +592,12 @@ export interface QueriesDateValidDefaultResponse extends HttpResponse { } /** Get null as date - this should result in no query parameters in uri */ -export interface QueriesDatenull200Response extends HttpResponse { +export interface QueriesDateNull200Response extends HttpResponse { status: "200"; } /** Get null as date - this should result in no query parameters in uri */ -export interface QueriesDatenullDefaultResponse extends HttpResponse { +export interface QueriesDateNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -614,12 +614,12 @@ export interface QueriesDateTimeValidDefaultResponse extends HttpResponse { } /** Get null as date-time, should result in no query parameters in uri */ -export interface QueriesDateTimenull200Response extends HttpResponse { +export interface QueriesDateTimeNull200Response extends HttpResponse { status: "200"; } /** Get null as date-time, should result in no query parameters in uri */ -export interface QueriesDateTimenullDefaultResponse extends HttpResponse { +export interface QueriesDateTimeNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -637,12 +637,12 @@ export interface QueriesArrayStringCsvValidDefaultResponse } /** Get a null array of string using the csv-array format */ -export interface QueriesArrayStringCsvnull200Response extends HttpResponse { +export interface QueriesArrayStringCsvNull200Response extends HttpResponse { status: "200"; } /** Get a null array of string using the csv-array format */ -export interface QueriesArrayStringCsvnullDefaultResponse extends HttpResponse { +export interface QueriesArrayStringCsvNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } @@ -720,38 +720,38 @@ export interface PathItemsGetAllWithValuesDefaultResponse extends HttpResponse { } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ -export interface PathItemsGetGlobalQuerynull200Response extends HttpResponse { +export interface PathItemsGetGlobalQueryNull200Response extends HttpResponse { status: "200"; } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery' */ -export interface PathItemsGetGlobalQuerynullDefaultResponse +export interface PathItemsGetGlobalQueryNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ -export interface PathItemsGetGlobalAndLocalQuerynull200Response +export interface PathItemsGetGlobalAndLocalQueryNull200Response extends HttpResponse { status: "200"; } /** send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null */ -export interface PathItemsGetGlobalAndLocalQuerynullDefaultResponse +export interface PathItemsGetGlobalAndLocalQueryNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ -export interface PathItemsGetLocalPathItemQuerynull200Response +export interface PathItemsGetLocalPathItemQueryNull200Response extends HttpResponse { status: "200"; } /** send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null */ -export interface PathItemsGetLocalPathItemQuerynullDefaultResponse +export interface PathItemsGetLocalPathItemQueryNullDefaultResponse extends HttpResponse { status: string; body: ErrorModelOutput; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts index 384c6b7e72..f375654b51 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts @@ -116,7 +116,7 @@ export default function createClient( .path("/paths/string/empty/{stringPath}", stringPath) .get(options); }, - stringnull: (stringPath, options) => { + stringNull: (stringPath, options) => { return client .path("/paths/string/null/{stringPath}", stringPath) .get(options); @@ -126,7 +126,7 @@ export default function createClient( .path("/paths/enum/green%20color/{enumPath}", enumPath) .get(options); }, - enumnull: (enumPath, options) => { + enumNull: (enumPath, options) => { return client .path("/paths/string/null/{enumPath}", enumPath) .get(options); @@ -141,7 +141,7 @@ export default function createClient( .path("/paths/byte/empty/{bytePath}", bytePath) .get(options); }, - bytenull: (bytePath, options) => { + byteNull: (bytePath, options) => { return client .path("/paths/byte/null/{bytePath}", bytePath) .get(options); @@ -151,7 +151,7 @@ export default function createClient( .path("/paths/date/2012-01-01/{datePath}", datePath) .get(options); }, - datenull: (datePath, options) => { + dateNull: (datePath, options) => { return client .path("/paths/date/null/{datePath}", datePath) .get(options); @@ -164,7 +164,7 @@ export default function createClient( ) .get(options); }, - dateTimenull: (dateTimePath, options) => { + dateTimeNull: (dateTimePath, options) => { return client .path("/paths/datetime/null/{dateTimePath}", dateTimePath) .get(options); @@ -195,7 +195,7 @@ export default function createClient( getBooleanFalse: (options) => { return client.path("/queries/bool/false").get(options); }, - getBooleannull: (options) => { + getBooleanNull: (options) => { return client.path("/queries/bool/null").get(options); }, getIntOneMillion: (options) => { @@ -204,7 +204,7 @@ export default function createClient( getIntNegativeOneMillion: (options) => { return client.path("/queries/int/-1000000").get(options); }, - getIntnull: (options) => { + getIntNull: (options) => { return client.path("/queries/int/null").get(options); }, getTenBillion: (options) => { @@ -213,7 +213,7 @@ export default function createClient( getNegativeTenBillion: (options) => { return client.path("/queries/long/-10000000000").get(options); }, - getLongnull: (options) => { + getLongNull: (options) => { return client.path("/queries/long/null").get(options); }, floatScientificPositive: (options) => { @@ -222,7 +222,7 @@ export default function createClient( floatScientificNegative: (options) => { return client.path("/queries/float/-1.034E-20").get(options); }, - floatnull: (options) => { + floatNull: (options) => { return client.path("/queries/float/null").get(options); }, doubleDecimalPositive: (options) => { @@ -231,7 +231,7 @@ export default function createClient( doubleDecimalNegative: (options) => { return client.path("/queries/double/-9999999.999").get(options); }, - doublenull: (options) => { + doubleNull: (options) => { return client.path("/queries/double/null").get(options); }, stringUnicode: (options) => { @@ -247,13 +247,13 @@ export default function createClient( stringEmpty: (options) => { return client.path("/queries/string/empty").get(options); }, - stringnull: (options) => { + stringNull: (options) => { return client.path("/queries/string/null").get(options); }, enumValid: (options) => { return client.path("/queries/enum/green%20color").get(options); }, - enumnull: (options) => { + enumNull: (options) => { return client.path("/queries/enum/null").get(options); }, byteMultiByte: (options) => { @@ -262,13 +262,13 @@ export default function createClient( byteEmpty: (options) => { return client.path("/queries/byte/empty").get(options); }, - bytenull: (options) => { + byteNull: (options) => { return client.path("/queries/byte/null").get(options); }, dateValid: (options) => { return client.path("/queries/date/2012-01-01").get(options); }, - datenull: (options) => { + dateNull: (options) => { return client.path("/queries/date/null").get(options); }, dateTimeValid: (options) => { @@ -276,13 +276,13 @@ export default function createClient( .path("/queries/datetime/2012-01-01T01%3A01%3A01Z") .get(options); }, - dateTimenull: (options) => { + dateTimeNull: (options) => { return client.path("/queries/datetime/null").get(options); }, arrayStringCsvValid: (options) => { return client.path("/queries/array/csv/string/valid").get(options); }, - arrayStringCsvnull: (options) => { + arrayStringCsvNull: (options) => { return client.path("/queries/array/csv/string/null").get(options); }, arrayStringCsvEmpty: (options) => { @@ -317,7 +317,7 @@ export default function createClient( ) .get(options); }, - getGlobalQuerynull: ( + getGlobalQueryNull: ( globalStringPath, pathItemStringPath, localStringPath, @@ -332,7 +332,7 @@ export default function createClient( ) .get(options); }, - getGlobalAndLocalQuerynull: ( + getGlobalAndLocalQueryNull: ( globalStringPath, pathItemStringPath, localStringPath, @@ -347,7 +347,7 @@ export default function createClient( ) .get(options); }, - getLocalPathItemQuerynull: ( + getLocalPathItemQueryNull: ( globalStringPath, pathItemStringPath, localStringPath, diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 3986d2b4d3..5d3973480d 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -150,9 +150,7 @@ export function normalizeName( const [firstPart, ...otherParts] = parts; const normalizedFirstPart = toCasing(firstPart, casingConvention); const normalizedParts = (otherParts || []) - .map((part) => - toCasing(part, CasingConvention.Pascal) - ) + .map((part) => toCasing(part, CasingConvention.Pascal)) .join(""); const normalized = checkBeginning(`${normalizedFirstPart}${normalizedParts}`); From 6dbe0443e1b8b8c5849aae6272651b61a7ad9fae Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 6 Nov 2024 16:03:48 +0800 Subject: [PATCH 20/91] Add test cases --- packages/rlc-common/test/helpers/nameUtils.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 612e28dd26..7a789852fe 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -6,6 +6,7 @@ describe("#normalizeName", () => { describe("for enum member name", () => { it("should normalize the name with pascal case", () => { expect(normalizeName("BasicGetNull", NameType.EnumMemberName, true)).to.equal("BasicGetNull"); + expect(normalizeName("size256x256", NameType.EnumMemberName, true)).to.equal("Size256X256"); expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName, true)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); expect(normalizeName("PagingGetNullNextLinkNamePagesParameters", NameType.EnumMemberName, true)).to.equal("PagingGetNullNextLinkNamePagesParameters"); expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName, true)).to.equal("AKVCertURI"); @@ -20,6 +21,16 @@ describe("#normalizeName", () => { expect(normalizeName("publicIPDisabled", NameType.EnumMemberName, true)).to.equal("PublicIPDisabled"); }); }); + describe("for property", () => { + it("should remove $ char", () => { + expect(normalizeName("$select", NameType.Parameter, true)).to.equal( + "select" + ); + expect(normalizeName("hate/threatening", NameType.Parameter, true)).to.equal( + "hateThreatening" + ); + }); + }); describe("for parameter", () => { it("should return the name with the suffix 'Param' if the name is a reserved name", () => { expect(normalizeName("static", NameType.Parameter, true)).to.equal( From 05d60c6111501a2e441428b96e0adc6e3a971347 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 6 Nov 2024 17:14:27 +0800 Subject: [PATCH 21/91] Fix the ci issues --- .../generated/azure/core/basic/src/index.d.ts | 4 ++++ .../azure/core/lro/rpc/src/index.d.ts | 4 ++++ .../azure/core/lro/standard/src/index.d.ts | 4 ++++ .../generated/azure/core/model/src/index.d.ts | 4 ++++ .../generated/azure/core/page/src/index.d.ts | 4 ++++ .../azure/core/scalar/src/index.d.ts | 4 ++++ .../azure/core/traits/src/index.d.ts | 4 ++++ .../azure/example/basic/src/index.d.ts | 4 ++++ .../common-properties/src/index.d.ts | 6 ++++- .../resource-manager/resources/src/index.d.ts | 24 ++++++++++--------- .../generated/encode/bytes/src/index.d.ts | 8 +++---- .../resiliency/srv-driven-main/src/index.d.ts | 5 ++++ .../resiliency/srv-driven-old/src/index.d.ts | 4 ++++ .../server/versions/versioned/src/index.d.ts | 5 ++++ .../generated/type/union/src/index.d.ts | 10 +++----- 15 files changed, 71 insertions(+), 23 deletions(-) diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts index e311b27b45..b0f8a94c62 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts @@ -42,6 +42,10 @@ export declare interface ExportOptionalParams extends OperationOptions { export declare interface GetOptionalParams extends OperationOptions { } +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare interface ListOptionalParams extends OperationOptions { top?: number; skip?: number; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts index 9c0f4a1999..d158658f10 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts @@ -14,6 +14,10 @@ export declare interface GenerationResult { data: string; } +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare interface LongRunningRpcOptionalParams extends OperationOptions { updateIntervalInMs?: number; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts index b2102474bb..d4c9fc312f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts @@ -23,6 +23,10 @@ export declare interface ExportOptionalParams extends OperationOptions { updateIntervalInMs?: number; } +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare function restorePoller(client: StandardClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; export declare interface RestorePollerOptions extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts index 25134248f9..7147d9ece5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts @@ -9,6 +9,10 @@ export declare interface AzureEmbeddingModel { export declare interface GetOptionalParams extends OperationOptions { } +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare class ModelClient { private _client; readonly pipeline: Pipeline; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts index 5d217d24bc..3409347c11 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts @@ -10,6 +10,10 @@ export declare interface FirstItem { readonly id: number; } +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare interface ListFirstItemOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts index 11c421eb04..07b873e0bd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts @@ -12,6 +12,10 @@ export declare interface GetOptionalParams extends OperationOptions { export declare interface HeaderOptionalParams extends OperationOptions { } +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare interface PostOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts index cd16e01594..96d57c375c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts @@ -2,6 +2,10 @@ import { ClientOptions } from '@azure-rest/core-client'; import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare interface RepeatableActionOptionalParams extends OperationOptions { repeatabilityRequestId?: string; repeatabilityFirstSent?: Date; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts index 1ecb020f74..84702c40fe 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts @@ -32,6 +32,10 @@ export declare interface BasicActionOptionalParams extends OperationOptions { export declare type Enum = "EnumValue1"; +export declare enum KnownVersions { + v2022_12_01_preview = "2022-12-01-preview" +} + export declare interface Model { int32Property?: number; float32Property?: number; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts index 8acb197f50..8b77590770 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts @@ -51,7 +51,11 @@ export declare enum KnownManagedServiceIdentityType { None = "None", SystemAssigned = "SystemAssigned", UserAssigned = "UserAssigned", - SystemAssignedUserAssigned = "SystemAssigned,UserAssigned" + "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned" +} + +export declare enum KnownVersions { + v2023_12_01_preview = "2023-12-01-preview" } export declare interface ManagedIdentityTrackedResource extends TrackedResource { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts index bc8e0bde8d..106c7891bc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts @@ -36,10 +36,18 @@ export declare enum KnownCreatedByType { Key = "Key" } -export declare enum KnownResourceProvisioningState { +export declare enum KnownProvisioningState { Succeeded = "Succeeded", Failed = "Failed", - Canceled = "Canceled" + Canceled = "Canceled", + Provisioning = "Provisioning", + Updating = "Updating", + Deleting = "Deleting", + Accepted = "Accepted" +} + +export declare enum KnownVersions { + v2023_12_01_preview = "2023-12-01-preview" } export declare interface NestedCreateOrReplaceOptionalParams extends OperationOptions { @@ -69,7 +77,7 @@ export declare interface NestedProxyResource extends ProxyResource { } export declare interface NestedProxyResourceProperties { - readonly provisioningState?: ProvisioningState_1; + readonly provisioningState?: ProvisioningState; description?: string; } @@ -92,11 +100,7 @@ export declare interface PageSettings { continuationToken?: string; } -export declare type ProvisioningState = ResourceProvisioningState | "Provisioning" | "Updating" | "Deleting" | "Accepted"; - -export declare type ProvisioningState_1 = ResourceProvisioningState | "Provisioning" | "Updating" | "Deleting" | "Accepted"; - -export declare type ProvisioningState_2 = ResourceProvisioningState | "Provisioning" | "Updating" | "Deleting" | "Accepted"; +export declare type ProvisioningState = string; export declare interface ProxyResource extends Resource { } @@ -108,8 +112,6 @@ export declare interface Resource { readonly systemData?: SystemData; } -export declare type ResourceProvisioningState = string; - export declare class ResourcesClient { private _client; readonly pipeline: Pipeline; @@ -204,7 +206,7 @@ export declare interface TopLevelTrackedResource extends TrackedResource { } export declare interface TopLevelTrackedResourceProperties { - readonly provisioningState?: ProvisioningState_2; + readonly provisioningState?: ProvisioningState; description?: string; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts index 7180a00474..e505dfd63f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts @@ -6,11 +6,11 @@ export declare interface Base64BytesProperty { value: Uint8Array; } -export declare interface Base64UrlArrayBytesProperty { +export declare interface Base64urlArrayBytesProperty { value: Uint8Array[]; } -export declare interface Base64UrlBytesProperty { +export declare interface Base64urlBytesProperty { value: Uint8Array; } @@ -66,8 +66,8 @@ export declare interface PropertyDefaultOptionalParams extends OperationOptions export declare interface PropertyOperations { default: (body: DefaultBytesProperty, options?: PropertyDefaultOptionalParams) => Promise; base64: (body: Base64BytesProperty, options?: PropertyBase64OptionalParams) => Promise; - base64url: (body: Base64UrlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; - base64urlArray: (body: Base64UrlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; + base64url: (body: Base64urlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; + base64urlArray: (body: Base64urlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; } export declare interface QueryBase64OptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts index bb6b0d9c72..9297bdfdfa 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts @@ -18,6 +18,11 @@ export declare interface FromOneRequiredOptionalParams extends OperationOptions newParameter?: string; } +export declare enum KnownVersions { + v1 = "v1", + v2 = "v2" +} + export declare class ResiliencyServiceDrivenClient { private _client; readonly pipeline: Pipeline; diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts index 7fd3e13b3d..efb2c9892a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts @@ -12,6 +12,10 @@ export declare interface FromOneOptionalOptionalParams extends OperationOptions export declare interface FromOneRequiredOptionalParams extends OperationOptions { } +export declare enum KnownVersions { + v1 = "v1" +} + export declare class ResiliencyServiceDrivenClient { private _client; readonly pipeline: Pipeline; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts index 7656c6703e..f0a0256c04 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts @@ -2,6 +2,11 @@ import { ClientOptions } from '@azure-rest/core-client'; import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; +export declare enum KnownVersions { + v2021_01_01_preview = "2021-01-01-preview", + v2022_12_01_preview = "2022-12-01-preview" +} + export declare class VersionedClient { private _client; readonly pipeline: Pipeline; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts index a40fdd9e5b..c57d297f3d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts @@ -11,8 +11,8 @@ export declare interface Dog { } export declare interface EnumsOnlyCases { - lr: LR | UD; - ud: UD; + lr: "left" | "right" | "up" | "down"; + ud: "up" | "down"; } export declare interface EnumsOnlyGetOptionalParams extends OperationOptions { @@ -56,11 +56,9 @@ export declare interface IntsOnlySendOptionalParams extends OperationOptions { export declare enum KnownStringExtensibleNamedUnion { OptionB = "b", - C = "c" + c = "c" } -export declare type LR = "left" | "right"; - export declare interface MixedLiteralsCases { stringLiteral: "a" | 2 | 3.3 | true; intLiteral: "a" | 2 | 3.3 | true; @@ -174,8 +172,6 @@ export declare interface StringsOnlyOperations { export declare interface StringsOnlySendOptionalParams extends OperationOptions { } -export declare type UD = "up" | "down"; - export declare class UnionClient { private _client; readonly pipeline: Pipeline; From e576e32cccfae7ed6db8f85ce4ad6b806a3afb50 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 08:58:25 +0800 Subject: [PATCH 22/91] Update the main branch --- .../generated/typespec-ts/src/classic/b/c/index.ts | 6 +++--- .../generated/typespec-ts/src/classic/b/e/c/index.ts | 6 +++--- .../generated/typespec-ts/src/classic/b/index.ts | 6 +++--- .../generated/azure/core/traits/src/index.d.ts | 2 ++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts index ed4e11e9b2..1f8670ba73 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../api/fooContext.js"; import { op1 } from "../../../api/b/c/index.js"; +import { Ba } from "../../../models/models.js"; import { BCOp1OptionalParams } from "../../../api/options.js"; -import { BA } from "../../../models/models.js"; /** Interface representing a BC operations. */ export interface BCOperations { - op1: (body: BA, options?: BCOp1OptionalParams) => Promise; + op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; } export function getBC(context: FooContext) { return { - op1: (body: BA, options?: BCOp1OptionalParams) => + op1: (body: Ba, options?: BCOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts index 0deea57233..f8ab6c6ed1 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../../api/fooContext.js"; import { op1 } from "../../../../api/b/e/c/index.js"; +import { Bea } from "../../../../models/models.js"; import { BECOp1OptionalParams } from "../../../../api/options.js"; -import { BEA } from "../../../../models/models.js"; /** Interface representing a BEC operations. */ export interface BECOperations { - op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; + op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; } export function getBEC(context: FooContext) { return { - op1: (body: BEA, options?: BECOp1OptionalParams) => + op1: (body: Bea, options?: BECOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts index 93991e66f7..d0f7c5c6f4 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts @@ -3,21 +3,21 @@ import { FooContext } from "../../api/fooContext.js"; import { op1 } from "../../api/b/index.js"; +import { Ba } from "../../models/models.js"; import { BOp1OptionalParams } from "../../api/options.js"; -import { BA } from "../../models/models.js"; import { BCOperations, getBCOperations } from "./c/index.js"; import { BEOperations, getBEOperations } from "./e/index.js"; /** Interface representing a B operations. */ export interface BOperations { - op1: (body: BA, options?: BOp1OptionalParams) => Promise; + op1: (body: Ba, options?: BOp1OptionalParams) => Promise; e: BEOperations; c: BCOperations; } export function getB(context: FooContext) { return { - op1: (body: BA, options?: BOp1OptionalParams) => + op1: (body: Ba, options?: BOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts index 96d57c375c..616bb4e110 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts @@ -6,6 +6,8 @@ export declare enum KnownVersions { v2022_12_01_preview = "2022-12-01-preview" } +export declare type RepeatabilityResult = "accepted" | "rejected"; + export declare interface RepeatableActionOptionalParams extends OperationOptions { repeatabilityRequestId?: string; repeatabilityFirstSent?: Date; From 4938ea5d00bcb7795306cd0edd66cbffab4bddd5 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 09:22:41 +0800 Subject: [PATCH 23/91] Fix the host name issue --- packages/typespec-ts/src/modular/emitModels.ts | 1 + packages/typespec-ts/src/transform/transform.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index f56ca96839..1241508f2c 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -54,6 +54,7 @@ import { getTypeExpression, normalizeModelPropertyName } from "./type-expressions/get-type-expression.js"; +import { emitQueue } from "../framework/hooks/sdkTypes.js"; type InterfaceStructure = OptionalKind & { extends?: string[]; diff --git a/packages/typespec-ts/src/transform/transform.ts b/packages/typespec-ts/src/transform/transform.ts index 664779a28d..79c4ee703d 100644 --- a/packages/typespec-ts/src/transform/transform.ts +++ b/packages/typespec-ts/src/transform/transform.ts @@ -148,6 +148,10 @@ export function transformUrlInfo( importedModels.add, importedModels ); + const normName = normalizeName(key, NameType.Parameter, true); + if (normName !== key && endpoint) { + endpoint = endpoint.replace(`{${key}}`, `{${normName}}`); + } urlParameters.push({ oriName: key, name: normalizeName(key, NameType.Parameter, true), From 18d1ba3c4c3b4d11035821e644f655e15b4729c3 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 10:14:15 +0800 Subject: [PATCH 24/91] Update the ignoreEnumMemberNameNormalize feature --- packages/rlc-common/src/helpers/nameUtils.ts | 51 ++++++++++++++++++- packages/rlc-common/src/interfaces.ts | 5 +- .../rlc-common/test/helpers/nameUtils.spec.ts | 10 ++++ packages/typespec-ts/src/lib.ts | 3 +- .../typespec-ts/src/modular/emitModels.ts | 17 +++++-- 5 files changed, 77 insertions(+), 9 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 5d3973480d..6b7d3dba2e 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -132,17 +132,24 @@ function getSuffix(nameType?: NameType) { } } +function isNumericLiteralName(name: string) { + return (+name).toString() === name; +} + export function normalizeName( name: string, nameType: NameType, shouldGuard?: boolean, customReservedNames: ReservedName[] = [], - casingOverride?: CasingConvention + casingOverride?: CasingConvention, ): string { if (name.startsWith("$DO_NOT_NORMALIZE$")) { return name.replace("$DO_NOT_NORMALIZE$", ""); } const casingConvention = casingOverride ?? getCasingConvention(nameType); + if (isNumericLiteralName(name)) { + return normalizeNumericLiteralName(name, nameType); + } const parts = deconstruct(name); if (parts.length === 0) { return name; @@ -154,9 +161,33 @@ export function normalizeName( .join(""); const normalized = checkBeginning(`${normalizedFirstPart}${normalizedParts}`); - return shouldGuard + const result = shouldGuard ? guardReservedNames(normalized, nameType, customReservedNames) : normalized; + return handleNumberStart(result, nameType); +} + +function handleNumberStart(name: string, nameType: NameType): string { + if (!name.match(/^\d/)) { + return name; + } + if (nameType === NameType.EnumMemberName) { + return `Number${name}`; + } else { + throw new Error(`Numeric literal names are not supported for ${nameType}`); + } +} + +export function normalizeNumericLiteralName( + name: string, + nameType: NameType): string { + if (nameType === NameType.EnumMemberName) { + return `Number${name}`; + } else { + // TODO: Add support for other name types if needed + throw new Error(`Numeric literal names are not supported for ${nameType}`); + } + } function isFullyUpperCase( @@ -228,6 +259,22 @@ function getCasingConvention(nameType: NameType) { } } +function getNumberPrefix(nameType: NameType) { + switch (nameType) { + case NameType.EnumMemberName: + return true; + case NameType.Class: + case NameType.Interface: + case NameType.OperationGroup: + case NameType.File: + case NameType.Property: + case NameType.Operation: + case NameType.Parameter: + case NameType.Method: + return false; + } +} + /** * TODO: Improve this function to handle cases such as TEST -> test. Current basic implementation * results in TEST -> test or Test (depending on the CasingConvention). We should switch to relay diff --git a/packages/rlc-common/src/interfaces.ts b/packages/rlc-common/src/interfaces.ts index e786765fd6..a5582b3e7f 100644 --- a/packages/rlc-common/src/interfaces.ts +++ b/packages/rlc-common/src/interfaces.ts @@ -248,6 +248,7 @@ export interface RLCOptions { experimentalExtensibleEnums?: boolean; clearOutputFolder?: boolean; ignorePropertyNameNormalize?: boolean; + ignoreEnumMemberNameNormalize?: boolean; } export interface ServiceInfo { @@ -317,9 +318,9 @@ export interface ArraySchema extends Schema { items?: Schema; } -export interface Property extends Schema {} +export interface Property extends Schema { } -export interface Parameter extends Schema {} +export interface Parameter extends Schema { } export interface PackageDetails { name: string; diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 7a789852fe..9bd080663f 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -5,6 +5,16 @@ import { NameType, normalizeName } from "../../src/helpers/nameUtils.js"; describe("#normalizeName", () => { describe("for enum member name", () => { it("should normalize the name with pascal case", () => { + expect(normalizeName("$DO_NOT_NORMALIZE$VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("VALIDATION_NOT_REQUIRED"); + expect(normalizeName("_10Min", NameType.EnumMemberName, true)).to.equal("Number10Min"); + expect(normalizeName("090", NameType.EnumMemberName, true)).to.equal("Number090"); + expect(normalizeName("10", NameType.EnumMemberName, true)).to.equal("Number10"); + // pls note `1` is a numeric literal number but `1.0` is not + expect(normalizeName("1", NameType.EnumMemberName, true)).to.equal("Number1"); + expect(normalizeName("1.0", NameType.EnumMemberName, true)).to.equal("Number10"); + expect(normalizeName("$DO_NOT_NORMALIZE$Number1.0", NameType.EnumMemberName, true)).to.equal("Number1.0"); + expect(normalizeName("1.1", NameType.EnumMemberName, true)).to.equal("Number1.1"); + expect(normalizeName("-1.1", NameType.EnumMemberName, true)).to.equal("Number-1.1"); expect(normalizeName("BasicGetNull", NameType.EnumMemberName, true)).to.equal("BasicGetNull"); expect(normalizeName("size256x256", NameType.EnumMemberName, true)).to.equal("Size256X256"); expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName, true)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); diff --git a/packages/typespec-ts/src/lib.ts b/packages/typespec-ts/src/lib.ts index 74151295ba..4f4f8cc0e2 100644 --- a/packages/typespec-ts/src/lib.ts +++ b/packages/typespec-ts/src/lib.ts @@ -92,7 +92,8 @@ export const RLCOptionsSchema: JSONSchemaType = { compatibilityMode: { type: "boolean", nullable: true }, experimentalExtensibleEnums: { type: "boolean", nullable: true }, clearOutputFolder: { type: "boolean", nullable: true }, - ignorePropertyNameNormalize: { type: "boolean", nullable: true } + ignorePropertyNameNormalize: { type: "boolean", nullable: true }, + ignoreEnumMemberNameNormalize: { type: "boolean", nullable: true } }, required: [] }; diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 1241508f2c..bfa7b1771a 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -8,7 +8,11 @@ import { StructureKind, TypeAliasDeclarationStructure } from "ts-morph"; -import { NameType, normalizeName } from "@azure-tools/rlc-common"; +import { + NameType, + normalizeName, + normalizeNumericLiteralName +} from "@azure-tools/rlc-common"; import { SdkArrayType, SdkBodyModelPropertyType, @@ -288,7 +292,7 @@ export function buildEnumTypes( kind: StructureKind.Enum, name: `Known${normalizeModelName(context, type)}`, isExported: true, - members: type.values.map(emitEnumMember) + members: type.values.map((value) => emitEnumMember(context, value)) }; const enumAsUnion: TypeAliasDeclarationStructure = { @@ -332,10 +336,15 @@ function getExtensibleEnumDescription(model: SdkEnumType): string | undefined { ].join(" \n"); } -function emitEnumMember(member: SdkEnumValueType): EnumMemberStructure { +function emitEnumMember( + context: SdkContext, + member: SdkEnumValueType +): EnumMemberStructure { const memberStructure: EnumMemberStructure = { kind: StructureKind.EnumMember, - name: normalizeName(member.name, NameType.EnumMemberName), + name: context.rlcOptions?.ignoreEnumMemberNameNormalize + ? normalizeNumericLiteralName(member.name, NameType.EnumMemberName) // need to normalize number also for enum member + : normalizeName(member.name, NameType.EnumMemberName, true), value: member.value }; From 57bad0f066ff3c43ccbded29e0a41faac21073fe Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 10:26:32 +0800 Subject: [PATCH 25/91] Update the package.json library name --- packages/rlc-common/src/helpers/nameUtils.ts | 5 ++--- packages/rlc-common/test/helpers/nameUtils.spec.ts | 1 + packages/rlc-common/test/integration/packageJson.spec.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 6b7d3dba2e..802f57127b 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -174,7 +174,7 @@ function handleNumberStart(name: string, nameType: NameType): string { if (nameType === NameType.EnumMemberName) { return `Number${name}`; } else { - throw new Error(`Numeric literal names are not supported for ${nameType}`); + return name; } } @@ -184,8 +184,7 @@ export function normalizeNumericLiteralName( if (nameType === NameType.EnumMemberName) { return `Number${name}`; } else { - // TODO: Add support for other name types if needed - throw new Error(`Numeric literal names are not supported for ${nameType}`); + return name; } } diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 9bd080663f..d3cfe537f3 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -5,6 +5,7 @@ import { NameType, normalizeName } from "../../src/helpers/nameUtils.js"; describe("#normalizeName", () => { describe("for enum member name", () => { it("should normalize the name with pascal case", () => { + expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName, true)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); expect(normalizeName("$DO_NOT_NORMALIZE$VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("VALIDATION_NOT_REQUIRED"); expect(normalizeName("_10Min", NameType.EnumMemberName, true)).to.equal("Number10Min"); expect(normalizeName("090", NameType.EnumMemberName, true)).to.equal("Number090"); diff --git a/packages/rlc-common/test/integration/packageJson.spec.ts b/packages/rlc-common/test/integration/packageJson.spec.ts index c14c26a681..82f06c51b5 100644 --- a/packages/rlc-common/test/integration/packageJson.spec.ts +++ b/packages/rlc-common/test/integration/packageJson.spec.ts @@ -83,7 +83,7 @@ describe("Package file generation", () => { }); describe("Azure flavor for Azure SDK for JS Monorepo", () => { - const libraryName = "@msinternal/test"; + const libraryName = "test"; const version = "1.0.0"; const description = "Test description"; @@ -132,7 +132,7 @@ describe("Package file generation", () => { const expectedMetadata = { constantPaths: [ { - path: "src/msinternalTest.ts", + path: "src/test.ts", prefix: "userAgentInfo" } ] @@ -155,7 +155,7 @@ describe("Package file generation", () => { prefix: "package-version" }, { - path: "src/msinternalTest.ts", + path: "src/test.ts", prefix: "userAgentInfo" } ] @@ -470,7 +470,7 @@ describe("Package file generation", () => { const packageFileContent = buildPackageFile(model); const packageFile = JSON.parse(packageFileContent?.content ?? "{}"); expect(packageFile).to.have.property("//metadata"); - expect(packageFile["//metadata"]["constantPaths"][0]).to.have.property("path", "src/msinternal/test.ts", "rlc"); + expect(packageFile["//metadata"]["constantPaths"][0]).to.have.property("path", "src/test.ts", "rlc"); }); }); From 2e2f76dc6b9908ed1f357a32b46338399381c41a Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 10:40:32 +0800 Subject: [PATCH 26/91] Update the smoke test --- packages/rlc-common/test/helpers/nameUtils.spec.ts | 1 + .../batch_modular/generated/typespec-ts/review/batch.api.md | 2 +- .../batch_modular/generated/typespec-ts/src/models/models.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index d3cfe537f3..43a8fa0a44 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -5,6 +5,7 @@ import { NameType, normalizeName } from "../../src/helpers/nameUtils.js"; describe("#normalizeName", () => { describe("for enum member name", () => { it("should normalize the name with pascal case", () => { + expect(normalizeName("OAuthTokensGetOAuthConnectionLinkMediaTypesParam", NameType.EnumMemberName, true)).to.equal("OAuthTokensGetOAuthConnectionLinkMediaTypesParam"); expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName, true)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); expect(normalizeName("$DO_NOT_NORMALIZE$VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("VALIDATION_NOT_REQUIRED"); expect(normalizeName("_10Min", NameType.EnumMemberName, true)).to.equal("Number10Min"); diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md index 7556bd0878..9361d77ee0 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md @@ -1324,7 +1324,7 @@ export interface JobStatistics { // @public export enum KnownVersions { - "2023-05-01.17.0" = "2023-05-01.17.0" + Number20230501170 = "2023-05-01.17.0" } // @public diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts index fb399e7977..a7285fab1a 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts @@ -6233,5 +6233,5 @@ export function batchApplicationDeserializer(item: any): BatchApplication { /** The Azure Batch service version. */ export enum KnownVersions { /** API Version 2023-05-01.17.0 */ - "2023-05-01.17.0" = "2023-05-01.17.0", + Number20230501170 = "2023-05-01.17.0", } From f6d8149cb98b1d3c0f8b6779fb661df74c36e433 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 10:54:13 +0800 Subject: [PATCH 27/91] Format rlc-common types --- packages/rlc-common/src/helpers/nameUtils.ts | 6 +++--- packages/rlc-common/src/interfaces.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 802f57127b..668c0fdbe9 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -141,7 +141,7 @@ export function normalizeName( nameType: NameType, shouldGuard?: boolean, customReservedNames: ReservedName[] = [], - casingOverride?: CasingConvention, + casingOverride?: CasingConvention ): string { if (name.startsWith("$DO_NOT_NORMALIZE$")) { return name.replace("$DO_NOT_NORMALIZE$", ""); @@ -180,13 +180,13 @@ function handleNumberStart(name: string, nameType: NameType): string { export function normalizeNumericLiteralName( name: string, - nameType: NameType): string { + nameType: NameType +): string { if (nameType === NameType.EnumMemberName) { return `Number${name}`; } else { return name; } - } function isFullyUpperCase( diff --git a/packages/rlc-common/src/interfaces.ts b/packages/rlc-common/src/interfaces.ts index a5582b3e7f..7a50eb55bd 100644 --- a/packages/rlc-common/src/interfaces.ts +++ b/packages/rlc-common/src/interfaces.ts @@ -318,9 +318,9 @@ export interface ArraySchema extends Schema { items?: Schema; } -export interface Property extends Schema { } +export interface Property extends Schema {} -export interface Parameter extends Schema { } +export interface Parameter extends Schema {} export interface PackageDetails { name: string; From 177b942ae639faec6c89411b2e9cd8ade47d6b9d Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 11:05:01 +0800 Subject: [PATCH 28/91] Fix lint issue --- packages/rlc-common/src/helpers/nameUtils.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 668c0fdbe9..dd0ba94260 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -258,22 +258,6 @@ function getCasingConvention(nameType: NameType) { } } -function getNumberPrefix(nameType: NameType) { - switch (nameType) { - case NameType.EnumMemberName: - return true; - case NameType.Class: - case NameType.Interface: - case NameType.OperationGroup: - case NameType.File: - case NameType.Property: - case NameType.Operation: - case NameType.Parameter: - case NameType.Method: - return false; - } -} - /** * TODO: Improve this function to handle cases such as TEST -> test. Current basic implementation * results in TEST -> test or Test (depending on the CasingConvention). We should switch to relay From 65a55ae2e7231d94bef2325b1267467b5e35f49f Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 12:13:32 +0800 Subject: [PATCH 29/91] Update the test cases --- .../typespec-ts/test/modularUnit/enumUnion.spec.ts | 12 ++++++------ .../models/apiVersion/apiVersionAsKnownVersions.md | 2 +- .../flatten/experimentalExtensibleEnumsTrue.md | 2 +- .../notFlatten/experimentalExtensibleEnumsFalse.md | 2 +- .../scenarios/models/serialization/enumKeyNorm.md | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts index c28f688b89..9326938d59 100644 --- a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts +++ b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts @@ -1222,17 +1222,17 @@ describe("model type", () => { ` ); await assertEqualContent( - modelFile!.getTypeAlias("Lr")?.getFullText()!, + modelFile!.getTypeAlias("LR")?.getFullText()!, ` - /** Type of Lr */ - export type Lr = "left" | "right"; + /** Type of LR */ + export type LR = "left" | "right"; ` ); await assertEqualContent( - modelFile!.getTypeAlias("Ud")?.getFullText()!, + modelFile!.getTypeAlias("UD")?.getFullText()!, ` - /** Type of Ud */ - export type Ud = "up" | "down"; + /** Type of UD */ + export type UD = "up" | "down"; ` ); }); diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md index 1ba917dfac..09b847a56c 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md @@ -40,6 +40,6 @@ Should generate KnownVersions in models.ts. /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - v2021_10_01_preview = "2021-10-01-preview", + V20211001Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md index 1805460ec1..1fd6d1719c 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md @@ -113,6 +113,6 @@ export type ProvisioningState = string; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - v2021_10_01_preview = "2021-10-01-preview", + V20211001Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md index 379f246a4f..703bff326a 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md @@ -96,6 +96,6 @@ export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - v2021_10_01_preview = "2021-10-01-preview", + V20211001Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index a83d5f83d7..6ee9652342 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -1,4 +1,4 @@ -# Should generate enum key normalization cases +# skip: Should generate enum key normalization cases ## TypeSpec From bedc279a2199fcb693625eaf396044a3a1c5073e Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 13:11:39 +0800 Subject: [PATCH 30/91] Fix the issue in autorest typescript repo --- .../generated/lroRest/src/parameters.ts | 46 +++++++++---------- packages/rlc-common/src/helpers/nameUtils.ts | 4 +- .../rlc-common/test/helpers/nameUtils.spec.ts | 6 +++ 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts index 87ea45250c..ed1b92edce 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts @@ -425,69 +425,69 @@ export type LROsPostAsyncRetrycanceledParameters = LROsPostAsyncRetrycanceledBodyParam & RequestParameters; -export interface LroretrysPut201CreatingSucceeded200BodyParam { +export interface LRORetrysPut201CreatingSucceeded200BodyParam { /** Product to put */ body?: Product; } -export interface LroretrysPut201CreatingSucceeded200MediaTypesParam { +export interface LRORetrysPut201CreatingSucceeded200MediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LroretrysPut201CreatingSucceeded200Parameters = - LroretrysPut201CreatingSucceeded200MediaTypesParam & - LroretrysPut201CreatingSucceeded200BodyParam & +export type LRORetrysPut201CreatingSucceeded200Parameters = + LRORetrysPut201CreatingSucceeded200MediaTypesParam & + LRORetrysPut201CreatingSucceeded200BodyParam & RequestParameters; -export interface LroretrysPutAsyncRelativeRetrySucceededBodyParam { +export interface LRORetrysPutAsyncRelativeRetrySucceededBodyParam { /** Product to put */ body?: Product; } -export interface LroretrysPutAsyncRelativeRetrySucceededMediaTypesParam { +export interface LRORetrysPutAsyncRelativeRetrySucceededMediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LroretrysPutAsyncRelativeRetrySucceededParameters = - LroretrysPutAsyncRelativeRetrySucceededMediaTypesParam & - LroretrysPutAsyncRelativeRetrySucceededBodyParam & +export type LRORetrysPutAsyncRelativeRetrySucceededParameters = + LRORetrysPutAsyncRelativeRetrySucceededMediaTypesParam & + LRORetrysPutAsyncRelativeRetrySucceededBodyParam & RequestParameters; -export type LroretrysDeleteProvisioning202Accepted200SucceededParameters = +export type LRORetrysDeleteProvisioning202Accepted200SucceededParameters = RequestParameters; -export type LroretrysDelete202Retry200Parameters = RequestParameters; -export type LroretrysDeleteAsyncRelativeRetrySucceededParameters = +export type LRORetrysDelete202Retry200Parameters = RequestParameters; +export type LRORetrysDeleteAsyncRelativeRetrySucceededParameters = RequestParameters; -export interface LroretrysPost202Retry200BodyParam { +export interface LRORetrysPost202Retry200BodyParam { /** Product to put */ body?: Product; } -export interface LroretrysPost202Retry200MediaTypesParam { +export interface LRORetrysPost202Retry200MediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LroretrysPost202Retry200Parameters = - LroretrysPost202Retry200MediaTypesParam & - LroretrysPost202Retry200BodyParam & +export type LRORetrysPost202Retry200Parameters = + LRORetrysPost202Retry200MediaTypesParam & + LRORetrysPost202Retry200BodyParam & RequestParameters; -export interface LroretrysPostAsyncRelativeRetrySucceededBodyParam { +export interface LRORetrysPostAsyncRelativeRetrySucceededBodyParam { /** Product to put */ body?: Product; } -export interface LroretrysPostAsyncRelativeRetrySucceededMediaTypesParam { +export interface LRORetrysPostAsyncRelativeRetrySucceededMediaTypesParam { /** Request content type */ contentType?: "application/json"; } -export type LroretrysPostAsyncRelativeRetrySucceededParameters = - LroretrysPostAsyncRelativeRetrySucceededMediaTypesParam & - LroretrysPostAsyncRelativeRetrySucceededBodyParam & +export type LRORetrysPostAsyncRelativeRetrySucceededParameters = + LRORetrysPostAsyncRelativeRetrySucceededMediaTypesParam & + LRORetrysPostAsyncRelativeRetrySucceededBodyParam & RequestParameters; export interface LrosaDsPutNonRetry400BodyParam { diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index dd0ba94260..d2628c17d1 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -216,8 +216,8 @@ function deconstruct(identifier: string): Array { const parts = `${identifier}` .replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar) .replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123 => foo123 bar) - .replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, "$1$2« $3$4") // Add a space after a plural uppper cased word(e.g. MBsFoo => MBs Foo) - .replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, "$1 $2$3") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) + .replace(/\b([_-]*)([A-Z]+)([A-Z])s([^a-z])(.*)/g, "$1$2$3« $4$5") // Add a space after a plural upper cased word(e.g. MBsFoo => MBs Foo) + .replace(/\b([_-]*)([A-Z]+)([A-Z])([a-z]+)/g, "$1$2 $3$4") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) .replace(/«/g, "s") .trim() .split(/[\W|_]+/) diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 43a8fa0a44..7702495573 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -106,6 +106,12 @@ describe("#normalizeName", () => { expect( normalizeName("LoadTest_Administration ", NameType.OperationGroup, true) ).to.equal("LoadTestAdministration"); + expect( + normalizeName("LRORetrysPostAsyncRelativeRetrySucceeded", NameType.OperationGroup, true) + ).to.equal("LRORetrysPostAsyncRelativeRetrySucceeded"); + expect( + normalizeName("_LRORetrysPostAsyncRelativeRetrySucceeded", NameType.OperationGroup, true) + ).to.equal("LRORetrysPostAsyncRelativeRetrySucceeded"); }); }); }); From ba3fbed7847e3f2839d303111c821144a1aab07c Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 13:26:09 +0800 Subject: [PATCH 31/91] Update the load test smoke --- packages/rlc-common/src/helpers/nameUtils.ts | 5 +- .../typespec-ts/review/load-testing.api.md | 118 +++++++++--------- .../typespec-ts/src/models/models.ts | 118 +++++++++--------- .../test/loadtesting_modular/tspconfig.yaml | 1 + 4 files changed, 121 insertions(+), 121 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index d2628c17d1..420680f4e4 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -182,11 +182,10 @@ export function normalizeNumericLiteralName( name: string, nameType: NameType ): string { - if (nameType === NameType.EnumMemberName) { + if (isNumericLiteralName(name) && nameType === NameType.EnumMemberName) { return `Number${name}`; - } else { - return name; } + return name; } function isFullyUpperCase( diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index 82514434fc..fb0569faaf 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -203,26 +203,26 @@ export enum KnownAPIVersions { // @public export enum KnownCertificateType { - AKVCERTURI = "AKV_CERT_URI" + AKV_CERT_URI = "AKV_CERT_URI" } // @public export enum KnownFileStatus { - NOTValidated = "NOT_VALIDATED", - ValidationFailure = "VALIDATION_FAILURE", - ValidationInitiated = "VALIDATION_INITIATED", - ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", - ValidationSuccess = "VALIDATION_SUCCESS" + NOT_VALIDATED = "NOT_VALIDATED", + VALIDATION_FAILURE = "VALIDATION_FAILURE", + VALIDATION_INITIATED = "VALIDATION_INITIATED", + VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS" } // @public export enum KnownFileType { - AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", - JMXFILE = "JMX_FILE", - TESTSCRIPT = "TEST_SCRIPT", - URLTESTCONFIG = "URL_TEST_CONFIG", - USERProperties = "USER_PROPERTIES", - ZIPPEDArtifacts = "ZIPPED_ARTIFACTS" + ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", + JMX_FILE = "JMX_FILE", + TEST_SCRIPT = "TEST_SCRIPT", + URL_TEST_CONFIG = "URL_TEST_CONFIG", + USER_PROPERTIES = "USER_PROPERTIES", + ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS" } // @public @@ -239,49 +239,49 @@ export enum KnownMetricUnit { // @public export enum KnownPFAction { - Continue = "continue", - Stop = "stop" + "continue" = "continue", + stop = "stop" } // @public export enum KnownPFAgFunc { - Avg = "avg", - Count = "count", - Max = "max", - Min = "min", - P50 = "p50", - P75 = "p75", - P90 = "p90", - P95 = "p95", - P96 = "p96", - P97 = "p97", - P98 = "p98", - P99 = "p99", - P999 = "p99.9", - P9999 = "p99.99", - Percentage = "percentage" + "p99.9" = "p99.9", + "p99.99" = "p99.99", + avg = "avg", + count = "count", + max = "max", + min = "min", + p50 = "p50", + p75 = "p75", + p90 = "p90", + p95 = "p95", + p96 = "p96", + p97 = "p97", + p98 = "p98", + p99 = "p99", + percentage = "percentage" } // @public export enum KnownPFMetrics { - Error = "error", - Latency = "latency", - Requests = "requests", - RequestsPerSec = "requests_per_sec", - ResponseTimeMs = "response_time_ms" + error = "error", + latency = "latency", + requests = "requests", + requests_per_sec = "requests_per_sec", + response_time_ms = "response_time_ms" } // @public export enum KnownPFResult { - Failed = "failed", - Passed = "passed", - Undetermined = "undetermined" + failed = "failed", + passed = "passed", + undetermined = "undetermined" } // @public export enum KnownPFTestResult { FAILED = "FAILED", - NOTApplicable = "NOT_APPLICABLE", + NOT_APPLICABLE = "NOT_APPLICABLE", PASSED = "PASSED" } @@ -304,28 +304,28 @@ export enum KnownResourceKind { // @public export enum KnownSecretType { - AKVSECRETURI = "AKV_SECRET_URI", - SECRETVALUE = "SECRET_VALUE" + AKV_SECRET_URI = "AKV_SECRET_URI", + SECRET_VALUE = "SECRET_VALUE" } // @public export enum KnownStatus { - Accepted = "ACCEPTED", - Cancelled = "CANCELLED", - Cancelling = "CANCELLING", - Configured = "CONFIGURED", - Configuring = "CONFIGURING", - Deprovisioned = "DEPROVISIONED", - Deprovisioning = "DEPROVISIONING", + ACCEPTED = "ACCEPTED", + CANCELLED = "CANCELLED", + CANCELLING = "CANCELLING", + CONFIGURED = "CONFIGURED", + CONFIGURING = "CONFIGURING", + DEPROVISIONED = "DEPROVISIONED", + DEPROVISIONING = "DEPROVISIONING", DONE = "DONE", - Executed = "EXECUTED", - Executing = "EXECUTING", + EXECUTED = "EXECUTED", + EXECUTING = "EXECUTING", FAILED = "FAILED", - Notstarted = "NOTSTARTED", - Provisioned = "PROVISIONED", - Provisioning = "PROVISIONING", - ValidationFailure = "VALIDATION_FAILURE", - ValidationSuccess = "VALIDATION_SUCCESS" + NOTSTARTED = "NOTSTARTED", + PROVISIONED = "PROVISIONED", + PROVISIONING = "PROVISIONING", + VALIDATION_FAILURE = "VALIDATION_FAILURE", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS" } // @public @@ -337,13 +337,13 @@ export enum KnownTestKind { // @public export enum KnownTestProfileRunStatus { - Accepted = "ACCEPTED", - Cancelled = "CANCELLED", - Cancelling = "CANCELLING", + ACCEPTED = "ACCEPTED", + CANCELLED = "CANCELLED", + CANCELLING = "CANCELLING", DONE = "DONE", - Executing = "EXECUTING", + EXECUTING = "EXECUTING", FAILED = "FAILED", - Notstarted = "NOTSTARTED" + NOTSTARTED = "NOTSTARTED" } // @public diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts index e3877aa4c6..943dbcc7bd 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts @@ -220,15 +220,15 @@ export function passFailMetricDeserializer(item: any): PassFailMetric { /** Metrics for pass/fail criteria. */ export enum KnownPFMetrics { /** Pass fail criteria for response time metric in milliseconds. */ - ResponseTimeMs = "response_time_ms", + response_time_ms = "response_time_ms", /** Pass fail criteria for latency metric in milliseconds. */ - Latency = "latency", + latency = "latency", /** Pass fail criteria for error metric. */ - Error = "error", + error = "error", /** Pass fail criteria for total requests. */ - Requests = "requests", + requests = "requests", /** Pass fail criteria for request per second. */ - RequestsPerSec = "requests_per_sec", + requests_per_sec = "requests_per_sec", } /** @@ -247,35 +247,35 @@ export type PFMetrics = string; /** Aggregation functions for pass/fail criteria. */ export enum KnownPFAgFunc { /** Criteria applies for count value. */ - Count = "count", + count = "count", /** Criteria applies for given percentage value. */ - Percentage = "percentage", + percentage = "percentage", /** Criteria applies for avg value. */ - Avg = "avg", + avg = "avg", /** Criteria applies for 50th percentile value. */ - P50 = "p50", + p50 = "p50", /** Criteria applies for 75th percentile value. */ - P75 = "p75", + p75 = "p75", /** Criteria applies for 90th percentile value. */ - P90 = "p90", + p90 = "p90", /** Criteria applies for 95th percentile value. */ - P95 = "p95", + p95 = "p95", /** Criteria applies for 96th percentile value. */ - P96 = "p96", + p96 = "p96", /** Criteria applies for 97th percentile value. */ - P97 = "p97", + p97 = "p97", /** Criteria applies for 98th percentile value. */ - P98 = "p98", + p98 = "p98", /** Criteria applies for 99th percentile value. */ - P99 = "p99", + p99 = "p99", /** Criteria applies for 99.9th percentile value. */ - P999 = "p99.9", + "p99.9" = "p99.9", /** Criteria applies for 99.99th percentile value. */ - P9999 = "p99.99", + "p99.99" = "p99.99", /** Criteria applies for minimum value. */ - Min = "min", + min = "min", /** Criteria applies for maximum value. */ - Max = "max", + max = "max", } /** @@ -304,9 +304,9 @@ export type PFAgFunc = string; /** Action to take on failure of pass/fail criteria. */ export enum KnownPFAction { /** Test will continue to run even if pass fail metric criteria metric gets failed. */ - Continue = "continue", + "continue" = "continue", /** Test run will stop if pass fail criteria metric is not passed. */ - Stop = "stop", + stop = "stop", } /** @@ -322,11 +322,11 @@ export type PFAction = string; /** Pass/fail criteria result. */ export enum KnownPFResult { /** Given pass fail criteria metric has passed. */ - Passed = "passed", + passed = "passed", /** Given pass fail criteria metric couldn't determine. */ - Undetermined = "undetermined", + undetermined = "undetermined", /** Given pass fail criteria metric has failed. */ - Failed = "failed", + failed = "failed", } /** @@ -408,9 +408,9 @@ export function secretDeserializer(item: any): Secret { /** Types of secrets supported. */ export enum KnownSecretType { /** If the secret is stored in an Azure Key Vault. */ - AKVSECRETURI = "AKV_SECRET_URI", + AKV_SECRET_URI = "AKV_SECRET_URI", /** If the secret value provided as plain text. */ - SECRETVALUE = "SECRET_VALUE", + SECRET_VALUE = "SECRET_VALUE", } /** @@ -450,7 +450,7 @@ export function certificateMetadataDeserializer( /** Types of certificates supported. */ export enum KnownCertificateType { /** If the certificate is stored in an Azure Key Vault. */ - AKVCERTURI = "AKV_CERT_URI", + AKV_CERT_URI = "AKV_CERT_URI", } /** @@ -672,17 +672,17 @@ export function testFileInfoDeserializer(item: any): TestFileInfo { /** Types of file supported. */ export enum KnownFileType { /** If the file is a JMX script. */ - JMXFILE = "JMX_FILE", + JMX_FILE = "JMX_FILE", /** If the file is a user properties file. */ - USERProperties = "USER_PROPERTIES", + USER_PROPERTIES = "USER_PROPERTIES", /** If the file is not among any of the other supported file types. */ - AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", + ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", /** If the file is a compressed archive containing a collection of various artifacts or resources. */ - ZIPPEDArtifacts = "ZIPPED_ARTIFACTS", + ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS", /** If the file is a JSON config file to define the requests for a URL test. */ - URLTESTCONFIG = "URL_TEST_CONFIG", + URL_TEST_CONFIG = "URL_TEST_CONFIG", /** If the file is a test script. */ - TESTSCRIPT = "TEST_SCRIPT", + TEST_SCRIPT = "TEST_SCRIPT", } /** @@ -702,15 +702,15 @@ export type FileType = string; /** File status. */ export enum KnownFileStatus { /** File is not validated. */ - NOTValidated = "NOT_VALIDATED", + NOT_VALIDATED = "NOT_VALIDATED", /** File is validated. */ - ValidationSuccess = "VALIDATION_SUCCESS", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS", /** File validation is failed. */ - ValidationFailure = "VALIDATION_FAILURE", + VALIDATION_FAILURE = "VALIDATION_FAILURE", /** File validation is in progress. */ - ValidationInitiated = "VALIDATION_INITIATED", + VALIDATION_INITIATED = "VALIDATION_INITIATED", /** Validation is not required. */ - ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", + VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", } /** @@ -1432,7 +1432,7 @@ export enum KnownPFTestResult { /** Pass/fail criteria has passed. */ PASSED = "PASSED", /** Pass/fail criteria is not applicable. */ - NOTApplicable = "NOT_APPLICABLE", + NOT_APPLICABLE = "NOT_APPLICABLE", /** Pass/fail criteria has failed. */ FAILED = "FAILED", } @@ -1451,37 +1451,37 @@ export type PFTestResult = string; /** Test run status. */ export enum KnownStatus { /** Test run request is accepted. */ - Accepted = "ACCEPTED", + ACCEPTED = "ACCEPTED", /** Test run is not yet started. */ - Notstarted = "NOTSTARTED", + NOTSTARTED = "NOTSTARTED", /** Test run is provisioning. */ - Provisioning = "PROVISIONING", + PROVISIONING = "PROVISIONING", /** Test run is provisioned. */ - Provisioned = "PROVISIONED", + PROVISIONED = "PROVISIONED", /** Test run is getting configured. */ - Configuring = "CONFIGURING", + CONFIGURING = "CONFIGURING", /** Test run configuration is done. */ - Configured = "CONFIGURED", + CONFIGURED = "CONFIGURED", /** Test run has started executing. */ - Executing = "EXECUTING", + EXECUTING = "EXECUTING", /** Test run execution is completed. */ - Executed = "EXECUTED", + EXECUTED = "EXECUTED", /** Test run is getting deprovisioned. */ - Deprovisioning = "DEPROVISIONING", + DEPROVISIONING = "DEPROVISIONING", /** Test run is deprovisioned. */ - Deprovisioned = "DEPROVISIONED", + DEPROVISIONED = "DEPROVISIONED", /** Test run is completed. */ DONE = "DONE", /** Test run is being cancelled. */ - Cancelling = "CANCELLING", + CANCELLING = "CANCELLING", /** Test run request is cancelled. */ - Cancelled = "CANCELLED", + CANCELLED = "CANCELLED", /** Test run request is failed. */ FAILED = "FAILED", /** Test run JMX file is validated. */ - ValidationSuccess = "VALIDATION_SUCCESS", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS", /** Test run JMX file validation is failed. */ - ValidationFailure = "VALIDATION_FAILURE", + VALIDATION_FAILURE = "VALIDATION_FAILURE", } /** @@ -2407,17 +2407,17 @@ export function testProfileRunDeserializer(item: any): TestProfileRun { /** Test profile run status. */ export enum KnownTestProfileRunStatus { /** Test profile run request is accepted. */ - Accepted = "ACCEPTED", + ACCEPTED = "ACCEPTED", /** Test profile run is not yet started. */ - Notstarted = "NOTSTARTED", + NOTSTARTED = "NOTSTARTED", /** Test profile run has started executing. */ - Executing = "EXECUTING", + EXECUTING = "EXECUTING", /** Test profile run has completed successfully. */ DONE = "DONE", /** Test profile run is being cancelled. */ - Cancelling = "CANCELLING", + CANCELLING = "CANCELLING", /** Test profile run is cancelled. */ - Cancelled = "CANCELLED", + CANCELLED = "CANCELLED", /** Test profile run has failed. */ FAILED = "FAILED", } diff --git a/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml b/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml index 5fe68fa528..72b89a9fd2 100644 --- a/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml +++ b/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml @@ -13,6 +13,7 @@ options: isModularLibrary: true hierarchyClient: false experimentalExtensibleEnums: true + ignoreEnumMemberNameNormalize: true packageDetails: name: "@azure/load-testing" description: This package contains Microsoft Azure LoadTestingClient client library. From 7d82484cccd1f20465b05b2873fb053977d34718 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 13:36:30 +0800 Subject: [PATCH 32/91] Update the spec --- .../generated/typespec-ts/review/arm-networkanalytics.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md index 8e704a1f67..6818aecd28 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md @@ -403,7 +403,7 @@ export enum KnownProvisioningState { // @public export enum KnownVersions { - v2023_11_15 = "2023-11-15" + V20231115 = "2023-11-15" } // @public diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts index 81b8b65d09..a1d9fbdee2 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts @@ -1457,5 +1457,5 @@ export type ActionType = string; /** The available API versions for the Microsoft.NetworkAnalytics RP. */ export enum KnownVersions { /** The 2023-11-15 stable version. */ - v2023_11_15 = "2023-11-15", + V20231115 = "2023-11-15", } From d9005b05469e663a2b572f64e08df7b83ed4d8cd Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 13:50:41 +0800 Subject: [PATCH 33/91] Fix the name issue in restore poller --- .../generated/typespec-ts/src/restorePollerHelpers.ts | 4 ++-- packages/typespec-ts/src/modular/buildOperations.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts index 1c5965b2e2..9a0c76fdf0 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/restorePollerHelpers.ts @@ -11,7 +11,7 @@ import { import { _createDeserialize as _createDeserializeDataProducts, _updateDeserialize as _updateDeserializeDataProducts, - _$deleteDeserialize as _deleteDeserializeDataProducts, + _$deleteDeserialize as _$deleteDeserializeDataProducts, } from "./api/dataProducts/index.js"; import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; import { @@ -117,7 +117,7 @@ const deserializeMap: Record = { }, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": { - deserializer: _deleteDeserializeDataProducts, + deserializer: _$deleteDeserializeDataProducts, expectedStatuses: ["202", "204", "200"], }, }; diff --git a/packages/typespec-ts/src/modular/buildOperations.ts b/packages/typespec-ts/src/modular/buildOperations.ts index cc2c58a6ec..54dd23a6c1 100644 --- a/packages/typespec-ts/src/modular/buildOperations.ts +++ b/packages/typespec-ts/src/modular/buildOperations.ts @@ -237,11 +237,11 @@ export function buildLroDeserDetailMap(client: Client) { const deserName = `_${name}Deserialize`; let renamedDeserName = undefined; if (existingNames.has(deserName)) { - const newName = `${name}Deserialize_${operationFileName - .split("/") - .slice(0, -1) - .join("_")}`; - renamedDeserName = `_${normalizeName(newName, NameType.Method)}`; + const suffix = normalizeName( + `${operationFileName.split("/").slice(0, -1).join("_")}`, + NameType.Method + ); + renamedDeserName = `${deserName}${suffix.charAt(0).toUpperCase()}${suffix.slice(1)}`; } existingNames.add(deserName); return { From 4b2721390b5093f0af752db155bd584fd58dd257 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:00:14 +0800 Subject: [PATCH 34/91] regen smoke test --- .../test/ai/generated/typespec-ts/review/ai-client.api.md | 4 ++-- .../test/ai/generated/typespec-ts/src/models/models.ts | 6 +++--- .../typespec-ts/review/ai-anomaly-detector.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/review/ai-chat-protocol.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/review/ai-content-safety.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/review/eventgrid.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 2 +- .../review/health-insights-radiologyinsights.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/src/classic/b/c/index.ts | 6 +++--- .../generated/typespec-ts/src/classic/b/e/c/index.ts | 6 +++--- .../generated/typespec-ts/src/classic/b/index.ts | 6 +++--- .../generated/typespec-ts/review/openai_modular.api.md | 8 ++++---- .../generated/typespec-ts/src/models/models.ts | 8 ++++---- .../generated/typespec-ts/review/overload_modular.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/review/schema-registry.api.md | 6 +++--- .../generated/typespec-ts/src/models/models.ts | 6 +++--- .../generated/typespec-ts/review/widget_dpg.api.md | 2 +- .../widget_dpg/generated/typespec-ts/src/models/models.ts | 2 +- 23 files changed, 42 insertions(+), 42 deletions(-) diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md index a9a544d824..261699b53b 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md +++ b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md @@ -527,7 +527,7 @@ export interface CredentialsApiKeyAuth { // @public export interface CredentialsSASAuth { - sas: string; + sAS: string; } // @public @@ -723,7 +723,7 @@ export type InputDataUnion = AppInsightsConfiguration | Dataset | InputData; // @public export enum KnownVersions { - "2024-07-01-preview" = "2024-07-01-preview" + Number20240701Preview = "2024-07-01-preview" } // @public diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts index d5363dd339..3628ba3b39 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts @@ -696,12 +696,12 @@ export function connectionPropertiesSASAuthDeserializer( /** The credentials needed for Shared Access Signatures (SAS) authentication */ export interface CredentialsSASAuth { /** The Shared Access Signatures (SAS) token */ - sas: string; + sAS: string; } export function credentialsSASAuthDeserializer(item: any): CredentialsSASAuth { return { - sas: item["SAS"], + sAS: item["SAS"], }; } @@ -4773,5 +4773,5 @@ export type VectorStoreFileStatusFilter = /** Azure AI API versions */ export enum KnownVersions { /** Azure AI API version 2024-07-01-preview. */ - "2024-07-01-preview" = "2024-07-01-preview", + Number20240701Preview = "2024-07-01-preview", } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index 9343baff99..d22607296f 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -33,7 +33,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { // (undocumented) - v1_1 = "v1.1" + V11 = "v1.1" } // @public diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index cad4b4f7c6..f653f3ebcb 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -1076,5 +1076,5 @@ export type APIVersion = "v1.1"; /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - v1_1 = "v1.1", + V11 = "v1.1", } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md index 2473225813..b29e03e333 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md @@ -89,7 +89,7 @@ export type FinishReason = "stop" | "length"; // @public export enum KnownAPIVersion { // (undocumented) - v20231001Preview = "2023-10-01-preview" + V20231001Preview = "2023-10-01-preview" } // @public diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts index 2d295dd082..b0fc5be2ac 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts @@ -247,5 +247,5 @@ export function chatChoiceRecordDeserializer(item: any): ChatChoiceRecord { /** Known values of {@link APIVersion} that the service accepts. */ export enum KnownAPIVersion { - v20231001Preview = "2023-10-01-preview", + V20231001Preview = "2023-10-01-preview", } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md index 7bdc977575..0169332a8f 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md @@ -126,7 +126,7 @@ export interface ImageData { // @public export enum KnownVersions { // (undocumented) - v2023_10_01 = "2023-10-01" + V20231001 = "2023-10-01" } // @public diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts index 922664ed1a..b5efd5581f 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts @@ -361,5 +361,5 @@ export function textAnalyzeSeverityResultDeserializer( /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - v2023_10_01 = "2023-10-01", + V20231001 = "2023-10-01", } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md index b818f6af46..a962d466f2 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md @@ -74,7 +74,7 @@ export interface FailedLockToken { // @public export enum KnownServiceApiVersions { // (undocumented) - v2023_06_01_preview = "2023-06-01-preview" + V20230601Preview = "2023-06-01-preview" } // @public diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts index 2274727647..f5313b769c 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts @@ -258,7 +258,7 @@ export function rejectResultDeserializer(item: any): RejectResult { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - v2023_06_01_preview = "2023-06-01-preview", + V20230601Preview = "2023-06-01-preview", } export function cloudEventArraySerializer(result: Array): any[] { diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md index bf659a9563..4db8810861 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md @@ -233,7 +233,7 @@ export type JobStatus = "notStarted" | "running" | "succeeded" | "failed" | "can // @public export enum KnownApiVersion { // (undocumented) - v2023_09_01_Preview = "2023-09-01-preview" + V20230901Preview = "2023-09-01-preview" } // @public diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts index 35c2c56726..74e54549fa 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts @@ -2291,5 +2291,5 @@ export type RepeatabilityResult = "accepted" | "rejected"; /** Known values of {@link ApiVersion} that the service accepts. */ export enum KnownApiVersion { - v2023_09_01_Preview = "2023-09-01-preview", + V20230901Preview = "2023-09-01-preview", } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts index 1f8670ba73..1d20656f74 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../api/fooContext.js"; import { op1 } from "../../../api/b/c/index.js"; -import { Ba } from "../../../models/models.js"; +import { BA } from "../../../models/models.js"; import { BCOp1OptionalParams } from "../../../api/options.js"; /** Interface representing a BC operations. */ export interface BCOperations { - op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; + op1: (body: BA, options?: BCOp1OptionalParams) => Promise; } export function getBC(context: FooContext) { return { - op1: (body: Ba, options?: BCOp1OptionalParams) => + op1: (body: BA, options?: BCOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts index f8ab6c6ed1..7301229b88 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../../api/fooContext.js"; import { op1 } from "../../../../api/b/e/c/index.js"; -import { Bea } from "../../../../models/models.js"; +import { BEA } from "../../../../models/models.js"; import { BECOp1OptionalParams } from "../../../../api/options.js"; /** Interface representing a BEC operations. */ export interface BECOperations { - op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; + op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; } export function getBEC(context: FooContext) { return { - op1: (body: Bea, options?: BECOp1OptionalParams) => + op1: (body: BEA, options?: BECOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts index d0f7c5c6f4..71e4d436d7 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts @@ -3,21 +3,21 @@ import { FooContext } from "../../api/fooContext.js"; import { op1 } from "../../api/b/index.js"; -import { Ba } from "../../models/models.js"; +import { BA } from "../../models/models.js"; import { BOp1OptionalParams } from "../../api/options.js"; import { BCOperations, getBCOperations } from "./c/index.js"; import { BEOperations, getBEOperations } from "./e/index.js"; /** Interface representing a B operations. */ export interface BOperations { - op1: (body: Ba, options?: BOp1OptionalParams) => Promise; + op1: (body: BA, options?: BOp1OptionalParams) => Promise; e: BEOperations; c: BCOperations; } export function getB(context: FooContext) { return { - op1: (body: Ba, options?: BOp1OptionalParams) => + op1: (body: BA, options?: BOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md index 1e61a43099..17815191d3 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md @@ -827,13 +827,13 @@ export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "102 // @public export enum KnownServiceApiVersions { // (undocumented) - v2022_12_01 = "2022-12-01", + V20221201 = "2022-12-01", // (undocumented) - v2023_05_15 = "2023-05-15", + V20230515 = "2023-05-15", // (undocumented) - v2024_02_01 = "2024-02-01", + V20240201 = "2024-02-01", // (undocumented) - v2024_06_01 = "2024-06-01" + V20240601 = "2024-06-01" } // @public diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts index 51d7ecb8b7..3fd2d4c379 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts @@ -3873,8 +3873,8 @@ export function embeddingsUsageDeserializer(item: any): EmbeddingsUsage { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - v2022_12_01 = "2022-12-01", - v2023_05_15 = "2023-05-15", - v2024_02_01 = "2024-02-01", - v2024_06_01 = "2024-06-01", + V20221201 = "2022-12-01", + V20230515 = "2023-05-15", + V20240201 = "2024-02-01", + V20240601 = "2024-06-01", } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md index e764bed764..862f76a14d 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md @@ -30,7 +30,7 @@ export interface FooOperationsOperations { // @public export enum KnownVersions { - "2022-08-30" = "2022-08-30" + Number20220830 = "2022-08-30" } // @public (undocumented) diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts index 925644a159..93040757c6 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts @@ -4,5 +4,5 @@ /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - "2022-08-30" = "2022-08-30", + Number20220830 = "2022-08-30", } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md index 73f2602824..9b413392ae 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md @@ -19,9 +19,9 @@ export type ContinuablePage = TPage & { // @public export enum KnownServiceApiVersions { - V2021_10 = "2021-10", - V2022_10 = "2022-10", - V2023_07_01 = "2023-07-01" + V202110 = "2021-10", + V202210 = "2022-10", + V20230701 = "2023-07-01" } // @public diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts index 7a2337bfe7..8bd71fc6d2 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts @@ -140,11 +140,11 @@ export type SchemaContentTypeValues = /** Represents the Schema Registry API version to use for requests. */ export enum KnownServiceApiVersions { /** Azure Schema Registry 2021-10 Version */ - V2021_10 = "2021-10", + V202110 = "2021-10", /** Azure Schema Registry 2022-10 Version */ - V2022_10 = "2022-10", + V202210 = "2022-10", /** Azure Schema Registry 2023-07-01 Version. This is the default version. */ - V2023_07_01 = "2023-07-01", + V20230701 = "2023-07-01", } /** The content type for the schema. */ diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md index 334ef05a0e..2ebea4a745 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md @@ -37,7 +37,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { - "1.0.0" = "1.0.0" + Number100 = "1.0.0" } // @public diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts index 76d8c3a4c3..bf79e4bf28 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts @@ -112,5 +112,5 @@ export function nonReferencedModelDeserializer(item: any): NonReferencedModel { /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - "1.0.0" = "1.0.0", + Number100 = "1.0.0", } From 1e750cde8b67dc80ac296fc73e56b16ae8dc65ff Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 14:19:11 +0800 Subject: [PATCH 35/91] Update the modular integration --- .../generated/azure/core/basic/src/index.d.ts | 2 +- .../generated/azure/core/lro/rpc/src/index.d.ts | 2 +- .../generated/azure/core/lro/standard/src/index.d.ts | 2 +- .../generated/azure/core/model/src/index.d.ts | 2 +- .../generated/azure/core/page/src/index.d.ts | 2 +- .../generated/azure/core/scalar/src/index.d.ts | 2 +- .../generated/azure/core/traits/src/index.d.ts | 2 +- .../generated/azure/example/basic/src/index.d.ts | 2 +- .../resource-manager/common-properties/src/index.d.ts | 4 ++-- .../azure/resource-manager/resources/src/index.d.ts | 2 +- .../generated/encode/bytes/src/index.d.ts | 8 ++++---- .../generated/resiliency/srv-driven-main/src/index.d.ts | 4 ++-- .../generated/resiliency/srv-driven-old/src/index.d.ts | 2 +- .../generated/server/versions/versioned/src/index.d.ts | 4 ++-- .../generated/type/union/src/index.d.ts | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts index b0f8a94c62..a5f37c1830 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts @@ -43,7 +43,7 @@ export declare interface GetOptionalParams extends OperationOptions { } export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare interface ListOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts index d158658f10..8264ff1f57 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts @@ -15,7 +15,7 @@ export declare interface GenerationResult { } export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare interface LongRunningRpcOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts index d4c9fc312f..21a8ae11e8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts @@ -24,7 +24,7 @@ export declare interface ExportOptionalParams extends OperationOptions { } export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare function restorePoller(client: StandardClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts index 7147d9ece5..4e52d4d646 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts @@ -10,7 +10,7 @@ export declare interface GetOptionalParams extends OperationOptions { } export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare class ModelClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts index 3409347c11..97a88e2162 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts @@ -11,7 +11,7 @@ export declare interface FirstItem { } export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare interface ListFirstItemOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts index 07b873e0bd..d2bf292bdf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts @@ -13,7 +13,7 @@ export declare interface HeaderOptionalParams extends OperationOptions { } export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare interface PostOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts index 616bb4e110..53a9008576 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts @@ -3,7 +3,7 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare type RepeatabilityResult = "accepted" | "rejected"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts index 84702c40fe..66f6d06fd6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts @@ -33,7 +33,7 @@ export declare interface BasicActionOptionalParams extends OperationOptions { export declare type Enum = "EnumValue1"; export declare enum KnownVersions { - v2022_12_01_preview = "2022-12-01-preview" + V20221201Preview = "2022-12-01-preview" } export declare interface Model { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts index 8b77590770..e21f411fe5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts @@ -51,11 +51,11 @@ export declare enum KnownManagedServiceIdentityType { None = "None", SystemAssigned = "SystemAssigned", UserAssigned = "UserAssigned", - "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned" + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned" } export declare enum KnownVersions { - v2023_12_01_preview = "2023-12-01-preview" + V20231201Preview = "2023-12-01-preview" } export declare interface ManagedIdentityTrackedResource extends TrackedResource { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts index 106c7891bc..31b4998ba7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts @@ -47,7 +47,7 @@ export declare enum KnownProvisioningState { } export declare enum KnownVersions { - v2023_12_01_preview = "2023-12-01-preview" + V20231201Preview = "2023-12-01-preview" } export declare interface NestedCreateOrReplaceOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts index e505dfd63f..7180a00474 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts @@ -6,11 +6,11 @@ export declare interface Base64BytesProperty { value: Uint8Array; } -export declare interface Base64urlArrayBytesProperty { +export declare interface Base64UrlArrayBytesProperty { value: Uint8Array[]; } -export declare interface Base64urlBytesProperty { +export declare interface Base64UrlBytesProperty { value: Uint8Array; } @@ -66,8 +66,8 @@ export declare interface PropertyDefaultOptionalParams extends OperationOptions export declare interface PropertyOperations { default: (body: DefaultBytesProperty, options?: PropertyDefaultOptionalParams) => Promise; base64: (body: Base64BytesProperty, options?: PropertyBase64OptionalParams) => Promise; - base64url: (body: Base64urlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; - base64urlArray: (body: Base64urlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; + base64url: (body: Base64UrlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; + base64urlArray: (body: Base64UrlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; } export declare interface QueryBase64OptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts index 9297bdfdfa..4d93af2ba5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts @@ -19,8 +19,8 @@ export declare interface FromOneRequiredOptionalParams extends OperationOptions } export declare enum KnownVersions { - v1 = "v1", - v2 = "v2" + V1 = "v1", + V2 = "v2" } export declare class ResiliencyServiceDrivenClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts index efb2c9892a..d63c570802 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts @@ -13,7 +13,7 @@ export declare interface FromOneRequiredOptionalParams extends OperationOptions } export declare enum KnownVersions { - v1 = "v1" + V1 = "v1" } export declare class ResiliencyServiceDrivenClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts index f0a0256c04..9d16dfefaa 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts @@ -3,8 +3,8 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; export declare enum KnownVersions { - v2021_01_01_preview = "2021-01-01-preview", - v2022_12_01_preview = "2022-12-01-preview" + V20210101Preview = "2021-01-01-preview", + V20221201Preview = "2022-12-01-preview" } export declare class VersionedClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts index 0d7e3d7b81..146048a65f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts @@ -56,7 +56,7 @@ export declare interface IntsOnlySendOptionalParams extends OperationOptions { export declare enum KnownStringExtensibleNamedUnion { OptionB = "b", - c = "c" + C = "c" } export declare interface MixedLiteralsCases { From 322d1bd7f7f390f211b89deaead645d0e4822f57 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 14:37:11 +0800 Subject: [PATCH 36/91] Update the integration test --- packages/typespec-ts/src/lib.ts | 6 + .../typespec-ts/src/modular/emitModels.ts | 20 +- .../type/property/nullable/src/index.d.ts | 288 +++++++++--------- 3 files changed, 167 insertions(+), 147 deletions(-) diff --git a/packages/typespec-ts/src/lib.ts b/packages/typespec-ts/src/lib.ts index 4f4f8cc0e2..01567e67de 100644 --- a/packages/typespec-ts/src/lib.ts +++ b/packages/typespec-ts/src/lib.ts @@ -268,6 +268,12 @@ const libDef = { messages: { default: paramMessage`Path parameter '${"paramName"}' cannot be optional.` } + }, + "prefix-adding-in-enum-member": { + severity: "warning", + messages: { + default: paramMessage`Enum member name ${"memberName"} is normalized to ${"normalizedName"} with "Number" prefix.` + } } }, emitter: { diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index bfa7b1771a..75a69d5e40 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -340,11 +340,25 @@ function emitEnumMember( context: SdkContext, member: SdkEnumValueType ): EnumMemberStructure { + const normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize + ? normalizeNumericLiteralName(member.name, NameType.EnumMemberName) // need to normalize number also for enum member + : normalizeName(member.name, NameType.EnumMemberName, true); + if ( + normalizedMemberName.toLowerCase().startsWith("number") && + !member.name.toLowerCase().startsWith("number") + ) { + reportDiagnostic(context.program, { + code: "prefix-adding-in-enum-member", + format: { + memberName: member.name, + normalizedName: normalizedMemberName + }, + target: NoTarget + }); + } const memberStructure: EnumMemberStructure = { kind: StructureKind.EnumMember, - name: context.rlcOptions?.ignoreEnumMemberNameNormalize - ? normalizeNumericLiteralName(member.name, NameType.EnumMemberName) // need to normalize number also for enum member - : normalizeName(member.name, NameType.EnumMemberName, true), + name: normalizedMemberName, value: member.value }; diff --git a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts index efb6c64c02..293723062c 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts @@ -4,57 +4,57 @@ import { HttpResponse } from '@azure-rest/core-client'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; -export declare interface BytesGetNonnull { - get(options?: BytesGetNonnullParameters): StreamableMethod; - patch(options: BytesPatchNonnullParameters): StreamableMethod; +export declare interface BytesGetNonNull { + get(options?: BytesGetNonNullParameters): StreamableMethod; + patch(options: BytesPatchNonNullParameters): StreamableMethod; } -export declare interface BytesGetNonnull200Response extends HttpResponse { +export declare interface BytesGetNonNull200Response extends HttpResponse { status: "200"; body: BytesPropertyOutput; } -export declare type BytesGetNonnullParameters = RequestParameters; +export declare type BytesGetNonNullParameters = RequestParameters; -export declare interface BytesGetnull { - get(options?: BytesGetnullParameters): StreamableMethod; - patch(options: BytesPatchnullParameters): StreamableMethod; +export declare interface BytesGetNull { + get(options?: BytesGetNullParameters): StreamableMethod; + patch(options: BytesPatchNullParameters): StreamableMethod; } -export declare interface BytesGetnull200Response extends HttpResponse { +export declare interface BytesGetNull200Response extends HttpResponse { status: "200"; body: BytesPropertyOutput; } -export declare type BytesGetnullParameters = RequestParameters; +export declare type BytesGetNullParameters = RequestParameters; -export declare interface BytesPatchNonnull204Response extends HttpResponse { +export declare interface BytesPatchNonNull204Response extends HttpResponse { status: "204"; } -export declare interface BytesPatchNonnullBodyParam { +export declare interface BytesPatchNonNullBodyParam { body: BytesPropertyResourceMergeAndPatch; } -export declare interface BytesPatchNonnullMediaTypesParam { +export declare interface BytesPatchNonNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type BytesPatchNonnullParameters = BytesPatchNonnullMediaTypesParam & BytesPatchNonnullBodyParam & RequestParameters; +export declare type BytesPatchNonNullParameters = BytesPatchNonNullMediaTypesParam & BytesPatchNonNullBodyParam & RequestParameters; -export declare interface BytesPatchnull204Response extends HttpResponse { +export declare interface BytesPatchNull204Response extends HttpResponse { status: "204"; } -export declare interface BytesPatchnullBodyParam { +export declare interface BytesPatchNullBodyParam { body: BytesPropertyResourceMergeAndPatch; } -export declare interface BytesPatchnullMediaTypesParam { +export declare interface BytesPatchNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type BytesPatchnullParameters = BytesPatchnullMediaTypesParam & BytesPatchnullBodyParam & RequestParameters; +export declare type BytesPatchNullParameters = BytesPatchNullMediaTypesParam & BytesPatchNullBodyParam & RequestParameters; export declare interface BytesProperty { requiredProperty: string; @@ -68,57 +68,57 @@ export declare interface BytesPropertyOutput { export declare type BytesPropertyResourceMergeAndPatch = Partial; -export declare interface CollectionsByteGetNonnull { - get(options?: CollectionsByteGetNonnullParameters): StreamableMethod; - patch(options: CollectionsBytePatchNonnullParameters): StreamableMethod; +export declare interface CollectionsByteGetNonNull { + get(options?: CollectionsByteGetNonNullParameters): StreamableMethod; + patch(options: CollectionsBytePatchNonNullParameters): StreamableMethod; } -export declare interface CollectionsByteGetNonnull200Response extends HttpResponse { +export declare interface CollectionsByteGetNonNull200Response extends HttpResponse { status: "200"; body: CollectionsBytePropertyOutput; } -export declare type CollectionsByteGetNonnullParameters = RequestParameters; +export declare type CollectionsByteGetNonNullParameters = RequestParameters; -export declare interface CollectionsByteGetnull { - get(options?: CollectionsByteGetnullParameters): StreamableMethod; - patch(options: CollectionsBytePatchnullParameters): StreamableMethod; +export declare interface CollectionsByteGetNull { + get(options?: CollectionsByteGetNullParameters): StreamableMethod; + patch(options: CollectionsBytePatchNullParameters): StreamableMethod; } -export declare interface CollectionsByteGetnull200Response extends HttpResponse { +export declare interface CollectionsByteGetNull200Response extends HttpResponse { status: "200"; body: CollectionsBytePropertyOutput; } -export declare type CollectionsByteGetnullParameters = RequestParameters; +export declare type CollectionsByteGetNullParameters = RequestParameters; -export declare interface CollectionsBytePatchNonnull204Response extends HttpResponse { +export declare interface CollectionsBytePatchNonNull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsBytePatchNonnullBodyParam { +export declare interface CollectionsBytePatchNonNullBodyParam { body: CollectionsBytePropertyResourceMergeAndPatch; } -export declare interface CollectionsBytePatchNonnullMediaTypesParam { +export declare interface CollectionsBytePatchNonNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsBytePatchNonnullParameters = CollectionsBytePatchNonnullMediaTypesParam & CollectionsBytePatchNonnullBodyParam & RequestParameters; +export declare type CollectionsBytePatchNonNullParameters = CollectionsBytePatchNonNullMediaTypesParam & CollectionsBytePatchNonNullBodyParam & RequestParameters; -export declare interface CollectionsBytePatchnull204Response extends HttpResponse { +export declare interface CollectionsBytePatchNull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsBytePatchnullBodyParam { +export declare interface CollectionsBytePatchNullBodyParam { body: CollectionsBytePropertyResourceMergeAndPatch; } -export declare interface CollectionsBytePatchnullMediaTypesParam { +export declare interface CollectionsBytePatchNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsBytePatchnullParameters = CollectionsBytePatchnullMediaTypesParam & CollectionsBytePatchnullBodyParam & RequestParameters; +export declare type CollectionsBytePatchNullParameters = CollectionsBytePatchNullMediaTypesParam & CollectionsBytePatchNullBodyParam & RequestParameters; export declare interface CollectionsByteProperty { requiredProperty: string; @@ -132,57 +132,57 @@ export declare interface CollectionsBytePropertyOutput { export declare type CollectionsBytePropertyResourceMergeAndPatch = Partial; -export declare interface CollectionsModelGetNonnull { - get(options?: CollectionsModelGetNonnullParameters): StreamableMethod; - patch(options: CollectionsModelPatchNonnullParameters): StreamableMethod; +export declare interface CollectionsModelGetNonNull { + get(options?: CollectionsModelGetNonNullParameters): StreamableMethod; + patch(options: CollectionsModelPatchNonNullParameters): StreamableMethod; } -export declare interface CollectionsModelGetNonnull200Response extends HttpResponse { +export declare interface CollectionsModelGetNonNull200Response extends HttpResponse { status: "200"; body: CollectionsModelPropertyOutput; } -export declare type CollectionsModelGetNonnullParameters = RequestParameters; +export declare type CollectionsModelGetNonNullParameters = RequestParameters; -export declare interface CollectionsModelGetnull { - get(options?: CollectionsModelGetnullParameters): StreamableMethod; - patch(options: CollectionsModelPatchnullParameters): StreamableMethod; +export declare interface CollectionsModelGetNull { + get(options?: CollectionsModelGetNullParameters): StreamableMethod; + patch(options: CollectionsModelPatchNullParameters): StreamableMethod; } -export declare interface CollectionsModelGetnull200Response extends HttpResponse { +export declare interface CollectionsModelGetNull200Response extends HttpResponse { status: "200"; body: CollectionsModelPropertyOutput; } -export declare type CollectionsModelGetnullParameters = RequestParameters; +export declare type CollectionsModelGetNullParameters = RequestParameters; -export declare interface CollectionsModelPatchNonnull204Response extends HttpResponse { +export declare interface CollectionsModelPatchNonNull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsModelPatchNonnullBodyParam { +export declare interface CollectionsModelPatchNonNullBodyParam { body: CollectionsModelPropertyResourceMergeAndPatch; } -export declare interface CollectionsModelPatchNonnullMediaTypesParam { +export declare interface CollectionsModelPatchNonNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsModelPatchNonnullParameters = CollectionsModelPatchNonnullMediaTypesParam & CollectionsModelPatchNonnullBodyParam & RequestParameters; +export declare type CollectionsModelPatchNonNullParameters = CollectionsModelPatchNonNullMediaTypesParam & CollectionsModelPatchNonNullBodyParam & RequestParameters; -export declare interface CollectionsModelPatchnull204Response extends HttpResponse { +export declare interface CollectionsModelPatchNull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsModelPatchnullBodyParam { +export declare interface CollectionsModelPatchNullBodyParam { body: CollectionsModelPropertyResourceMergeAndPatch; } -export declare interface CollectionsModelPatchnullMediaTypesParam { +export declare interface CollectionsModelPatchNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsModelPatchnullParameters = CollectionsModelPatchnullMediaTypesParam & CollectionsModelPatchnullBodyParam & RequestParameters; +export declare type CollectionsModelPatchNullParameters = CollectionsModelPatchNullMediaTypesParam & CollectionsModelPatchNullBodyParam & RequestParameters; export declare interface CollectionsModelProperty { requiredProperty: string; @@ -196,57 +196,57 @@ export declare interface CollectionsModelPropertyOutput { export declare type CollectionsModelPropertyResourceMergeAndPatch = Partial; -export declare interface CollectionsStringGetNonnull { - get(options?: CollectionsStringGetNonnullParameters): StreamableMethod; - patch(options: CollectionsStringPatchNonnullParameters): StreamableMethod; +export declare interface CollectionsStringGetNonNull { + get(options?: CollectionsStringGetNonNullParameters): StreamableMethod; + patch(options: CollectionsStringPatchNonNullParameters): StreamableMethod; } -export declare interface CollectionsStringGetNonnull200Response extends HttpResponse { +export declare interface CollectionsStringGetNonNull200Response extends HttpResponse { status: "200"; body: CollectionsStringPropertyOutput; } -export declare type CollectionsStringGetNonnullParameters = RequestParameters; +export declare type CollectionsStringGetNonNullParameters = RequestParameters; -export declare interface CollectionsStringGetnull { - get(options?: CollectionsStringGetnullParameters): StreamableMethod; - patch(options: CollectionsStringPatchnullParameters): StreamableMethod; +export declare interface CollectionsStringGetNull { + get(options?: CollectionsStringGetNullParameters): StreamableMethod; + patch(options: CollectionsStringPatchNullParameters): StreamableMethod; } -export declare interface CollectionsStringGetnull200Response extends HttpResponse { +export declare interface CollectionsStringGetNull200Response extends HttpResponse { status: "200"; body: CollectionsStringPropertyOutput; } -export declare type CollectionsStringGetnullParameters = RequestParameters; +export declare type CollectionsStringGetNullParameters = RequestParameters; -export declare interface CollectionsStringPatchNonnull204Response extends HttpResponse { +export declare interface CollectionsStringPatchNonNull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsStringPatchNonnullBodyParam { +export declare interface CollectionsStringPatchNonNullBodyParam { body: CollectionsStringPropertyResourceMergeAndPatch; } -export declare interface CollectionsStringPatchNonnullMediaTypesParam { +export declare interface CollectionsStringPatchNonNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsStringPatchNonnullParameters = CollectionsStringPatchNonnullMediaTypesParam & CollectionsStringPatchNonnullBodyParam & RequestParameters; +export declare type CollectionsStringPatchNonNullParameters = CollectionsStringPatchNonNullMediaTypesParam & CollectionsStringPatchNonNullBodyParam & RequestParameters; -export declare interface CollectionsStringPatchnull204Response extends HttpResponse { +export declare interface CollectionsStringPatchNull204Response extends HttpResponse { status: "204"; } -export declare interface CollectionsStringPatchnullBodyParam { +export declare interface CollectionsStringPatchNullBodyParam { body: CollectionsStringPropertyResourceMergeAndPatch; } -export declare interface CollectionsStringPatchnullMediaTypesParam { +export declare interface CollectionsStringPatchNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type CollectionsStringPatchnullParameters = CollectionsStringPatchnullMediaTypesParam & CollectionsStringPatchnullBodyParam & RequestParameters; +export declare type CollectionsStringPatchNullParameters = CollectionsStringPatchNullMediaTypesParam & CollectionsStringPatchNullBodyParam & RequestParameters; export declare interface CollectionsStringProperty { requiredProperty: string; @@ -263,57 +263,57 @@ export declare type CollectionsStringPropertyResourceMergeAndPatch = Partial; - patch(options: DatetimePatchNonnullParameters): StreamableMethod; +export declare interface DatetimeGetNonNull { + get(options?: DatetimeGetNonNullParameters): StreamableMethod; + patch(options: DatetimePatchNonNullParameters): StreamableMethod; } -export declare interface DatetimeGetNonnull200Response extends HttpResponse { +export declare interface DatetimeGetNonNull200Response extends HttpResponse { status: "200"; body: DatetimePropertyOutput; } -export declare type DatetimeGetNonnullParameters = RequestParameters; +export declare type DatetimeGetNonNullParameters = RequestParameters; -export declare interface DatetimeGetnull { - get(options?: DatetimeGetnullParameters): StreamableMethod; - patch(options: DatetimePatchnullParameters): StreamableMethod; +export declare interface DatetimeGetNull { + get(options?: DatetimeGetNullParameters): StreamableMethod; + patch(options: DatetimePatchNullParameters): StreamableMethod; } -export declare interface DatetimeGetnull200Response extends HttpResponse { +export declare interface DatetimeGetNull200Response extends HttpResponse { status: "200"; body: DatetimePropertyOutput; } -export declare type DatetimeGetnullParameters = RequestParameters; +export declare type DatetimeGetNullParameters = RequestParameters; -export declare interface DatetimePatchNonnull204Response extends HttpResponse { +export declare interface DatetimePatchNonNull204Response extends HttpResponse { status: "204"; } -export declare interface DatetimePatchNonnullBodyParam { +export declare interface DatetimePatchNonNullBodyParam { body: DatetimePropertyResourceMergeAndPatch; } -export declare interface DatetimePatchNonnullMediaTypesParam { +export declare interface DatetimePatchNonNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DatetimePatchNonnullParameters = DatetimePatchNonnullMediaTypesParam & DatetimePatchNonnullBodyParam & RequestParameters; +export declare type DatetimePatchNonNullParameters = DatetimePatchNonNullMediaTypesParam & DatetimePatchNonNullBodyParam & RequestParameters; -export declare interface DatetimePatchnull204Response extends HttpResponse { +export declare interface DatetimePatchNull204Response extends HttpResponse { status: "204"; } -export declare interface DatetimePatchnullBodyParam { +export declare interface DatetimePatchNullBodyParam { body: DatetimePropertyResourceMergeAndPatch; } -export declare interface DatetimePatchnullMediaTypesParam { +export declare interface DatetimePatchNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DatetimePatchnullParameters = DatetimePatchnullMediaTypesParam & DatetimePatchnullBodyParam & RequestParameters; +export declare type DatetimePatchNullParameters = DatetimePatchNullMediaTypesParam & DatetimePatchNullBodyParam & RequestParameters; export declare interface DatetimeProperty { requiredProperty: string; @@ -327,57 +327,57 @@ export declare interface DatetimePropertyOutput { export declare type DatetimePropertyResourceMergeAndPatch = Partial; -export declare interface DurationGetNonnull { - get(options?: DurationGetNonnullParameters): StreamableMethod; - patch(options: DurationPatchNonnullParameters): StreamableMethod; +export declare interface DurationGetNonNull { + get(options?: DurationGetNonNullParameters): StreamableMethod; + patch(options: DurationPatchNonNullParameters): StreamableMethod; } -export declare interface DurationGetNonnull200Response extends HttpResponse { +export declare interface DurationGetNonNull200Response extends HttpResponse { status: "200"; body: DurationPropertyOutput; } -export declare type DurationGetNonnullParameters = RequestParameters; +export declare type DurationGetNonNullParameters = RequestParameters; -export declare interface DurationGetnull { - get(options?: DurationGetnullParameters): StreamableMethod; - patch(options: DurationPatchnullParameters): StreamableMethod; +export declare interface DurationGetNull { + get(options?: DurationGetNullParameters): StreamableMethod; + patch(options: DurationPatchNullParameters): StreamableMethod; } -export declare interface DurationGetnull200Response extends HttpResponse { +export declare interface DurationGetNull200Response extends HttpResponse { status: "200"; body: DurationPropertyOutput; } -export declare type DurationGetnullParameters = RequestParameters; +export declare type DurationGetNullParameters = RequestParameters; -export declare interface DurationPatchNonnull204Response extends HttpResponse { +export declare interface DurationPatchNonNull204Response extends HttpResponse { status: "204"; } -export declare interface DurationPatchNonnullBodyParam { +export declare interface DurationPatchNonNullBodyParam { body: DurationPropertyResourceMergeAndPatch; } -export declare interface DurationPatchNonnullMediaTypesParam { +export declare interface DurationPatchNonNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DurationPatchNonnullParameters = DurationPatchNonnullMediaTypesParam & DurationPatchNonnullBodyParam & RequestParameters; +export declare type DurationPatchNonNullParameters = DurationPatchNonNullMediaTypesParam & DurationPatchNonNullBodyParam & RequestParameters; -export declare interface DurationPatchnull204Response extends HttpResponse { +export declare interface DurationPatchNull204Response extends HttpResponse { status: "204"; } -export declare interface DurationPatchnullBodyParam { +export declare interface DurationPatchNullBodyParam { body: DurationPropertyResourceMergeAndPatch; } -export declare interface DurationPatchnullMediaTypesParam { +export declare interface DurationPatchNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type DurationPatchnullParameters = DurationPatchnullMediaTypesParam & DurationPatchnullBodyParam & RequestParameters; +export declare type DurationPatchNullParameters = DurationPatchNullMediaTypesParam & DurationPatchNullBodyParam & RequestParameters; export declare interface DurationProperty { requiredProperty: string; @@ -407,73 +407,73 @@ export declare interface NullableClientOptions extends ClientOptions { } export declare interface Routes { - (path: "/type/property/nullable/string/non-null"): StringModelGetNonnull; - (path: "/type/property/nullable/string/null"): StringModelGetnull; - (path: "/type/property/nullable/bytes/non-null"): BytesGetNonnull; - (path: "/type/property/nullable/bytes/null"): BytesGetnull; - (path: "/type/property/nullable/datetime/non-null"): DatetimeGetNonnull; - (path: "/type/property/nullable/datetime/null"): DatetimeGetnull; - (path: "/type/property/nullable/duration/non-null"): DurationGetNonnull; - (path: "/type/property/nullable/duration/null"): DurationGetnull; - (path: "/type/property/nullable/collections/bytes/non-null"): CollectionsByteGetNonnull; - (path: "/type/property/nullable/collections/bytes/null"): CollectionsByteGetnull; - (path: "/type/property/nullable/collections/model/non-null"): CollectionsModelGetNonnull; - (path: "/type/property/nullable/collections/model/null"): CollectionsModelGetnull; - (path: "/type/property/nullable/collections/string/non-null"): CollectionsStringGetNonnull; - (path: "/type/property/nullable/collections/string/null"): CollectionsStringGetnull; -} - -export declare interface StringModelGetNonnull { - get(options?: StringModelGetNonnullParameters): StreamableMethod; - patch(options: StringModelPatchNonnullParameters): StreamableMethod; -} - -export declare interface StringModelGetNonnull200Response extends HttpResponse { + (path: "/type/property/nullable/string/non-null"): StringModelGetNonNull; + (path: "/type/property/nullable/string/null"): StringModelGetNull; + (path: "/type/property/nullable/bytes/non-null"): BytesGetNonNull; + (path: "/type/property/nullable/bytes/null"): BytesGetNull; + (path: "/type/property/nullable/datetime/non-null"): DatetimeGetNonNull; + (path: "/type/property/nullable/datetime/null"): DatetimeGetNull; + (path: "/type/property/nullable/duration/non-null"): DurationGetNonNull; + (path: "/type/property/nullable/duration/null"): DurationGetNull; + (path: "/type/property/nullable/collections/bytes/non-null"): CollectionsByteGetNonNull; + (path: "/type/property/nullable/collections/bytes/null"): CollectionsByteGetNull; + (path: "/type/property/nullable/collections/model/non-null"): CollectionsModelGetNonNull; + (path: "/type/property/nullable/collections/model/null"): CollectionsModelGetNull; + (path: "/type/property/nullable/collections/string/non-null"): CollectionsStringGetNonNull; + (path: "/type/property/nullable/collections/string/null"): CollectionsStringGetNull; +} + +export declare interface StringModelGetNonNull { + get(options?: StringModelGetNonNullParameters): StreamableMethod; + patch(options: StringModelPatchNonNullParameters): StreamableMethod; +} + +export declare interface StringModelGetNonNull200Response extends HttpResponse { status: "200"; body: StringPropertyOutput; } -export declare type StringModelGetNonnullParameters = RequestParameters; +export declare type StringModelGetNonNullParameters = RequestParameters; -export declare interface StringModelGetnull { - get(options?: StringModelGetnullParameters): StreamableMethod; - patch(options: StringModelPatchnullParameters): StreamableMethod; +export declare interface StringModelGetNull { + get(options?: StringModelGetNullParameters): StreamableMethod; + patch(options: StringModelPatchNullParameters): StreamableMethod; } -export declare interface StringModelGetnull200Response extends HttpResponse { +export declare interface StringModelGetNull200Response extends HttpResponse { status: "200"; body: StringPropertyOutput; } -export declare type StringModelGetnullParameters = RequestParameters; +export declare type StringModelGetNullParameters = RequestParameters; -export declare interface StringModelPatchNonnull204Response extends HttpResponse { +export declare interface StringModelPatchNonNull204Response extends HttpResponse { status: "204"; } -export declare interface StringModelPatchNonnullBodyParam { +export declare interface StringModelPatchNonNullBodyParam { body: StringPropertyResourceMergeAndPatch; } -export declare interface StringModelPatchNonnullMediaTypesParam { +export declare interface StringModelPatchNonNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type StringModelPatchNonnullParameters = StringModelPatchNonnullMediaTypesParam & StringModelPatchNonnullBodyParam & RequestParameters; +export declare type StringModelPatchNonNullParameters = StringModelPatchNonNullMediaTypesParam & StringModelPatchNonNullBodyParam & RequestParameters; -export declare interface StringModelPatchnull204Response extends HttpResponse { +export declare interface StringModelPatchNull204Response extends HttpResponse { status: "204"; } -export declare interface StringModelPatchnullBodyParam { +export declare interface StringModelPatchNullBodyParam { body: StringPropertyResourceMergeAndPatch; } -export declare interface StringModelPatchnullMediaTypesParam { +export declare interface StringModelPatchNullMediaTypesParam { contentType: "application/merge-patch+json"; } -export declare type StringModelPatchnullParameters = StringModelPatchnullMediaTypesParam & StringModelPatchnullBodyParam & RequestParameters; +export declare type StringModelPatchNullParameters = StringModelPatchNullMediaTypesParam & StringModelPatchNullBodyParam & RequestParameters; export declare interface StringProperty { requiredProperty: string; From 7f1cbfa96ae95237a75223f5de2bef9440daac78 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 12 Nov 2024 14:57:40 +0800 Subject: [PATCH 37/91] Fix the modular UTs --- .../test/modularUnit/enumUnion.spec.ts | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts index 9326938d59..13c4bbda5c 100644 --- a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts +++ b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts @@ -980,13 +980,15 @@ describe("model type", () => { }); describe("number | numeric literal | nullable", () => { - it("number enum", async () => { + it("number enum and ignore warnings", async () => { const modelFile = await emitModularModelsFromTypeSpec(` model Test { color: 1 | 2; } op read(@body body: Test): void; - `); + `, { + mustEmptyDiagnostic: false + }); assert.ok(modelFile); await assertEqualContent( modelFile!.getInterface("Test")?.getFullText()!, @@ -1008,6 +1010,21 @@ describe("model type", () => { ); }); + it("number enum and not ignore warnings", async () => { + try { + await emitModularModelsFromTypeSpec(` + model Test { + color: 1 | 2; + } + op read(@body body: Test): void; + `, { + mustEmptyDiagnostic: true + }); + } catch (e: any) { + assert.strictEqual(e[0].message, 'Enum member name 1 is normalized to Number1 with "Number" prefix.'); + } + }); + it("number enum member", async () => { const modelFile = await emitModularModelsFromTypeSpec(` enum Color { From 99c0a704cc09737f7e897eb0aa9b81db003d67c5 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 13 Nov 2024 11:10:39 +0800 Subject: [PATCH 38/91] Update the test cases --- .../models/serialization/enumKeyNorm.md | 90 ++++++++++++------- 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index 6ee9652342..09380b5a9d 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -1,47 +1,69 @@ -# skip: Should generate enum key normalization cases +# Should generate enum key normalization cases ## TypeSpec This is tsp definition. ```tsp +import "@typespec/http"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service({ + title: "Microsoft.Contoso management service", +}) +namespace Microsoft.Contoso; + union ExtensibleString { pascal: "pascal", - pascalCase: "pascalCase", - PascalCase: PascalCase, - pascalcase: "pascalcase", - Pascalcase: "Pascalcase", - pascal_case_: "pascal_case_", - pascal_case: "pascal_case", - _pascal_case: "_pascal_case", - `pascal, case`: "pascal, case", + pascalCase1: "pascalCase1", + PascalCase2: "PascalCase2", + pascalcase3: "pascalcase3", + Pascalcase4: "Pascalcase4", + pascal_case_5: "pascal_case_5", + pascal_case6: "pascal_case6", + _pascal_case7: "_pascal_case7", + `pascal, case8`: "pascal, case8", MAX_of_MLD: "MAX_of_MLD", + // we will keep the upper case + YES_OR_NO1: "YES OR NO", + YES_OR_NO2: "YES OR NO", + VALIDATION_SUCCESS: "VALIDATION_SUCCESS", ___pascal____case6666: "___pascal____case6666", _10Pascal: "_10Pascal", `090`: "090", `10`: "10", + `20`: "20", `1.0`: "1.0", - `-1.0`: "-1.0", + `-2.0`: "-2.0", string, } - union ExtensibleNumber { - "One": 1, - "2": 2, - "-2.1": -2.1, - int8 + One: 1, + `2`: 2, + `-2.1`: -2.1, + 3, + int8, } model Foo { extensibleString: ExtensibleString; extensibleNumber: ExtensibleNumber; } op post(@body body: Foo): void; +@@clientName(ExtensibleString.`-2.0`, "$DO_NOT_NORMALIZE$Item-1.0"); +@@clientName(ExtensibleString.`YES_OR_NO2`, "Yes_Or_No2"); +// cannot locate the number enum item and issue here: https://github.com/microsoft/typespec/issues/5081 +// @@clientName(ExtensibleNumber.3, "Enum3"); ``` This is the tspconfig.yaml. ```yaml +withRawContent: true +mustEmptyDiagnostic: false experimentalExtensibleEnums: true ``` @@ -66,22 +88,25 @@ export function fooSerializer(item: Foo): any { /** Known values of {@link ExtensibleString} that the service accepts. */ export enum KnownExtensibleString { Pascal = "pascal", - // Please note duplicated names here and see design doc for more details - PascalCase = "pascalCase", - PascalCase = "PascalCase", - Pascalcase = "pascalcase", - Pascalcase = "Pascalcase", - PascalCase = "pascal_case_", - PascalCase = "pascal_case", - PascalCase = "_pascal_case", - PascalCase = "pascal, case", - MaxOfMld = "MAX_of_MLD", + PascalCase1 = "pascalCase1", + PascalCase2 = "PascalCase2", + Pascalcase3 = "pascalcase3", + Pascalcase4 = "Pascalcase4", + PascalCase5 = "pascal_case_5", + PascalCase6 = "pascal_case6", + PascalCase7 = "_pascal_case7", + PascalCase8 = "pascal, case8", + MAXOfMLD = "MAX_of_MLD", + YESORNO1 = "YES OR NO", + YesOrNo2 = "YES OR NO", + ValidationSuccess = "VALIDATION_SUCCESS", PascalCase6666 = "___pascal____case6666", - "10Pascal" = "_10Pascal", - "090" = "090", + Number10Pascal = "_10Pascal", + Number090 = "090", Number10 = "10", - "Number1.0" = "1.0", - "Number-1.0" = "-1.0" + Number20 = "20", + Number10 = "1.0", + "Item-1.0" = "-2.0" } /** Type of ExtensibleString */ @@ -89,9 +114,10 @@ export type ExtensibleString = string; /** Known values of {@link ExtensibleNumber} that the service accepts. */ export enum KnownExtensibleNumber { - "One" = 1, - "Number2" = 2, - "Number-2.1" = -2.1 + One = 1, + Number2 = 2, + "Number-2.1" = -2.1, + Number3 = 3 } /** Type of ExtensibleNumber */ From c6def9f4af0970c468ef9a89c76f45b79118f46c Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 13 Nov 2024 11:26:03 +0800 Subject: [PATCH 39/91] Update the UTs --- .../models/serialization/enumKeyNorm.md | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index 09380b5a9d..20df9cae30 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -6,14 +6,17 @@ This is tsp definition. ```tsp import "@typespec/http"; +import "@typespec/versioning"; import "@azure-tools/typespec-client-generator-core"; using TypeSpec.Http; +using TypeSpec.Versioning; using Azure.ClientGenerator.Core; @service({ title: "Microsoft.Contoso management service", }) +@versioned(Microsoft.Contoso.Versions) namespace Microsoft.Contoso; union ExtensibleString { @@ -48,6 +51,14 @@ union ExtensibleNumber { 3, int8, } + + +enum Versions { + PreviewVersion: "2024-07-01-preview", + `2024-07-01`, + `2024-08-01-preview` +} + model Foo { extensibleString: ExtensibleString; extensibleNumber: ExtensibleNumber; @@ -55,8 +66,9 @@ model Foo { op post(@body body: Foo): void; @@clientName(ExtensibleString.`-2.0`, "$DO_NOT_NORMALIZE$Item-1.0"); @@clientName(ExtensibleString.`YES_OR_NO2`, "Yes_Or_No2"); -// cannot locate the number enum item and issue here: https://github.com/microsoft/typespec/issues/5081 +// Issue here: https://github.com/microsoft/typespec/issues/5081 // @@clientName(ExtensibleNumber.3, "Enum3"); +@@clientName(Versions.`2024-07-01`, "StableVersion"); ``` This is the tspconfig.yaml. @@ -122,4 +134,11 @@ export enum KnownExtensibleNumber { /** Type of ExtensibleNumber */ export type ExtensibleNumber = number; + +/** Known values of {@link Versions} that the service accepts. */ +export enum KnownVersions { + PreviewVersion = "2024-07-01-preview", + Number20240701 = "2024-07-01", + Number20240801Preview = "2024-08-01-preview" +} ``` From 81d3d75ab2193843109e45df9c2fd09cbd4d8f1a Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 13 Nov 2024 11:34:33 +0800 Subject: [PATCH 40/91] Update the test cases --- .../modularUnit/scenarios/models/serialization/enumKeyNorm.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index 20df9cae30..d59dea4850 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -68,6 +68,7 @@ op post(@body body: Foo): void; @@clientName(ExtensibleString.`YES_OR_NO2`, "Yes_Or_No2"); // Issue here: https://github.com/microsoft/typespec/issues/5081 // @@clientName(ExtensibleNumber.3, "Enum3"); +// TODO: renaming is not working in compiler v0.61 but should be fixed in v0.62 @@clientName(Versions.`2024-07-01`, "StableVersion"); ``` From d2353bcfd65e21606b1f2698c65ba589cc1e3ebe Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 14 Nov 2024 11:41:50 +0800 Subject: [PATCH 41/91] Resolve conflicts --- packages/typespec-ts/src/lib.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/typespec-ts/src/lib.ts b/packages/typespec-ts/src/lib.ts index 26f3f66ef9..5e9b3194a9 100644 --- a/packages/typespec-ts/src/lib.ts +++ b/packages/typespec-ts/src/lib.ts @@ -93,7 +93,7 @@ export const RLCOptionsSchema: JSONSchemaType = { experimentalExtensibleEnums: { type: "boolean", nullable: true }, clearOutputFolder: { type: "boolean", nullable: true }, ignorePropertyNameNormalize: { type: "boolean", nullable: true }, - ignoreEnumMemberNameNormalize: { type: "boolean", nullable: true } + ignoreEnumMemberNameNormalize: { type: "boolean", nullable: true }, compatibilityQueryMultiFormat: { type: "boolean", nullable: true } }, required: [] @@ -270,13 +270,10 @@ const libDef = { default: paramMessage`Path parameter '${"paramName"}' cannot be optional.` } }, - "prefix-adding-in-enum-member": { "un-supported-format-cases": { severity: "warning", messages: { - severity: "warning", - messages: { - default: paramMessage`Enum member name ${"memberName"} is normalized to ${"normalizedName"} with "Number" prefix.` + default: paramMessage`The parameter ${"paramName"} with explode: ${"explode"} and format: ${"format"} is not supported.` } }, "parameter-type-not-supported": { @@ -284,6 +281,12 @@ const libDef = { messages: { default: paramMessage`Parameter '${"paramName"}' with type '${"paramType"}' is not supported and we would ignore this parameter.` } + }, + "prefix-adding-in-enum-member": { + severity: "warning", + messages: { + default: paramMessage`Enum member name ${"memberName"} is normalized to ${"normalizedName"} with "Number" prefix.` + } } }, emitter: { From 64495b7c81c25e134f3336d6646c9e27278ae865 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 14 Nov 2024 12:56:58 +0800 Subject: [PATCH 42/91] Update UTs --- .../modularUnit/scenarios/models/serialization/enumKeyNorm.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index d59dea4850..fa2cbaf0b6 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -68,7 +68,6 @@ op post(@body body: Foo): void; @@clientName(ExtensibleString.`YES_OR_NO2`, "Yes_Or_No2"); // Issue here: https://github.com/microsoft/typespec/issues/5081 // @@clientName(ExtensibleNumber.3, "Enum3"); -// TODO: renaming is not working in compiler v0.61 but should be fixed in v0.62 @@clientName(Versions.`2024-07-01`, "StableVersion"); ``` @@ -139,7 +138,7 @@ export type ExtensibleNumber = number; /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { PreviewVersion = "2024-07-01-preview", - Number20240701 = "2024-07-01", + StableVersion = "2024-07-01", Number20240801Preview = "2024-08-01-preview" } ``` From 5d49852138ffb285b1316294550132f7955b172b Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:21:08 +0800 Subject: [PATCH 43/91] fix ci --- .../test/integration/generated/encode/bytes/src/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts index c398efe7dc..bb2d91ed28 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts @@ -223,10 +223,10 @@ export declare interface QueryBase64UrlArrayQueryParam { } export declare interface QueryBase64UrlArrayQueryParamProperties { - value: string[] | QueryBase64urlArrayValueQueryParam; + value: string[] | QueryBase64UrlArrayValueQueryParam; } -export declare interface QueryBase64urlArrayValueQueryParam { +export declare interface QueryBase64UrlArrayValueQueryParam { value: string[]; explode: false; style: "form"; From c064ec5c7e0faa48d20937b4e653936f734dfb70 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 19 Nov 2024 18:02:49 +0800 Subject: [PATCH 44/91] Improve the normalization algo for number and upper cases --- .../rlc-common/src/buildClientDefinitions.ts | 8 +- .../rlc-common/src/buildMethodShortcuts.ts | 8 +- packages/rlc-common/src/buildObjectTypes.ts | 18 +- .../src/helpers/nameConstructors.ts | 3 +- packages/rlc-common/src/helpers/nameUtils.ts | 99 ++++++---- .../rlc-common/test/helpers/nameUtils.spec.ts | 169 ++++++++++++------ .../typespec-ts/src/modular/buildCodeModel.ts | 6 +- .../typespec-ts/src/modular/emitModels.ts | 8 +- .../src/modular/helpers/clientHelpers.ts | 2 +- .../src/modular/helpers/namingHelpers.ts | 2 +- .../typespec-ts/src/transform/transform.ts | 4 +- packages/typespec-ts/src/utils/modelUtils.ts | 6 +- .../typespec-ts/src/utils/operationUtil.ts | 5 +- 13 files changed, 203 insertions(+), 135 deletions(-) diff --git a/packages/rlc-common/src/buildClientDefinitions.ts b/packages/rlc-common/src/buildClientDefinitions.ts index 17f0db9433..39412f46ad 100644 --- a/packages/rlc-common/src/buildClientDefinitions.ts +++ b/packages/rlc-common/src/buildClientDefinitions.ts @@ -245,9 +245,11 @@ function getShortcutName(interfaceName: string) { const clientProperty = normalizeName( interfaceName.substring(0, endIndex), NameType.OperationGroup, - true, - REST_CLIENT_RESERVED, - CasingConvention.Camel + { + shouldGuard: true, + casingOverride: CasingConvention.Camel, + customReservedNames: REST_CLIENT_RESERVED + } ); return { diff --git a/packages/rlc-common/src/buildMethodShortcuts.ts b/packages/rlc-common/src/buildMethodShortcuts.ts index 833a2b2965..087f068187 100644 --- a/packages/rlc-common/src/buildMethodShortcuts.ts +++ b/packages/rlc-common/src/buildMethodShortcuts.ts @@ -27,9 +27,11 @@ export function buildMethodShortcutImplementation(paths: Paths) { const groupName = normalizeName( paths[path].operationGroupName, NameType.OperationGroup, - true, - REST_CLIENT_RESERVED, - CasingConvention.Camel + { + shouldGuard: true, + casingOverride: CasingConvention.Camel, + customReservedNames: REST_CLIENT_RESERVED + } ); if (keys[groupName]) { diff --git a/packages/rlc-common/src/buildObjectTypes.ts b/packages/rlc-common/src/buildObjectTypes.ts index bdfc591b1a..7b08276a35 100644 --- a/packages/rlc-common/src/buildObjectTypes.ts +++ b/packages/rlc-common/src/buildObjectTypes.ts @@ -226,11 +226,7 @@ function getObjectBaseName( schemaUsage: SchemaContext[] ) { const nameSuffix = schemaUsage.includes(SchemaContext.Output) ? "Output" : ""; - const name = normalizeName( - objectSchema.name, - NameType.Interface, - true /** guard name */ - ); + const name = normalizeName(objectSchema.name, NameType.Interface); return `${name}${nameSuffix}`; } @@ -259,11 +255,7 @@ function getPolymorphicTypeAlias( const nameSuffix = schemaUsage.includes(SchemaContext.Output) ? "Output" : ""; - const name = normalizeName( - child.name, - NameType.Interface, - true /** shouldGuard */ - ); + const name = normalizeName(child.name, NameType.Interface); unionTypes.push(`${name}${nameSuffix}`); } @@ -516,11 +508,7 @@ export function getImmediateParentsNames( ? parent.outputTypeName : parent.typeName) ?? parent.name }` - : `${normalizeName( - parent.name, - NameType.Interface, - true /** shouldGuard */ - )}${nameSuffix}`; + : `${normalizeName(parent.name, NameType.Interface)}${nameSuffix}`; return isObjectSchema(parent) && isPolymorphicParent(parent) ? `${name}Parent` diff --git a/packages/rlc-common/src/helpers/nameConstructors.ts b/packages/rlc-common/src/helpers/nameConstructors.ts index 08e0f9e66d..2ed7f1516f 100644 --- a/packages/rlc-common/src/helpers/nameConstructors.ts +++ b/packages/rlc-common/src/helpers/nameConstructors.ts @@ -57,8 +57,7 @@ export function getResponseBaseName( return normalizeName( `${operationGroup}_${normalizeName( operationName, - NameType.Operation, - true + NameType.Operation )}_${statusCode}`, NameType.Interface ); diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 420680f4e4..41ee7d97e5 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -1,6 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +export interface NormalizeNameOption { + shouldGuard?: boolean; + customReservedNames?: ReservedName[]; + casingOverride?: CasingConvention; + numberPrefixOverride?: string; +} + export interface ReservedName { name: string; reservedFor: NameType[]; @@ -132,60 +139,54 @@ function getSuffix(nameType?: NameType) { } } -function isNumericLiteralName(name: string) { - return (+name).toString() === name; -} - export function normalizeName( name: string, nameType: NameType, - shouldGuard?: boolean, - customReservedNames: ReservedName[] = [], - casingOverride?: CasingConvention + options: NormalizeNameOption = { + shouldGuard: true, + customReservedNames: [], + casingOverride: undefined, + numberPrefixOverride: "Num" + } ): string { + const { shouldGuard, customReservedNames, casingOverride } = options; if (name.startsWith("$DO_NOT_NORMALIZE$")) { return name.replace("$DO_NOT_NORMALIZE$", ""); } const casingConvention = casingOverride ?? getCasingConvention(nameType); - if (isNumericLiteralName(name)) { - return normalizeNumericLiteralName(name, nameType); - } const parts = deconstruct(name); if (parts.length === 0) { return name; } const [firstPart, ...otherParts] = parts; - const normalizedFirstPart = toCasing(firstPart, casingConvention); + const normalizedFirstPart = toCasing(firstPart, casingConvention, true); const normalizedParts = (otherParts || []) .map((part) => toCasing(part, CasingConvention.Pascal)) .join(""); - const normalized = checkBeginning(`${normalizedFirstPart}${normalizedParts}`); + const normalized = `${normalizedFirstPart}${normalizedParts}`; const result = shouldGuard ? guardReservedNames(normalized, nameType, customReservedNames) : normalized; - return handleNumberStart(result, nameType); -} - -function handleNumberStart(name: string, nameType: NameType): string { - if (!name.match(/^\d/)) { - return name; - } - if (nameType === NameType.EnumMemberName) { - return `Number${name}`; - } else { - return name; - } + return escapeNumericLiteral(result, nameType, options); } -export function normalizeNumericLiteralName( +export function escapeNumericLiteral( name: string, - nameType: NameType + nameType: NameType, + options: NormalizeNameOption = { + shouldGuard: true, + customReservedNames: [], + casingOverride: undefined, + numberPrefixOverride: "Num" + } ): string { - if (isNumericLiteralName(name) && nameType === NameType.EnumMemberName) { - return `Number${name}`; + const casingConvention = + options.casingOverride ?? getCasingConvention(nameType); + if (!name.match(/^[\-\.]?\d/)) { + return name; } - return name; + return `${toCasing(options.numberPrefixOverride!, casingConvention)}${name}`; } function isFullyUpperCase( @@ -219,16 +220,28 @@ function deconstruct(identifier: string): Array { .replace(/\b([_-]*)([A-Z]+)([A-Z])([a-z]+)/g, "$1$2 $3$4") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) .replace(/«/g, "s") .trim() - .split(/[\W|_]+/) - .map((each) => (isFullyUpperCase(each) ? each : each.toLowerCase())); - return parts.filter((part) => part.trim().length > 0); + .split(/[^A-Za-z0-9\_\-.]+/); + // Split by non-alphanumeric characters and try to keep _-. between numbers + const refinedParts: string[] = []; + for (let i = 0; i < parts.length; i++) { + const part = parts[i]; + const isPrevNumber = isNumber(parts[i - 1]); + const isNextNumber = isNumber(parts[i + 1]); + if ((isPrevNumber || isNextNumber) && ["_", "-", "."].includes(part)) { + refinedParts.push(part); + } else { + refinedParts.push( + ...parts[i] + .split(/[\W|_]+/) + .map((each) => (isFullyUpperCase(each) ? each : each.toLowerCase())) + ); + } + } + return refinedParts.filter((part) => part.trim().length > 0); } -function checkBeginning(name: string): string { - if (name.startsWith("@")) { - return name.substring(1); - } - return name; +function isNumber(value?: string) { + return value && value.match(/^\d+$/); } export function getModelsName(title: string): string { @@ -262,12 +275,20 @@ function getCasingConvention(nameType: NameType) { * results in TEST -> test or Test (depending on the CasingConvention). We should switch to relay * on Modeler four namer for this once it is stable */ -function toCasing(str: string, casing: CasingConvention): string { +function toCasing( + str: string, + casing: CasingConvention, + keepConsistent = false +): string { const firstChar = casing === CasingConvention.Pascal ? str.charAt(0).toUpperCase() : str.charAt(0).toLowerCase(); - return `${firstChar}${str.substring(1)}`; + const allLowerCases = + casing !== CasingConvention.Pascal && + keepConsistent && + str.toUpperCase() === str; + return allLowerCases ? str.toLowerCase() : `${firstChar}${str.substring(1)}`; } export function pascalCase(str: string) { diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 7702495573..11f6984bb6 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -4,84 +4,147 @@ import { NameType, normalizeName } from "../../src/helpers/nameUtils.js"; describe("#normalizeName", () => { describe("for enum member name", () => { - it("should normalize the name with pascal case", () => { - expect(normalizeName("OAuthTokensGetOAuthConnectionLinkMediaTypesParam", NameType.EnumMemberName, true)).to.equal("OAuthTokensGetOAuthConnectionLinkMediaTypesParam"); - expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName, true)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); - expect(normalizeName("$DO_NOT_NORMALIZE$VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("VALIDATION_NOT_REQUIRED"); - expect(normalizeName("_10Min", NameType.EnumMemberName, true)).to.equal("Number10Min"); - expect(normalizeName("090", NameType.EnumMemberName, true)).to.equal("Number090"); - expect(normalizeName("10", NameType.EnumMemberName, true)).to.equal("Number10"); + it("should normalize any chars including digits properly", () => { + expect(normalizeName("-10Min", NameType.EnumMemberName)).to.equal("Num-10Min"); + expect(normalizeName("090", NameType.EnumMemberName)).to.equal("Num090"); + expect(normalizeName("10", NameType.EnumMemberName)).to.equal("Num10"); // pls note `1` is a numeric literal number but `1.0` is not - expect(normalizeName("1", NameType.EnumMemberName, true)).to.equal("Number1"); - expect(normalizeName("1.0", NameType.EnumMemberName, true)).to.equal("Number10"); - expect(normalizeName("$DO_NOT_NORMALIZE$Number1.0", NameType.EnumMemberName, true)).to.equal("Number1.0"); - expect(normalizeName("1.1", NameType.EnumMemberName, true)).to.equal("Number1.1"); - expect(normalizeName("-1.1", NameType.EnumMemberName, true)).to.equal("Number-1.1"); - expect(normalizeName("BasicGetNull", NameType.EnumMemberName, true)).to.equal("BasicGetNull"); - expect(normalizeName("size256x256", NameType.EnumMemberName, true)).to.equal("Size256X256"); - expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName, true)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); - expect(normalizeName("PagingGetNullNextLinkNamePagesParameters", NameType.EnumMemberName, true)).to.equal("PagingGetNullNextLinkNamePagesParameters"); - expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName, true)).to.equal("AKVCertURI"); - expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName, true)).to.equal("AzureOpenAIOperationStateOutput"); - expect(normalizeName("TSModel", NameType.EnumMemberName, true)).to.equal("TSModel"); - expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName, true)).to.equal("ValidationNOTRequired"); - expect(normalizeName("ValidationNotRequired", NameType.EnumMemberName, true)).to.equal("ValidationNotRequired"); - expect(normalizeName("KnownPFTestResult", NameType.EnumMemberName, true)).to.equal("KnownPFTestResult"); - expect(normalizeName("repeatabilityRequestID", NameType.EnumMemberName, true)).to.equal("RepeatabilityRequestID"); - expect(normalizeName("C", NameType.EnumMemberName, true)).to.equal("C"); - expect(normalizeName("splitAllCSVs", NameType.EnumMemberName, true)).to.equal("SplitAllCSVs"); - expect(normalizeName("publicIPDisabled", NameType.EnumMemberName, true)).to.equal("PublicIPDisabled"); + expect(normalizeName("1", NameType.EnumMemberName)).to.equal("Num1"); + expect(normalizeName("1.0", NameType.EnumMemberName)).to.equal("Num1.0"); + expect(normalizeName(".5", NameType.EnumMemberName)).to.equal("Num.5"); + expect(normalizeName(".0", NameType.EnumMemberName)).to.equal("Num.0"); + expect(normalizeName("$DO_NOT_NORMALIZE$Number1.0", NameType.EnumMemberName)).to.equal("Number1.0"); + expect(normalizeName("1.1", NameType.EnumMemberName)).to.equal("Num1.1"); + expect(normalizeName("-1.1", NameType.EnumMemberName)).to.equal("Num-1.1"); + expect(normalizeName("v2023_11_15", NameType.EnumMemberName)).to.equal("V2023_11_15"); + expect(normalizeName("2024-07-01-preview", NameType.EnumMemberName)).to.equal("Num2024-07-01Preview"); + expect(normalizeName("v1_1", NameType.EnumMemberName, { + numberPrefixOverride: "V" + })).to.equal("V1_1"); + expect(normalizeName("v20231001Preview", NameType.EnumMemberName)).to.equal("V20231001Preview"); + expect(normalizeName("2022-08-30", NameType.EnumMemberName, { + numberPrefixOverride: "V" + })).to.equal("V2022-08-30"); + }); + it("should keep whole upper case or convert to lower ones", () => { + expect(normalizeName("SAS", NameType.EnumMemberName)).to.equal("SAS"); + expect(normalizeName("SAS_AUTHENTICATION_IP", NameType.EnumMemberName)).to.equal("SASAuthenticationIP"); + }); + it("should normalize the name", () => { + expect(normalizeName("OAuthTokensGetOAuthConnectionLinkMediaTypesParam", NameType.EnumMemberName)).to.equal("OAuthTokensGetOAuthConnectionLinkMediaTypesParam"); + expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); + expect(normalizeName("$DO_NOT_NORMALIZE$VALIDATION_NOT_REQUIRED", NameType.EnumMemberName)).to.equal("VALIDATION_NOT_REQUIRED"); + expect(normalizeName("BasicGetNull", NameType.EnumMemberName)).to.equal("BasicGetNull"); + expect(normalizeName("size256x256", NameType.EnumMemberName)).to.equal("Size256X256"); + expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.EnumMemberName)).to.equal("LRORetrysPut201CreatingSucceeded200BodyParam"); + expect(normalizeName("PagingGetNullNextLinkNamePagesParameters", NameType.EnumMemberName)).to.equal("PagingGetNullNextLinkNamePagesParameters"); + expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName)).to.equal("AKVCertURI"); + expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName)).to.equal("AzureOpenAIOperationStateOutput"); + expect(normalizeName("TSModel", NameType.EnumMemberName)).to.equal("TSModel"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName)).to.equal("ValidationNOTRequired"); + expect(normalizeName("ValidationNotRequired", NameType.EnumMemberName)).to.equal("ValidationNotRequired"); + expect(normalizeName("KnownPFTestResult", NameType.EnumMemberName)).to.equal("KnownPFTestResult"); + expect(normalizeName("repeatabilityRequestID", NameType.EnumMemberName)).to.equal("RepeatabilityRequestID"); + expect(normalizeName("C", NameType.EnumMemberName)).to.equal("C"); + expect(normalizeName("splitAllCSVs", NameType.EnumMemberName)).to.equal("SplitAllCSVs"); + expect(normalizeName("publicIPDisabled", NameType.EnumMemberName)).to.equal("PublicIPDisabled"); }); }); describe("for property", () => { it("should remove $ char", () => { - expect(normalizeName("$select", NameType.Parameter, true)).to.equal( + expect(normalizeName("$select", NameType.Property)).to.equal( "select" ); - expect(normalizeName("hate/threatening", NameType.Parameter, true)).to.equal( + expect(normalizeName("hate/threatening", NameType.Property)).to.equal( "hateThreatening" ); }); + it("should keep whole upper case or convert to lower ones", () => { + expect(normalizeName("SAS", NameType.Property)).to.equal("sas"); + expect(normalizeName("SAS_AUTHENTICATION_IP", NameType.Property)).to.equal("sasAuthenticationIP"); + }); + it("should normalize number properly", () => { + expect(normalizeName("-10Min", NameType.Property)).to.equal("num-10Min"); + expect(normalizeName("090", NameType.Property)).to.equal("num090"); + expect(normalizeName("10", NameType.Property)).to.equal("num10"); + // pls note `1` is a numeric literal number but `1.0` is not + expect(normalizeName("1", NameType.Property)).to.equal("num1"); + expect(normalizeName("1.0", NameType.Property)).to.equal("num1.0"); + expect(normalizeName(".5", NameType.Property)).to.equal("num.5"); + expect(normalizeName(".0", NameType.Property)).to.equal("num.0"); + expect(normalizeName("$DO_NOT_NORMALIZE$Number1.0", NameType.Property)).to.equal("Number1.0"); + expect(normalizeName("1.1", NameType.Property)).to.equal("num1.1"); + expect(normalizeName("-1.1", NameType.Property)).to.equal("num-1.1"); + expect(normalizeName("v2023_11_15", NameType.Property)).to.equal("v2023_11_15"); + expect(normalizeName("2024-07-01-preview", NameType.Property)).to.equal("num2024-07-01Preview"); + expect(normalizeName("v1_1", NameType.Property, { + numberPrefixOverride: "V" + })).to.equal("v1_1"); + expect(normalizeName("v20231001Preview", NameType.Property)).to.equal("v20231001Preview"); + expect(normalizeName("2022-08-30", NameType.Property, { + numberPrefixOverride: "V" + })).to.equal("v2022-08-30"); + }); + it("should normalize the name", () => { + expect(normalizeName("OAuthTokensGetOAuthConnectionLinkMediaTypesParam", NameType.Property)).to.equal("oAuthTokensGetOAuthConnectionLinkMediaTypesParam"); + expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.Property)).to.equal("lroRetrysPut201CreatingSucceeded200BodyParam"); + expect(normalizeName("$DO_NOT_NORMALIZE$VALIDATION_NOT_REQUIRED", NameType.Property)).to.equal("VALIDATION_NOT_REQUIRED"); + expect(normalizeName("BasicGetNull", NameType.Property)).to.equal("basicGetNull"); + expect(normalizeName("size256x256", NameType.Property)).to.equal("size256X256"); + expect(normalizeName("LRORetrysPut201CreatingSucceeded200BodyParam", NameType.Property)).to.equal("lroRetrysPut201CreatingSucceeded200BodyParam"); + expect(normalizeName("PagingGetNullNextLinkNamePagesParameters", NameType.Property)).to.equal("pagingGetNullNextLinkNamePagesParameters"); + expect(normalizeName("AKV_cert_URI", NameType.Property)).to.equal("akvCertURI"); + expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.Property)).to.equal("azureOpenAIOperationStateOutput"); + expect(normalizeName("TSModel", NameType.Property)).to.equal("tsModel"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.Property)).to.equal("validationNOTRequired"); + expect(normalizeName("ValidationNotRequired", NameType.Property)).to.equal("validationNotRequired"); + expect(normalizeName("KnownPFTestResult", NameType.Property)).to.equal("knownPFTestResult"); + expect(normalizeName("repeatabilityRequestID", NameType.Property)).to.equal("repeatabilityRequestID"); + expect(normalizeName("C", NameType.Property)).to.equal("c"); + expect(normalizeName("splitAllCSVs", NameType.Property)).to.equal("splitAllCSVs"); + expect(normalizeName("publicIPDisabled", NameType.Property)).to.equal("publicIPDisabled"); + }); }); describe("for parameter", () => { it("should return the name with the suffix 'Param' if the name is a reserved name", () => { - expect(normalizeName("static", NameType.Parameter, true)).to.equal( + expect(normalizeName("static", NameType.Parameter)).to.equal( "staticParam" ); - expect(normalizeName("any", NameType.Parameter, true)).to.equal( + expect(normalizeName("any", NameType.Parameter)).to.equal( "anyParam" ); + expect(normalizeName("SAS", NameType.Parameter)).to.equal("sas"); }); - it("should normalize the name with camel case", () => { - expect(normalizeName("NodeVMExtension", NameType.Parameter, true)).to.equal("nodeVMExtension"); - expect(normalizeName("TSModel", NameType.Property, true)).to.equal("tSModel"); - expect(normalizeName("Base64urlArrayBytesProperty", NameType.Property, true)).to.equal("base64UrlArrayBytesProperty"); - expect(normalizeName("ISO8601DurationProperty", NameType.Property, true)).to.equal("iSO8601DurationProperty"); - expect(normalizeName("C", NameType.Parameter, true)).to.equal("c"); - expect(normalizeName("pascalCase", NameType.Parameter, true)).to.equal( + it("should normalize the name", () => { + expect(normalizeName("NodeVMExtension", NameType.Parameter)).to.equal("nodeVMExtension"); + expect(normalizeName("TSModel", NameType.Parameter)).to.equal("tsModel"); + expect(normalizeName("Base64urlArrayBytesProperty", NameType.Parameter)).to.equal("base64UrlArrayBytesProperty"); + expect(normalizeName("ISO8601DurationProperty", NameType.Parameter,)).to.equal("iso8601DurationProperty"); + expect(normalizeName("C", NameType.Parameter,)).to.equal("c"); + expect(normalizeName("pascalCase", NameType.Parameter,)).to.equal( "pascalCase" ); - expect(normalizeName("PascalCase", NameType.Parameter, true)).to.equal( + expect(normalizeName("PascalCase", NameType.Parameter,)).to.equal( "pascalCase" ); - expect(normalizeName("pascal_case_", NameType.Parameter, true)).to.equal( + expect(normalizeName("pascal_case_", NameType.Parameter,)).to.equal( "pascalCase" ); - expect(normalizeName("_pascal_case", NameType.Parameter, true)).to.equal( + expect(normalizeName("_pascal_case", NameType.Parameter,)).to.equal( "pascalCase" ); - expect(normalizeName("pascal, case", NameType.Parameter, true)).to.equal( + expect(normalizeName("pascal, case", NameType.Parameter,)).to.equal( "pascalCase" ); - expect(normalizeName("MAX_of_MLD", NameType.Parameter, true)).to.equal( - "mAXOfMLD" + expect(normalizeName("MAX_of_MLD", NameType.Parameter,)).to.equal( + "maxOfMLD" ); - expect(normalizeName("___pascal____case6666", NameType.Parameter, true)).to.equal( + expect(normalizeName("___pascal____case6666", NameType.Parameter,)).to.equal( "pascalCase6666" ); - expect(normalizeName("_10Pascal", NameType.Parameter, true)).to.equal( - "10Pascal" + expect(normalizeName("_10Pascal", NameType.Parameter,)).to.equal( + "_10Pascal" ); }); @@ -89,28 +152,28 @@ describe("#normalizeName", () => { describe("for operation", () => { it("should return the name with the suffix 'Operation' if the name is a reserved name", () => { - expect(normalizeName("export", NameType.Operation, true)).to.equal( + expect(normalizeName("export", NameType.Operation,)).to.equal( "export" ); }); - it("should normalize the name with camel case", () => { + it("should normalize the name", () => { expect( - normalizeName("create_ wideget", NameType.Parameter, true) + normalizeName("create_ wideget", NameType.Parameter,) ).to.equal("createWideget"); }); }); describe("for operation group", () => { - it("should normalize the name with pasel case", () => { + it("should normalize the name", () => { expect( - normalizeName("LoadTest_Administration ", NameType.OperationGroup, true) + normalizeName("LoadTest_Administration ", NameType.OperationGroup,) ).to.equal("LoadTestAdministration"); expect( - normalizeName("LRORetrysPostAsyncRelativeRetrySucceeded", NameType.OperationGroup, true) + normalizeName("LRORetrysPostAsyncRelativeRetrySucceeded", NameType.OperationGroup,) ).to.equal("LRORetrysPostAsyncRelativeRetrySucceeded"); expect( - normalizeName("_LRORetrysPostAsyncRelativeRetrySucceeded", NameType.OperationGroup, true) + normalizeName("_LRORetrysPostAsyncRelativeRetrySucceeded", NameType.OperationGroup,) ).to.equal("LRORetrysPostAsyncRelativeRetrySucceeded"); }); }); diff --git a/packages/typespec-ts/src/modular/buildCodeModel.ts b/packages/typespec-ts/src/modular/buildCodeModel.ts index c8eb6ff068..9eabd13613 100644 --- a/packages/typespec-ts/src/modular/buildCodeModel.ts +++ b/packages/typespec-ts/src/modular/buildCodeModel.ts @@ -442,8 +442,7 @@ function emitParamBase( optional = parameter.optional; name = normalizeName( getLibraryName(context, parameter), - NameType.Parameter, - true + NameType.Parameter ); restApiName = getWireName(context, parameter); description = getDocStr(program, parameter); @@ -1081,8 +1080,7 @@ export function emitModel( : undefined; const overridedModelName = normalizeName( getLibraryName(context, type) ?? getFriendlyName(context.program, type), - NameType.Interface, - true + NameType.Interface ); const fullNamespaceName = getModelNamespaceName(context, type.namespace!) diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 75a69d5e40..13ce8ec451 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -11,7 +11,7 @@ import { import { NameType, normalizeName, - normalizeNumericLiteralName + escapeNumericLiteral } from "@azure-tools/rlc-common"; import { SdkArrayType, @@ -341,8 +341,8 @@ function emitEnumMember( member: SdkEnumValueType ): EnumMemberStructure { const normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize - ? normalizeNumericLiteralName(member.name, NameType.EnumMemberName) // need to normalize number also for enum member - : normalizeName(member.name, NameType.EnumMemberName, true); + ? escapeNumericLiteral(member.name, NameType.EnumMemberName) // need to normalize number also for enum member + : normalizeName(member.name, NameType.EnumMemberName); if ( normalizedMemberName.toLowerCase().startsWith("number") && !member.name.toLowerCase().startsWith("number") @@ -488,7 +488,7 @@ export function normalizeModelName( if (type.isGeneratedName) { internalModelPrefix = "_"; } - return `${internalModelPrefix}${normalizeName(namespacePrefix + type.name + unionSuffix, nameType, true)}`; + return `${internalModelPrefix}${normalizeName(namespacePrefix + type.name + unionSuffix, nameType)}`; } function buildModelPolymorphicType(context: SdkContext, type: SdkModelType) { diff --git a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts index 5b114faf13..5acf37628b 100644 --- a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts @@ -145,7 +145,7 @@ export function getClientParameterName( return "endpointParam"; } - return normalizeName(parameter.name, NameType.Parameter, true); + return normalizeName(parameter.name, NameType.Parameter); } export function buildGetClientEndpointParam( diff --git a/packages/typespec-ts/src/modular/helpers/namingHelpers.ts b/packages/typespec-ts/src/modular/helpers/namingHelpers.ts index e25577ca0c..23b9d09429 100644 --- a/packages/typespec-ts/src/modular/helpers/namingHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/namingHelpers.ts @@ -52,7 +52,7 @@ export function getOperationName( } return { - name: normalizeName(casingFn(operation.name), NameType.Operation, true) + name: normalizeName(casingFn(operation.name), NameType.Operation) }; } diff --git a/packages/typespec-ts/src/transform/transform.ts b/packages/typespec-ts/src/transform/transform.ts index c4ed84d53d..9c0946e8c0 100644 --- a/packages/typespec-ts/src/transform/transform.ts +++ b/packages/typespec-ts/src/transform/transform.ts @@ -150,13 +150,13 @@ export function transformUrlInfo( importedModels.add, importedModels ); - const normName = normalizeName(key, NameType.Parameter, true); + const normName = normalizeName(key, NameType.Parameter); if (normName !== key && endpoint) { endpoint = endpoint.replace(`{${key}}`, `{${normName}}`); } urlParameters.push({ oriName: key, - name: normalizeName(key, NameType.Parameter, true), + name: normalizeName(key, NameType.Parameter), type: getTypeName(schema, usage), description: (getDoc(program, property) && diff --git a/packages/typespec-ts/src/utils/modelUtils.ts b/packages/typespec-ts/src/utils/modelUtils.ts index c902935f96..36596ab583 100644 --- a/packages/typespec-ts/src/utils/modelUtils.ts +++ b/packages/typespec-ts/src/utils/modelUtils.ts @@ -656,11 +656,7 @@ function getSchemaForModel( fromCore: isCoreModel }; // normalized the output name - modelSchema.name = normalizeName( - modelSchema.name, - NameType.Interface, - true /** shouldGuard */ - ); + modelSchema.name = normalizeName(modelSchema.name, NameType.Interface); if (model.name === "Record" && isRecordModelType(program, model)) { return getSchemaForRecordModel(dpgContext, model, { usage }); diff --git a/packages/typespec-ts/src/utils/operationUtil.ts b/packages/typespec-ts/src/utils/operationUtil.ts index 3a6217ee34..47c2f8d4d0 100644 --- a/packages/typespec-ts/src/utils/operationUtil.ts +++ b/packages/typespec-ts/src/utils/operationUtil.ts @@ -148,7 +148,7 @@ export function getOperationGroupName( return namespaceNames .map((name) => { - return normalizeName(name, NameType.Interface, true); + return normalizeName(name, NameType.Interface); }) .join(""); } @@ -158,8 +158,7 @@ export function getOperationName(dpgContext: SdkContext, operation: Operation) { return normalizeName( projectedOperationName ?? operation.name, - NameType.Interface, - true + NameType.Interface ); } From 0d50e1e488d99b40d68388f51bb19c4883b3af9e Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 19 Nov 2024 19:44:56 +0800 Subject: [PATCH 45/91] Revert the change and update the codegen --- .../rlc-common/src/buildClientDefinitions.ts | 12 ++--- .../rlc-common/src/buildMethodShortcuts.ts | 13 ++--- packages/rlc-common/src/buildObjectTypes.ts | 51 +++++++++++-------- .../src/helpers/nameConstructors.ts | 2 +- packages/rlc-common/src/helpers/nameUtils.ts | 50 +++++++++++------- .../rlc-common/test/helpers/nameUtils.spec.ts | 3 ++ .../typespec-ts/src/modular/emitModels.ts | 4 +- .../azure/core/lro/rpc/src/index.d.ts | 2 +- .../azure/core/lro/standard/src/index.d.ts | 2 +- .../generated/azure/core/model/src/index.d.ts | 2 +- .../resource-manager/resources/src/index.d.ts | 2 +- 11 files changed, 83 insertions(+), 60 deletions(-) diff --git a/packages/rlc-common/src/buildClientDefinitions.ts b/packages/rlc-common/src/buildClientDefinitions.ts index 39412f46ad..82711183d8 100644 --- a/packages/rlc-common/src/buildClientDefinitions.ts +++ b/packages/rlc-common/src/buildClientDefinitions.ts @@ -180,8 +180,8 @@ function getPathFirstRoutesInterfaceDefinition( /{/g, "\\{" )}' has methods for the following verbs: ${Object.keys( - paths[key].methods - ).join(", ")}` + paths[key].methods + ).join(", ")}` ], parameters: [ { name: "path", type: `"${key}"` }, @@ -245,11 +245,9 @@ function getShortcutName(interfaceName: string) { const clientProperty = normalizeName( interfaceName.substring(0, endIndex), NameType.OperationGroup, - { - shouldGuard: true, - casingOverride: CasingConvention.Camel, - customReservedNames: REST_CLIENT_RESERVED - } + true, + REST_CLIENT_RESERVED, + CasingConvention.Camel ); return { diff --git a/packages/rlc-common/src/buildMethodShortcuts.ts b/packages/rlc-common/src/buildMethodShortcuts.ts index 087f068187..236538398e 100644 --- a/packages/rlc-common/src/buildMethodShortcuts.ts +++ b/packages/rlc-common/src/buildMethodShortcuts.ts @@ -27,11 +27,9 @@ export function buildMethodShortcutImplementation(paths: Paths) { const groupName = normalizeName( paths[path].operationGroupName, NameType.OperationGroup, - { - shouldGuard: true, - casingOverride: CasingConvention.Camel, - customReservedNames: REST_CLIENT_RESERVED - } + true, + REST_CLIENT_RESERVED, + CasingConvention.Camel ); if (keys[groupName]) { @@ -68,9 +66,8 @@ function generateOperationDeclaration( method: string, pathParams: PathParameter[] = [] ): string { - const pathParamNames = `${ - pathParams.length > 0 ? `${pathParams.map((p) => p.name)},` : "" - }`; + const pathParamNames = `${pathParams.length > 0 ? `${pathParams.map((p) => p.name)},` : "" + }`; return `"${operationName}": (${pathParamNames} options) => { return client.path("${path}", ${pathParamNames}).${method}(options); }`; diff --git a/packages/rlc-common/src/buildObjectTypes.ts b/packages/rlc-common/src/buildObjectTypes.ts index 7b08276a35..f230a92cfc 100644 --- a/packages/rlc-common/src/buildObjectTypes.ts +++ b/packages/rlc-common/src/buildObjectTypes.ts @@ -226,7 +226,11 @@ function getObjectBaseName( schemaUsage: SchemaContext[] ) { const nameSuffix = schemaUsage.includes(SchemaContext.Output) ? "Output" : ""; - const name = normalizeName(objectSchema.name, NameType.Interface); + const name = normalizeName( + objectSchema.name, + NameType.Interface, + true /** guard name */ + ); return `${name}${nameSuffix}`; } @@ -255,7 +259,11 @@ function getPolymorphicTypeAlias( const nameSuffix = schemaUsage.includes(SchemaContext.Output) ? "Output" : ""; - const name = normalizeName(child.name, NameType.Interface); + const name = normalizeName( + child.name, + NameType.Interface, + true /** shouldGuard */ + ); unionTypes.push(`${name}${nameSuffix}`); } @@ -492,23 +500,26 @@ export function getImmediateParentsNames( : ""; const name = isDictionarySchema(parent) ? Object.entries(objectSchema.properties!)?.some((prop) => { - const typeName = prop[1].typeName ?? prop[1].type; - return ( - `Record` !== parent.typeName && - !(parent as any).additionalProperties?.typeName?.includes( - typeName - ) - ); - }) + const typeName = prop[1].typeName ?? prop[1].type; + return ( + `Record` !== parent.typeName && + !(parent as any).additionalProperties?.typeName?.includes( + typeName + ) + ); + }) ? schemaUsage.includes(SchemaContext.Output) ? "Record" : "Record" - : `${ - (schemaUsage.includes(SchemaContext.Output) - ? parent.outputTypeName - : parent.typeName) ?? parent.name - }` - : `${normalizeName(parent.name, NameType.Interface)}${nameSuffix}`; + : `${(schemaUsage.includes(SchemaContext.Output) + ? parent.outputTypeName + : parent.typeName) ?? parent.name + }` + : `${normalizeName( + parent.name, + NameType.Interface, + true /** shouldGuard */ + )}${nameSuffix}`; return isObjectSchema(parent) && isPolymorphicParent(parent) ? `${name}Parent` @@ -546,8 +557,8 @@ function getPropertySignatures( function isBinaryArray(schema: Schema): boolean { return Boolean( isArraySchema(schema) && - (schema.items?.typeName?.includes("NodeJS.ReadableStream") || - schema.items?.outputTypeName?.includes("NodeJS.ReadableStream")) + (schema.items?.typeName?.includes("NodeJS.ReadableStream") || + schema.items?.outputTypeName?.includes("NodeJS.ReadableStream")) ); } @@ -593,7 +604,7 @@ export function getPropertySignature( type = schema.typeName; importedModels.add( (schema as any).additionalProperties.typeName ?? - (schema as any).additionalProperties.name + (schema as any).additionalProperties.name ); } else { type = @@ -628,4 +639,4 @@ function generateForOutput( (schemaUsage.includes(SchemaContext.Exception) && propertyUsage?.includes(SchemaContext.Exception)) ); -} +} \ No newline at end of file diff --git a/packages/rlc-common/src/helpers/nameConstructors.ts b/packages/rlc-common/src/helpers/nameConstructors.ts index 2ed7f1516f..90d3841556 100644 --- a/packages/rlc-common/src/helpers/nameConstructors.ts +++ b/packages/rlc-common/src/helpers/nameConstructors.ts @@ -58,7 +58,7 @@ export function getResponseBaseName( `${operationGroup}_${normalizeName( operationName, NameType.Operation - )}_${statusCode}`, + )} ${statusCode}`, // since status code is a number, we use space to separate it from operationName NameType.Interface ); } diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 41ee7d97e5..9f3ed9acdf 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -142,14 +142,32 @@ function getSuffix(nameType?: NameType) { export function normalizeName( name: string, nameType: NameType, - options: NormalizeNameOption = { - shouldGuard: true, - customReservedNames: [], - casingOverride: undefined, - numberPrefixOverride: "Num" - } + shouldGuard?: boolean, + customReservedNames?: ReservedName[], + casingOverride?: CasingConvention): string; +export function normalizeName( + name: string, + nameType: NameType, + options?: NormalizeNameOption +): string; +export function normalizeName( + name: string, + nameType: NameType, + optionsOrShouldGuard?: NormalizeNameOption | boolean, + optionalCustomReservedNames?: ReservedName[], + optionalCasingOverride?: CasingConvention ): string { - const { shouldGuard, customReservedNames, casingOverride } = options; + let shouldGuard: boolean | undefined, customReservedNames: ReservedName[], casingOverride: CasingConvention | undefined, numberPrefixOverride: string | undefined; + if (typeof optionsOrShouldGuard === "boolean") { + shouldGuard = optionsOrShouldGuard; + customReservedNames = optionalCustomReservedNames ?? []; + casingOverride = optionalCasingOverride; + } else { + shouldGuard = optionsOrShouldGuard?.shouldGuard; + customReservedNames = optionsOrShouldGuard?.customReservedNames ?? []; + casingOverride = optionsOrShouldGuard?.casingOverride; + numberPrefixOverride = optionsOrShouldGuard?.numberPrefixOverride; + } if (name.startsWith("$DO_NOT_NORMALIZE$")) { return name.replace("$DO_NOT_NORMALIZE$", ""); } @@ -168,25 +186,19 @@ export function normalizeName( const result = shouldGuard ? guardReservedNames(normalized, nameType, customReservedNames) : normalized; - return escapeNumericLiteral(result, nameType, options); + return escapeNumericLiteralStart(result, nameType, numberPrefixOverride); } -export function escapeNumericLiteral( +export function escapeNumericLiteralStart( name: string, nameType: NameType, - options: NormalizeNameOption = { - shouldGuard: true, - customReservedNames: [], - casingOverride: undefined, - numberPrefixOverride: "Num" - } + prefix: string = "Num" ): string { - const casingConvention = - options.casingOverride ?? getCasingConvention(nameType); - if (!name.match(/^[\-\.]?\d/)) { + const casingConvention = getCasingConvention(nameType); + if (!name || !name.match(/^[\-\.]?\d/)) { return name; } - return `${toCasing(options.numberPrefixOverride!, casingConvention)}${name}`; + return `${toCasing(prefix, casingConvention)}${name}`; } function isFullyUpperCase( diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 11f6984bb6..f4e33cc168 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -6,6 +6,9 @@ describe("#normalizeName", () => { describe("for enum member name", () => { it("should normalize any chars including digits properly", () => { expect(normalizeName("-10Min", NameType.EnumMemberName)).to.equal("Num-10Min"); + expect(normalizeName("LROsPut202Retry200_202Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200_202Response"); + expect(normalizeName("LROsPut202Retry200_Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200Response"); + expect(normalizeName("LROsPut202Retry200 202Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200202Response"); expect(normalizeName("090", NameType.EnumMemberName)).to.equal("Num090"); expect(normalizeName("10", NameType.EnumMemberName)).to.equal("Num10"); // pls note `1` is a numeric literal number but `1.0` is not diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 13ce8ec451..68ac832359 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -342,7 +342,9 @@ function emitEnumMember( ): EnumMemberStructure { const normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize ? escapeNumericLiteral(member.name, NameType.EnumMemberName) // need to normalize number also for enum member - : normalizeName(member.name, NameType.EnumMemberName); + : normalizeName(member.name, NameType.EnumMemberName, { + numberPrefixOverride: member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : undefined + }); if ( normalizedMemberName.toLowerCase().startsWith("number") && !member.name.toLowerCase().startsWith("number") diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts index 8264ff1f57..de53fe4494 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts @@ -15,7 +15,7 @@ export declare interface GenerationResult { } export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare interface LongRunningRpcOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts index 21a8ae11e8..5e0c2b3079 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts @@ -24,7 +24,7 @@ export declare interface ExportOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare function restorePoller(client: StandardClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts index 4e52d4d646..66f814d423 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts @@ -10,7 +10,7 @@ export declare interface GetOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare class ModelClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts index 31b4998ba7..6ec45ffbe1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts @@ -47,7 +47,7 @@ export declare enum KnownProvisioningState { } export declare enum KnownVersions { - V20231201Preview = "2023-12-01-preview" + V2023_12_01Preview = "2023-12-01-preview" } export declare interface NestedCreateOrReplaceOptionalParams extends OperationOptions { From b9874d39c3612d796eefba3aa1a538d88f31743a Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 19 Nov 2024 19:46:21 +0800 Subject: [PATCH 46/91] Update the format --- .../rlc-common/src/buildClientDefinitions.ts | 4 +- .../rlc-common/src/buildMethodShortcuts.ts | 5 ++- packages/rlc-common/src/buildObjectTypes.ts | 41 ++++++++++--------- packages/rlc-common/src/helpers/nameUtils.ts | 8 +++- .../typespec-ts/src/modular/emitModels.ts | 5 ++- .../generated/azure/core/basic/src/index.d.ts | 2 +- .../azure/core/scalar/src/index.d.ts | 2 +- .../azure/core/traits/src/index.d.ts | 2 +- .../generated/client/naming/src/index.d.ts | 2 +- .../server/versions/versioned/src/index.d.ts | 4 +- .../type/enum/extensible/src/index.d.ts | 20 ++++----- .../generated/type/enum/fixed/src/index.d.ts | 16 ++++---- .../type/property/nullable/src/index.d.ts | 20 ++++----- .../type/property/optionality/src/index.d.ts | 32 +++++++-------- .../generated/type/scalar/src/index.d.ts | 8 ++-- 15 files changed, 89 insertions(+), 82 deletions(-) diff --git a/packages/rlc-common/src/buildClientDefinitions.ts b/packages/rlc-common/src/buildClientDefinitions.ts index 82711183d8..17f0db9433 100644 --- a/packages/rlc-common/src/buildClientDefinitions.ts +++ b/packages/rlc-common/src/buildClientDefinitions.ts @@ -180,8 +180,8 @@ function getPathFirstRoutesInterfaceDefinition( /{/g, "\\{" )}' has methods for the following verbs: ${Object.keys( - paths[key].methods - ).join(", ")}` + paths[key].methods + ).join(", ")}` ], parameters: [ { name: "path", type: `"${key}"` }, diff --git a/packages/rlc-common/src/buildMethodShortcuts.ts b/packages/rlc-common/src/buildMethodShortcuts.ts index 236538398e..833a2b2965 100644 --- a/packages/rlc-common/src/buildMethodShortcuts.ts +++ b/packages/rlc-common/src/buildMethodShortcuts.ts @@ -66,8 +66,9 @@ function generateOperationDeclaration( method: string, pathParams: PathParameter[] = [] ): string { - const pathParamNames = `${pathParams.length > 0 ? `${pathParams.map((p) => p.name)},` : "" - }`; + const pathParamNames = `${ + pathParams.length > 0 ? `${pathParams.map((p) => p.name)},` : "" + }`; return `"${operationName}": (${pathParamNames} options) => { return client.path("${path}", ${pathParamNames}).${method}(options); }`; diff --git a/packages/rlc-common/src/buildObjectTypes.ts b/packages/rlc-common/src/buildObjectTypes.ts index f230a92cfc..bdfc591b1a 100644 --- a/packages/rlc-common/src/buildObjectTypes.ts +++ b/packages/rlc-common/src/buildObjectTypes.ts @@ -500,26 +500,27 @@ export function getImmediateParentsNames( : ""; const name = isDictionarySchema(parent) ? Object.entries(objectSchema.properties!)?.some((prop) => { - const typeName = prop[1].typeName ?? prop[1].type; - return ( - `Record` !== parent.typeName && - !(parent as any).additionalProperties?.typeName?.includes( - typeName - ) - ); - }) + const typeName = prop[1].typeName ?? prop[1].type; + return ( + `Record` !== parent.typeName && + !(parent as any).additionalProperties?.typeName?.includes( + typeName + ) + ); + }) ? schemaUsage.includes(SchemaContext.Output) ? "Record" : "Record" - : `${(schemaUsage.includes(SchemaContext.Output) - ? parent.outputTypeName - : parent.typeName) ?? parent.name - }` + : `${ + (schemaUsage.includes(SchemaContext.Output) + ? parent.outputTypeName + : parent.typeName) ?? parent.name + }` : `${normalizeName( - parent.name, - NameType.Interface, - true /** shouldGuard */ - )}${nameSuffix}`; + parent.name, + NameType.Interface, + true /** shouldGuard */ + )}${nameSuffix}`; return isObjectSchema(parent) && isPolymorphicParent(parent) ? `${name}Parent` @@ -557,8 +558,8 @@ function getPropertySignatures( function isBinaryArray(schema: Schema): boolean { return Boolean( isArraySchema(schema) && - (schema.items?.typeName?.includes("NodeJS.ReadableStream") || - schema.items?.outputTypeName?.includes("NodeJS.ReadableStream")) + (schema.items?.typeName?.includes("NodeJS.ReadableStream") || + schema.items?.outputTypeName?.includes("NodeJS.ReadableStream")) ); } @@ -604,7 +605,7 @@ export function getPropertySignature( type = schema.typeName; importedModels.add( (schema as any).additionalProperties.typeName ?? - (schema as any).additionalProperties.name + (schema as any).additionalProperties.name ); } else { type = @@ -639,4 +640,4 @@ function generateForOutput( (schemaUsage.includes(SchemaContext.Exception) && propertyUsage?.includes(SchemaContext.Exception)) ); -} \ No newline at end of file +} diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 9f3ed9acdf..3ba59c558e 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -144,7 +144,8 @@ export function normalizeName( nameType: NameType, shouldGuard?: boolean, customReservedNames?: ReservedName[], - casingOverride?: CasingConvention): string; + casingOverride?: CasingConvention +): string; export function normalizeName( name: string, nameType: NameType, @@ -157,7 +158,10 @@ export function normalizeName( optionalCustomReservedNames?: ReservedName[], optionalCasingOverride?: CasingConvention ): string { - let shouldGuard: boolean | undefined, customReservedNames: ReservedName[], casingOverride: CasingConvention | undefined, numberPrefixOverride: string | undefined; + let shouldGuard: boolean | undefined, + customReservedNames: ReservedName[], + casingOverride: CasingConvention | undefined, + numberPrefixOverride: string | undefined; if (typeof optionsOrShouldGuard === "boolean") { shouldGuard = optionsOrShouldGuard; customReservedNames = optionalCustomReservedNames ?? []; diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 68ac832359..4b3af63a17 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -343,8 +343,9 @@ function emitEnumMember( const normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize ? escapeNumericLiteral(member.name, NameType.EnumMemberName) // need to normalize number also for enum member : normalizeName(member.name, NameType.EnumMemberName, { - numberPrefixOverride: member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : undefined - }); + numberPrefixOverride: + member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : undefined + }); if ( normalizedMemberName.toLowerCase().startsWith("number") && !member.name.toLowerCase().startsWith("number") diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts index a5f37c1830..13c69a9137 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts @@ -43,7 +43,7 @@ export declare interface GetOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare interface ListOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts index d2bf292bdf..fb6cc83919 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts @@ -13,7 +13,7 @@ export declare interface HeaderOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare interface PostOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts index 53a9008576..8db1cc3397 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts @@ -3,7 +3,7 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare type RepeatabilityResult = "accepted" | "rejected"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts index 6588f5f6d6..2aedc2bff2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts @@ -39,7 +39,7 @@ export declare interface CompatibleWithEncodedNameOptionalParams extends Operati export declare type ExtensibleEnum = "value1" | "value2"; export declare interface LanguageClientNameModel { - tSName: boolean; + tsName: boolean; } export declare interface LanguageOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts index 9d16dfefaa..7265837524 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts @@ -3,8 +3,8 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; export declare enum KnownVersions { - V20210101Preview = "2021-01-01-preview", - V20221201Preview = "2022-12-01-preview" + V2021_01_01Preview = "2021-01-01-preview", + V2022_12_01Preview = "2022-12-01-preview" } export declare class VersionedClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts index a3b81f671d..2df92905ee 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts @@ -8,29 +8,29 @@ export declare class ExtensibleClient { private _client; readonly pipeline: Pipeline; constructor(options?: ExtensibleClientOptionalParams); - readonly string: StringOperations; + readonly string: StringModelOperations; } export declare interface ExtensibleClientOptionalParams extends ClientOptions { } -export declare interface StringGetKnownValueOptionalParams extends OperationOptions { +export declare interface StringModelGetKnownValueOptionalParams extends OperationOptions { } -export declare interface StringGetUnknownValueOptionalParams extends OperationOptions { +export declare interface StringModelGetUnknownValueOptionalParams extends OperationOptions { } -export declare interface StringOperations { - getKnownValue: (options?: StringGetKnownValueOptionalParams) => Promise; - getUnknownValue: (options?: StringGetUnknownValueOptionalParams) => Promise; - putKnownValue: (body: DaysOfWeekExtensibleEnum, options?: StringPutKnownValueOptionalParams) => Promise; - putUnknownValue: (body: DaysOfWeekExtensibleEnum, options?: StringPutUnknownValueOptionalParams) => Promise; +export declare interface StringModelOperations { + getKnownValue: (options?: StringModelGetKnownValueOptionalParams) => Promise; + getUnknownValue: (options?: StringModelGetUnknownValueOptionalParams) => Promise; + putKnownValue: (body: DaysOfWeekExtensibleEnum, options?: StringModelPutKnownValueOptionalParams) => Promise; + putUnknownValue: (body: DaysOfWeekExtensibleEnum, options?: StringModelPutUnknownValueOptionalParams) => Promise; } -export declare interface StringPutKnownValueOptionalParams extends OperationOptions { +export declare interface StringModelPutKnownValueOptionalParams extends OperationOptions { } -export declare interface StringPutUnknownValueOptionalParams extends OperationOptions { +export declare interface StringModelPutUnknownValueOptionalParams extends OperationOptions { } export { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts index 0e8d906dee..083f855d3d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts @@ -8,25 +8,25 @@ export declare class FixedClient { private _client; readonly pipeline: Pipeline; constructor(options?: FixedClientOptionalParams); - readonly string: StringOperations; + readonly string: StringModelOperations; } export declare interface FixedClientOptionalParams extends ClientOptions { } -export declare interface StringGetKnownValueOptionalParams extends OperationOptions { +export declare interface StringModelGetKnownValueOptionalParams extends OperationOptions { } -export declare interface StringOperations { - getKnownValue: (options?: StringGetKnownValueOptionalParams) => Promise; - putKnownValue: (body: DaysOfWeekEnum, options?: StringPutKnownValueOptionalParams) => Promise; - putUnknownValue: (body: DaysOfWeekEnum, options?: StringPutUnknownValueOptionalParams) => Promise; +export declare interface StringModelOperations { + getKnownValue: (options?: StringModelGetKnownValueOptionalParams) => Promise; + putKnownValue: (body: DaysOfWeekEnum, options?: StringModelPutKnownValueOptionalParams) => Promise; + putUnknownValue: (body: DaysOfWeekEnum, options?: StringModelPutUnknownValueOptionalParams) => Promise; } -export declare interface StringPutKnownValueOptionalParams extends OperationOptions { +export declare interface StringModelPutKnownValueOptionalParams extends OperationOptions { } -export declare interface StringPutUnknownValueOptionalParams extends OperationOptions { +export declare interface StringModelPutUnknownValueOptionalParams extends OperationOptions { } export { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts index c40a92486f..b89699ea40 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts @@ -166,7 +166,7 @@ export declare class NullableClient { private _client; readonly pipeline: Pipeline; constructor(options?: NullableClientOptionalParams); - readonly string: StringOperations; + readonly string: StringModelOperations; readonly bytes: BytesOperations; readonly datetime: DatetimeOperations; readonly duration: DurationOperations; @@ -178,24 +178,24 @@ export declare class NullableClient { export declare interface NullableClientOptionalParams extends ClientOptions { } -export declare interface StringGetNonNullOptionalParams extends OperationOptions { +export declare interface StringModelGetNonNullOptionalParams extends OperationOptions { } -export declare interface StringGetNullOptionalParams extends OperationOptions { +export declare interface StringModelGetNullOptionalParams extends OperationOptions { } -export declare interface StringOperations { - getNonNull: (options?: StringGetNonNullOptionalParams) => Promise; - getNull: (options?: StringGetNullOptionalParams) => Promise; - patchNonNull: (body: StringProperty, options?: StringPatchNonNullOptionalParams) => Promise; - patchNull: (body: StringProperty, options?: StringPatchNullOptionalParams) => Promise; +export declare interface StringModelOperations { + getNonNull: (options?: StringModelGetNonNullOptionalParams) => Promise; + getNull: (options?: StringModelGetNullOptionalParams) => Promise; + patchNonNull: (body: StringProperty, options?: StringModelPatchNonNullOptionalParams) => Promise; + patchNull: (body: StringProperty, options?: StringModelPatchNullOptionalParams) => Promise; } -export declare interface StringPatchNonNullOptionalParams extends OperationOptions { +export declare interface StringModelPatchNonNullOptionalParams extends OperationOptions { contentType?: string; } -export declare interface StringPatchNullOptionalParams extends OperationOptions { +export declare interface StringModelPatchNullOptionalParams extends OperationOptions { contentType?: string; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts index 16419913c0..ce8d081776 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts @@ -190,7 +190,7 @@ export declare class OptionalClient { private _client; readonly pipeline: Pipeline; constructor(options?: OptionalClientOptionalParams); - readonly string: StringOperations; + readonly string: StringModelOperations; readonly bytes: BytesOperations; readonly datetime: DatetimeOperations; readonly duration: DurationOperations; @@ -281,12 +281,6 @@ export declare interface RequiredAndOptionalPutAllOptionalParams extends Operati export declare interface RequiredAndOptionalPutRequiredOnlyOptionalParams extends OperationOptions { } -export declare interface StringGetAllOptionalParams extends OperationOptions { -} - -export declare interface StringGetDefaultOptionalParams extends OperationOptions { -} - export declare interface StringLiteralGetAllOptionalParams extends OperationOptions { } @@ -310,21 +304,27 @@ export declare interface StringLiteralPutAllOptionalParams extends OperationOpti export declare interface StringLiteralPutDefaultOptionalParams extends OperationOptions { } -export declare interface StringOperations { - getAll: (options?: StringGetAllOptionalParams) => Promise; - getDefault: (options?: StringGetDefaultOptionalParams) => Promise; - putAll: (body: StringProperty, options?: StringPutAllOptionalParams) => Promise; - putDefault: (body: StringProperty, options?: StringPutDefaultOptionalParams) => Promise; +export declare interface StringModelGetAllOptionalParams extends OperationOptions { } -export declare interface StringProperty { - property?: string; +export declare interface StringModelGetDefaultOptionalParams extends OperationOptions { } -export declare interface StringPutAllOptionalParams extends OperationOptions { +export declare interface StringModelOperations { + getAll: (options?: StringModelGetAllOptionalParams) => Promise; + getDefault: (options?: StringModelGetDefaultOptionalParams) => Promise; + putAll: (body: StringProperty, options?: StringModelPutAllOptionalParams) => Promise; + putDefault: (body: StringProperty, options?: StringModelPutDefaultOptionalParams) => Promise; } -export declare interface StringPutDefaultOptionalParams extends OperationOptions { +export declare interface StringModelPutAllOptionalParams extends OperationOptions { +} + +export declare interface StringModelPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface StringProperty { + property?: string; } export declare interface UnionFloatLiteralGetAllOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts index db8733c172..55a9217751 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts @@ -5,7 +5,7 @@ import { Pipeline } from '@azure/core-rest-pipeline'; export declare interface BooleanGetOptionalParams extends OperationOptions { } -export declare interface BooleanOperations { +export declare interface BooleanModelOperations { get: (options?: BooleanGetOptionalParams) => Promise; put: (body: boolean, options?: BooleanPutOptionalParams) => Promise; } @@ -69,8 +69,8 @@ export declare class ScalarClient { private _client; readonly pipeline: Pipeline; constructor(options?: ScalarClientOptionalParams); - readonly string: StringOperations; - readonly boolean: BooleanOperations; + readonly string: StringModelOperations; + readonly boolean: BooleanModelOperations; readonly unknown: UnknownOperations; readonly decimalType: DecimalTypeOperations; readonly decimal128Type: Decimal128TypeOperations; @@ -84,7 +84,7 @@ export declare interface ScalarClientOptionalParams extends ClientOptions { export declare interface StringGetOptionalParams extends OperationOptions { } -export declare interface StringOperations { +export declare interface StringModelOperations { get: (options?: StringGetOptionalParams) => Promise; put: (body: string, options?: StringPutOptionalParams) => Promise; } From 6029c41a833899d92db3e151ac3fa4c4ee263ea7 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 19 Nov 2024 19:52:18 +0800 Subject: [PATCH 47/91] Revert the breaking changes --- packages/typespec-ts/src/modular/buildCodeModel.ts | 6 ++++-- packages/typespec-ts/src/modular/emitModels.ts | 10 +++++----- .../typespec-ts/src/modular/helpers/clientHelpers.ts | 2 +- .../typespec-ts/src/modular/helpers/namingHelpers.ts | 2 +- packages/typespec-ts/src/transform/transform.ts | 2 +- packages/typespec-ts/src/utils/operationUtil.ts | 5 +++-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/typespec-ts/src/modular/buildCodeModel.ts b/packages/typespec-ts/src/modular/buildCodeModel.ts index 9eabd13613..c8eb6ff068 100644 --- a/packages/typespec-ts/src/modular/buildCodeModel.ts +++ b/packages/typespec-ts/src/modular/buildCodeModel.ts @@ -442,7 +442,8 @@ function emitParamBase( optional = parameter.optional; name = normalizeName( getLibraryName(context, parameter), - NameType.Parameter + NameType.Parameter, + true ); restApiName = getWireName(context, parameter); description = getDocStr(program, parameter); @@ -1080,7 +1081,8 @@ export function emitModel( : undefined; const overridedModelName = normalizeName( getLibraryName(context, type) ?? getFriendlyName(context.program, type), - NameType.Interface + NameType.Interface, + true ); const fullNamespaceName = getModelNamespaceName(context, type.namespace!) diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 4b3af63a17..66c988a25d 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -11,7 +11,7 @@ import { import { NameType, normalizeName, - escapeNumericLiteral + escapeNumericLiteralStart } from "@azure-tools/rlc-common"; import { SdkArrayType, @@ -341,14 +341,14 @@ function emitEnumMember( member: SdkEnumValueType ): EnumMemberStructure { const normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize - ? escapeNumericLiteral(member.name, NameType.EnumMemberName) // need to normalize number also for enum member + ? escapeNumericLiteralStart(member.name, NameType.EnumMemberName) // need to normalize number also for enum member : normalizeName(member.name, NameType.EnumMemberName, { numberPrefixOverride: - member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : undefined + member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : "num" }); if ( - normalizedMemberName.toLowerCase().startsWith("number") && - !member.name.toLowerCase().startsWith("number") + normalizedMemberName.toLowerCase().startsWith("num") && + !member.name.toLowerCase().startsWith("num") ) { reportDiagnostic(context.program, { code: "prefix-adding-in-enum-member", diff --git a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts index 5acf37628b..5b114faf13 100644 --- a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts @@ -145,7 +145,7 @@ export function getClientParameterName( return "endpointParam"; } - return normalizeName(parameter.name, NameType.Parameter); + return normalizeName(parameter.name, NameType.Parameter, true); } export function buildGetClientEndpointParam( diff --git a/packages/typespec-ts/src/modular/helpers/namingHelpers.ts b/packages/typespec-ts/src/modular/helpers/namingHelpers.ts index 23b9d09429..e25577ca0c 100644 --- a/packages/typespec-ts/src/modular/helpers/namingHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/namingHelpers.ts @@ -52,7 +52,7 @@ export function getOperationName( } return { - name: normalizeName(casingFn(operation.name), NameType.Operation) + name: normalizeName(casingFn(operation.name), NameType.Operation, true) }; } diff --git a/packages/typespec-ts/src/transform/transform.ts b/packages/typespec-ts/src/transform/transform.ts index 9c0946e8c0..a2effc380c 100644 --- a/packages/typespec-ts/src/transform/transform.ts +++ b/packages/typespec-ts/src/transform/transform.ts @@ -156,7 +156,7 @@ export function transformUrlInfo( } urlParameters.push({ oriName: key, - name: normalizeName(key, NameType.Parameter), + name: normalizeName(key, NameType.Parameter, true), type: getTypeName(schema, usage), description: (getDoc(program, property) && diff --git a/packages/typespec-ts/src/utils/operationUtil.ts b/packages/typespec-ts/src/utils/operationUtil.ts index 47c2f8d4d0..3a6217ee34 100644 --- a/packages/typespec-ts/src/utils/operationUtil.ts +++ b/packages/typespec-ts/src/utils/operationUtil.ts @@ -148,7 +148,7 @@ export function getOperationGroupName( return namespaceNames .map((name) => { - return normalizeName(name, NameType.Interface); + return normalizeName(name, NameType.Interface, true); }) .join(""); } @@ -158,7 +158,8 @@ export function getOperationName(dpgContext: SdkContext, operation: Operation) { return normalizeName( projectedOperationName ?? operation.name, - NameType.Interface + NameType.Interface, + true ); } From 406ce02b8c95ad42a682764a290f7c4354136d5d Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 19 Nov 2024 19:59:30 +0800 Subject: [PATCH 48/91] Revert un-necessary changes --- packages/typespec-ts/src/utils/modelUtils.ts | 6 +++- .../type/property/nullable/src/index.d.ts | 20 ++++++------ .../type/property/optionality/src/index.d.ts | 32 +++++++++---------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/packages/typespec-ts/src/utils/modelUtils.ts b/packages/typespec-ts/src/utils/modelUtils.ts index 36596ab583..c902935f96 100644 --- a/packages/typespec-ts/src/utils/modelUtils.ts +++ b/packages/typespec-ts/src/utils/modelUtils.ts @@ -656,7 +656,11 @@ function getSchemaForModel( fromCore: isCoreModel }; // normalized the output name - modelSchema.name = normalizeName(modelSchema.name, NameType.Interface); + modelSchema.name = normalizeName( + modelSchema.name, + NameType.Interface, + true /** shouldGuard */ + ); if (model.name === "Record" && isRecordModelType(program, model)) { return getSchemaForRecordModel(dpgContext, model, { usage }); diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts index b89699ea40..c40a92486f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts @@ -166,7 +166,7 @@ export declare class NullableClient { private _client; readonly pipeline: Pipeline; constructor(options?: NullableClientOptionalParams); - readonly string: StringModelOperations; + readonly string: StringOperations; readonly bytes: BytesOperations; readonly datetime: DatetimeOperations; readonly duration: DurationOperations; @@ -178,24 +178,24 @@ export declare class NullableClient { export declare interface NullableClientOptionalParams extends ClientOptions { } -export declare interface StringModelGetNonNullOptionalParams extends OperationOptions { +export declare interface StringGetNonNullOptionalParams extends OperationOptions { } -export declare interface StringModelGetNullOptionalParams extends OperationOptions { +export declare interface StringGetNullOptionalParams extends OperationOptions { } -export declare interface StringModelOperations { - getNonNull: (options?: StringModelGetNonNullOptionalParams) => Promise; - getNull: (options?: StringModelGetNullOptionalParams) => Promise; - patchNonNull: (body: StringProperty, options?: StringModelPatchNonNullOptionalParams) => Promise; - patchNull: (body: StringProperty, options?: StringModelPatchNullOptionalParams) => Promise; +export declare interface StringOperations { + getNonNull: (options?: StringGetNonNullOptionalParams) => Promise; + getNull: (options?: StringGetNullOptionalParams) => Promise; + patchNonNull: (body: StringProperty, options?: StringPatchNonNullOptionalParams) => Promise; + patchNull: (body: StringProperty, options?: StringPatchNullOptionalParams) => Promise; } -export declare interface StringModelPatchNonNullOptionalParams extends OperationOptions { +export declare interface StringPatchNonNullOptionalParams extends OperationOptions { contentType?: string; } -export declare interface StringModelPatchNullOptionalParams extends OperationOptions { +export declare interface StringPatchNullOptionalParams extends OperationOptions { contentType?: string; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts index ce8d081776..16419913c0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts @@ -190,7 +190,7 @@ export declare class OptionalClient { private _client; readonly pipeline: Pipeline; constructor(options?: OptionalClientOptionalParams); - readonly string: StringModelOperations; + readonly string: StringOperations; readonly bytes: BytesOperations; readonly datetime: DatetimeOperations; readonly duration: DurationOperations; @@ -281,6 +281,12 @@ export declare interface RequiredAndOptionalPutAllOptionalParams extends Operati export declare interface RequiredAndOptionalPutRequiredOnlyOptionalParams extends OperationOptions { } +export declare interface StringGetAllOptionalParams extends OperationOptions { +} + +export declare interface StringGetDefaultOptionalParams extends OperationOptions { +} + export declare interface StringLiteralGetAllOptionalParams extends OperationOptions { } @@ -304,27 +310,21 @@ export declare interface StringLiteralPutAllOptionalParams extends OperationOpti export declare interface StringLiteralPutDefaultOptionalParams extends OperationOptions { } -export declare interface StringModelGetAllOptionalParams extends OperationOptions { -} - -export declare interface StringModelGetDefaultOptionalParams extends OperationOptions { +export declare interface StringOperations { + getAll: (options?: StringGetAllOptionalParams) => Promise; + getDefault: (options?: StringGetDefaultOptionalParams) => Promise; + putAll: (body: StringProperty, options?: StringPutAllOptionalParams) => Promise; + putDefault: (body: StringProperty, options?: StringPutDefaultOptionalParams) => Promise; } -export declare interface StringModelOperations { - getAll: (options?: StringModelGetAllOptionalParams) => Promise; - getDefault: (options?: StringModelGetDefaultOptionalParams) => Promise; - putAll: (body: StringProperty, options?: StringModelPutAllOptionalParams) => Promise; - putDefault: (body: StringProperty, options?: StringModelPutDefaultOptionalParams) => Promise; -} - -export declare interface StringModelPutAllOptionalParams extends OperationOptions { +export declare interface StringProperty { + property?: string; } -export declare interface StringModelPutDefaultOptionalParams extends OperationOptions { +export declare interface StringPutAllOptionalParams extends OperationOptions { } -export declare interface StringProperty { - property?: string; +export declare interface StringPutDefaultOptionalParams extends OperationOptions { } export declare interface UnionFloatLiteralGetAllOptionalParams extends OperationOptions { From 4a5481b955e9bbae1cbe2f23e29bfa161132d272 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 19 Nov 2024 20:56:58 +0800 Subject: [PATCH 49/91] Update the integration for rlc and modular --- .../src/helpers/nameConstructors.ts | 3 ++- packages/typespec-ts/src/lib.ts | 2 +- .../typespec-ts/src/modular/emitModels.ts | 9 ++++---- .../generated/azure/core/page/src/index.d.ts | 2 +- .../azure/example/basic/src/index.d.ts | 2 +- .../common-properties/src/index.d.ts | 2 +- .../type/enum/extensible/src/index.d.ts | 20 ++++++++--------- .../generated/type/enum/fixed/src/index.d.ts | 16 +++++++------- .../generated/type/scalar/src/index.d.ts | 8 +++---- .../test/modularUnit/enumUnion.spec.ts | 2 +- .../apiVersion/apiVersionAsKnownVersions.md | 2 +- .../experimentalExtensibleEnumsTrue.md | 2 +- .../experimentalExtensibleEnumsFalse.md | 2 +- .../models/serialization/enumKeyNorm.md | 22 +++++++++---------- .../cookieParam/ignoreCookieParam.md | 8 +++---- 15 files changed, 52 insertions(+), 50 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameConstructors.ts b/packages/rlc-common/src/helpers/nameConstructors.ts index 90d3841556..ac579b6806 100644 --- a/packages/rlc-common/src/helpers/nameConstructors.ts +++ b/packages/rlc-common/src/helpers/nameConstructors.ts @@ -57,7 +57,8 @@ export function getResponseBaseName( return normalizeName( `${operationGroup}_${normalizeName( operationName, - NameType.Operation + NameType.Operation, + true )} ${statusCode}`, // since status code is a number, we use space to separate it from operationName NameType.Interface ); diff --git a/packages/typespec-ts/src/lib.ts b/packages/typespec-ts/src/lib.ts index 5e9b3194a9..08137df79b 100644 --- a/packages/typespec-ts/src/lib.ts +++ b/packages/typespec-ts/src/lib.ts @@ -285,7 +285,7 @@ const libDef = { "prefix-adding-in-enum-member": { severity: "warning", messages: { - default: paramMessage`Enum member name ${"memberName"} is normalized to ${"normalizedName"} with "Number" prefix.` + default: paramMessage`Enum member name ${"memberName"} is normalized to ${"normalizedName"} with "Num" prefix.` } } }, diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 66c988a25d..1cd20427f6 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -343,9 +343,10 @@ function emitEnumMember( const normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize ? escapeNumericLiteralStart(member.name, NameType.EnumMemberName) // need to normalize number also for enum member : normalizeName(member.name, NameType.EnumMemberName, { - numberPrefixOverride: - member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : "num" - }); + shouldGuard: true, + numberPrefixOverride: + member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : "num" + }); if ( normalizedMemberName.toLowerCase().startsWith("num") && !member.name.toLowerCase().startsWith("num") @@ -491,7 +492,7 @@ export function normalizeModelName( if (type.isGeneratedName) { internalModelPrefix = "_"; } - return `${internalModelPrefix}${normalizeName(namespacePrefix + type.name + unionSuffix, nameType)}`; + return `${internalModelPrefix}${normalizeName(namespacePrefix + type.name + unionSuffix, nameType, true)}`; } function buildModelPolymorphicType(context: SdkContext, type: SdkModelType) { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts index 97a88e2162..2356ce9f89 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts @@ -11,7 +11,7 @@ export declare interface FirstItem { } export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare interface ListFirstItemOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts index 66f6d06fd6..1621d26c55 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts @@ -33,7 +33,7 @@ export declare interface BasicActionOptionalParams extends OperationOptions { export declare type Enum = "EnumValue1"; export declare enum KnownVersions { - V20221201Preview = "2022-12-01-preview" + V2022_12_01Preview = "2022-12-01-preview" } export declare interface Model { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts index e21f411fe5..aa353099b0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts @@ -55,7 +55,7 @@ export declare enum KnownManagedServiceIdentityType { } export declare enum KnownVersions { - V20231201Preview = "2023-12-01-preview" + V2023_12_01Preview = "2023-12-01-preview" } export declare interface ManagedIdentityTrackedResource extends TrackedResource { diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts index 2df92905ee..a3b81f671d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts @@ -8,29 +8,29 @@ export declare class ExtensibleClient { private _client; readonly pipeline: Pipeline; constructor(options?: ExtensibleClientOptionalParams); - readonly string: StringModelOperations; + readonly string: StringOperations; } export declare interface ExtensibleClientOptionalParams extends ClientOptions { } -export declare interface StringModelGetKnownValueOptionalParams extends OperationOptions { +export declare interface StringGetKnownValueOptionalParams extends OperationOptions { } -export declare interface StringModelGetUnknownValueOptionalParams extends OperationOptions { +export declare interface StringGetUnknownValueOptionalParams extends OperationOptions { } -export declare interface StringModelOperations { - getKnownValue: (options?: StringModelGetKnownValueOptionalParams) => Promise; - getUnknownValue: (options?: StringModelGetUnknownValueOptionalParams) => Promise; - putKnownValue: (body: DaysOfWeekExtensibleEnum, options?: StringModelPutKnownValueOptionalParams) => Promise; - putUnknownValue: (body: DaysOfWeekExtensibleEnum, options?: StringModelPutUnknownValueOptionalParams) => Promise; +export declare interface StringOperations { + getKnownValue: (options?: StringGetKnownValueOptionalParams) => Promise; + getUnknownValue: (options?: StringGetUnknownValueOptionalParams) => Promise; + putKnownValue: (body: DaysOfWeekExtensibleEnum, options?: StringPutKnownValueOptionalParams) => Promise; + putUnknownValue: (body: DaysOfWeekExtensibleEnum, options?: StringPutUnknownValueOptionalParams) => Promise; } -export declare interface StringModelPutKnownValueOptionalParams extends OperationOptions { +export declare interface StringPutKnownValueOptionalParams extends OperationOptions { } -export declare interface StringModelPutUnknownValueOptionalParams extends OperationOptions { +export declare interface StringPutUnknownValueOptionalParams extends OperationOptions { } export { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts index 083f855d3d..0e8d906dee 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts @@ -8,25 +8,25 @@ export declare class FixedClient { private _client; readonly pipeline: Pipeline; constructor(options?: FixedClientOptionalParams); - readonly string: StringModelOperations; + readonly string: StringOperations; } export declare interface FixedClientOptionalParams extends ClientOptions { } -export declare interface StringModelGetKnownValueOptionalParams extends OperationOptions { +export declare interface StringGetKnownValueOptionalParams extends OperationOptions { } -export declare interface StringModelOperations { - getKnownValue: (options?: StringModelGetKnownValueOptionalParams) => Promise; - putKnownValue: (body: DaysOfWeekEnum, options?: StringModelPutKnownValueOptionalParams) => Promise; - putUnknownValue: (body: DaysOfWeekEnum, options?: StringModelPutUnknownValueOptionalParams) => Promise; +export declare interface StringOperations { + getKnownValue: (options?: StringGetKnownValueOptionalParams) => Promise; + putKnownValue: (body: DaysOfWeekEnum, options?: StringPutKnownValueOptionalParams) => Promise; + putUnknownValue: (body: DaysOfWeekEnum, options?: StringPutUnknownValueOptionalParams) => Promise; } -export declare interface StringModelPutKnownValueOptionalParams extends OperationOptions { +export declare interface StringPutKnownValueOptionalParams extends OperationOptions { } -export declare interface StringModelPutUnknownValueOptionalParams extends OperationOptions { +export declare interface StringPutUnknownValueOptionalParams extends OperationOptions { } export { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts index 55a9217751..db8733c172 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts @@ -5,7 +5,7 @@ import { Pipeline } from '@azure/core-rest-pipeline'; export declare interface BooleanGetOptionalParams extends OperationOptions { } -export declare interface BooleanModelOperations { +export declare interface BooleanOperations { get: (options?: BooleanGetOptionalParams) => Promise; put: (body: boolean, options?: BooleanPutOptionalParams) => Promise; } @@ -69,8 +69,8 @@ export declare class ScalarClient { private _client; readonly pipeline: Pipeline; constructor(options?: ScalarClientOptionalParams); - readonly string: StringModelOperations; - readonly boolean: BooleanModelOperations; + readonly string: StringOperations; + readonly boolean: BooleanOperations; readonly unknown: UnknownOperations; readonly decimalType: DecimalTypeOperations; readonly decimal128Type: Decimal128TypeOperations; @@ -84,7 +84,7 @@ export declare interface ScalarClientOptionalParams extends ClientOptions { export declare interface StringGetOptionalParams extends OperationOptions { } -export declare interface StringModelOperations { +export declare interface StringOperations { get: (options?: StringGetOptionalParams) => Promise; put: (body: string, options?: StringPutOptionalParams) => Promise; } diff --git a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts index 13c4bbda5c..8b0b42e385 100644 --- a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts +++ b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts @@ -1021,7 +1021,7 @@ describe("model type", () => { mustEmptyDiagnostic: true }); } catch (e: any) { - assert.strictEqual(e[0].message, 'Enum member name 1 is normalized to Number1 with "Number" prefix.'); + assert.strictEqual(e[0].message, 'Enum member name 1 is normalized to Num1 with "Num" prefix.'); } }); diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md index 09b847a56c..43e4bbc023 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md @@ -40,6 +40,6 @@ Should generate KnownVersions in models.ts. /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V20211001Preview = "2021-10-01-preview", + V2021_10_01Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md index 1fd6d1719c..2d6553ba96 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md @@ -113,6 +113,6 @@ export type ProvisioningState = string; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V20211001Preview = "2021-10-01-preview", + V2021_10_01Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md index 703bff326a..b8f315b5ad 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md @@ -96,6 +96,6 @@ export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V20211001Preview = "2021-10-01-preview", + V2021_10_01Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index fa2cbaf0b6..6d8f2fe733 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -93,7 +93,7 @@ export interface Foo { export function fooSerializer(item: Foo): any { return { extensibleString: item["extensibleString"], - extensibleNumber: item["extensibleNumber"] + extensibleNumber: item["extensibleNumber"], }; } @@ -113,12 +113,12 @@ export enum KnownExtensibleString { YesOrNo2 = "YES OR NO", ValidationSuccess = "VALIDATION_SUCCESS", PascalCase6666 = "___pascal____case6666", - Number10Pascal = "_10Pascal", - Number090 = "090", - Number10 = "10", - Number20 = "20", - Number10 = "1.0", - "Item-1.0" = "-2.0" + _10Pascal = "_10Pascal", + Num090 = "090", + Num10 = "10", + Num20 = "20", + "Num1.0" = "1.0", + "Item-1.0" = "-2.0", } /** Type of ExtensibleString */ @@ -127,9 +127,9 @@ export type ExtensibleString = string; /** Known values of {@link ExtensibleNumber} that the service accepts. */ export enum KnownExtensibleNumber { One = 1, - Number2 = 2, - "Number-2.1" = -2.1, - Number3 = 3 + Num2 = 2, + "Num-2.1" = -2.1, + Num3 = 3, } /** Type of ExtensibleNumber */ @@ -139,6 +139,6 @@ export type ExtensibleNumber = number; export enum KnownVersions { PreviewVersion = "2024-07-01-preview", StableVersion = "2024-07-01", - Number20240801Preview = "2024-08-01-preview" + "V2024-08-01Preview" = "2024-08-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/operations/cookieParam/ignoreCookieParam.md b/packages/typespec-ts/test/modularUnit/scenarios/operations/cookieParam/ignoreCookieParam.md index 51f2987604..3b4cd231f5 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/operations/cookieParam/ignoreCookieParam.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/operations/cookieParam/ignoreCookieParam.md @@ -28,12 +28,12 @@ import { StreamableMethod, PathUncheckedResponse, createRestError, - operationOptionsToRequestParameters + operationOptionsToRequestParameters, } from "@azure-rest/core-client"; export function _testSend( context: Client, - options: TestOptionalParams = { requestOptions: {} } + options: TestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/") @@ -41,7 +41,7 @@ export function _testSend( } export async function _testDeserialize( - result: PathUncheckedResponse + result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { @@ -53,7 +53,7 @@ export async function _testDeserialize( export async function test( context: Client, - options: TestOptionalParams = { requestOptions: {} } + options: TestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _testSend(context, options); return _testDeserialize(result); From dc7c870f207ab938014ef2a56ef40e966a5c73f7 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 09:28:23 +0800 Subject: [PATCH 50/91] Update the lint issues --- packages/rlc-common/src/helpers/nameUtils.ts | 4 ++-- packages/rlc-common/test/helpers/nameUtils.spec.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 3ba59c558e..251e0c25a1 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -199,7 +199,7 @@ export function escapeNumericLiteralStart( prefix: string = "Num" ): string { const casingConvention = getCasingConvention(nameType); - if (!name || !name.match(/^[\-\.]?\d/)) { + if (!name || !name.match(/^[-.]?\d/)) { return name; } return `${toCasing(prefix, casingConvention)}${name}`; @@ -236,7 +236,7 @@ function deconstruct(identifier: string): Array { .replace(/\b([_-]*)([A-Z]+)([A-Z])([a-z]+)/g, "$1$2 $3$4") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection) .replace(/«/g, "s") .trim() - .split(/[^A-Za-z0-9\_\-.]+/); + .split(/[^A-Za-z0-9_\-.]+/); // Split by non-alphanumeric characters and try to keep _-. between numbers const refinedParts: string[] = []; for (let i = 0; i < parts.length; i++) { diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index f4e33cc168..b1300cb12c 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -110,10 +110,10 @@ describe("#normalizeName", () => { }); describe("for parameter", () => { it("should return the name with the suffix 'Param' if the name is a reserved name", () => { - expect(normalizeName("static", NameType.Parameter)).to.equal( + expect(normalizeName("static", NameType.Parameter, true)).to.equal( "staticParam" ); - expect(normalizeName("any", NameType.Parameter)).to.equal( + expect(normalizeName("any", NameType.Parameter, true)).to.equal( "anyParam" ); expect(normalizeName("SAS", NameType.Parameter)).to.equal("sas"); From 68bbb1cd1ffe99a6c1b42560e83a2aafb6db9f02 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 09:48:21 +0800 Subject: [PATCH 51/91] Update the autorest smoke testing --- .../generated/dpgCustomization/package.json | 2 +- ...ionClient.ts => dpgCustomizationClient.ts} | 0 .../generated/dpgCustomization/src/index.ts | 4 +- .../generated/lroRest/src/index.ts | 4 +- .../{lRORestClient.ts => lroRestClient.ts} | 0 .../generated/lroRest/src/responses.ts | 56 +++++++++---------- .../typespec-ts/src/modular/emitModels.ts | 8 +-- .../typespec-ts/src/transform/transform.ts | 2 +- 8 files changed, 38 insertions(+), 38 deletions(-) rename packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/{dPGCustomizationClient.ts => dpgCustomizationClient.ts} (100%) rename packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/{lRORestClient.ts => lroRestClient.ts} (100%) diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json index 52a7425c10..749c16f948 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json @@ -35,7 +35,7 @@ "prefix": "package-version" }, { - "path": "src/dPGCustomizationClient.ts", + "path": "src/dpgCustomizationClient.ts", "prefix": "userAgentInfo" } ] diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dPGCustomizationClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts similarity index 100% rename from packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dPGCustomizationClient.ts rename to packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts index aed4707bb0..86715b481d 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGCustomizationClient from "./dPGCustomizationClient"; +import DPGCustomizationClient from "./dpgCustomizationClient"; -export * from "./dPGCustomizationClient"; +export * from "./dpgCustomizationClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts index fd135e7119..e330dc9c21 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import LRORestClient from "./lRORestClient"; +import LRORestClient from "./lroRestClient"; -export * from "./lRORestClient"; +export * from "./lroRestClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lRORestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts similarity index 100% rename from packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lRORestClient.ts rename to packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts index c4ab58dab2..0c430ddeaf 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts @@ -890,27 +890,27 @@ export interface LROsPostAsyncRetrycanceledDefaultResponse } /** Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysPut201CreatingSucceeded200200Response +export interface LroRetrysPut201CreatingSucceeded200200Response extends HttpResponse { status: "200"; body: ProductOutput; } /** Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysPut201CreatingSucceeded200201Response +export interface LroRetrysPut201CreatingSucceeded200201Response extends HttpResponse { status: "201"; body: ProductOutput; } /** Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysPut201CreatingSucceeded200DefaultResponse +export interface LroRetrysPut201CreatingSucceeded200DefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LRORetrysPutAsyncRelativeRetrySucceeded200Headers { +export interface LroRetrysPutAsyncRelativeRetrySucceeded200Headers { /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ "azure-asyncoperation"?: string; /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ @@ -920,28 +920,28 @@ export interface LRORetrysPutAsyncRelativeRetrySucceeded200Headers { } /** Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LRORetrysPutAsyncRelativeRetrySucceeded200Response +export interface LroRetrysPutAsyncRelativeRetrySucceeded200Response extends HttpResponse { status: "200"; body: ProductOutput; - headers: RawHttpHeaders & LRORetrysPutAsyncRelativeRetrySucceeded200Headers; + headers: RawHttpHeaders & LroRetrysPutAsyncRelativeRetrySucceeded200Headers; } /** Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LRORetrysPutAsyncRelativeRetrySucceededDefaultResponse +export interface LroRetrysPutAsyncRelativeRetrySucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } /** Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysDeleteProvisioning202Accepted200Succeeded200Response +export interface LroRetrysDeleteProvisioning202Accepted200Succeeded200Response extends HttpResponse { status: "200"; body: ProductOutput; } -export interface LRORetrysDeleteProvisioning202Accepted200Succeeded202Headers { +export interface LroRetrysDeleteProvisioning202Accepted200Succeeded202Headers { /** Location to poll for result status: will be set to /lro/retryerror/delete/provisioning/202/accepted/200/succeeded */ location?: string; /** Number of milliseconds until the next poll should be sent, will be set to zero */ @@ -949,22 +949,22 @@ export interface LRORetrysDeleteProvisioning202Accepted200Succeeded202Headers { } /** Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysDeleteProvisioning202Accepted200Succeeded202Response +export interface LroRetrysDeleteProvisioning202Accepted200Succeeded202Response extends HttpResponse { status: "202"; body: ProductOutput; headers: RawHttpHeaders & - LRORetrysDeleteProvisioning202Accepted200Succeeded202Headers; + LroRetrysDeleteProvisioning202Accepted200Succeeded202Headers; } /** Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysDeleteProvisioning202Accepted200SucceededDefaultResponse +export interface LroRetrysDeleteProvisioning202Accepted200SucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LRORetrysDelete202Retry200202Headers { +export interface LroRetrysDelete202Retry200202Headers { /** Location to poll for result status: will be set to /lro/retryerror/delete/202/retry/200 */ location?: string; /** Number of milliseconds until the next poll should be sent, will be set to zero */ @@ -972,19 +972,19 @@ export interface LRORetrysDelete202Retry200202Headers { } /** Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysDelete202Retry200202Response extends HttpResponse { +export interface LroRetrysDelete202Retry200202Response extends HttpResponse { status: "202"; - headers: RawHttpHeaders & LRORetrysDelete202Retry200202Headers; + headers: RawHttpHeaders & LroRetrysDelete202Retry200202Headers; } /** Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LRORetrysDelete202Retry200DefaultResponse +export interface LroRetrysDelete202Retry200DefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LRORetrysDeleteAsyncRelativeRetrySucceeded202Headers { +export interface LroRetrysDeleteAsyncRelativeRetrySucceeded202Headers { /** Location to poll for result status: will be set to /lro/retryerror/deleteasync/retry/succeeded/operationResults/200 */ "azure-asyncoperation"?: string; /** Location to poll for result status: will be set to /lro/retryerror/deleteasync/retry/succeeded/operationResults/200 */ @@ -994,21 +994,21 @@ export interface LRORetrysDeleteAsyncRelativeRetrySucceeded202Headers { } /** Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LRORetrysDeleteAsyncRelativeRetrySucceeded202Response +export interface LroRetrysDeleteAsyncRelativeRetrySucceeded202Response extends HttpResponse { status: "202"; headers: RawHttpHeaders & - LRORetrysDeleteAsyncRelativeRetrySucceeded202Headers; + LroRetrysDeleteAsyncRelativeRetrySucceeded202Headers; } /** Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LRORetrysDeleteAsyncRelativeRetrySucceededDefaultResponse +export interface LroRetrysDeleteAsyncRelativeRetrySucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LRORetrysPost202Retry200202Headers { +export interface LroRetrysPost202Retry200202Headers { /** Location to poll for result status: will be set to /lro/retryerror/post/202/retry/200 */ location?: string; /** Number of milliseconds until the next poll should be sent, will be set to zero */ @@ -1016,18 +1016,18 @@ export interface LRORetrysPost202Retry200202Headers { } /** Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success */ -export interface LRORetrysPost202Retry200202Response extends HttpResponse { +export interface LroRetrysPost202Retry200202Response extends HttpResponse { status: "202"; - headers: RawHttpHeaders & LRORetrysPost202Retry200202Headers; + headers: RawHttpHeaders & LroRetrysPost202Retry200202Headers; } /** Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success */ -export interface LRORetrysPost202Retry200DefaultResponse extends HttpResponse { +export interface LroRetrysPost202Retry200DefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LRORetrysPostAsyncRelativeRetrySucceeded202Headers { +export interface LroRetrysPostAsyncRelativeRetrySucceeded202Headers { /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ "azure-asyncoperation"?: string; /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ @@ -1037,14 +1037,14 @@ export interface LRORetrysPostAsyncRelativeRetrySucceeded202Headers { } /** Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LRORetrysPostAsyncRelativeRetrySucceeded202Response +export interface LroRetrysPostAsyncRelativeRetrySucceeded202Response extends HttpResponse { status: "202"; - headers: RawHttpHeaders & LRORetrysPostAsyncRelativeRetrySucceeded202Headers; + headers: RawHttpHeaders & LroRetrysPostAsyncRelativeRetrySucceeded202Headers; } /** Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LRORetrysPostAsyncRelativeRetrySucceededDefaultResponse +export interface LroRetrysPostAsyncRelativeRetrySucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index 1cd20427f6..276d5de221 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -343,10 +343,10 @@ function emitEnumMember( const normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize ? escapeNumericLiteralStart(member.name, NameType.EnumMemberName) // need to normalize number also for enum member : normalizeName(member.name, NameType.EnumMemberName, { - shouldGuard: true, - numberPrefixOverride: - member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : "num" - }); + shouldGuard: true, + numberPrefixOverride: + member.enumType.usage === UsageFlags.ApiVersionEnum ? "V" : "num" + }); if ( normalizedMemberName.toLowerCase().startsWith("num") && !member.name.toLowerCase().startsWith("num") diff --git a/packages/typespec-ts/src/transform/transform.ts b/packages/typespec-ts/src/transform/transform.ts index a2effc380c..c4ed84d53d 100644 --- a/packages/typespec-ts/src/transform/transform.ts +++ b/packages/typespec-ts/src/transform/transform.ts @@ -150,7 +150,7 @@ export function transformUrlInfo( importedModels.add, importedModels ); - const normName = normalizeName(key, NameType.Parameter); + const normName = normalizeName(key, NameType.Parameter, true); if (normName !== key && endpoint) { endpoint = endpoint.replace(`{${key}}`, `{${normName}}`); } From 24527c657746e240d4debead8cc967b5c95e1926 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 09:49:24 +0800 Subject: [PATCH 52/91] Push rename file changes --- .../src/dpgCustomizationClient.ts | 60 ------------------- .../generated/lroRest/src/lroRestClient.ts | 44 -------------- 2 files changed, 104 deletions(-) delete mode 100644 packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts delete mode 100644 packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts deleted file mode 100644 index b9876033b9..0000000000 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "./logger"; -import { DPGCustomizationClient } from "./clientDefinitions"; - -/** The optional parameters for the client */ -export interface DPGCustomizationClientOptions extends ClientOptions {} - -/** - * Initialize a new instance of `DPGCustomizationClient` - * @param options - the parameter for all optional parameters - */ -export default function createClient( - options: DPGCustomizationClientOptions = {}, -): DPGCustomizationClient { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; - const userAgentInfo = `azsdk-js-dpg-customization-rest/1.0.0-preview1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - }; - const client = getClient(endpointUrl, options) as DPGCustomizationClient; - - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - logger.warning( - "This client does not support client api-version, please change it at the operation level", - ); - } - - return { - ...client, - ...{ - getModel: (mode, options) => { - return client.path("/customization/model/{mode}", mode).get(options); - }, - postModel: (mode, options) => { - return client.path("/customization/model/{mode}", mode).post(options); - }, - getPages: (mode, options) => { - return client.path("/customization/paging/{mode}", mode).get(options); - }, - lro: (mode, options) => { - return client.path("/customization/lro/{mode}", mode).put(options); - }, - }, - }; -} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts deleted file mode 100644 index e23cf52862..0000000000 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "./logger"; -import { LRORestClient } from "./clientDefinitions"; - -/** The optional parameters for the client */ -export interface LRORestClientOptions extends ClientOptions {} - -/** - * Initialize a new instance of `LRORestClient` - * @param options - the parameter for all optional parameters - */ -export default function createClient( - options: LRORestClientOptions = {}, -): LRORestClient { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; - const userAgentInfo = `azsdk-js-lro-rest/1.0.0-preview1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - }; - const client = getClient(endpointUrl, options) as LRORestClient; - - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - logger.warning( - "This client does not support client api-version, please change it at the operation level", - ); - } - - return client; -} From f4f07add29b0736f981292a935c561b3be3e1f55 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 09:58:24 +0800 Subject: [PATCH 53/91] Update the file name changes --- .../src/dpgCustomizationClient.ts | 60 +++++++++++++++++++ .../generated/lroRest/src/lroRestClient.ts | 44 ++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts create mode 100644 packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts new file mode 100644 index 0000000000..b9876033b9 --- /dev/null +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import { DPGCustomizationClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface DPGCustomizationClientOptions extends ClientOptions {} + +/** + * Initialize a new instance of `DPGCustomizationClient` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: DPGCustomizationClientOptions = {}, +): DPGCustomizationClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-dpg-customization-rest/1.0.0-preview1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + const client = getClient(endpointUrl, options) as DPGCustomizationClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + + return { + ...client, + ...{ + getModel: (mode, options) => { + return client.path("/customization/model/{mode}", mode).get(options); + }, + postModel: (mode, options) => { + return client.path("/customization/model/{mode}", mode).post(options); + }, + getPages: (mode, options) => { + return client.path("/customization/paging/{mode}", mode).get(options); + }, + lro: (mode, options) => { + return client.path("/customization/lro/{mode}", mode).put(options); + }, + }, + }; +} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts new file mode 100644 index 0000000000..e23cf52862 --- /dev/null +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import { LRORestClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface LRORestClientOptions extends ClientOptions {} + +/** + * Initialize a new instance of `LRORestClient` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: LRORestClientOptions = {}, +): LRORestClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-lro-rest/1.0.0-preview1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + const client = getClient(endpointUrl, options) as LRORestClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + + return client; +} From 815b7dc8989f05acb6dada7a527afc627b69883c Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 10:16:06 +0800 Subject: [PATCH 54/91] Update the normalize style --- .../generated/lroRest/src/responses.ts | 56 +++++++++---------- .../src/helpers/nameConstructors.ts | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts index 0c430ddeaf..c4ab58dab2 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts @@ -890,27 +890,27 @@ export interface LROsPostAsyncRetrycanceledDefaultResponse } /** Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysPut201CreatingSucceeded200200Response +export interface LRORetrysPut201CreatingSucceeded200200Response extends HttpResponse { status: "200"; body: ProductOutput; } /** Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysPut201CreatingSucceeded200201Response +export interface LRORetrysPut201CreatingSucceeded200201Response extends HttpResponse { status: "201"; body: ProductOutput; } /** Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysPut201CreatingSucceeded200DefaultResponse +export interface LRORetrysPut201CreatingSucceeded200DefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LroRetrysPutAsyncRelativeRetrySucceeded200Headers { +export interface LRORetrysPutAsyncRelativeRetrySucceeded200Headers { /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ "azure-asyncoperation"?: string; /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ @@ -920,28 +920,28 @@ export interface LroRetrysPutAsyncRelativeRetrySucceeded200Headers { } /** Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LroRetrysPutAsyncRelativeRetrySucceeded200Response +export interface LRORetrysPutAsyncRelativeRetrySucceeded200Response extends HttpResponse { status: "200"; body: ProductOutput; - headers: RawHttpHeaders & LroRetrysPutAsyncRelativeRetrySucceeded200Headers; + headers: RawHttpHeaders & LRORetrysPutAsyncRelativeRetrySucceeded200Headers; } /** Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LroRetrysPutAsyncRelativeRetrySucceededDefaultResponse +export interface LRORetrysPutAsyncRelativeRetrySucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } /** Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysDeleteProvisioning202Accepted200Succeeded200Response +export interface LRORetrysDeleteProvisioning202Accepted200Succeeded200Response extends HttpResponse { status: "200"; body: ProductOutput; } -export interface LroRetrysDeleteProvisioning202Accepted200Succeeded202Headers { +export interface LRORetrysDeleteProvisioning202Accepted200Succeeded202Headers { /** Location to poll for result status: will be set to /lro/retryerror/delete/provisioning/202/accepted/200/succeeded */ location?: string; /** Number of milliseconds until the next poll should be sent, will be set to zero */ @@ -949,22 +949,22 @@ export interface LroRetrysDeleteProvisioning202Accepted200Succeeded202Headers { } /** Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysDeleteProvisioning202Accepted200Succeeded202Response +export interface LRORetrysDeleteProvisioning202Accepted200Succeeded202Response extends HttpResponse { status: "202"; body: ProductOutput; headers: RawHttpHeaders & - LroRetrysDeleteProvisioning202Accepted200Succeeded202Headers; + LRORetrysDeleteProvisioning202Accepted200Succeeded202Headers; } /** Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysDeleteProvisioning202Accepted200SucceededDefaultResponse +export interface LRORetrysDeleteProvisioning202Accepted200SucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LroRetrysDelete202Retry200202Headers { +export interface LRORetrysDelete202Retry200202Headers { /** Location to poll for result status: will be set to /lro/retryerror/delete/202/retry/200 */ location?: string; /** Number of milliseconds until the next poll should be sent, will be set to zero */ @@ -972,19 +972,19 @@ export interface LroRetrysDelete202Retry200202Headers { } /** Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysDelete202Retry200202Response extends HttpResponse { +export interface LRORetrysDelete202Retry200202Response extends HttpResponse { status: "202"; - headers: RawHttpHeaders & LroRetrysDelete202Retry200202Headers; + headers: RawHttpHeaders & LRORetrysDelete202Retry200202Headers; } /** Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ */ -export interface LroRetrysDelete202Retry200DefaultResponse +export interface LRORetrysDelete202Retry200DefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LroRetrysDeleteAsyncRelativeRetrySucceeded202Headers { +export interface LRORetrysDeleteAsyncRelativeRetrySucceeded202Headers { /** Location to poll for result status: will be set to /lro/retryerror/deleteasync/retry/succeeded/operationResults/200 */ "azure-asyncoperation"?: string; /** Location to poll for result status: will be set to /lro/retryerror/deleteasync/retry/succeeded/operationResults/200 */ @@ -994,21 +994,21 @@ export interface LroRetrysDeleteAsyncRelativeRetrySucceeded202Headers { } /** Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LroRetrysDeleteAsyncRelativeRetrySucceeded202Response +export interface LRORetrysDeleteAsyncRelativeRetrySucceeded202Response extends HttpResponse { status: "202"; headers: RawHttpHeaders & - LroRetrysDeleteAsyncRelativeRetrySucceeded202Headers; + LRORetrysDeleteAsyncRelativeRetrySucceeded202Headers; } /** Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LroRetrysDeleteAsyncRelativeRetrySucceededDefaultResponse +export interface LRORetrysDeleteAsyncRelativeRetrySucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LroRetrysPost202Retry200202Headers { +export interface LRORetrysPost202Retry200202Headers { /** Location to poll for result status: will be set to /lro/retryerror/post/202/retry/200 */ location?: string; /** Number of milliseconds until the next poll should be sent, will be set to zero */ @@ -1016,18 +1016,18 @@ export interface LroRetrysPost202Retry200202Headers { } /** Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success */ -export interface LroRetrysPost202Retry200202Response extends HttpResponse { +export interface LRORetrysPost202Retry200202Response extends HttpResponse { status: "202"; - headers: RawHttpHeaders & LroRetrysPost202Retry200202Headers; + headers: RawHttpHeaders & LRORetrysPost202Retry200202Headers; } /** Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success */ -export interface LroRetrysPost202Retry200DefaultResponse extends HttpResponse { +export interface LRORetrysPost202Retry200DefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; } -export interface LroRetrysPostAsyncRelativeRetrySucceeded202Headers { +export interface LRORetrysPostAsyncRelativeRetrySucceeded202Headers { /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ "azure-asyncoperation"?: string; /** Location to poll for result status: will be set to /lro/retryerror/putasync/retry/succeeded/operationResults/200 */ @@ -1037,14 +1037,14 @@ export interface LroRetrysPostAsyncRelativeRetrySucceeded202Headers { } /** Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LroRetrysPostAsyncRelativeRetrySucceeded202Response +export interface LRORetrysPostAsyncRelativeRetrySucceeded202Response extends HttpResponse { status: "202"; - headers: RawHttpHeaders & LroRetrysPostAsyncRelativeRetrySucceeded202Headers; + headers: RawHttpHeaders & LRORetrysPostAsyncRelativeRetrySucceeded202Headers; } /** Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status */ -export interface LroRetrysPostAsyncRelativeRetrySucceededDefaultResponse +export interface LRORetrysPostAsyncRelativeRetrySucceededDefaultResponse extends HttpResponse { status: string; body: CloudErrorOutput; diff --git a/packages/rlc-common/src/helpers/nameConstructors.ts b/packages/rlc-common/src/helpers/nameConstructors.ts index ac579b6806..f86593cfd2 100644 --- a/packages/rlc-common/src/helpers/nameConstructors.ts +++ b/packages/rlc-common/src/helpers/nameConstructors.ts @@ -57,7 +57,7 @@ export function getResponseBaseName( return normalizeName( `${operationGroup}_${normalizeName( operationName, - NameType.Operation, + NameType.Interface, true )} ${statusCode}`, // since status code is a number, we use space to separate it from operationName NameType.Interface From 690b9214130788f9fbf796f434aadf192bc9d2a6 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 10:20:58 +0800 Subject: [PATCH 55/91] Update the smoek test --- .../review/arm-networkanalytics.api.md | 2 +- .../generated/typespec-ts/src/models/models.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md index 6818aecd28..384af6155d 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/review/arm-networkanalytics.api.md @@ -403,7 +403,7 @@ export enum KnownProvisioningState { // @public export enum KnownVersions { - V20231115 = "2023-11-15" + V2023_11_15 = "2023-11-15" } // @public diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts index a1d9fbdee2..e5684f99b8 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/src/models/models.ts @@ -271,7 +271,7 @@ export function dataProductNetworkAclsSerializer( virtualNetworkRule: virtualNetworkRuleArraySerializer( item["virtualNetworkRule"], ), - ipRules: iPRulesArraySerializer(item["ipRules"]), + ipRules: ipRulesArraySerializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -286,7 +286,7 @@ export function dataProductNetworkAclsDeserializer( virtualNetworkRule: virtualNetworkRuleArrayDeserializer( item["virtualNetworkRule"], ), - ipRules: iPRulesArrayDeserializer(item["ipRules"]), + ipRules: ipRulesArrayDeserializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -332,15 +332,15 @@ export function virtualNetworkRuleDeserializer(item: any): VirtualNetworkRule { }; } -export function iPRulesArraySerializer(result: Array): any[] { +export function ipRulesArraySerializer(result: Array): any[] { return result.map((item) => { - return iPRulesSerializer(item); + return ipRulesSerializer(item); }); } -export function iPRulesArrayDeserializer(result: Array): any[] { +export function ipRulesArrayDeserializer(result: Array): any[] { return result.map((item) => { - return iPRulesDeserializer(item); + return ipRulesDeserializer(item); }); } @@ -352,11 +352,11 @@ export interface IPRules { action: string; } -export function iPRulesSerializer(item: IPRules): any { +export function ipRulesSerializer(item: IPRules): any { return { value: item["value"], action: item["action"] }; } -export function iPRulesDeserializer(item: any): IPRules { +export function ipRulesDeserializer(item: any): IPRules { return { value: item["value"], action: item["action"], @@ -1457,5 +1457,5 @@ export type ActionType = string; /** The available API versions for the Microsoft.NetworkAnalytics RP. */ export enum KnownVersions { /** The 2023-11-15 stable version. */ - V20231115 = "2023-11-15", + V2023_11_15 = "2023-11-15", } From 8a92de3895d8492b5ef57d109651b61ea0226ddf Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:53:52 +0800 Subject: [PATCH 56/91] fix ci --- .../generated/rlc-initial/src/index.ts | 4 +-- .../generated/rlc-updated/src/index.ts | 4 +-- .../typespec-ts/review/ai-client.api.md | 4 +-- .../typespec-ts/src/models/models.ts | 6 ++-- .../review/ai-anomaly-detector.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/review/batch.api.md | 2 +- .../typespec-ts/src/models/models.ts | 32 +++++++++---------- .../review/ai-content-safety.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../typespec-ts/review/eventgrid.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../health-insights-radiologyinsights.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../typespec-ts/src/api/b/c/index.ts | 4 +-- .../typespec-ts/src/api/b/e/c/index.ts | 4 +-- .../generated/typespec-ts/src/api/b/index.ts | 4 +-- .../typespec-ts/src/models/models.ts | 4 +-- .../typespec-ts/review/openai_modular.api.md | 8 ++--- .../typespec-ts/src/models/models.ts | 8 ++--- .../review/overload_modular.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../typespec-ts/review/schema-registry.api.md | 6 ++-- .../typespec-ts/src/models/models.ts | 6 ++-- .../typespec-ts/review/widget_dpg.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- 26 files changed, 60 insertions(+), 60 deletions(-) diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts index 1b9b69d069..477abcdc86 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dPGClient"; +import DPGClient from "./dpgClient"; -export * from "./dPGClient"; +export * from "./dpgClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts index 1b9b69d069..477abcdc86 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dPGClient"; +import DPGClient from "./dpgClient"; -export * from "./dPGClient"; +export * from "./dpgClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md index 261699b53b..d0f0a4716e 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md +++ b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md @@ -527,7 +527,7 @@ export interface CredentialsApiKeyAuth { // @public export interface CredentialsSASAuth { - sAS: string; + sas: string; } // @public @@ -723,7 +723,7 @@ export type InputDataUnion = AppInsightsConfiguration | Dataset | InputData; // @public export enum KnownVersions { - Number20240701Preview = "2024-07-01-preview" + "V2024-07-01Preview" = "2024-07-01-preview" } // @public diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts index 3628ba3b39..19ac1ed6a0 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts @@ -696,12 +696,12 @@ export function connectionPropertiesSASAuthDeserializer( /** The credentials needed for Shared Access Signatures (SAS) authentication */ export interface CredentialsSASAuth { /** The Shared Access Signatures (SAS) token */ - sAS: string; + sas: string; } export function credentialsSASAuthDeserializer(item: any): CredentialsSASAuth { return { - sAS: item["SAS"], + sas: item["SAS"], }; } @@ -4773,5 +4773,5 @@ export type VectorStoreFileStatusFilter = /** Azure AI API versions */ export enum KnownVersions { /** Azure AI API version 2024-07-01-preview. */ - Number20240701Preview = "2024-07-01-preview", + "V2024-07-01Preview" = "2024-07-01-preview", } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index 3b36a829cc..6e9f00aa65 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -30,7 +30,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { // (undocumented) - V11 = "v1.1" + V1_1 = "v1.1" } // @public diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index 548faeb3b4..6ef55786d6 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -1073,5 +1073,5 @@ export function univariateUnivariateChangePointDetectionResultDeserializer( /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - V11 = "v1.1", + V1_1 = "v1.1", } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md index 9361d77ee0..0a87d83125 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md @@ -1324,7 +1324,7 @@ export interface JobStatistics { // @public export enum KnownVersions { - Number20230501170 = "2023-05-01.17.0" + "V2023-05-01.17.0" = "2023-05-01.17.0" } // @public diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts index a7285fab1a..95b397a59c 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts @@ -1144,10 +1144,10 @@ export function nodeVMExtensionDeserializer(item: any): NodeVMExtension { provisioningState: item["provisioningState"], vmExtension: !item["vmExtension"] ? item["vmExtension"] - : vMExtensionDeserializer(item["vmExtension"]), + : vmExtensionDeserializer(item["vmExtension"]), instanceView: !item["instanceView"] ? item["instanceView"] - : vMExtensionInstanceViewDeserializer(item["instanceView"]), + : vmExtensionInstanceViewDeserializer(item["instanceView"]), }; } @@ -1173,7 +1173,7 @@ export interface VMExtension { provisionAfterExtensions?: string[]; } -export function vMExtensionSerializer(item: VMExtension): any { +export function vmExtensionSerializer(item: VMExtension): any { return { name: item["name"], publisher: item["publisher"], @@ -1191,7 +1191,7 @@ export function vMExtensionSerializer(item: VMExtension): any { }; } -export function vMExtensionDeserializer(item: any): VMExtension { +export function vmExtensionDeserializer(item: any): VMExtension { return { name: item["name"], publisher: item["publisher"], @@ -1219,7 +1219,7 @@ export interface VMExtensionInstanceView { subStatuses?: InstanceViewStatus[]; } -export function vMExtensionInstanceViewDeserializer( +export function vmExtensionInstanceViewDeserializer( item: any, ): VMExtensionInstanceView { return { @@ -3378,8 +3378,8 @@ export function virtualMachineConfigurationSerializer( ), extensions: !item["extensions"] ? item["extensions"] - : vMExtensionArraySerializer(item["extensions"]), - osDisk: !item["osDisk"] ? item["osDisk"] : oSDiskSerializer(item["osDisk"]), + : vmExtensionArraySerializer(item["extensions"]), + osDisk: !item["osDisk"] ? item["osDisk"] : osDiskSerializer(item["osDisk"]), }; } @@ -3411,10 +3411,10 @@ export function virtualMachineConfigurationDeserializer( ), extensions: !item["extensions"] ? item["extensions"] - : vMExtensionArrayDeserializer(item["extensions"]), + : vmExtensionArrayDeserializer(item["extensions"]), osDisk: !item["osDisk"] ? item["osDisk"] - : oSDiskDeserializer(item["osDisk"]), + : osDiskDeserializer(item["osDisk"]), }; } @@ -3614,17 +3614,17 @@ export function nodePlacementConfigurationDeserializer( /** NodePlacementPolicyType enums */ export type NodePlacementPolicyType = "regional" | "zonal"; -export function vMExtensionArraySerializer(result: Array): any[] { +export function vmExtensionArraySerializer(result: Array): any[] { return result.map((item) => { - return vMExtensionSerializer(item); + return vmExtensionSerializer(item); }); } -export function vMExtensionArrayDeserializer( +export function vmExtensionArrayDeserializer( result: Array, ): any[] { return result.map((item) => { - return vMExtensionDeserializer(item); + return vmExtensionDeserializer(item); }); } @@ -3634,7 +3634,7 @@ export interface OSDisk { ephemeralOSDiskSettings?: DiffDiskSettings; } -export function oSDiskSerializer(item: OSDisk): any { +export function osDiskSerializer(item: OSDisk): any { return { ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] @@ -3642,7 +3642,7 @@ export function oSDiskSerializer(item: OSDisk): any { }; } -export function oSDiskDeserializer(item: any): OSDisk { +export function osDiskDeserializer(item: any): OSDisk { return { ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] @@ -6233,5 +6233,5 @@ export function batchApplicationDeserializer(item: any): BatchApplication { /** The Azure Batch service version. */ export enum KnownVersions { /** API Version 2023-05-01.17.0 */ - Number20230501170 = "2023-05-01.17.0", + "V2023-05-01.17.0" = "2023-05-01.17.0", } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md index 0169332a8f..3c8c0c2feb 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md @@ -126,7 +126,7 @@ export interface ImageData { // @public export enum KnownVersions { // (undocumented) - V20231001 = "2023-10-01" + V2023_10_01 = "2023-10-01" } // @public diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts index b5efd5581f..cba0b5cd18 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts @@ -361,5 +361,5 @@ export function textAnalyzeSeverityResultDeserializer( /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - V20231001 = "2023-10-01", + V2023_10_01 = "2023-10-01", } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md index a962d466f2..d64d71a289 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md @@ -74,7 +74,7 @@ export interface FailedLockToken { // @public export enum KnownServiceApiVersions { // (undocumented) - V20230601Preview = "2023-06-01-preview" + V2023_06_01Preview = "2023-06-01-preview" } // @public diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts index f5313b769c..ca4b14b7a4 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts @@ -258,7 +258,7 @@ export function rejectResultDeserializer(item: any): RejectResult { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - V20230601Preview = "2023-06-01-preview", + V2023_06_01Preview = "2023-06-01-preview", } export function cloudEventArraySerializer(result: Array): any[] { diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md index 4db8810861..c9632bdb2c 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md @@ -233,7 +233,7 @@ export type JobStatus = "notStarted" | "running" | "succeeded" | "failed" | "can // @public export enum KnownApiVersion { // (undocumented) - V20230901Preview = "2023-09-01-preview" + V2023_09_01Preview = "2023-09-01-preview" } // @public diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts index 74e54549fa..3d04d15a1b 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts @@ -2291,5 +2291,5 @@ export type RepeatabilityResult = "accepted" | "rejected"; /** Known values of {@link ApiVersion} that the service accepts. */ export enum KnownApiVersion { - V20230901Preview = "2023-09-01-preview", + V2023_09_01Preview = "2023-09-01-preview", } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts index 2e6e7f1f6e..8c60f5a4ae 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BCOp1OptionalParams, FooContext as Client } from "../../index.js"; -import { BA, bASerializer } from "../../../models/models.js"; +import { BA, baSerializer } from "../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -19,7 +19,7 @@ export function _op1Send( .path("/b/c") .post({ ...operationOptionsToRequestParameters(options), - body: bASerializer(body), + body: baSerializer(body), }); } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts index a14c4483a7..4508c37416 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BECOp1OptionalParams, FooContext as Client } from "../../../index.js"; -import { BEA, bEASerializer } from "../../../../models/models.js"; +import { BEA, beaSerializer } from "../../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -19,7 +19,7 @@ export function _op1Send( .path("/b/e") .post({ ...operationOptionsToRequestParameters(options), - body: bEASerializer(body), + body: beaSerializer(body), }); } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts index 3a00aefffb..b047ea4873 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BOp1OptionalParams, FooContext as Client } from "../index.js"; -import { BA, bASerializer } from "../../models/models.js"; +import { BA, baSerializer } from "../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -19,7 +19,7 @@ export function _op1Send( .path("/b") .post({ ...operationOptionsToRequestParameters(options), - body: bASerializer(body), + body: baSerializer(body), }); } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts index a553429661..b8f9cf5f20 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts @@ -15,7 +15,7 @@ export interface BA { prop2: string; } -export function bASerializer(item: BA): any { +export function baSerializer(item: BA): any { return { prop2: item["prop2"] }; } @@ -24,6 +24,6 @@ export interface BEA { prop3: string; } -export function bEASerializer(item: BEA): any { +export function beaSerializer(item: BEA): any { return { prop3: item["prop3"] }; } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md index 17815191d3..53f2fb069c 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md @@ -827,13 +827,13 @@ export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "102 // @public export enum KnownServiceApiVersions { // (undocumented) - V20221201 = "2022-12-01", + V2022_12_01 = "2022-12-01", // (undocumented) - V20230515 = "2023-05-15", + V2023_05_15 = "2023-05-15", // (undocumented) - V20240201 = "2024-02-01", + V2024_02_01 = "2024-02-01", // (undocumented) - V20240601 = "2024-06-01" + V2024_06_01 = "2024-06-01" } // @public diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts index 3fd2d4c379..97bdab0f54 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts @@ -3873,8 +3873,8 @@ export function embeddingsUsageDeserializer(item: any): EmbeddingsUsage { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - V20221201 = "2022-12-01", - V20230515 = "2023-05-15", - V20240201 = "2024-02-01", - V20240601 = "2024-06-01", + V2022_12_01 = "2022-12-01", + V2023_05_15 = "2023-05-15", + V2024_02_01 = "2024-02-01", + V2024_06_01 = "2024-06-01", } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md index 862f76a14d..d528f802b2 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md @@ -30,7 +30,7 @@ export interface FooOperationsOperations { // @public export enum KnownVersions { - Number20220830 = "2022-08-30" + "V2022-08-30" = "2022-08-30" } // @public (undocumented) diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts index 93040757c6..af52f2870d 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts @@ -4,5 +4,5 @@ /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - Number20220830 = "2022-08-30", + "V2022-08-30" = "2022-08-30", } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md index 9b413392ae..73f2602824 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md @@ -19,9 +19,9 @@ export type ContinuablePage = TPage & { // @public export enum KnownServiceApiVersions { - V202110 = "2021-10", - V202210 = "2022-10", - V20230701 = "2023-07-01" + V2021_10 = "2021-10", + V2022_10 = "2022-10", + V2023_07_01 = "2023-07-01" } // @public diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts index 8bd71fc6d2..7a2337bfe7 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts @@ -140,11 +140,11 @@ export type SchemaContentTypeValues = /** Represents the Schema Registry API version to use for requests. */ export enum KnownServiceApiVersions { /** Azure Schema Registry 2021-10 Version */ - V202110 = "2021-10", + V2021_10 = "2021-10", /** Azure Schema Registry 2022-10 Version */ - V202210 = "2022-10", + V2022_10 = "2022-10", /** Azure Schema Registry 2023-07-01 Version. This is the default version. */ - V20230701 = "2023-07-01", + V2023_07_01 = "2023-07-01", } /** The content type for the schema. */ diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md index 2ebea4a745..9842564959 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md @@ -37,7 +37,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { - Number100 = "1.0.0" + "V1.0.0" = "1.0.0" } // @public diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts index bf79e4bf28..049f27b59a 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts @@ -112,5 +112,5 @@ export function nonReferencedModelDeserializer(item: any): NonReferencedModel { /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - Number100 = "1.0.0", + "V1.0.0" = "1.0.0", } From d7c1d6100d1a6b76e05c7e619880bf7a99eb889b Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:37:11 +0800 Subject: [PATCH 57/91] update --- .../generated/rlc-initial/src/dPGClient.ts | 63 ------------------- .../generated/rlc-initial/src/index.ts | 4 +- 2 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts deleted file mode 100644 index 589984849a..0000000000 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "./logger"; -import { DPGClient } from "./clientDefinitions"; - -/** The optional parameters for the client */ -export interface DPGClientOptions extends ClientOptions {} - -/** - * Initialize a new instance of `DPGClient` - * @param options - the parameter for all optional parameters - */ -export default function createClient( - options: DPGClientOptions = {}, -): DPGClient { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; - const userAgentInfo = `azsdk-js-rlcClient-rest/1.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - }; - const client = getClient(endpointUrl, options) as DPGClient; - - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - logger.warning( - "This client does not support client api-version, please change it at the operation level", - ); - } - - return { - ...client, - params: { - headNoParams: (options) => { - return client.path("/serviceDriven/parameters").head(options); - }, - getRequired: (options) => { - return client.path("/serviceDriven/parameters").get(options); - }, - putRequiredOptional: (options) => { - return client.path("/serviceDriven/parameters").put(options); - }, - postParameters: (options) => { - return client.path("/serviceDriven/parameters").post(options); - }, - getOptional: (options) => { - return client.path("/serviceDriven/moreParameters").get(options); - }, - }, - }; -} diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts index 477abcdc86..1b9b69d069 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dpgClient"; +import DPGClient from "./dPGClient"; -export * from "./dpgClient"; +export * from "./dPGClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; From 6139fe6f32b4d98ad66ee62433391a492adff455 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:39:31 +0800 Subject: [PATCH 58/91] update --- .../test/version-tolerance/generated/rlc-initial/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts index 1b9b69d069..477abcdc86 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dPGClient"; +import DPGClient from "./dpgClient"; -export * from "./dPGClient"; +export * from "./dpgClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; From 4ab4e88a13fdc227f20dd83506cb8c5a987860d4 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:39:40 +0800 Subject: [PATCH 59/91] update --- .../generated/rlc-initial/src/dpgClient.ts | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts new file mode 100644 index 0000000000..589984849a --- /dev/null +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import { DPGClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface DPGClientOptions extends ClientOptions {} + +/** + * Initialize a new instance of `DPGClient` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: DPGClientOptions = {}, +): DPGClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-rlcClient-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + const client = getClient(endpointUrl, options) as DPGClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + + return { + ...client, + params: { + headNoParams: (options) => { + return client.path("/serviceDriven/parameters").head(options); + }, + getRequired: (options) => { + return client.path("/serviceDriven/parameters").get(options); + }, + putRequiredOptional: (options) => { + return client.path("/serviceDriven/parameters").put(options); + }, + postParameters: (options) => { + return client.path("/serviceDriven/parameters").post(options); + }, + getOptional: (options) => { + return client.path("/serviceDriven/moreParameters").get(options); + }, + }, + }; +} From 7a01172595a8ee74dc3a4cd7a27edfe5d48fb6b3 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:44:55 +0800 Subject: [PATCH 60/91] update dpgName --- .../generated/rlc-updated/src/{dPGClient.ts => dpgClient2.ts} | 0 .../test/version-tolerance/generated/rlc-updated/src/index.ts | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/{dPGClient.ts => dpgClient2.ts} (100%) diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dPGClient.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient2.ts similarity index 100% rename from packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dPGClient.ts rename to packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient2.ts diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts index 477abcdc86..046b4a5c1a 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dpgClient"; +import DPGClient from "./dpgClient2"; -export * from "./dpgClient"; +export * from "./dpgClient2"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; From cfd75a0ed0bb180356574c859585a8c96d7da4da Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:46:05 +0800 Subject: [PATCH 61/91] update dpgName --- .../generated/rlc-updated/src/{dpgClient2.ts => dpgClient.ts} | 0 .../test/version-tolerance/generated/rlc-updated/src/index.ts | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/{dpgClient2.ts => dpgClient.ts} (100%) diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient2.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient.ts similarity index 100% rename from packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient2.ts rename to packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient.ts diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts index 046b4a5c1a..477abcdc86 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dpgClient2"; +import DPGClient from "./dpgClient"; -export * from "./dpgClient2"; +export * from "./dpgClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; From 75b3b6399b4b5527fc823911f05c72ca529cd8cc Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 12:29:09 +0800 Subject: [PATCH 62/91] Update the autorest cases in HLC --- .../generated/petstore/src/models/index.ts | 53 ++++++++++++++++++- .../test/integration/swaggers/petstore.json | 23 +++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts b/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts index accaaae99e..a29d865e2a 100644 --- a/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts +++ b/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts @@ -70,6 +70,40 @@ export enum KnownPetStatus { Pending = "pending", /** Sold */ Sold = "sold", + /** PascalCase1 */ + PascalCase1 = "pascalCase1", + /** PascalCase2 */ + PascalCase2 = "PascalCase2", + /** Pascalcase3 */ + Pascalcase3 = "pascalcase3", + /** Pascalcase4 */ + Pascalcase4 = "Pascalcase4", + /** PascalCase5 */ + PascalCase5 = "pascal_case_5", + /** PascalCase6 */ + PascalCase6 = "pascal_case6", + /** PascalCase7 */ + PascalCase7 = "_pascal_case7", + /** PascalCase8 */ + PascalCase8 = "pascal, case8", + /** MAXOfMLD */ + MAXOfMLD = "MAX_of_MLD", + /** YESORNO */ + YESORNO = "YES OR NO", + /** FailedNOTValidation */ + FailedNOTValidation = "FAILED_NOT_VALIDATION", + /** ValidationSuccess */ + ValidationSuccess = "VALIDATION_SUCCESS", + /** PascalCase6666 */ + PascalCase6666 = "___pascal____case6666", + /** Ninety */ + Ninety = "090", + /** One0 */ + One0 = "1.0", + /** Select */ + Select = "$select", + /** HateThreating */ + HateThreating = "hate/threating", } /** @@ -79,7 +113,24 @@ export enum KnownPetStatus { * ### Known values supported by the service * **available** \ * **pending** \ - * **sold** + * **sold** \ + * **pascalCase1** \ + * **PascalCase2** \ + * **pascalcase3** \ + * **Pascalcase4** \ + * **pascal_case_5** \ + * **pascal_case6** \ + * **_pascal_case7** \ + * **pascal, case8** \ + * **MAX_of_MLD** \ + * **YES OR NO** \ + * **FAILED_NOT_VALIDATION** \ + * **VALIDATION_SUCCESS** \ + * **___pascal____case6666** \ + * **090** \ + * **1.0** \ + * **$select** \ + * **hate\/threating** */ export type PetStatus = string; diff --git a/packages/autorest.typescript/test/integration/swaggers/petstore.json b/packages/autorest.typescript/test/integration/swaggers/petstore.json index 9e2d3223b6..71f828c9a1 100644 --- a/packages/autorest.typescript/test/integration/swaggers/petstore.json +++ b/packages/autorest.typescript/test/integration/swaggers/petstore.json @@ -884,7 +884,28 @@ "status": { "type": "string", "description": "pet status in the store", - "enum": ["available", "pending", "sold"] + "enum": [ + "available", + "pending", + "sold", + "pascalCase1", + "PascalCase2", + "pascalcase3", + "Pascalcase4", + "pascal_case_5", + "pascal_case6", + "_pascal_case7", + "pascal, case8", + "MAX_of_MLD", + "YES OR NO", + "FAILED_NOT_VALIDATION", + "VALIDATION_SUCCESS", + "___pascal____case6666", + "090", + "1.0", + "$select", + "hate/threating" + ] }, "petRestrictionLevel": { "type": "string", From 64afca50496894805a8ed1c7761273e431d4b927 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 20 Nov 2024 12:34:30 +0800 Subject: [PATCH 63/91] Update the int test --- .../typespec-ts/test/modularIntegration/clientNaming.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts b/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts index 74d1ec6346..2ed37f16be 100644 --- a/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts @@ -19,7 +19,7 @@ describe("NameAndEncodedName Client", () => { }); it("should work with property language", async () => { - const result = await client.language({ tSName: true }); + const result = await client.language({ tsName: true }); assert.isUndefined(result); }); From ec92f0b150eccbb5000762094d2b6105c0b6d3bc Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:20:17 +0800 Subject: [PATCH 64/91] fix ci --- .../corecompattest/src/models/index.ts | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts b/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts index 2c91864cd5..dd417bff60 100644 --- a/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts +++ b/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts @@ -71,6 +71,40 @@ export enum KnownPetStatus { Pending = "pending", /** Sold */ Sold = "sold", + /** PascalCase1 */ + PascalCase1 = "pascalCase1", + /** PascalCase2 */ + PascalCase2 = "PascalCase2", + /** Pascalcase3 */ + Pascalcase3 = "pascalcase3", + /** Pascalcase4 */ + Pascalcase4 = "Pascalcase4", + /** PascalCase5 */ + PascalCase5 = "pascal_case_5", + /** PascalCase6 */ + PascalCase6 = "pascal_case6", + /** PascalCase7 */ + PascalCase7 = "_pascal_case7", + /** PascalCase8 */ + PascalCase8 = "pascal, case8", + /** MAXOfMLD */ + MAXOfMLD = "MAX_of_MLD", + /** YESORNO */ + YESORNO = "YES OR NO", + /** FailedNOTValidation */ + FailedNOTValidation = "FAILED_NOT_VALIDATION", + /** ValidationSuccess */ + ValidationSuccess = "VALIDATION_SUCCESS", + /** PascalCase6666 */ + PascalCase6666 = "___pascal____case6666", + /** Ninety */ + Ninety = "090", + /** One0 */ + One0 = "1.0", + /** Select */ + Select = "$select", + /** HateThreating */ + HateThreating = "hate/threating", } /** @@ -80,7 +114,24 @@ export enum KnownPetStatus { * ### Known values supported by the service * **available** \ * **pending** \ - * **sold** + * **sold** \ + * **pascalCase1** \ + * **PascalCase2** \ + * **pascalcase3** \ + * **Pascalcase4** \ + * **pascal_case_5** \ + * **pascal_case6** \ + * **_pascal_case7** \ + * **pascal, case8** \ + * **MAX_of_MLD** \ + * **YES OR NO** \ + * **FAILED_NOT_VALIDATION** \ + * **VALIDATION_SUCCESS** \ + * **___pascal____case6666** \ + * **090** \ + * **1.0** \ + * **$select** \ + * **hate\/threating** */ export type PetStatus = string; From 1e7a7b6bbc50d6128329c58cb962ce648fe7f73a Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 21 Nov 2024 13:57:10 +0800 Subject: [PATCH 65/91] Improve with number for prefix and suffix --- packages/rlc-common/src/helpers/nameUtils.ts | 50 ++++++++++++++++--- .../rlc-common/test/helpers/nameUtils.spec.ts | 9 ++-- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 251e0c25a1..3a00c13800 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -240,24 +240,58 @@ function deconstruct(identifier: string): Array { // Split by non-alphanumeric characters and try to keep _-. between numbers const refinedParts: string[] = []; for (let i = 0; i < parts.length; i++) { - const part = parts[i]; - const isPrevNumber = isNumber(parts[i - 1]); - const isNextNumber = isNumber(parts[i + 1]); - if ((isPrevNumber || isNextNumber) && ["_", "-", "."].includes(part)) { - refinedParts.push(part); - } else { + const [firstMatch, midPart, lastMatch] = extractReservedCharAndSubString( + parts[i], + isNumber(parts[i - 1]), + isNumber(parts[i + 1]) + ); + if (firstMatch) { + refinedParts.push(firstMatch); + } + if (midPart) { refinedParts.push( - ...parts[i] + ...midPart .split(/[\W|_]+/) .map((each) => (isFullyUpperCase(each) ? each : each.toLowerCase())) ); } + if (lastMatch) { + refinedParts.push(lastMatch); + } } return refinedParts.filter((part) => part.trim().length > 0); } +function isReservedChar(part: string) { + return ["_", "-", "."].includes(part); +} + +function extractReservedCharAndSubString( + part: string, + isPrevNumber: boolean = false, + isNextNumber: boolean = false +) { + if ((isPrevNumber || isNextNumber) && isReservedChar(part)) { + return [part]; + } + const firstMatch = isPrevNumber && isReservedChar(part[0]); + const lastMatch = isNextNumber && isReservedChar(part[part.length - 1]); + if (firstMatch && lastMatch) { + return [part[0], part.substring(1, part.length - 1), part[part.length - 1]]; + } else if (firstMatch && !lastMatch) { + return [part[0], part.substring(1)]; + } else if (!firstMatch && lastMatch) { + return [ + undefined, + part.substring(0, part.length - 1), + part[part.length - 1] + ]; + } + return [undefined, part]; +} + function isNumber(value?: string) { - return value && value.match(/^\d+$/); + return Boolean(value && value.match(/^\d+$/)); } export function getModelsName(title: string): string { diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index b1300cb12c..48842ba158 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -7,7 +7,7 @@ describe("#normalizeName", () => { it("should normalize any chars including digits properly", () => { expect(normalizeName("-10Min", NameType.EnumMemberName)).to.equal("Num-10Min"); expect(normalizeName("LROsPut202Retry200_202Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200_202Response"); - expect(normalizeName("LROsPut202Retry200_Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200Response"); + expect(normalizeName("LROsPut202Retry200_Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200_Response"); expect(normalizeName("LROsPut202Retry200 202Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200202Response"); expect(normalizeName("090", NameType.EnumMemberName)).to.equal("Num090"); expect(normalizeName("10", NameType.EnumMemberName)).to.equal("Num10"); @@ -20,7 +20,10 @@ describe("#normalizeName", () => { expect(normalizeName("1.1", NameType.EnumMemberName)).to.equal("Num1.1"); expect(normalizeName("-1.1", NameType.EnumMemberName)).to.equal("Num-1.1"); expect(normalizeName("v2023_11_15", NameType.EnumMemberName)).to.equal("V2023_11_15"); - expect(normalizeName("2024-07-01-preview", NameType.EnumMemberName)).to.equal("Num2024-07-01Preview"); + expect(normalizeName("2024-07-01-preview", NameType.EnumMemberName)).to.equal("Num2024-07-01-Preview"); + expect(normalizeName("Version-2024-07-01-preview", NameType.EnumMemberName)).to.equal("Version-2024-07-01-Preview"); + expect(normalizeName("Version-101-preview", NameType.EnumMemberName)).to.equal("Version-101-Preview"); + expect(normalizeName("100_Inc_200", NameType.EnumMemberName)).to.equal("Num100_Inc_200"); expect(normalizeName("v1_1", NameType.EnumMemberName, { numberPrefixOverride: "V" })).to.equal("V1_1"); @@ -79,7 +82,7 @@ describe("#normalizeName", () => { expect(normalizeName("1.1", NameType.Property)).to.equal("num1.1"); expect(normalizeName("-1.1", NameType.Property)).to.equal("num-1.1"); expect(normalizeName("v2023_11_15", NameType.Property)).to.equal("v2023_11_15"); - expect(normalizeName("2024-07-01-preview", NameType.Property)).to.equal("num2024-07-01Preview"); + expect(normalizeName("2024-07-01-preview", NameType.Property)).to.equal("num2024-07-01-Preview"); expect(normalizeName("v1_1", NameType.Property, { numberPrefixOverride: "V" })).to.equal("v1_1"); From 4379f995cde9b153f3e8ea6f080beb9d8ff8c4bd Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:14:47 +0800 Subject: [PATCH 66/91] fix ci --- .../bodyComplexRest/src/parameters.ts | 4 +- .../generated/headerRest/src/parameters.ts | 4 +- .../httpInfrastructureRest/src/parameters.ts | 173 +++++++++--------- .../generated/lroRest/src/parameters.ts | 55 +++--- .../test/unit/parametersGenerator.spec.ts | 2 +- 5 files changed, 122 insertions(+), 116 deletions(-) diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts index 85dc564c3a..2a3b5ac1fa 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts @@ -163,7 +163,7 @@ export type PrimitivePutDateTimeParameters = PrimitivePutDateTimeMediaTypesParam & PrimitivePutDateTimeBodyParam & RequestParameters; -export type PrimitiveGetDateTimeRfc1123Parameters = RequestParameters; +export type PrimitiveGetDateTimeRfc1123_Parameters = RequestParameters; export interface PrimitivePutDateTimeRfc1123BodyParam { /** Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT' */ @@ -175,7 +175,7 @@ export interface PrimitivePutDateTimeRfc1123MediaTypesParam { contentType?: "application/json"; } -export type PrimitivePutDateTimeRfc1123Parameters = +export type PrimitivePutDateTimeRfc1123_Parameters = PrimitivePutDateTimeRfc1123MediaTypesParam & PrimitivePutDateTimeRfc1123BodyParam & RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts index eb87b8d6bf..db2dacbcf8 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts @@ -249,7 +249,7 @@ export interface HeaderParamDatetimeRfc1123HeaderParam { headers: RawHttpHeadersInput & HeaderParamDatetimeRfc1123Headers; } -export type HeaderParamDatetimeRfc1123Parameters = +export type HeaderParamDatetimeRfc1123_Parameters = HeaderParamDatetimeRfc1123HeaderParam & RequestParameters; export interface HeaderResponseDatetimeRfc1123Headers { @@ -261,7 +261,7 @@ export interface HeaderResponseDatetimeRfc1123HeaderParam { headers: RawHttpHeadersInput & HeaderResponseDatetimeRfc1123Headers; } -export type HeaderResponseDatetimeRfc1123Parameters = +export type HeaderResponseDatetimeRfc1123_Parameters = HeaderResponseDatetimeRfc1123HeaderParam & RequestParameters; export interface HeaderParamDurationHeaders { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts index 61c4ddfe1a..e50b328c2e 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts @@ -6,9 +6,9 @@ import { RequestParameters } from "@azure-rest/core-client"; export type HttpFailureGetEmptyErrorParameters = RequestParameters; export type HttpFailureGetNoModelErrorParameters = RequestParameters; export type HttpFailureGetNoModelEmptyParameters = RequestParameters; -export type HttpSuccessHead200Parameters = RequestParameters; -export type HttpSuccessGet200Parameters = RequestParameters; -export type HttpSuccessOptions200Parameters = RequestParameters; +export type HttpSuccessHead200_Parameters = RequestParameters; +export type HttpSuccessGet200_Parameters = RequestParameters; +export type HttpSuccessOptions200_Parameters = RequestParameters; export interface HttpSuccessPut200BodyParam { /** Simple boolean value true */ @@ -20,7 +20,7 @@ export interface HttpSuccessPut200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut200Parameters = HttpSuccessPut200MediaTypesParam & +export type HttpSuccessPut200_Parameters = HttpSuccessPut200MediaTypesParam & HttpSuccessPut200BodyParam & RequestParameters; @@ -34,9 +34,10 @@ export interface HttpSuccessPatch200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPatch200Parameters = HttpSuccessPatch200MediaTypesParam & - HttpSuccessPatch200BodyParam & - RequestParameters; +export type HttpSuccessPatch200_Parameters = + HttpSuccessPatch200MediaTypesParam & + HttpSuccessPatch200BodyParam & + RequestParameters; export interface HttpSuccessPost200BodyParam { /** Simple boolean value true */ @@ -48,7 +49,7 @@ export interface HttpSuccessPost200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost200Parameters = HttpSuccessPost200MediaTypesParam & +export type HttpSuccessPost200_Parameters = HttpSuccessPost200MediaTypesParam & HttpSuccessPost200BodyParam & RequestParameters; @@ -62,7 +63,7 @@ export interface HttpSuccessDelete200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessDelete200Parameters = +export type HttpSuccessDelete200_Parameters = HttpSuccessDelete200MediaTypesParam & HttpSuccessDelete200BodyParam & RequestParameters; @@ -77,7 +78,7 @@ export interface HttpSuccessPut201MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut201Parameters = HttpSuccessPut201MediaTypesParam & +export type HttpSuccessPut201_Parameters = HttpSuccessPut201MediaTypesParam & HttpSuccessPut201BodyParam & RequestParameters; @@ -91,7 +92,7 @@ export interface HttpSuccessPost201MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost201Parameters = HttpSuccessPost201MediaTypesParam & +export type HttpSuccessPost201_Parameters = HttpSuccessPost201MediaTypesParam & HttpSuccessPost201BodyParam & RequestParameters; @@ -105,7 +106,7 @@ export interface HttpSuccessPut202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut202Parameters = HttpSuccessPut202MediaTypesParam & +export type HttpSuccessPut202_Parameters = HttpSuccessPut202MediaTypesParam & HttpSuccessPut202BodyParam & RequestParameters; @@ -119,9 +120,10 @@ export interface HttpSuccessPatch202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPatch202Parameters = HttpSuccessPatch202MediaTypesParam & - HttpSuccessPatch202BodyParam & - RequestParameters; +export type HttpSuccessPatch202_Parameters = + HttpSuccessPatch202MediaTypesParam & + HttpSuccessPatch202BodyParam & + RequestParameters; export interface HttpSuccessPost202BodyParam { /** Simple boolean value true */ @@ -133,7 +135,7 @@ export interface HttpSuccessPost202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost202Parameters = HttpSuccessPost202MediaTypesParam & +export type HttpSuccessPost202_Parameters = HttpSuccessPost202MediaTypesParam & HttpSuccessPost202BodyParam & RequestParameters; @@ -147,11 +149,11 @@ export interface HttpSuccessDelete202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessDelete202Parameters = +export type HttpSuccessDelete202_Parameters = HttpSuccessDelete202MediaTypesParam & HttpSuccessDelete202BodyParam & RequestParameters; -export type HttpSuccessHead204Parameters = RequestParameters; +export type HttpSuccessHead204_Parameters = RequestParameters; export interface HttpSuccessPut204BodyParam { /** Simple boolean value true */ @@ -163,7 +165,7 @@ export interface HttpSuccessPut204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut204Parameters = HttpSuccessPut204MediaTypesParam & +export type HttpSuccessPut204_Parameters = HttpSuccessPut204MediaTypesParam & HttpSuccessPut204BodyParam & RequestParameters; @@ -177,9 +179,10 @@ export interface HttpSuccessPatch204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPatch204Parameters = HttpSuccessPatch204MediaTypesParam & - HttpSuccessPatch204BodyParam & - RequestParameters; +export type HttpSuccessPatch204_Parameters = + HttpSuccessPatch204MediaTypesParam & + HttpSuccessPatch204BodyParam & + RequestParameters; export interface HttpSuccessPost204BodyParam { /** Simple boolean value true */ @@ -191,7 +194,7 @@ export interface HttpSuccessPost204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost204Parameters = HttpSuccessPost204MediaTypesParam & +export type HttpSuccessPost204_Parameters = HttpSuccessPost204MediaTypesParam & HttpSuccessPost204BodyParam & RequestParameters; @@ -205,15 +208,15 @@ export interface HttpSuccessDelete204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessDelete204Parameters = +export type HttpSuccessDelete204_Parameters = HttpSuccessDelete204MediaTypesParam & HttpSuccessDelete204BodyParam & RequestParameters; -export type HttpSuccessHead404Parameters = RequestParameters; -export type HttpRedirectsHead300Parameters = RequestParameters; -export type HttpRedirectsGet300Parameters = RequestParameters; -export type HttpRedirectsHead301Parameters = RequestParameters; -export type HttpRedirectsGet301Parameters = RequestParameters; +export type HttpSuccessHead404_Parameters = RequestParameters; +export type HttpRedirectsHead300_Parameters = RequestParameters; +export type HttpRedirectsGet300_Parameters = RequestParameters; +export type HttpRedirectsHead301_Parameters = RequestParameters; +export type HttpRedirectsGet301_Parameters = RequestParameters; export interface HttpRedirectsPut301BodyParam { /** Simple boolean value true */ @@ -225,11 +228,12 @@ export interface HttpRedirectsPut301MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPut301Parameters = HttpRedirectsPut301MediaTypesParam & - HttpRedirectsPut301BodyParam & - RequestParameters; -export type HttpRedirectsHead302Parameters = RequestParameters; -export type HttpRedirectsGet302Parameters = RequestParameters; +export type HttpRedirectsPut301_Parameters = + HttpRedirectsPut301MediaTypesParam & + HttpRedirectsPut301BodyParam & + RequestParameters; +export type HttpRedirectsHead302_Parameters = RequestParameters; +export type HttpRedirectsGet302_Parameters = RequestParameters; export interface HttpRedirectsPatch302BodyParam { /** Simple boolean value true */ @@ -241,7 +245,7 @@ export interface HttpRedirectsPatch302MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPatch302Parameters = +export type HttpRedirectsPatch302_Parameters = HttpRedirectsPatch302MediaTypesParam & HttpRedirectsPatch302BodyParam & RequestParameters; @@ -256,13 +260,13 @@ export interface HttpRedirectsPost303MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPost303Parameters = +export type HttpRedirectsPost303_Parameters = HttpRedirectsPost303MediaTypesParam & HttpRedirectsPost303BodyParam & RequestParameters; -export type HttpRedirectsHead307Parameters = RequestParameters; -export type HttpRedirectsGet307Parameters = RequestParameters; -export type HttpRedirectsOptions307Parameters = RequestParameters; +export type HttpRedirectsHead307_Parameters = RequestParameters; +export type HttpRedirectsGet307_Parameters = RequestParameters; +export type HttpRedirectsOptions307_Parameters = RequestParameters; export interface HttpRedirectsPut307BodyParam { /** Simple boolean value true */ @@ -274,9 +278,10 @@ export interface HttpRedirectsPut307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPut307Parameters = HttpRedirectsPut307MediaTypesParam & - HttpRedirectsPut307BodyParam & - RequestParameters; +export type HttpRedirectsPut307_Parameters = + HttpRedirectsPut307MediaTypesParam & + HttpRedirectsPut307BodyParam & + RequestParameters; export interface HttpRedirectsPatch307BodyParam { /** Simple boolean value true */ @@ -288,7 +293,7 @@ export interface HttpRedirectsPatch307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPatch307Parameters = +export type HttpRedirectsPatch307_Parameters = HttpRedirectsPatch307MediaTypesParam & HttpRedirectsPatch307BodyParam & RequestParameters; @@ -303,7 +308,7 @@ export interface HttpRedirectsPost307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPost307Parameters = +export type HttpRedirectsPost307_Parameters = HttpRedirectsPost307MediaTypesParam & HttpRedirectsPost307BodyParam & RequestParameters; @@ -318,13 +323,13 @@ export interface HttpRedirectsDelete307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsDelete307Parameters = +export type HttpRedirectsDelete307_Parameters = HttpRedirectsDelete307MediaTypesParam & HttpRedirectsDelete307BodyParam & RequestParameters; -export type HttpClientFailureHead400Parameters = RequestParameters; -export type HttpClientFailureGet400Parameters = RequestParameters; -export type HttpClientFailureOptions400Parameters = RequestParameters; +export type HttpClientFailureHead400_Parameters = RequestParameters; +export type HttpClientFailureGet400_Parameters = RequestParameters; +export type HttpClientFailureOptions400_Parameters = RequestParameters; export interface HttpClientFailurePut400BodyParam { /** Simple boolean value true */ @@ -336,7 +341,7 @@ export interface HttpClientFailurePut400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut400Parameters = +export type HttpClientFailurePut400_Parameters = HttpClientFailurePut400MediaTypesParam & HttpClientFailurePut400BodyParam & RequestParameters; @@ -351,7 +356,7 @@ export interface HttpClientFailurePatch400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePatch400Parameters = +export type HttpClientFailurePatch400_Parameters = HttpClientFailurePatch400MediaTypesParam & HttpClientFailurePatch400BodyParam & RequestParameters; @@ -366,7 +371,7 @@ export interface HttpClientFailurePost400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePost400Parameters = +export type HttpClientFailurePost400_Parameters = HttpClientFailurePost400MediaTypesParam & HttpClientFailurePost400BodyParam & RequestParameters; @@ -381,14 +386,14 @@ export interface HttpClientFailureDelete400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailureDelete400Parameters = +export type HttpClientFailureDelete400_Parameters = HttpClientFailureDelete400MediaTypesParam & HttpClientFailureDelete400BodyParam & RequestParameters; -export type HttpClientFailureHead401Parameters = RequestParameters; -export type HttpClientFailureGet402Parameters = RequestParameters; -export type HttpClientFailureOptions403Parameters = RequestParameters; -export type HttpClientFailureGet403Parameters = RequestParameters; +export type HttpClientFailureHead401_Parameters = RequestParameters; +export type HttpClientFailureGet402_Parameters = RequestParameters; +export type HttpClientFailureOptions403_Parameters = RequestParameters; +export type HttpClientFailureGet403_Parameters = RequestParameters; export interface HttpClientFailurePut404BodyParam { /** Simple boolean value true */ @@ -400,7 +405,7 @@ export interface HttpClientFailurePut404MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut404Parameters = +export type HttpClientFailurePut404_Parameters = HttpClientFailurePut404MediaTypesParam & HttpClientFailurePut404BodyParam & RequestParameters; @@ -415,7 +420,7 @@ export interface HttpClientFailurePatch405MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePatch405Parameters = +export type HttpClientFailurePatch405_Parameters = HttpClientFailurePatch405MediaTypesParam & HttpClientFailurePatch405BodyParam & RequestParameters; @@ -430,7 +435,7 @@ export interface HttpClientFailurePost406MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePost406Parameters = +export type HttpClientFailurePost406_Parameters = HttpClientFailurePost406MediaTypesParam & HttpClientFailurePost406BodyParam & RequestParameters; @@ -445,7 +450,7 @@ export interface HttpClientFailureDelete407MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailureDelete407Parameters = +export type HttpClientFailureDelete407_Parameters = HttpClientFailureDelete407MediaTypesParam & HttpClientFailureDelete407BodyParam & RequestParameters; @@ -460,14 +465,14 @@ export interface HttpClientFailurePut409MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut409Parameters = +export type HttpClientFailurePut409_Parameters = HttpClientFailurePut409MediaTypesParam & HttpClientFailurePut409BodyParam & RequestParameters; -export type HttpClientFailureHead410Parameters = RequestParameters; -export type HttpClientFailureGet411Parameters = RequestParameters; -export type HttpClientFailureOptions412Parameters = RequestParameters; -export type HttpClientFailureGet412Parameters = RequestParameters; +export type HttpClientFailureHead410_Parameters = RequestParameters; +export type HttpClientFailureGet411_Parameters = RequestParameters; +export type HttpClientFailureOptions412_Parameters = RequestParameters; +export type HttpClientFailureGet412_Parameters = RequestParameters; export interface HttpClientFailurePut413BodyParam { /** Simple boolean value true */ @@ -479,7 +484,7 @@ export interface HttpClientFailurePut413MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut413Parameters = +export type HttpClientFailurePut413_Parameters = HttpClientFailurePut413MediaTypesParam & HttpClientFailurePut413BodyParam & RequestParameters; @@ -494,7 +499,7 @@ export interface HttpClientFailurePatch414MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePatch414Parameters = +export type HttpClientFailurePatch414_Parameters = HttpClientFailurePatch414MediaTypesParam & HttpClientFailurePatch414BodyParam & RequestParameters; @@ -509,11 +514,11 @@ export interface HttpClientFailurePost415MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePost415Parameters = +export type HttpClientFailurePost415_Parameters = HttpClientFailurePost415MediaTypesParam & HttpClientFailurePost415BodyParam & RequestParameters; -export type HttpClientFailureGet416Parameters = RequestParameters; +export type HttpClientFailureGet416_Parameters = RequestParameters; export interface HttpClientFailureDelete417BodyParam { /** Simple boolean value true */ @@ -525,13 +530,13 @@ export interface HttpClientFailureDelete417MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailureDelete417Parameters = +export type HttpClientFailureDelete417_Parameters = HttpClientFailureDelete417MediaTypesParam & HttpClientFailureDelete417BodyParam & RequestParameters; -export type HttpClientFailureHead429Parameters = RequestParameters; -export type HttpServerFailureHead501Parameters = RequestParameters; -export type HttpServerFailureGet501Parameters = RequestParameters; +export type HttpClientFailureHead429_Parameters = RequestParameters; +export type HttpServerFailureHead501_Parameters = RequestParameters; +export type HttpServerFailureGet501_Parameters = RequestParameters; export interface HttpServerFailurePost505BodyParam { /** Simple boolean value true */ @@ -543,7 +548,7 @@ export interface HttpServerFailurePost505MediaTypesParam { contentType?: "application/json"; } -export type HttpServerFailurePost505Parameters = +export type HttpServerFailurePost505_Parameters = HttpServerFailurePost505MediaTypesParam & HttpServerFailurePost505BodyParam & RequestParameters; @@ -558,11 +563,11 @@ export interface HttpServerFailureDelete505MediaTypesParam { contentType?: "application/json"; } -export type HttpServerFailureDelete505Parameters = +export type HttpServerFailureDelete505_Parameters = HttpServerFailureDelete505MediaTypesParam & HttpServerFailureDelete505BodyParam & RequestParameters; -export type HttpRetryHead408Parameters = RequestParameters; +export type HttpRetryHead408_Parameters = RequestParameters; export interface HttpRetryPut500BodyParam { /** Simple boolean value true */ @@ -574,7 +579,7 @@ export interface HttpRetryPut500MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPut500Parameters = HttpRetryPut500MediaTypesParam & +export type HttpRetryPut500_Parameters = HttpRetryPut500MediaTypesParam & HttpRetryPut500BodyParam & RequestParameters; @@ -588,11 +593,11 @@ export interface HttpRetryPatch500MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPatch500Parameters = HttpRetryPatch500MediaTypesParam & +export type HttpRetryPatch500_Parameters = HttpRetryPatch500MediaTypesParam & HttpRetryPatch500BodyParam & RequestParameters; -export type HttpRetryGet502Parameters = RequestParameters; -export type HttpRetryOptions502Parameters = RequestParameters; +export type HttpRetryGet502_Parameters = RequestParameters; +export type HttpRetryOptions502_Parameters = RequestParameters; export interface HttpRetryPost503BodyParam { /** Simple boolean value true */ @@ -604,7 +609,7 @@ export interface HttpRetryPost503MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPost503Parameters = HttpRetryPost503MediaTypesParam & +export type HttpRetryPost503_Parameters = HttpRetryPost503MediaTypesParam & HttpRetryPost503BodyParam & RequestParameters; @@ -618,7 +623,7 @@ export interface HttpRetryDelete503MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryDelete503Parameters = HttpRetryDelete503MediaTypesParam & +export type HttpRetryDelete503_Parameters = HttpRetryDelete503MediaTypesParam & HttpRetryDelete503BodyParam & RequestParameters; @@ -632,7 +637,7 @@ export interface HttpRetryPut504MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPut504Parameters = HttpRetryPut504MediaTypesParam & +export type HttpRetryPut504_Parameters = HttpRetryPut504MediaTypesParam & HttpRetryPut504BodyParam & RequestParameters; @@ -646,7 +651,7 @@ export interface HttpRetryPatch504MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPatch504Parameters = HttpRetryPatch504MediaTypesParam & +export type HttpRetryPatch504_Parameters = HttpRetryPatch504MediaTypesParam & HttpRetryPatch504BodyParam & RequestParameters; export type MultipleResponsesGet200Model204NoModelDefaultError200ValidParameters = diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts index ed1b92edce..7e8460c3b2 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts @@ -103,7 +103,7 @@ export interface LROsPut202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut202Retry200Parameters = LROsPut202Retry200MediaTypesParam & +export type LROsPut202Retry200_Parameters = LROsPut202Retry200MediaTypesParam & LROsPut202Retry200BodyParam & RequestParameters; @@ -117,7 +117,7 @@ export interface LROsPut201CreatingSucceeded200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut201CreatingSucceeded200Parameters = +export type LROsPut201CreatingSucceeded200_Parameters = LROsPut201CreatingSucceeded200MediaTypesParam & LROsPut201CreatingSucceeded200BodyParam & RequestParameters; @@ -132,7 +132,7 @@ export interface LROsPut200UpdatingSucceeded204MediaTypesParam { contentType?: "application/json"; } -export type LROsPut200UpdatingSucceeded204Parameters = +export type LROsPut200UpdatingSucceeded204_Parameters = LROsPut200UpdatingSucceeded204MediaTypesParam & LROsPut200UpdatingSucceeded204BodyParam & RequestParameters; @@ -147,7 +147,7 @@ export interface LROsPut201CreatingFailed200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut201CreatingFailed200Parameters = +export type LROsPut201CreatingFailed200_Parameters = LROsPut201CreatingFailed200MediaTypesParam & LROsPut201CreatingFailed200BodyParam & RequestParameters; @@ -162,7 +162,7 @@ export interface LROsPut200Acceptedcanceled200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut200Acceptedcanceled200Parameters = +export type LROsPut200Acceptedcanceled200_Parameters = LROsPut200Acceptedcanceled200MediaTypesParam & LROsPut200Acceptedcanceled200BodyParam & RequestParameters; @@ -316,13 +316,13 @@ export type LROsPutAsyncSubResourceParameters = RequestParameters; export type LROsDeleteProvisioning202Accepted200SucceededParameters = RequestParameters; -export type LROsDeleteProvisioning202DeletingFailed200Parameters = +export type LROsDeleteProvisioning202DeletingFailed200_Parameters = RequestParameters; -export type LROsDeleteProvisioning202Deletingcanceled200Parameters = +export type LROsDeleteProvisioning202Deletingcanceled200_Parameters = RequestParameters; export type LROsDelete204SucceededParameters = RequestParameters; -export type LROsDelete202Retry200Parameters = RequestParameters; -export type LROsDelete202NoRetry204Parameters = RequestParameters; +export type LROsDelete202Retry200_Parameters = RequestParameters; +export type LROsDelete202NoRetry204_Parameters = RequestParameters; export type LROsDeleteNoHeaderInRetryParameters = RequestParameters; export type LROsDeleteAsyncNoHeaderInRetryParameters = RequestParameters; export type LROsDeleteAsyncRetrySucceededParameters = RequestParameters; @@ -341,9 +341,10 @@ export interface LROsPost202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LROsPost202Retry200Parameters = LROsPost202Retry200MediaTypesParam & - LROsPost202Retry200BodyParam & - RequestParameters; +export type LROsPost202Retry200_Parameters = + LROsPost202Retry200MediaTypesParam & + LROsPost202Retry200BodyParam & + RequestParameters; export interface LROsPost202NoRetry204BodyParam { /** Product to put */ @@ -355,7 +356,7 @@ export interface LROsPost202NoRetry204MediaTypesParam { contentType?: "application/json"; } -export type LROsPost202NoRetry204Parameters = +export type LROsPost202NoRetry204_Parameters = LROsPost202NoRetry204MediaTypesParam & LROsPost202NoRetry204BodyParam & RequestParameters; @@ -435,7 +436,7 @@ export interface LRORetrysPut201CreatingSucceeded200MediaTypesParam { contentType?: "application/json"; } -export type LRORetrysPut201CreatingSucceeded200Parameters = +export type LRORetrysPut201CreatingSucceeded200_Parameters = LRORetrysPut201CreatingSucceeded200MediaTypesParam & LRORetrysPut201CreatingSucceeded200BodyParam & RequestParameters; @@ -456,7 +457,7 @@ export type LRORetrysPutAsyncRelativeRetrySucceededParameters = RequestParameters; export type LRORetrysDeleteProvisioning202Accepted200SucceededParameters = RequestParameters; -export type LRORetrysDelete202Retry200Parameters = RequestParameters; +export type LRORetrysDelete202Retry200_Parameters = RequestParameters; export type LRORetrysDeleteAsyncRelativeRetrySucceededParameters = RequestParameters; @@ -470,7 +471,7 @@ export interface LRORetrysPost202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LRORetrysPost202Retry200Parameters = +export type LRORetrysPost202Retry200_Parameters = LRORetrysPost202Retry200MediaTypesParam & LRORetrysPost202Retry200BodyParam & RequestParameters; @@ -500,7 +501,7 @@ export interface LrosaDsPutNonRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPutNonRetry400Parameters = +export type LrosaDsPutNonRetry400_Parameters = LrosaDsPutNonRetry400MediaTypesParam & LrosaDsPutNonRetry400BodyParam & RequestParameters; @@ -515,7 +516,7 @@ export interface LrosaDsPutNonRetry201Creating400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPutNonRetry201Creating400Parameters = +export type LrosaDsPutNonRetry201Creating400_Parameters = LrosaDsPutNonRetry201Creating400MediaTypesParam & LrosaDsPutNonRetry201Creating400BodyParam & RequestParameters; @@ -545,13 +546,13 @@ export interface LrosaDsPutAsyncRelativeRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPutAsyncRelativeRetry400Parameters = +export type LrosaDsPutAsyncRelativeRetry400_Parameters = LrosaDsPutAsyncRelativeRetry400MediaTypesParam & LrosaDsPutAsyncRelativeRetry400BodyParam & RequestParameters; -export type LrosaDsDeleteNonRetry400Parameters = RequestParameters; -export type LrosaDsDelete202NonRetry400Parameters = RequestParameters; -export type LrosaDsDeleteAsyncRelativeRetry400Parameters = RequestParameters; +export type LrosaDsDeleteNonRetry400_Parameters = RequestParameters; +export type LrosaDsDelete202NonRetry400_Parameters = RequestParameters; +export type LrosaDsDeleteAsyncRelativeRetry400_Parameters = RequestParameters; export interface LrosaDsPostNonRetry400BodyParam { /** Product to put */ @@ -563,7 +564,7 @@ export interface LrosaDsPostNonRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPostNonRetry400Parameters = +export type LrosaDsPostNonRetry400_Parameters = LrosaDsPostNonRetry400MediaTypesParam & LrosaDsPostNonRetry400BodyParam & RequestParameters; @@ -578,7 +579,7 @@ export interface LrosaDsPost202NonRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPost202NonRetry400Parameters = +export type LrosaDsPost202NonRetry400_Parameters = LrosaDsPost202NonRetry400MediaTypesParam & LrosaDsPost202NonRetry400BodyParam & RequestParameters; @@ -593,7 +594,7 @@ export interface LrosaDsPostAsyncRelativeRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPostAsyncRelativeRetry400Parameters = +export type LrosaDsPostAsyncRelativeRetry400_Parameters = LrosaDsPostAsyncRelativeRetry400MediaTypesParam & LrosaDsPostAsyncRelativeRetry400BodyParam & RequestParameters; @@ -796,7 +797,7 @@ export interface LROsCustomHeaderPut201CreatingSucceeded200MediaTypesParam { contentType?: "application/json"; } -export type LROsCustomHeaderPut201CreatingSucceeded200Parameters = +export type LROsCustomHeaderPut201CreatingSucceeded200_Parameters = LROsCustomHeaderPut201CreatingSucceeded200MediaTypesParam & LROsCustomHeaderPut201CreatingSucceeded200BodyParam & RequestParameters; @@ -811,7 +812,7 @@ export interface LROsCustomHeaderPost202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LROsCustomHeaderPost202Retry200Parameters = +export type LROsCustomHeaderPost202Retry200_Parameters = LROsCustomHeaderPost202Retry200MediaTypesParam & LROsCustomHeaderPost202Retry200BodyParam & RequestParameters; diff --git a/packages/typespec-ts/test/unit/parametersGenerator.spec.ts b/packages/typespec-ts/test/unit/parametersGenerator.spec.ts index a02bfb9c62..639fcc327d 100644 --- a/packages/typespec-ts/test/unit/parametersGenerator.spec.ts +++ b/packages/typespec-ts/test/unit/parametersGenerator.spec.ts @@ -176,7 +176,7 @@ describe("Parameters.ts", () => { } export type TestParameters = TestQueryParam & RequestParameters; - export type Test1Parameters = RequestParameters; + export type Test1_Parameters = RequestParameters; ` ); }); From 541ab72068063dd4bd037b95a6e1b09f1eec1a72 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:33:57 +0800 Subject: [PATCH 67/91] fix modular ut test --- .../models/apiVersion/apiVersionAsKnownVersions.md | 2 +- .../flatten/experimentalExtensibleEnumsTrue.md | 4 ++-- .../scenarios/models/serialization/enumKeyNorm.md | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md index 43e4bbc023..204f65afe4 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md @@ -40,6 +40,6 @@ Should generate KnownVersions in models.ts. /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V2021_10_01Preview = "2021-10-01-preview", + V2021_10_01_Preview = "2021-10-01-preview" } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md index 2d6553ba96..a3efcbf0de 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md @@ -92,7 +92,7 @@ export enum KnownProvisioningState { /** The resource is being deleted */ Deleting = "Deleting", /** The resource create request has been accepted */ - Accepted = "Accepted", + Accepted = "Accepted" } /** @@ -113,6 +113,6 @@ export type ProvisioningState = string; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V2021_10_01Preview = "2021-10-01-preview", + V2021_10_01_Preview = "2021-10-01-preview" } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index 6d8f2fe733..f269a5ac53 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -93,7 +93,7 @@ export interface Foo { export function fooSerializer(item: Foo): any { return { extensibleString: item["extensibleString"], - extensibleNumber: item["extensibleNumber"], + extensibleNumber: item["extensibleNumber"] }; } @@ -104,7 +104,7 @@ export enum KnownExtensibleString { PascalCase2 = "PascalCase2", Pascalcase3 = "pascalcase3", Pascalcase4 = "Pascalcase4", - PascalCase5 = "pascal_case_5", + PascalCase_5 = "pascal_case_5", PascalCase6 = "pascal_case6", PascalCase7 = "_pascal_case7", PascalCase8 = "pascal, case8", @@ -118,7 +118,7 @@ export enum KnownExtensibleString { Num10 = "10", Num20 = "20", "Num1.0" = "1.0", - "Item-1.0" = "-2.0", + "Item-1.0" = "-2.0" } /** Type of ExtensibleString */ @@ -129,7 +129,7 @@ export enum KnownExtensibleNumber { One = 1, Num2 = 2, "Num-2.1" = -2.1, - Num3 = 3, + Num3 = 3 } /** Type of ExtensibleNumber */ @@ -139,6 +139,6 @@ export type ExtensibleNumber = number; export enum KnownVersions { PreviewVersion = "2024-07-01-preview", StableVersion = "2024-07-01", - "V2024-08-01Preview" = "2024-08-01-preview", + "V2024-08-01-Preview" = "2024-08-01-preview" } ``` From 5f8efcbeff98e18d19bd83985911837284db0635 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:47:11 +0800 Subject: [PATCH 68/91] update modular ut case --- .../nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md index b8f315b5ad..171756147e 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md @@ -96,6 +96,6 @@ export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V2021_10_01Preview = "2021-10-01-preview", + V2021_10_01_Preview = "2021-10-01-preview" } ``` From d7b302c59c46f7ac16d2597a23d22c85e1524995 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:16:07 +0800 Subject: [PATCH 69/91] fix ci --- .../typespec-ts/review/ai-client.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../typespec-ts/review/eventgrid.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../health-insights-radiologyinsights.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../review/openai-non-branded.api.md | 2 +- .../typespec-ts/src/models/models.ts | 4 +- .../generated/encode/bytes/src/index.d.ts | 26 ++++++------ .../generated/encode/datetime/src/index.d.ts | 40 +++++++++---------- .../generated/encode/duration/src/index.d.ts | 16 ++++---- .../additional-properties/src/index.d.ts | 36 ++++++++--------- .../type/property/value-types/src/index.d.ts | 32 +++++++-------- .../generated/versioning/added/src/index.d.ts | 12 +++--- .../generated/azure/core/basic/src/index.d.ts | 2 +- .../azure/core/lro/rpc/src/index.d.ts | 2 +- .../azure/core/lro/standard/src/index.d.ts | 2 +- .../generated/azure/core/model/src/index.d.ts | 2 +- .../generated/azure/core/page/src/index.d.ts | 2 +- .../azure/core/scalar/src/index.d.ts | 2 +- .../azure/core/traits/src/index.d.ts | 2 +- .../azure/example/basic/src/index.d.ts | 2 +- .../common-properties/src/index.d.ts | 2 +- .../resource-manager/resources/src/index.d.ts | 2 +- .../server/versions/versioned/src/index.d.ts | 4 +- 25 files changed, 102 insertions(+), 102 deletions(-) diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md index d0f0a4716e..2c60227cdd 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md +++ b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md @@ -723,7 +723,7 @@ export type InputDataUnion = AppInsightsConfiguration | Dataset | InputData; // @public export enum KnownVersions { - "V2024-07-01Preview" = "2024-07-01-preview" + "V2024-07-01-Preview" = "2024-07-01-preview" } // @public diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts index 19ac1ed6a0..15778ffbee 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts @@ -4773,5 +4773,5 @@ export type VectorStoreFileStatusFilter = /** Azure AI API versions */ export enum KnownVersions { /** Azure AI API version 2024-07-01-preview. */ - "V2024-07-01Preview" = "2024-07-01-preview", + "V2024-07-01-Preview" = "2024-07-01-preview", } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md index d64d71a289..722fc5a835 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md @@ -74,7 +74,7 @@ export interface FailedLockToken { // @public export enum KnownServiceApiVersions { // (undocumented) - V2023_06_01Preview = "2023-06-01-preview" + V2023_06_01_Preview = "2023-06-01-preview" } // @public diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts index ca4b14b7a4..c8d3ba29a7 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts @@ -258,7 +258,7 @@ export function rejectResultDeserializer(item: any): RejectResult { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - V2023_06_01Preview = "2023-06-01-preview", + V2023_06_01_Preview = "2023-06-01-preview", } export function cloudEventArraySerializer(result: Array): any[] { diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md index c9632bdb2c..43f144149b 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md @@ -233,7 +233,7 @@ export type JobStatus = "notStarted" | "running" | "succeeded" | "failed" | "can // @public export enum KnownApiVersion { // (undocumented) - V2023_09_01Preview = "2023-09-01-preview" + V2023_09_01_Preview = "2023-09-01-preview" } // @public diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts index 3d04d15a1b..12398f54b7 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts @@ -2291,5 +2291,5 @@ export type RepeatabilityResult = "accepted" | "rejected"; /** Known values of {@link ApiVersion} that the service accepts. */ export enum KnownApiVersion { - V2023_09_01Preview = "2023-09-01-preview", + V2023_09_01_Preview = "2023-09-01-preview", } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index 58eab3afa9..25b3828b54 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -619,7 +619,7 @@ export interface FineTuningOperations { // @public export interface Image { - b64Json?: Uint8Array; + b64_Json?: Uint8Array; url?: string; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index 613835d627..27f753de2b 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -324,13 +324,13 @@ export interface Image { /** The URL of the generated image, if `response_format` is `url` (default). */ url?: string; /** The base64-encoded JSON of the generated image, if `response_format` is `b64_json`. */ - b64Json?: Uint8Array; + b64_Json?: Uint8Array; } export function imageDeserializer(item: any): Image { return { url: item["url"], - b64Json: !item["b64_json"] + b64_Json: !item["b64_json"] ? item["b64_json"] : typeof item["b64_json"] === "string" ? stringToUint8Array(item["b64_json"], "base64") diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts index bb2d91ed28..b261c442df 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts @@ -51,13 +51,15 @@ export declare interface DefaultBytesPropertyOutput { } export declare interface HeaderBase64 { - get(options: HeaderBase64Parameters): StreamableMethod; + get(options: HeaderBase64_Parameters): StreamableMethod; } export declare interface HeaderBase64204Response extends HttpResponse { status: "204"; } +export declare type HeaderBase64_Parameters = HeaderBase64HeaderParam & RequestParameters; + export declare interface HeaderBase64HeaderParam { headers: RawHttpHeadersInput & HeaderBase64Headers; } @@ -66,8 +68,6 @@ export declare interface HeaderBase64Headers { value: string; } -export declare type HeaderBase64Parameters = HeaderBase64HeaderParam & RequestParameters; - export declare interface HeaderBase64Url { get(options: HeaderBase64UrlParameters): StreamableMethod; } @@ -123,7 +123,7 @@ export declare interface HeaderDefaultHeaders { export declare type HeaderDefaultParameters = HeaderDefaultHeaderParam & RequestParameters; export declare interface PropertyBase64 { - post(options: PropertyBase64Parameters): StreamableMethod; + post(options: PropertyBase64_Parameters): StreamableMethod; } export declare interface PropertyBase64200Response extends HttpResponse { @@ -131,12 +131,12 @@ export declare interface PropertyBase64200Response extends HttpResponse { body: Base64BytesPropertyOutput; } +export declare type PropertyBase64_Parameters = PropertyBase64BodyParam & RequestParameters; + export declare interface PropertyBase64BodyParam { body: Base64BytesProperty; } -export declare type PropertyBase64Parameters = PropertyBase64BodyParam & RequestParameters; - export declare interface PropertyBase64Url { post(options: PropertyBase64UrlParameters): StreamableMethod; } @@ -183,14 +183,14 @@ export declare interface PropertyDefaultBodyParam { export declare type PropertyDefaultParameters = PropertyDefaultBodyParam & RequestParameters; export declare interface QueryBase64 { - get(options: QueryBase64Parameters): StreamableMethod; + get(options: QueryBase64_Parameters): StreamableMethod; } export declare interface QueryBase64204Response extends HttpResponse { status: "204"; } -export declare type QueryBase64Parameters = QueryBase64QueryParam & RequestParameters; +export declare type QueryBase64_Parameters = QueryBase64QueryParam & RequestParameters; export declare interface QueryBase64QueryParam { queryParameters: QueryBase64QueryParamProperties; @@ -261,19 +261,19 @@ export declare interface QueryDefaultQueryParamProperties { } export declare interface RequestBodyBase64 { - post(options: RequestBodyBase64Parameters): StreamableMethod; + post(options: RequestBodyBase64_Parameters): StreamableMethod; } export declare interface RequestBodyBase64204Response extends HttpResponse { status: "204"; } +export declare type RequestBodyBase64_Parameters = RequestBodyBase64BodyParam & RequestParameters; + export declare interface RequestBodyBase64BodyParam { body: string; } -export declare type RequestBodyBase64Parameters = RequestBodyBase64BodyParam & RequestParameters; - export declare interface RequestBodyBase64Url { post(options: RequestBodyBase64UrlParameters): StreamableMethod; } @@ -339,7 +339,7 @@ export declare interface RequestBodyOctetStreamMediaTypesParam { export declare type RequestBodyOctetStreamParameters = RequestBodyOctetStreamMediaTypesParam & RequestBodyOctetStreamBodyParam & RequestParameters; export declare interface ResponseBodyBase64 { - get(options?: ResponseBodyBase64Parameters): StreamableMethod; + get(options?: ResponseBodyBase64_Parameters): StreamableMethod; } export declare interface ResponseBodyBase64200Response extends HttpResponse { @@ -347,7 +347,7 @@ export declare interface ResponseBodyBase64200Response extends HttpResponse { body: string; } -export declare type ResponseBodyBase64Parameters = RequestParameters; +export declare type ResponseBodyBase64_Parameters = RequestParameters; export declare interface ResponseBodyBase64Url { get(options?: ResponseBodyBase64UrlParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts index 42632262a2..ed1cdd60fc 100644 --- a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts @@ -45,13 +45,15 @@ export declare interface HeaderDefaultHeaders { export declare type HeaderDefaultParameters = HeaderDefaultHeaderParam & RequestParameters; export declare interface HeaderRfc3339 { - get(options: HeaderRfc3339Parameters): StreamableMethod; + get(options: HeaderRfc3339_Parameters): StreamableMethod; } export declare interface HeaderRfc3339204Response extends HttpResponse { status: "204"; } +export declare type HeaderRfc3339_Parameters = HeaderRfc3339HeaderParam & RequestParameters; + export declare interface HeaderRfc3339HeaderParam { headers: RawHttpHeadersInput & HeaderRfc3339Headers; } @@ -60,16 +62,16 @@ export declare interface HeaderRfc3339Headers { value: string; } -export declare type HeaderRfc3339Parameters = HeaderRfc3339HeaderParam & RequestParameters; - export declare interface HeaderRfc7231 { - get(options: HeaderRfc7231Parameters): StreamableMethod; + get(options: HeaderRfc7231_Parameters): StreamableMethod; } export declare interface HeaderRfc7231204Response extends HttpResponse { status: "204"; } +export declare type HeaderRfc7231_Parameters = HeaderRfc7231HeaderParam & RequestParameters; + export declare interface HeaderRfc7231HeaderParam { headers: RawHttpHeadersInput & HeaderRfc7231Headers; } @@ -78,8 +80,6 @@ export declare interface HeaderRfc7231Headers { value: string; } -export declare type HeaderRfc7231Parameters = HeaderRfc7231HeaderParam & RequestParameters; - export declare interface HeaderUnixTimestamp { get(options: HeaderUnixTimestampParameters): StreamableMethod; } @@ -132,7 +132,7 @@ export declare interface PropertyDefaultBodyParam { export declare type PropertyDefaultParameters = PropertyDefaultBodyParam & RequestParameters; export declare interface PropertyRfc3339 { - post(options: PropertyRfc3339Parameters): StreamableMethod; + post(options: PropertyRfc3339_Parameters): StreamableMethod; } export declare interface PropertyRfc3339200Response extends HttpResponse { @@ -140,14 +140,14 @@ export declare interface PropertyRfc3339200Response extends HttpResponse { body: Rfc3339DatetimePropertyOutput; } +export declare type PropertyRfc3339_Parameters = PropertyRfc3339BodyParam & RequestParameters; + export declare interface PropertyRfc3339BodyParam { body: Rfc3339DatetimeProperty; } -export declare type PropertyRfc3339Parameters = PropertyRfc3339BodyParam & RequestParameters; - export declare interface PropertyRfc7231 { - post(options: PropertyRfc7231Parameters): StreamableMethod; + post(options: PropertyRfc7231_Parameters): StreamableMethod; } export declare interface PropertyRfc7231200Response extends HttpResponse { @@ -155,12 +155,12 @@ export declare interface PropertyRfc7231200Response extends HttpResponse { body: Rfc7231DatetimePropertyOutput; } +export declare type PropertyRfc7231_Parameters = PropertyRfc7231BodyParam & RequestParameters; + export declare interface PropertyRfc7231BodyParam { body: Rfc7231DatetimeProperty; } -export declare type PropertyRfc7231Parameters = PropertyRfc7231BodyParam & RequestParameters; - export declare interface PropertyUnixTimestamp { post(options: PropertyUnixTimestampParameters): StreamableMethod; } @@ -210,14 +210,14 @@ export declare interface QueryDefaultQueryParamProperties { } export declare interface QueryRfc3339 { - get(options: QueryRfc3339Parameters): StreamableMethod; + get(options: QueryRfc3339_Parameters): StreamableMethod; } export declare interface QueryRfc3339204Response extends HttpResponse { status: "204"; } -export declare type QueryRfc3339Parameters = QueryRfc3339QueryParam & RequestParameters; +export declare type QueryRfc3339_Parameters = QueryRfc3339QueryParam & RequestParameters; export declare interface QueryRfc3339QueryParam { queryParameters: QueryRfc3339QueryParamProperties; @@ -228,14 +228,14 @@ export declare interface QueryRfc3339QueryParamProperties { } export declare interface QueryRfc7231 { - get(options: QueryRfc7231Parameters): StreamableMethod; + get(options: QueryRfc7231_Parameters): StreamableMethod; } export declare interface QueryRfc7231204Response extends HttpResponse { status: "204"; } -export declare type QueryRfc7231Parameters = QueryRfc7231QueryParam & RequestParameters; +export declare type QueryRfc7231_Parameters = QueryRfc7231QueryParam & RequestParameters; export declare interface QueryRfc7231QueryParam { queryParameters: QueryRfc7231QueryParamProperties; @@ -303,7 +303,7 @@ export declare interface ResponseHeaderDefault204Response extends HttpResponse { export declare type ResponseHeaderDefaultParameters = RequestParameters; export declare interface ResponseHeaderRfc3339 { - get(options?: ResponseHeaderRfc3339Parameters): StreamableMethod; + get(options?: ResponseHeaderRfc3339_Parameters): StreamableMethod; } export declare interface ResponseHeaderRfc3339204Headers { @@ -315,10 +315,10 @@ export declare interface ResponseHeaderRfc3339204Response extends HttpResponse { headers: RawHttpHeaders & ResponseHeaderRfc3339204Headers; } -export declare type ResponseHeaderRfc3339Parameters = RequestParameters; +export declare type ResponseHeaderRfc3339_Parameters = RequestParameters; export declare interface ResponseHeaderRfc7231 { - get(options?: ResponseHeaderRfc7231Parameters): StreamableMethod; + get(options?: ResponseHeaderRfc7231_Parameters): StreamableMethod; } export declare interface ResponseHeaderRfc7231204Headers { @@ -330,7 +330,7 @@ export declare interface ResponseHeaderRfc7231204Response extends HttpResponse { headers: RawHttpHeaders & ResponseHeaderRfc7231204Headers; } -export declare type ResponseHeaderRfc7231Parameters = RequestParameters; +export declare type ResponseHeaderRfc7231_Parameters = RequestParameters; export declare interface ResponseHeaderUnixTimestamp { get(options?: ResponseHeaderUnixTimestampParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts index 0d950809be..62093b4a32 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts @@ -122,13 +122,15 @@ export declare interface HeaderInt32SecondsHeaders { export declare type HeaderInt32SecondsParameters = HeaderInt32SecondsHeaderParam & RequestParameters; export declare interface HeaderIso8601 { - get(options: HeaderIso8601Parameters): StreamableMethod; + get(options: HeaderIso8601_Parameters): StreamableMethod; } export declare interface HeaderIso8601204Response extends HttpResponse { status: "204"; } +export declare type HeaderIso8601_Parameters = HeaderIso8601HeaderParam & RequestParameters; + export declare interface HeaderIso8601Array { get(options: HeaderIso8601ArrayParameters): StreamableMethod; } @@ -155,8 +157,6 @@ export declare interface HeaderIso8601Headers { duration: string; } -export declare type HeaderIso8601Parameters = HeaderIso8601HeaderParam & RequestParameters; - export declare interface Int32SecondsDurationProperty { value: number; } @@ -249,7 +249,7 @@ export declare interface PropertyInt32SecondsBodyParam { export declare type PropertyInt32SecondsParameters = PropertyInt32SecondsBodyParam & RequestParameters; export declare interface PropertyIso8601 { - post(options: PropertyIso8601Parameters): StreamableMethod; + post(options: PropertyIso8601_Parameters): StreamableMethod; } export declare interface PropertyIso8601200Response extends HttpResponse { @@ -257,12 +257,12 @@ export declare interface PropertyIso8601200Response extends HttpResponse { body: ISO8601DurationPropertyOutput; } +export declare type PropertyIso8601_Parameters = PropertyIso8601BodyParam & RequestParameters; + export declare interface PropertyIso8601BodyParam { body: ISO8601DurationProperty; } -export declare type PropertyIso8601Parameters = PropertyIso8601BodyParam & RequestParameters; - export declare interface QueryDefault { get(options: QueryDefaultParameters): StreamableMethod; } @@ -360,14 +360,14 @@ export declare interface QueryInt32SecondsQueryParamProperties { } export declare interface QueryIso8601 { - get(options: QueryIso8601Parameters): StreamableMethod; + get(options: QueryIso8601_Parameters): StreamableMethod; } export declare interface QueryIso8601204Response extends HttpResponse { status: "204"; } -export declare type QueryIso8601Parameters = QueryIso8601QueryParam & RequestParameters; +export declare type QueryIso8601_Parameters = QueryIso8601QueryParam & RequestParameters; export declare interface QueryIso8601QueryParam { queryParameters: QueryIso8601QueryParamProperties; diff --git a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts index dc12201371..e9602ad80c 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts @@ -939,49 +939,49 @@ export declare interface SpreadRecordForUnionOutput extends Record flag: boolean; } -export declare interface SpreadRecordNonDiscriminatedUnion2Get { - get(options?: SpreadRecordNonDiscriminatedUnion2GetParameters): StreamableMethod; - put(options: SpreadRecordNonDiscriminatedUnion2PutParameters): StreamableMethod; -} - -export declare interface SpreadRecordNonDiscriminatedUnion2Get200Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion2_Get200Response extends HttpResponse { status: "200"; body: SpreadRecordForNonDiscriminatedUnion2Output; } -export declare type SpreadRecordNonDiscriminatedUnion2GetParameters = RequestParameters; +export declare type SpreadRecordNonDiscriminatedUnion2_GetParameters = RequestParameters; -export declare interface SpreadRecordNonDiscriminatedUnion2Put204Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion2_Put204Response extends HttpResponse { status: "204"; } -export declare interface SpreadRecordNonDiscriminatedUnion2PutBodyParam { +export declare interface SpreadRecordNonDiscriminatedUnion2_PutBodyParam { body: SpreadRecordForNonDiscriminatedUnion2; } -export declare type SpreadRecordNonDiscriminatedUnion2PutParameters = SpreadRecordNonDiscriminatedUnion2PutBodyParam & RequestParameters; +export declare type SpreadRecordNonDiscriminatedUnion2_PutParameters = SpreadRecordNonDiscriminatedUnion2_PutBodyParam & RequestParameters; -export declare interface SpreadRecordNonDiscriminatedUnion3Get { - get(options?: SpreadRecordNonDiscriminatedUnion3GetParameters): StreamableMethod; - put(options: SpreadRecordNonDiscriminatedUnion3PutParameters): StreamableMethod; +export declare interface SpreadRecordNonDiscriminatedUnion2Get { + get(options?: SpreadRecordNonDiscriminatedUnion2_GetParameters): StreamableMethod; + put(options: SpreadRecordNonDiscriminatedUnion2_PutParameters): StreamableMethod; } -export declare interface SpreadRecordNonDiscriminatedUnion3Get200Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion3_Get200Response extends HttpResponse { status: "200"; body: SpreadRecordForNonDiscriminatedUnion3Output; } -export declare type SpreadRecordNonDiscriminatedUnion3GetParameters = RequestParameters; +export declare type SpreadRecordNonDiscriminatedUnion3_GetParameters = RequestParameters; -export declare interface SpreadRecordNonDiscriminatedUnion3Put204Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion3_Put204Response extends HttpResponse { status: "204"; } -export declare interface SpreadRecordNonDiscriminatedUnion3PutBodyParam { +export declare interface SpreadRecordNonDiscriminatedUnion3_PutBodyParam { body: SpreadRecordForNonDiscriminatedUnion3; } -export declare type SpreadRecordNonDiscriminatedUnion3PutParameters = SpreadRecordNonDiscriminatedUnion3PutBodyParam & RequestParameters; +export declare type SpreadRecordNonDiscriminatedUnion3_PutParameters = SpreadRecordNonDiscriminatedUnion3_PutBodyParam & RequestParameters; + +export declare interface SpreadRecordNonDiscriminatedUnion3Get { + get(options?: SpreadRecordNonDiscriminatedUnion3_GetParameters): StreamableMethod; + put(options: SpreadRecordNonDiscriminatedUnion3_PutParameters): StreamableMethod; +} export declare interface SpreadRecordNonDiscriminatedUnionGet { get(options?: SpreadRecordNonDiscriminatedUnionGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts index 7f1f1102d0..e463b766b0 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts @@ -217,35 +217,35 @@ export declare interface DatetimePutBodyParam { export declare type DatetimePutParameters = DatetimePutBodyParam & RequestParameters; -export declare interface Decimal128Get { - get(options?: Decimal128GetParameters): StreamableMethod; - put(options: Decimal128PutParameters): StreamableMethod; -} - -export declare interface Decimal128Get200Response extends HttpResponse { +export declare interface Decimal128_Get200Response extends HttpResponse { status: "200"; body: Decimal128PropertyOutput; } -export declare type Decimal128GetParameters = RequestParameters; +export declare type Decimal128_GetParameters = RequestParameters; -export declare interface Decimal128Property { - property: number; +export declare interface Decimal128_Put204Response extends HttpResponse { + status: "204"; } -export declare interface Decimal128PropertyOutput { - property: number; +export declare interface Decimal128_PutBodyParam { + body: Decimal128Property; } -export declare interface Decimal128Put204Response extends HttpResponse { - status: "204"; +export declare type Decimal128_PutParameters = Decimal128_PutBodyParam & RequestParameters; + +export declare interface Decimal128Get { + get(options?: Decimal128_GetParameters): StreamableMethod; + put(options: Decimal128_PutParameters): StreamableMethod; } -export declare interface Decimal128PutBodyParam { - body: Decimal128Property; +export declare interface Decimal128Property { + property: number; } -export declare type Decimal128PutParameters = Decimal128PutBodyParam & RequestParameters; +export declare interface Decimal128PropertyOutput { + property: number; +} export declare interface DecimalGet { get(options?: DecimalGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts index 6cdc6053da..35e3a3008e 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts @@ -55,7 +55,7 @@ export declare type UnionV2 = string | number; export declare type UnionV2Output = string | number; export declare interface V1 { - post(options: V1Parameters): StreamableMethod; + post(options: V1_Parameters): StreamableMethod; } export declare interface V1200Response extends HttpResponse { @@ -63,6 +63,8 @@ export declare interface V1200Response extends HttpResponse { body: ModelV1Output; } +export declare type V1_Parameters = V1HeaderParam & V1BodyParam & RequestParameters; + export declare interface V1BodyParam { body: ModelV1; } @@ -75,10 +77,8 @@ export declare interface V1Headers { "header-v2": string; } -export declare type V1Parameters = V1HeaderParam & V1BodyParam & RequestParameters; - export declare interface V2 { - post(options: V2Parameters): StreamableMethod; + post(options: V2_Parameters): StreamableMethod; } export declare interface V2200Response extends HttpResponse { @@ -86,6 +86,8 @@ export declare interface V2200Response extends HttpResponse { body: ModelV2Output; } +export declare type V2_Parameters = V2BodyParam & RequestParameters; + export declare interface V2BodyParam { body: ModelV2; } @@ -105,8 +107,6 @@ export declare interface V2InInterfaceBodyParam { export declare type V2InInterfaceParameters = V2InInterfaceBodyParam & RequestParameters; -export declare type V2Parameters = V2BodyParam & RequestParameters; - export declare type VersioningAddedClient = Client & { path: Routes; }; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts index 13c69a9137..7422cb62e5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts @@ -43,7 +43,7 @@ export declare interface GetOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare interface ListOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts index de53fe4494..18364afa70 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts @@ -15,7 +15,7 @@ export declare interface GenerationResult { } export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare interface LongRunningRpcOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts index 5e0c2b3079..39a9193c99 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts @@ -24,7 +24,7 @@ export declare interface ExportOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare function restorePoller(client: StandardClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts index 66f814d423..812978b9d2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts @@ -10,7 +10,7 @@ export declare interface GetOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare class ModelClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts index 2356ce9f89..64c5e62d9b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts @@ -11,7 +11,7 @@ export declare interface FirstItem { } export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare interface ListFirstItemOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts index fb6cc83919..6d819f1f68 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts @@ -13,7 +13,7 @@ export declare interface HeaderOptionalParams extends OperationOptions { } export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare interface PostOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts index 8db1cc3397..0ac0f92c26 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts @@ -3,7 +3,7 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare type RepeatabilityResult = "accepted" | "rejected"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts index 1621d26c55..c67595ab16 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts @@ -33,7 +33,7 @@ export declare interface BasicActionOptionalParams extends OperationOptions { export declare type Enum = "EnumValue1"; export declare enum KnownVersions { - V2022_12_01Preview = "2022-12-01-preview" + V2022_12_01_Preview = "2022-12-01-preview" } export declare interface Model { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts index aa353099b0..3661aef684 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts @@ -55,7 +55,7 @@ export declare enum KnownManagedServiceIdentityType { } export declare enum KnownVersions { - V2023_12_01Preview = "2023-12-01-preview" + V2023_12_01_Preview = "2023-12-01-preview" } export declare interface ManagedIdentityTrackedResource extends TrackedResource { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts index 6ec45ffbe1..6069d2a1c1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts @@ -47,7 +47,7 @@ export declare enum KnownProvisioningState { } export declare enum KnownVersions { - V2023_12_01Preview = "2023-12-01-preview" + V2023_12_01_Preview = "2023-12-01-preview" } export declare interface NestedCreateOrReplaceOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts index 7265837524..9f17b94923 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts @@ -3,8 +3,8 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; export declare enum KnownVersions { - V2021_01_01Preview = "2021-01-01-preview", - V2022_12_01Preview = "2022-12-01-preview" + V2021_01_01_Preview = "2021-01-01-preview", + V2022_12_01_Preview = "2022-12-01-preview" } export declare class VersionedClient { From ce65b440ddf4cb606d0eae03cd632f7130e9ab0f Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 21 Nov 2024 17:27:36 +0800 Subject: [PATCH 70/91] Update the logic only working for non interface like type --- packages/rlc-common/src/helpers/nameUtils.ts | 14 ++++++++++++-- packages/rlc-common/test/helpers/nameUtils.spec.ts | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 3a00c13800..f9ac730507 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -176,7 +176,7 @@ export function normalizeName( return name.replace("$DO_NOT_NORMALIZE$", ""); } const casingConvention = casingOverride ?? getCasingConvention(nameType); - const parts = deconstruct(name); + const parts = deconstruct(name, nameType); if (parts.length === 0) { return name; } @@ -228,7 +228,7 @@ function isFullyUpperCase( return false; } -function deconstruct(identifier: string): Array { +function deconstruct(identifier: string, nameType: NameType): Array { const parts = `${identifier}` .replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar) .replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123 => foo123 bar) @@ -242,6 +242,7 @@ function deconstruct(identifier: string): Array { for (let i = 0; i < parts.length; i++) { const [firstMatch, midPart, lastMatch] = extractReservedCharAndSubString( parts[i], + nameType, isNumber(parts[i - 1]), isNumber(parts[i + 1]) ); @@ -268,12 +269,21 @@ function isReservedChar(part: string) { function extractReservedCharAndSubString( part: string, + nameType: NameType, isPrevNumber: boolean = false, isNextNumber: boolean = false ) { + const optimized = ![ + NameType.OperationGroup, + NameType.Interface, + NameType.Class + ].includes(nameType); if ((isPrevNumber || isNextNumber) && isReservedChar(part)) { return [part]; } + if (!optimized) { + return [undefined, part]; + } const firstMatch = isPrevNumber && isReservedChar(part[0]); const lastMatch = isNextNumber && isReservedChar(part[part.length - 1]); if (firstMatch && lastMatch) { diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 48842ba158..8b942ad7d1 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -9,6 +9,8 @@ describe("#normalizeName", () => { expect(normalizeName("LROsPut202Retry200_202Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200_202Response"); expect(normalizeName("LROsPut202Retry200_Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200_Response"); expect(normalizeName("LROsPut202Retry200 202Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200202Response"); + expect(normalizeName("LROsPut202Retry200-Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200-Response"); + expect(normalizeName("LROsPut202Retry200.Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200.Response"); expect(normalizeName("090", NameType.EnumMemberName)).to.equal("Num090"); expect(normalizeName("10", NameType.EnumMemberName)).to.equal("Num10"); // pls note `1` is a numeric literal number but `1.0` is not @@ -181,6 +183,9 @@ describe("#normalizeName", () => { expect( normalizeName("_LRORetrysPostAsyncRelativeRetrySucceeded", NameType.OperationGroup,) ).to.equal("LRORetrysPostAsyncRelativeRetrySucceeded"); + expect(normalizeName("LROsPut202Retry200_Response", NameType.OperationGroup)).to.equal("LROsPut202Retry200Response"); + expect(normalizeName("LROsPut202Retry200-Response", NameType.OperationGroup)).to.equal("LROsPut202Retry200Response"); + expect(normalizeName("LROsPut202Retry200.Response", NameType.OperationGroup)).to.equal("LROsPut202Retry200Response"); }); }); }); From cc8227d143eb8befd5f8ca4d3f1336a9a67e994d Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 21 Nov 2024 17:37:13 +0800 Subject: [PATCH 71/91] Update the enum list --- packages/rlc-common/src/helpers/nameUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index f9ac730507..a0ef5e861b 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -276,7 +276,9 @@ function extractReservedCharAndSubString( const optimized = ![ NameType.OperationGroup, NameType.Interface, - NameType.Class + NameType.Class, + NameType.Property, + NameType.Parameter ].includes(nameType); if ((isPrevNumber || isNextNumber) && isReservedChar(part)) { return [part]; From 1d31df2e9bc810db06d8aa12b45a470647bf304d Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 21 Nov 2024 17:37:45 +0800 Subject: [PATCH 72/91] Update the enum list --- packages/rlc-common/src/helpers/nameUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index a0ef5e861b..921a17fd9f 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -273,7 +273,7 @@ function extractReservedCharAndSubString( isPrevNumber: boolean = false, isNextNumber: boolean = false ) { - const optimized = ![ + const notOptimized = [ NameType.OperationGroup, NameType.Interface, NameType.Class, @@ -283,7 +283,7 @@ function extractReservedCharAndSubString( if ((isPrevNumber || isNextNumber) && isReservedChar(part)) { return [part]; } - if (!optimized) { + if (notOptimized) { return [undefined, part]; } const firstMatch = isPrevNumber && isReservedChar(part[0]); From c0abf84a080955701110aa8f310b66081f7c802d Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 21 Nov 2024 17:49:13 +0800 Subject: [PATCH 73/91] Update the test cases --- packages/rlc-common/src/helpers/nameUtils.ts | 6 +++--- packages/rlc-common/test/helpers/nameUtils.spec.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 921a17fd9f..3bc6367952 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -243,8 +243,8 @@ function deconstruct(identifier: string, nameType: NameType): Array { const [firstMatch, midPart, lastMatch] = extractReservedCharAndSubString( parts[i], nameType, - isNumber(parts[i - 1]), - isNumber(parts[i + 1]) + parts[i - 1] === undefined ? true : isNumber(parts[i - 1]), + parts[i + 1] === undefined ? true : isNumber(parts[i + 1]) ); if (firstMatch) { refinedParts.push(firstMatch); @@ -280,7 +280,7 @@ function extractReservedCharAndSubString( NameType.Property, NameType.Parameter ].includes(nameType); - if ((isPrevNumber || isNextNumber) && isReservedChar(part)) { + if (isPrevNumber && isNextNumber && isReservedChar(part)) { return [part]; } if (notOptimized) { diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 8b942ad7d1..80df0f9dce 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -72,6 +72,7 @@ describe("#normalizeName", () => { expect(normalizeName("SAS_AUTHENTICATION_IP", NameType.Property)).to.equal("sasAuthenticationIP"); }); it("should normalize number properly", () => { + expect(normalizeName("2024-07-01-preview", NameType.Property)).to.equal("num2024-07-01Preview"); expect(normalizeName("-10Min", NameType.Property)).to.equal("num-10Min"); expect(normalizeName("090", NameType.Property)).to.equal("num090"); expect(normalizeName("10", NameType.Property)).to.equal("num10"); @@ -84,7 +85,7 @@ describe("#normalizeName", () => { expect(normalizeName("1.1", NameType.Property)).to.equal("num1.1"); expect(normalizeName("-1.1", NameType.Property)).to.equal("num-1.1"); expect(normalizeName("v2023_11_15", NameType.Property)).to.equal("v2023_11_15"); - expect(normalizeName("2024-07-01-preview", NameType.Property)).to.equal("num2024-07-01-Preview"); + expect(normalizeName("v1_1", NameType.Property, { numberPrefixOverride: "V" })).to.equal("v1_1"); From b2ac3d298524fa2b22b4805431996ebcec5bf6b8 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:28:18 +0800 Subject: [PATCH 74/91] fix ci --- .../generated/encode/bytes/src/index.d.ts | 26 ++++++------ .../generated/encode/datetime/src/index.d.ts | 40 +++++++++---------- .../generated/encode/duration/src/index.d.ts | 16 ++++---- .../additional-properties/src/index.d.ts | 36 ++++++++--------- .../type/property/value-types/src/index.d.ts | 32 +++++++-------- .../generated/versioning/added/src/index.d.ts | 12 +++--- .../test/unit/parametersGenerator.spec.ts | 2 +- 7 files changed, 82 insertions(+), 82 deletions(-) diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts index b261c442df..bb2d91ed28 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts @@ -51,15 +51,13 @@ export declare interface DefaultBytesPropertyOutput { } export declare interface HeaderBase64 { - get(options: HeaderBase64_Parameters): StreamableMethod; + get(options: HeaderBase64Parameters): StreamableMethod; } export declare interface HeaderBase64204Response extends HttpResponse { status: "204"; } -export declare type HeaderBase64_Parameters = HeaderBase64HeaderParam & RequestParameters; - export declare interface HeaderBase64HeaderParam { headers: RawHttpHeadersInput & HeaderBase64Headers; } @@ -68,6 +66,8 @@ export declare interface HeaderBase64Headers { value: string; } +export declare type HeaderBase64Parameters = HeaderBase64HeaderParam & RequestParameters; + export declare interface HeaderBase64Url { get(options: HeaderBase64UrlParameters): StreamableMethod; } @@ -123,7 +123,7 @@ export declare interface HeaderDefaultHeaders { export declare type HeaderDefaultParameters = HeaderDefaultHeaderParam & RequestParameters; export declare interface PropertyBase64 { - post(options: PropertyBase64_Parameters): StreamableMethod; + post(options: PropertyBase64Parameters): StreamableMethod; } export declare interface PropertyBase64200Response extends HttpResponse { @@ -131,12 +131,12 @@ export declare interface PropertyBase64200Response extends HttpResponse { body: Base64BytesPropertyOutput; } -export declare type PropertyBase64_Parameters = PropertyBase64BodyParam & RequestParameters; - export declare interface PropertyBase64BodyParam { body: Base64BytesProperty; } +export declare type PropertyBase64Parameters = PropertyBase64BodyParam & RequestParameters; + export declare interface PropertyBase64Url { post(options: PropertyBase64UrlParameters): StreamableMethod; } @@ -183,14 +183,14 @@ export declare interface PropertyDefaultBodyParam { export declare type PropertyDefaultParameters = PropertyDefaultBodyParam & RequestParameters; export declare interface QueryBase64 { - get(options: QueryBase64_Parameters): StreamableMethod; + get(options: QueryBase64Parameters): StreamableMethod; } export declare interface QueryBase64204Response extends HttpResponse { status: "204"; } -export declare type QueryBase64_Parameters = QueryBase64QueryParam & RequestParameters; +export declare type QueryBase64Parameters = QueryBase64QueryParam & RequestParameters; export declare interface QueryBase64QueryParam { queryParameters: QueryBase64QueryParamProperties; @@ -261,19 +261,19 @@ export declare interface QueryDefaultQueryParamProperties { } export declare interface RequestBodyBase64 { - post(options: RequestBodyBase64_Parameters): StreamableMethod; + post(options: RequestBodyBase64Parameters): StreamableMethod; } export declare interface RequestBodyBase64204Response extends HttpResponse { status: "204"; } -export declare type RequestBodyBase64_Parameters = RequestBodyBase64BodyParam & RequestParameters; - export declare interface RequestBodyBase64BodyParam { body: string; } +export declare type RequestBodyBase64Parameters = RequestBodyBase64BodyParam & RequestParameters; + export declare interface RequestBodyBase64Url { post(options: RequestBodyBase64UrlParameters): StreamableMethod; } @@ -339,7 +339,7 @@ export declare interface RequestBodyOctetStreamMediaTypesParam { export declare type RequestBodyOctetStreamParameters = RequestBodyOctetStreamMediaTypesParam & RequestBodyOctetStreamBodyParam & RequestParameters; export declare interface ResponseBodyBase64 { - get(options?: ResponseBodyBase64_Parameters): StreamableMethod; + get(options?: ResponseBodyBase64Parameters): StreamableMethod; } export declare interface ResponseBodyBase64200Response extends HttpResponse { @@ -347,7 +347,7 @@ export declare interface ResponseBodyBase64200Response extends HttpResponse { body: string; } -export declare type ResponseBodyBase64_Parameters = RequestParameters; +export declare type ResponseBodyBase64Parameters = RequestParameters; export declare interface ResponseBodyBase64Url { get(options?: ResponseBodyBase64UrlParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts index ed1cdd60fc..42632262a2 100644 --- a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts @@ -45,15 +45,13 @@ export declare interface HeaderDefaultHeaders { export declare type HeaderDefaultParameters = HeaderDefaultHeaderParam & RequestParameters; export declare interface HeaderRfc3339 { - get(options: HeaderRfc3339_Parameters): StreamableMethod; + get(options: HeaderRfc3339Parameters): StreamableMethod; } export declare interface HeaderRfc3339204Response extends HttpResponse { status: "204"; } -export declare type HeaderRfc3339_Parameters = HeaderRfc3339HeaderParam & RequestParameters; - export declare interface HeaderRfc3339HeaderParam { headers: RawHttpHeadersInput & HeaderRfc3339Headers; } @@ -62,16 +60,16 @@ export declare interface HeaderRfc3339Headers { value: string; } +export declare type HeaderRfc3339Parameters = HeaderRfc3339HeaderParam & RequestParameters; + export declare interface HeaderRfc7231 { - get(options: HeaderRfc7231_Parameters): StreamableMethod; + get(options: HeaderRfc7231Parameters): StreamableMethod; } export declare interface HeaderRfc7231204Response extends HttpResponse { status: "204"; } -export declare type HeaderRfc7231_Parameters = HeaderRfc7231HeaderParam & RequestParameters; - export declare interface HeaderRfc7231HeaderParam { headers: RawHttpHeadersInput & HeaderRfc7231Headers; } @@ -80,6 +78,8 @@ export declare interface HeaderRfc7231Headers { value: string; } +export declare type HeaderRfc7231Parameters = HeaderRfc7231HeaderParam & RequestParameters; + export declare interface HeaderUnixTimestamp { get(options: HeaderUnixTimestampParameters): StreamableMethod; } @@ -132,7 +132,7 @@ export declare interface PropertyDefaultBodyParam { export declare type PropertyDefaultParameters = PropertyDefaultBodyParam & RequestParameters; export declare interface PropertyRfc3339 { - post(options: PropertyRfc3339_Parameters): StreamableMethod; + post(options: PropertyRfc3339Parameters): StreamableMethod; } export declare interface PropertyRfc3339200Response extends HttpResponse { @@ -140,14 +140,14 @@ export declare interface PropertyRfc3339200Response extends HttpResponse { body: Rfc3339DatetimePropertyOutput; } -export declare type PropertyRfc3339_Parameters = PropertyRfc3339BodyParam & RequestParameters; - export declare interface PropertyRfc3339BodyParam { body: Rfc3339DatetimeProperty; } +export declare type PropertyRfc3339Parameters = PropertyRfc3339BodyParam & RequestParameters; + export declare interface PropertyRfc7231 { - post(options: PropertyRfc7231_Parameters): StreamableMethod; + post(options: PropertyRfc7231Parameters): StreamableMethod; } export declare interface PropertyRfc7231200Response extends HttpResponse { @@ -155,12 +155,12 @@ export declare interface PropertyRfc7231200Response extends HttpResponse { body: Rfc7231DatetimePropertyOutput; } -export declare type PropertyRfc7231_Parameters = PropertyRfc7231BodyParam & RequestParameters; - export declare interface PropertyRfc7231BodyParam { body: Rfc7231DatetimeProperty; } +export declare type PropertyRfc7231Parameters = PropertyRfc7231BodyParam & RequestParameters; + export declare interface PropertyUnixTimestamp { post(options: PropertyUnixTimestampParameters): StreamableMethod; } @@ -210,14 +210,14 @@ export declare interface QueryDefaultQueryParamProperties { } export declare interface QueryRfc3339 { - get(options: QueryRfc3339_Parameters): StreamableMethod; + get(options: QueryRfc3339Parameters): StreamableMethod; } export declare interface QueryRfc3339204Response extends HttpResponse { status: "204"; } -export declare type QueryRfc3339_Parameters = QueryRfc3339QueryParam & RequestParameters; +export declare type QueryRfc3339Parameters = QueryRfc3339QueryParam & RequestParameters; export declare interface QueryRfc3339QueryParam { queryParameters: QueryRfc3339QueryParamProperties; @@ -228,14 +228,14 @@ export declare interface QueryRfc3339QueryParamProperties { } export declare interface QueryRfc7231 { - get(options: QueryRfc7231_Parameters): StreamableMethod; + get(options: QueryRfc7231Parameters): StreamableMethod; } export declare interface QueryRfc7231204Response extends HttpResponse { status: "204"; } -export declare type QueryRfc7231_Parameters = QueryRfc7231QueryParam & RequestParameters; +export declare type QueryRfc7231Parameters = QueryRfc7231QueryParam & RequestParameters; export declare interface QueryRfc7231QueryParam { queryParameters: QueryRfc7231QueryParamProperties; @@ -303,7 +303,7 @@ export declare interface ResponseHeaderDefault204Response extends HttpResponse { export declare type ResponseHeaderDefaultParameters = RequestParameters; export declare interface ResponseHeaderRfc3339 { - get(options?: ResponseHeaderRfc3339_Parameters): StreamableMethod; + get(options?: ResponseHeaderRfc3339Parameters): StreamableMethod; } export declare interface ResponseHeaderRfc3339204Headers { @@ -315,10 +315,10 @@ export declare interface ResponseHeaderRfc3339204Response extends HttpResponse { headers: RawHttpHeaders & ResponseHeaderRfc3339204Headers; } -export declare type ResponseHeaderRfc3339_Parameters = RequestParameters; +export declare type ResponseHeaderRfc3339Parameters = RequestParameters; export declare interface ResponseHeaderRfc7231 { - get(options?: ResponseHeaderRfc7231_Parameters): StreamableMethod; + get(options?: ResponseHeaderRfc7231Parameters): StreamableMethod; } export declare interface ResponseHeaderRfc7231204Headers { @@ -330,7 +330,7 @@ export declare interface ResponseHeaderRfc7231204Response extends HttpResponse { headers: RawHttpHeaders & ResponseHeaderRfc7231204Headers; } -export declare type ResponseHeaderRfc7231_Parameters = RequestParameters; +export declare type ResponseHeaderRfc7231Parameters = RequestParameters; export declare interface ResponseHeaderUnixTimestamp { get(options?: ResponseHeaderUnixTimestampParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts index 62093b4a32..0d950809be 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts @@ -122,15 +122,13 @@ export declare interface HeaderInt32SecondsHeaders { export declare type HeaderInt32SecondsParameters = HeaderInt32SecondsHeaderParam & RequestParameters; export declare interface HeaderIso8601 { - get(options: HeaderIso8601_Parameters): StreamableMethod; + get(options: HeaderIso8601Parameters): StreamableMethod; } export declare interface HeaderIso8601204Response extends HttpResponse { status: "204"; } -export declare type HeaderIso8601_Parameters = HeaderIso8601HeaderParam & RequestParameters; - export declare interface HeaderIso8601Array { get(options: HeaderIso8601ArrayParameters): StreamableMethod; } @@ -157,6 +155,8 @@ export declare interface HeaderIso8601Headers { duration: string; } +export declare type HeaderIso8601Parameters = HeaderIso8601HeaderParam & RequestParameters; + export declare interface Int32SecondsDurationProperty { value: number; } @@ -249,7 +249,7 @@ export declare interface PropertyInt32SecondsBodyParam { export declare type PropertyInt32SecondsParameters = PropertyInt32SecondsBodyParam & RequestParameters; export declare interface PropertyIso8601 { - post(options: PropertyIso8601_Parameters): StreamableMethod; + post(options: PropertyIso8601Parameters): StreamableMethod; } export declare interface PropertyIso8601200Response extends HttpResponse { @@ -257,12 +257,12 @@ export declare interface PropertyIso8601200Response extends HttpResponse { body: ISO8601DurationPropertyOutput; } -export declare type PropertyIso8601_Parameters = PropertyIso8601BodyParam & RequestParameters; - export declare interface PropertyIso8601BodyParam { body: ISO8601DurationProperty; } +export declare type PropertyIso8601Parameters = PropertyIso8601BodyParam & RequestParameters; + export declare interface QueryDefault { get(options: QueryDefaultParameters): StreamableMethod; } @@ -360,14 +360,14 @@ export declare interface QueryInt32SecondsQueryParamProperties { } export declare interface QueryIso8601 { - get(options: QueryIso8601_Parameters): StreamableMethod; + get(options: QueryIso8601Parameters): StreamableMethod; } export declare interface QueryIso8601204Response extends HttpResponse { status: "204"; } -export declare type QueryIso8601_Parameters = QueryIso8601QueryParam & RequestParameters; +export declare type QueryIso8601Parameters = QueryIso8601QueryParam & RequestParameters; export declare interface QueryIso8601QueryParam { queryParameters: QueryIso8601QueryParamProperties; diff --git a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts index e9602ad80c..dc12201371 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts @@ -939,49 +939,49 @@ export declare interface SpreadRecordForUnionOutput extends Record flag: boolean; } -export declare interface SpreadRecordNonDiscriminatedUnion2_Get200Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion2Get { + get(options?: SpreadRecordNonDiscriminatedUnion2GetParameters): StreamableMethod; + put(options: SpreadRecordNonDiscriminatedUnion2PutParameters): StreamableMethod; +} + +export declare interface SpreadRecordNonDiscriminatedUnion2Get200Response extends HttpResponse { status: "200"; body: SpreadRecordForNonDiscriminatedUnion2Output; } -export declare type SpreadRecordNonDiscriminatedUnion2_GetParameters = RequestParameters; +export declare type SpreadRecordNonDiscriminatedUnion2GetParameters = RequestParameters; -export declare interface SpreadRecordNonDiscriminatedUnion2_Put204Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion2Put204Response extends HttpResponse { status: "204"; } -export declare interface SpreadRecordNonDiscriminatedUnion2_PutBodyParam { +export declare interface SpreadRecordNonDiscriminatedUnion2PutBodyParam { body: SpreadRecordForNonDiscriminatedUnion2; } -export declare type SpreadRecordNonDiscriminatedUnion2_PutParameters = SpreadRecordNonDiscriminatedUnion2_PutBodyParam & RequestParameters; +export declare type SpreadRecordNonDiscriminatedUnion2PutParameters = SpreadRecordNonDiscriminatedUnion2PutBodyParam & RequestParameters; -export declare interface SpreadRecordNonDiscriminatedUnion2Get { - get(options?: SpreadRecordNonDiscriminatedUnion2_GetParameters): StreamableMethod; - put(options: SpreadRecordNonDiscriminatedUnion2_PutParameters): StreamableMethod; +export declare interface SpreadRecordNonDiscriminatedUnion3Get { + get(options?: SpreadRecordNonDiscriminatedUnion3GetParameters): StreamableMethod; + put(options: SpreadRecordNonDiscriminatedUnion3PutParameters): StreamableMethod; } -export declare interface SpreadRecordNonDiscriminatedUnion3_Get200Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion3Get200Response extends HttpResponse { status: "200"; body: SpreadRecordForNonDiscriminatedUnion3Output; } -export declare type SpreadRecordNonDiscriminatedUnion3_GetParameters = RequestParameters; +export declare type SpreadRecordNonDiscriminatedUnion3GetParameters = RequestParameters; -export declare interface SpreadRecordNonDiscriminatedUnion3_Put204Response extends HttpResponse { +export declare interface SpreadRecordNonDiscriminatedUnion3Put204Response extends HttpResponse { status: "204"; } -export declare interface SpreadRecordNonDiscriminatedUnion3_PutBodyParam { +export declare interface SpreadRecordNonDiscriminatedUnion3PutBodyParam { body: SpreadRecordForNonDiscriminatedUnion3; } -export declare type SpreadRecordNonDiscriminatedUnion3_PutParameters = SpreadRecordNonDiscriminatedUnion3_PutBodyParam & RequestParameters; - -export declare interface SpreadRecordNonDiscriminatedUnion3Get { - get(options?: SpreadRecordNonDiscriminatedUnion3_GetParameters): StreamableMethod; - put(options: SpreadRecordNonDiscriminatedUnion3_PutParameters): StreamableMethod; -} +export declare type SpreadRecordNonDiscriminatedUnion3PutParameters = SpreadRecordNonDiscriminatedUnion3PutBodyParam & RequestParameters; export declare interface SpreadRecordNonDiscriminatedUnionGet { get(options?: SpreadRecordNonDiscriminatedUnionGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts index e463b766b0..7f1f1102d0 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts @@ -217,35 +217,35 @@ export declare interface DatetimePutBodyParam { export declare type DatetimePutParameters = DatetimePutBodyParam & RequestParameters; -export declare interface Decimal128_Get200Response extends HttpResponse { +export declare interface Decimal128Get { + get(options?: Decimal128GetParameters): StreamableMethod; + put(options: Decimal128PutParameters): StreamableMethod; +} + +export declare interface Decimal128Get200Response extends HttpResponse { status: "200"; body: Decimal128PropertyOutput; } -export declare type Decimal128_GetParameters = RequestParameters; +export declare type Decimal128GetParameters = RequestParameters; -export declare interface Decimal128_Put204Response extends HttpResponse { - status: "204"; +export declare interface Decimal128Property { + property: number; } -export declare interface Decimal128_PutBodyParam { - body: Decimal128Property; +export declare interface Decimal128PropertyOutput { + property: number; } -export declare type Decimal128_PutParameters = Decimal128_PutBodyParam & RequestParameters; - -export declare interface Decimal128Get { - get(options?: Decimal128_GetParameters): StreamableMethod; - put(options: Decimal128_PutParameters): StreamableMethod; +export declare interface Decimal128Put204Response extends HttpResponse { + status: "204"; } -export declare interface Decimal128Property { - property: number; +export declare interface Decimal128PutBodyParam { + body: Decimal128Property; } -export declare interface Decimal128PropertyOutput { - property: number; -} +export declare type Decimal128PutParameters = Decimal128PutBodyParam & RequestParameters; export declare interface DecimalGet { get(options?: DecimalGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts index 35e3a3008e..6cdc6053da 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts @@ -55,7 +55,7 @@ export declare type UnionV2 = string | number; export declare type UnionV2Output = string | number; export declare interface V1 { - post(options: V1_Parameters): StreamableMethod; + post(options: V1Parameters): StreamableMethod; } export declare interface V1200Response extends HttpResponse { @@ -63,8 +63,6 @@ export declare interface V1200Response extends HttpResponse { body: ModelV1Output; } -export declare type V1_Parameters = V1HeaderParam & V1BodyParam & RequestParameters; - export declare interface V1BodyParam { body: ModelV1; } @@ -77,8 +75,10 @@ export declare interface V1Headers { "header-v2": string; } +export declare type V1Parameters = V1HeaderParam & V1BodyParam & RequestParameters; + export declare interface V2 { - post(options: V2_Parameters): StreamableMethod; + post(options: V2Parameters): StreamableMethod; } export declare interface V2200Response extends HttpResponse { @@ -86,8 +86,6 @@ export declare interface V2200Response extends HttpResponse { body: ModelV2Output; } -export declare type V2_Parameters = V2BodyParam & RequestParameters; - export declare interface V2BodyParam { body: ModelV2; } @@ -107,6 +105,8 @@ export declare interface V2InInterfaceBodyParam { export declare type V2InInterfaceParameters = V2InInterfaceBodyParam & RequestParameters; +export declare type V2Parameters = V2BodyParam & RequestParameters; + export declare type VersioningAddedClient = Client & { path: Routes; }; diff --git a/packages/typespec-ts/test/unit/parametersGenerator.spec.ts b/packages/typespec-ts/test/unit/parametersGenerator.spec.ts index 639fcc327d..a02bfb9c62 100644 --- a/packages/typespec-ts/test/unit/parametersGenerator.spec.ts +++ b/packages/typespec-ts/test/unit/parametersGenerator.spec.ts @@ -176,7 +176,7 @@ describe("Parameters.ts", () => { } export type TestParameters = TestQueryParam & RequestParameters; - export type Test1_Parameters = RequestParameters; + export type Test1Parameters = RequestParameters; ` ); }); From 9580d6ed9d4fbd9cf336094f8540e06d2f6fff61 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:32:15 +0800 Subject: [PATCH 75/91] fix ci --- .../bodyComplexRest/src/parameters.ts | 4 +- .../generated/headerRest/src/parameters.ts | 4 +- .../httpInfrastructureRest/src/parameters.ts | 173 +++++++++--------- .../generated/lroRest/src/parameters.ts | 55 +++--- .../review/openai-non-branded.api.md | 2 +- .../typespec-ts/src/models/models.ts | 4 +- .../models/serialization/enumKeyNorm.md | 4 +- 7 files changed, 120 insertions(+), 126 deletions(-) diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts index 2a3b5ac1fa..85dc564c3a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts @@ -163,7 +163,7 @@ export type PrimitivePutDateTimeParameters = PrimitivePutDateTimeMediaTypesParam & PrimitivePutDateTimeBodyParam & RequestParameters; -export type PrimitiveGetDateTimeRfc1123_Parameters = RequestParameters; +export type PrimitiveGetDateTimeRfc1123Parameters = RequestParameters; export interface PrimitivePutDateTimeRfc1123BodyParam { /** Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT' */ @@ -175,7 +175,7 @@ export interface PrimitivePutDateTimeRfc1123MediaTypesParam { contentType?: "application/json"; } -export type PrimitivePutDateTimeRfc1123_Parameters = +export type PrimitivePutDateTimeRfc1123Parameters = PrimitivePutDateTimeRfc1123MediaTypesParam & PrimitivePutDateTimeRfc1123BodyParam & RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts index db2dacbcf8..eb87b8d6bf 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts @@ -249,7 +249,7 @@ export interface HeaderParamDatetimeRfc1123HeaderParam { headers: RawHttpHeadersInput & HeaderParamDatetimeRfc1123Headers; } -export type HeaderParamDatetimeRfc1123_Parameters = +export type HeaderParamDatetimeRfc1123Parameters = HeaderParamDatetimeRfc1123HeaderParam & RequestParameters; export interface HeaderResponseDatetimeRfc1123Headers { @@ -261,7 +261,7 @@ export interface HeaderResponseDatetimeRfc1123HeaderParam { headers: RawHttpHeadersInput & HeaderResponseDatetimeRfc1123Headers; } -export type HeaderResponseDatetimeRfc1123_Parameters = +export type HeaderResponseDatetimeRfc1123Parameters = HeaderResponseDatetimeRfc1123HeaderParam & RequestParameters; export interface HeaderParamDurationHeaders { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts index e50b328c2e..61c4ddfe1a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts @@ -6,9 +6,9 @@ import { RequestParameters } from "@azure-rest/core-client"; export type HttpFailureGetEmptyErrorParameters = RequestParameters; export type HttpFailureGetNoModelErrorParameters = RequestParameters; export type HttpFailureGetNoModelEmptyParameters = RequestParameters; -export type HttpSuccessHead200_Parameters = RequestParameters; -export type HttpSuccessGet200_Parameters = RequestParameters; -export type HttpSuccessOptions200_Parameters = RequestParameters; +export type HttpSuccessHead200Parameters = RequestParameters; +export type HttpSuccessGet200Parameters = RequestParameters; +export type HttpSuccessOptions200Parameters = RequestParameters; export interface HttpSuccessPut200BodyParam { /** Simple boolean value true */ @@ -20,7 +20,7 @@ export interface HttpSuccessPut200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut200_Parameters = HttpSuccessPut200MediaTypesParam & +export type HttpSuccessPut200Parameters = HttpSuccessPut200MediaTypesParam & HttpSuccessPut200BodyParam & RequestParameters; @@ -34,10 +34,9 @@ export interface HttpSuccessPatch200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPatch200_Parameters = - HttpSuccessPatch200MediaTypesParam & - HttpSuccessPatch200BodyParam & - RequestParameters; +export type HttpSuccessPatch200Parameters = HttpSuccessPatch200MediaTypesParam & + HttpSuccessPatch200BodyParam & + RequestParameters; export interface HttpSuccessPost200BodyParam { /** Simple boolean value true */ @@ -49,7 +48,7 @@ export interface HttpSuccessPost200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost200_Parameters = HttpSuccessPost200MediaTypesParam & +export type HttpSuccessPost200Parameters = HttpSuccessPost200MediaTypesParam & HttpSuccessPost200BodyParam & RequestParameters; @@ -63,7 +62,7 @@ export interface HttpSuccessDelete200MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessDelete200_Parameters = +export type HttpSuccessDelete200Parameters = HttpSuccessDelete200MediaTypesParam & HttpSuccessDelete200BodyParam & RequestParameters; @@ -78,7 +77,7 @@ export interface HttpSuccessPut201MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut201_Parameters = HttpSuccessPut201MediaTypesParam & +export type HttpSuccessPut201Parameters = HttpSuccessPut201MediaTypesParam & HttpSuccessPut201BodyParam & RequestParameters; @@ -92,7 +91,7 @@ export interface HttpSuccessPost201MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost201_Parameters = HttpSuccessPost201MediaTypesParam & +export type HttpSuccessPost201Parameters = HttpSuccessPost201MediaTypesParam & HttpSuccessPost201BodyParam & RequestParameters; @@ -106,7 +105,7 @@ export interface HttpSuccessPut202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut202_Parameters = HttpSuccessPut202MediaTypesParam & +export type HttpSuccessPut202Parameters = HttpSuccessPut202MediaTypesParam & HttpSuccessPut202BodyParam & RequestParameters; @@ -120,10 +119,9 @@ export interface HttpSuccessPatch202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPatch202_Parameters = - HttpSuccessPatch202MediaTypesParam & - HttpSuccessPatch202BodyParam & - RequestParameters; +export type HttpSuccessPatch202Parameters = HttpSuccessPatch202MediaTypesParam & + HttpSuccessPatch202BodyParam & + RequestParameters; export interface HttpSuccessPost202BodyParam { /** Simple boolean value true */ @@ -135,7 +133,7 @@ export interface HttpSuccessPost202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost202_Parameters = HttpSuccessPost202MediaTypesParam & +export type HttpSuccessPost202Parameters = HttpSuccessPost202MediaTypesParam & HttpSuccessPost202BodyParam & RequestParameters; @@ -149,11 +147,11 @@ export interface HttpSuccessDelete202MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessDelete202_Parameters = +export type HttpSuccessDelete202Parameters = HttpSuccessDelete202MediaTypesParam & HttpSuccessDelete202BodyParam & RequestParameters; -export type HttpSuccessHead204_Parameters = RequestParameters; +export type HttpSuccessHead204Parameters = RequestParameters; export interface HttpSuccessPut204BodyParam { /** Simple boolean value true */ @@ -165,7 +163,7 @@ export interface HttpSuccessPut204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPut204_Parameters = HttpSuccessPut204MediaTypesParam & +export type HttpSuccessPut204Parameters = HttpSuccessPut204MediaTypesParam & HttpSuccessPut204BodyParam & RequestParameters; @@ -179,10 +177,9 @@ export interface HttpSuccessPatch204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPatch204_Parameters = - HttpSuccessPatch204MediaTypesParam & - HttpSuccessPatch204BodyParam & - RequestParameters; +export type HttpSuccessPatch204Parameters = HttpSuccessPatch204MediaTypesParam & + HttpSuccessPatch204BodyParam & + RequestParameters; export interface HttpSuccessPost204BodyParam { /** Simple boolean value true */ @@ -194,7 +191,7 @@ export interface HttpSuccessPost204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessPost204_Parameters = HttpSuccessPost204MediaTypesParam & +export type HttpSuccessPost204Parameters = HttpSuccessPost204MediaTypesParam & HttpSuccessPost204BodyParam & RequestParameters; @@ -208,15 +205,15 @@ export interface HttpSuccessDelete204MediaTypesParam { contentType?: "application/json"; } -export type HttpSuccessDelete204_Parameters = +export type HttpSuccessDelete204Parameters = HttpSuccessDelete204MediaTypesParam & HttpSuccessDelete204BodyParam & RequestParameters; -export type HttpSuccessHead404_Parameters = RequestParameters; -export type HttpRedirectsHead300_Parameters = RequestParameters; -export type HttpRedirectsGet300_Parameters = RequestParameters; -export type HttpRedirectsHead301_Parameters = RequestParameters; -export type HttpRedirectsGet301_Parameters = RequestParameters; +export type HttpSuccessHead404Parameters = RequestParameters; +export type HttpRedirectsHead300Parameters = RequestParameters; +export type HttpRedirectsGet300Parameters = RequestParameters; +export type HttpRedirectsHead301Parameters = RequestParameters; +export type HttpRedirectsGet301Parameters = RequestParameters; export interface HttpRedirectsPut301BodyParam { /** Simple boolean value true */ @@ -228,12 +225,11 @@ export interface HttpRedirectsPut301MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPut301_Parameters = - HttpRedirectsPut301MediaTypesParam & - HttpRedirectsPut301BodyParam & - RequestParameters; -export type HttpRedirectsHead302_Parameters = RequestParameters; -export type HttpRedirectsGet302_Parameters = RequestParameters; +export type HttpRedirectsPut301Parameters = HttpRedirectsPut301MediaTypesParam & + HttpRedirectsPut301BodyParam & + RequestParameters; +export type HttpRedirectsHead302Parameters = RequestParameters; +export type HttpRedirectsGet302Parameters = RequestParameters; export interface HttpRedirectsPatch302BodyParam { /** Simple boolean value true */ @@ -245,7 +241,7 @@ export interface HttpRedirectsPatch302MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPatch302_Parameters = +export type HttpRedirectsPatch302Parameters = HttpRedirectsPatch302MediaTypesParam & HttpRedirectsPatch302BodyParam & RequestParameters; @@ -260,13 +256,13 @@ export interface HttpRedirectsPost303MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPost303_Parameters = +export type HttpRedirectsPost303Parameters = HttpRedirectsPost303MediaTypesParam & HttpRedirectsPost303BodyParam & RequestParameters; -export type HttpRedirectsHead307_Parameters = RequestParameters; -export type HttpRedirectsGet307_Parameters = RequestParameters; -export type HttpRedirectsOptions307_Parameters = RequestParameters; +export type HttpRedirectsHead307Parameters = RequestParameters; +export type HttpRedirectsGet307Parameters = RequestParameters; +export type HttpRedirectsOptions307Parameters = RequestParameters; export interface HttpRedirectsPut307BodyParam { /** Simple boolean value true */ @@ -278,10 +274,9 @@ export interface HttpRedirectsPut307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPut307_Parameters = - HttpRedirectsPut307MediaTypesParam & - HttpRedirectsPut307BodyParam & - RequestParameters; +export type HttpRedirectsPut307Parameters = HttpRedirectsPut307MediaTypesParam & + HttpRedirectsPut307BodyParam & + RequestParameters; export interface HttpRedirectsPatch307BodyParam { /** Simple boolean value true */ @@ -293,7 +288,7 @@ export interface HttpRedirectsPatch307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPatch307_Parameters = +export type HttpRedirectsPatch307Parameters = HttpRedirectsPatch307MediaTypesParam & HttpRedirectsPatch307BodyParam & RequestParameters; @@ -308,7 +303,7 @@ export interface HttpRedirectsPost307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsPost307_Parameters = +export type HttpRedirectsPost307Parameters = HttpRedirectsPost307MediaTypesParam & HttpRedirectsPost307BodyParam & RequestParameters; @@ -323,13 +318,13 @@ export interface HttpRedirectsDelete307MediaTypesParam { contentType?: "application/json"; } -export type HttpRedirectsDelete307_Parameters = +export type HttpRedirectsDelete307Parameters = HttpRedirectsDelete307MediaTypesParam & HttpRedirectsDelete307BodyParam & RequestParameters; -export type HttpClientFailureHead400_Parameters = RequestParameters; -export type HttpClientFailureGet400_Parameters = RequestParameters; -export type HttpClientFailureOptions400_Parameters = RequestParameters; +export type HttpClientFailureHead400Parameters = RequestParameters; +export type HttpClientFailureGet400Parameters = RequestParameters; +export type HttpClientFailureOptions400Parameters = RequestParameters; export interface HttpClientFailurePut400BodyParam { /** Simple boolean value true */ @@ -341,7 +336,7 @@ export interface HttpClientFailurePut400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut400_Parameters = +export type HttpClientFailurePut400Parameters = HttpClientFailurePut400MediaTypesParam & HttpClientFailurePut400BodyParam & RequestParameters; @@ -356,7 +351,7 @@ export interface HttpClientFailurePatch400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePatch400_Parameters = +export type HttpClientFailurePatch400Parameters = HttpClientFailurePatch400MediaTypesParam & HttpClientFailurePatch400BodyParam & RequestParameters; @@ -371,7 +366,7 @@ export interface HttpClientFailurePost400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePost400_Parameters = +export type HttpClientFailurePost400Parameters = HttpClientFailurePost400MediaTypesParam & HttpClientFailurePost400BodyParam & RequestParameters; @@ -386,14 +381,14 @@ export interface HttpClientFailureDelete400MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailureDelete400_Parameters = +export type HttpClientFailureDelete400Parameters = HttpClientFailureDelete400MediaTypesParam & HttpClientFailureDelete400BodyParam & RequestParameters; -export type HttpClientFailureHead401_Parameters = RequestParameters; -export type HttpClientFailureGet402_Parameters = RequestParameters; -export type HttpClientFailureOptions403_Parameters = RequestParameters; -export type HttpClientFailureGet403_Parameters = RequestParameters; +export type HttpClientFailureHead401Parameters = RequestParameters; +export type HttpClientFailureGet402Parameters = RequestParameters; +export type HttpClientFailureOptions403Parameters = RequestParameters; +export type HttpClientFailureGet403Parameters = RequestParameters; export interface HttpClientFailurePut404BodyParam { /** Simple boolean value true */ @@ -405,7 +400,7 @@ export interface HttpClientFailurePut404MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut404_Parameters = +export type HttpClientFailurePut404Parameters = HttpClientFailurePut404MediaTypesParam & HttpClientFailurePut404BodyParam & RequestParameters; @@ -420,7 +415,7 @@ export interface HttpClientFailurePatch405MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePatch405_Parameters = +export type HttpClientFailurePatch405Parameters = HttpClientFailurePatch405MediaTypesParam & HttpClientFailurePatch405BodyParam & RequestParameters; @@ -435,7 +430,7 @@ export interface HttpClientFailurePost406MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePost406_Parameters = +export type HttpClientFailurePost406Parameters = HttpClientFailurePost406MediaTypesParam & HttpClientFailurePost406BodyParam & RequestParameters; @@ -450,7 +445,7 @@ export interface HttpClientFailureDelete407MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailureDelete407_Parameters = +export type HttpClientFailureDelete407Parameters = HttpClientFailureDelete407MediaTypesParam & HttpClientFailureDelete407BodyParam & RequestParameters; @@ -465,14 +460,14 @@ export interface HttpClientFailurePut409MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut409_Parameters = +export type HttpClientFailurePut409Parameters = HttpClientFailurePut409MediaTypesParam & HttpClientFailurePut409BodyParam & RequestParameters; -export type HttpClientFailureHead410_Parameters = RequestParameters; -export type HttpClientFailureGet411_Parameters = RequestParameters; -export type HttpClientFailureOptions412_Parameters = RequestParameters; -export type HttpClientFailureGet412_Parameters = RequestParameters; +export type HttpClientFailureHead410Parameters = RequestParameters; +export type HttpClientFailureGet411Parameters = RequestParameters; +export type HttpClientFailureOptions412Parameters = RequestParameters; +export type HttpClientFailureGet412Parameters = RequestParameters; export interface HttpClientFailurePut413BodyParam { /** Simple boolean value true */ @@ -484,7 +479,7 @@ export interface HttpClientFailurePut413MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePut413_Parameters = +export type HttpClientFailurePut413Parameters = HttpClientFailurePut413MediaTypesParam & HttpClientFailurePut413BodyParam & RequestParameters; @@ -499,7 +494,7 @@ export interface HttpClientFailurePatch414MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePatch414_Parameters = +export type HttpClientFailurePatch414Parameters = HttpClientFailurePatch414MediaTypesParam & HttpClientFailurePatch414BodyParam & RequestParameters; @@ -514,11 +509,11 @@ export interface HttpClientFailurePost415MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailurePost415_Parameters = +export type HttpClientFailurePost415Parameters = HttpClientFailurePost415MediaTypesParam & HttpClientFailurePost415BodyParam & RequestParameters; -export type HttpClientFailureGet416_Parameters = RequestParameters; +export type HttpClientFailureGet416Parameters = RequestParameters; export interface HttpClientFailureDelete417BodyParam { /** Simple boolean value true */ @@ -530,13 +525,13 @@ export interface HttpClientFailureDelete417MediaTypesParam { contentType?: "application/json"; } -export type HttpClientFailureDelete417_Parameters = +export type HttpClientFailureDelete417Parameters = HttpClientFailureDelete417MediaTypesParam & HttpClientFailureDelete417BodyParam & RequestParameters; -export type HttpClientFailureHead429_Parameters = RequestParameters; -export type HttpServerFailureHead501_Parameters = RequestParameters; -export type HttpServerFailureGet501_Parameters = RequestParameters; +export type HttpClientFailureHead429Parameters = RequestParameters; +export type HttpServerFailureHead501Parameters = RequestParameters; +export type HttpServerFailureGet501Parameters = RequestParameters; export interface HttpServerFailurePost505BodyParam { /** Simple boolean value true */ @@ -548,7 +543,7 @@ export interface HttpServerFailurePost505MediaTypesParam { contentType?: "application/json"; } -export type HttpServerFailurePost505_Parameters = +export type HttpServerFailurePost505Parameters = HttpServerFailurePost505MediaTypesParam & HttpServerFailurePost505BodyParam & RequestParameters; @@ -563,11 +558,11 @@ export interface HttpServerFailureDelete505MediaTypesParam { contentType?: "application/json"; } -export type HttpServerFailureDelete505_Parameters = +export type HttpServerFailureDelete505Parameters = HttpServerFailureDelete505MediaTypesParam & HttpServerFailureDelete505BodyParam & RequestParameters; -export type HttpRetryHead408_Parameters = RequestParameters; +export type HttpRetryHead408Parameters = RequestParameters; export interface HttpRetryPut500BodyParam { /** Simple boolean value true */ @@ -579,7 +574,7 @@ export interface HttpRetryPut500MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPut500_Parameters = HttpRetryPut500MediaTypesParam & +export type HttpRetryPut500Parameters = HttpRetryPut500MediaTypesParam & HttpRetryPut500BodyParam & RequestParameters; @@ -593,11 +588,11 @@ export interface HttpRetryPatch500MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPatch500_Parameters = HttpRetryPatch500MediaTypesParam & +export type HttpRetryPatch500Parameters = HttpRetryPatch500MediaTypesParam & HttpRetryPatch500BodyParam & RequestParameters; -export type HttpRetryGet502_Parameters = RequestParameters; -export type HttpRetryOptions502_Parameters = RequestParameters; +export type HttpRetryGet502Parameters = RequestParameters; +export type HttpRetryOptions502Parameters = RequestParameters; export interface HttpRetryPost503BodyParam { /** Simple boolean value true */ @@ -609,7 +604,7 @@ export interface HttpRetryPost503MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPost503_Parameters = HttpRetryPost503MediaTypesParam & +export type HttpRetryPost503Parameters = HttpRetryPost503MediaTypesParam & HttpRetryPost503BodyParam & RequestParameters; @@ -623,7 +618,7 @@ export interface HttpRetryDelete503MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryDelete503_Parameters = HttpRetryDelete503MediaTypesParam & +export type HttpRetryDelete503Parameters = HttpRetryDelete503MediaTypesParam & HttpRetryDelete503BodyParam & RequestParameters; @@ -637,7 +632,7 @@ export interface HttpRetryPut504MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPut504_Parameters = HttpRetryPut504MediaTypesParam & +export type HttpRetryPut504Parameters = HttpRetryPut504MediaTypesParam & HttpRetryPut504BodyParam & RequestParameters; @@ -651,7 +646,7 @@ export interface HttpRetryPatch504MediaTypesParam { contentType?: "application/json"; } -export type HttpRetryPatch504_Parameters = HttpRetryPatch504MediaTypesParam & +export type HttpRetryPatch504Parameters = HttpRetryPatch504MediaTypesParam & HttpRetryPatch504BodyParam & RequestParameters; export type MultipleResponsesGet200Model204NoModelDefaultError200ValidParameters = diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts index 7e8460c3b2..ed1b92edce 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts @@ -103,7 +103,7 @@ export interface LROsPut202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut202Retry200_Parameters = LROsPut202Retry200MediaTypesParam & +export type LROsPut202Retry200Parameters = LROsPut202Retry200MediaTypesParam & LROsPut202Retry200BodyParam & RequestParameters; @@ -117,7 +117,7 @@ export interface LROsPut201CreatingSucceeded200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut201CreatingSucceeded200_Parameters = +export type LROsPut201CreatingSucceeded200Parameters = LROsPut201CreatingSucceeded200MediaTypesParam & LROsPut201CreatingSucceeded200BodyParam & RequestParameters; @@ -132,7 +132,7 @@ export interface LROsPut200UpdatingSucceeded204MediaTypesParam { contentType?: "application/json"; } -export type LROsPut200UpdatingSucceeded204_Parameters = +export type LROsPut200UpdatingSucceeded204Parameters = LROsPut200UpdatingSucceeded204MediaTypesParam & LROsPut200UpdatingSucceeded204BodyParam & RequestParameters; @@ -147,7 +147,7 @@ export interface LROsPut201CreatingFailed200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut201CreatingFailed200_Parameters = +export type LROsPut201CreatingFailed200Parameters = LROsPut201CreatingFailed200MediaTypesParam & LROsPut201CreatingFailed200BodyParam & RequestParameters; @@ -162,7 +162,7 @@ export interface LROsPut200Acceptedcanceled200MediaTypesParam { contentType?: "application/json"; } -export type LROsPut200Acceptedcanceled200_Parameters = +export type LROsPut200Acceptedcanceled200Parameters = LROsPut200Acceptedcanceled200MediaTypesParam & LROsPut200Acceptedcanceled200BodyParam & RequestParameters; @@ -316,13 +316,13 @@ export type LROsPutAsyncSubResourceParameters = RequestParameters; export type LROsDeleteProvisioning202Accepted200SucceededParameters = RequestParameters; -export type LROsDeleteProvisioning202DeletingFailed200_Parameters = +export type LROsDeleteProvisioning202DeletingFailed200Parameters = RequestParameters; -export type LROsDeleteProvisioning202Deletingcanceled200_Parameters = +export type LROsDeleteProvisioning202Deletingcanceled200Parameters = RequestParameters; export type LROsDelete204SucceededParameters = RequestParameters; -export type LROsDelete202Retry200_Parameters = RequestParameters; -export type LROsDelete202NoRetry204_Parameters = RequestParameters; +export type LROsDelete202Retry200Parameters = RequestParameters; +export type LROsDelete202NoRetry204Parameters = RequestParameters; export type LROsDeleteNoHeaderInRetryParameters = RequestParameters; export type LROsDeleteAsyncNoHeaderInRetryParameters = RequestParameters; export type LROsDeleteAsyncRetrySucceededParameters = RequestParameters; @@ -341,10 +341,9 @@ export interface LROsPost202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LROsPost202Retry200_Parameters = - LROsPost202Retry200MediaTypesParam & - LROsPost202Retry200BodyParam & - RequestParameters; +export type LROsPost202Retry200Parameters = LROsPost202Retry200MediaTypesParam & + LROsPost202Retry200BodyParam & + RequestParameters; export interface LROsPost202NoRetry204BodyParam { /** Product to put */ @@ -356,7 +355,7 @@ export interface LROsPost202NoRetry204MediaTypesParam { contentType?: "application/json"; } -export type LROsPost202NoRetry204_Parameters = +export type LROsPost202NoRetry204Parameters = LROsPost202NoRetry204MediaTypesParam & LROsPost202NoRetry204BodyParam & RequestParameters; @@ -436,7 +435,7 @@ export interface LRORetrysPut201CreatingSucceeded200MediaTypesParam { contentType?: "application/json"; } -export type LRORetrysPut201CreatingSucceeded200_Parameters = +export type LRORetrysPut201CreatingSucceeded200Parameters = LRORetrysPut201CreatingSucceeded200MediaTypesParam & LRORetrysPut201CreatingSucceeded200BodyParam & RequestParameters; @@ -457,7 +456,7 @@ export type LRORetrysPutAsyncRelativeRetrySucceededParameters = RequestParameters; export type LRORetrysDeleteProvisioning202Accepted200SucceededParameters = RequestParameters; -export type LRORetrysDelete202Retry200_Parameters = RequestParameters; +export type LRORetrysDelete202Retry200Parameters = RequestParameters; export type LRORetrysDeleteAsyncRelativeRetrySucceededParameters = RequestParameters; @@ -471,7 +470,7 @@ export interface LRORetrysPost202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LRORetrysPost202Retry200_Parameters = +export type LRORetrysPost202Retry200Parameters = LRORetrysPost202Retry200MediaTypesParam & LRORetrysPost202Retry200BodyParam & RequestParameters; @@ -501,7 +500,7 @@ export interface LrosaDsPutNonRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPutNonRetry400_Parameters = +export type LrosaDsPutNonRetry400Parameters = LrosaDsPutNonRetry400MediaTypesParam & LrosaDsPutNonRetry400BodyParam & RequestParameters; @@ -516,7 +515,7 @@ export interface LrosaDsPutNonRetry201Creating400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPutNonRetry201Creating400_Parameters = +export type LrosaDsPutNonRetry201Creating400Parameters = LrosaDsPutNonRetry201Creating400MediaTypesParam & LrosaDsPutNonRetry201Creating400BodyParam & RequestParameters; @@ -546,13 +545,13 @@ export interface LrosaDsPutAsyncRelativeRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPutAsyncRelativeRetry400_Parameters = +export type LrosaDsPutAsyncRelativeRetry400Parameters = LrosaDsPutAsyncRelativeRetry400MediaTypesParam & LrosaDsPutAsyncRelativeRetry400BodyParam & RequestParameters; -export type LrosaDsDeleteNonRetry400_Parameters = RequestParameters; -export type LrosaDsDelete202NonRetry400_Parameters = RequestParameters; -export type LrosaDsDeleteAsyncRelativeRetry400_Parameters = RequestParameters; +export type LrosaDsDeleteNonRetry400Parameters = RequestParameters; +export type LrosaDsDelete202NonRetry400Parameters = RequestParameters; +export type LrosaDsDeleteAsyncRelativeRetry400Parameters = RequestParameters; export interface LrosaDsPostNonRetry400BodyParam { /** Product to put */ @@ -564,7 +563,7 @@ export interface LrosaDsPostNonRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPostNonRetry400_Parameters = +export type LrosaDsPostNonRetry400Parameters = LrosaDsPostNonRetry400MediaTypesParam & LrosaDsPostNonRetry400BodyParam & RequestParameters; @@ -579,7 +578,7 @@ export interface LrosaDsPost202NonRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPost202NonRetry400_Parameters = +export type LrosaDsPost202NonRetry400Parameters = LrosaDsPost202NonRetry400MediaTypesParam & LrosaDsPost202NonRetry400BodyParam & RequestParameters; @@ -594,7 +593,7 @@ export interface LrosaDsPostAsyncRelativeRetry400MediaTypesParam { contentType?: "application/json"; } -export type LrosaDsPostAsyncRelativeRetry400_Parameters = +export type LrosaDsPostAsyncRelativeRetry400Parameters = LrosaDsPostAsyncRelativeRetry400MediaTypesParam & LrosaDsPostAsyncRelativeRetry400BodyParam & RequestParameters; @@ -797,7 +796,7 @@ export interface LROsCustomHeaderPut201CreatingSucceeded200MediaTypesParam { contentType?: "application/json"; } -export type LROsCustomHeaderPut201CreatingSucceeded200_Parameters = +export type LROsCustomHeaderPut201CreatingSucceeded200Parameters = LROsCustomHeaderPut201CreatingSucceeded200MediaTypesParam & LROsCustomHeaderPut201CreatingSucceeded200BodyParam & RequestParameters; @@ -812,7 +811,7 @@ export interface LROsCustomHeaderPost202Retry200MediaTypesParam { contentType?: "application/json"; } -export type LROsCustomHeaderPost202Retry200_Parameters = +export type LROsCustomHeaderPost202Retry200Parameters = LROsCustomHeaderPost202Retry200MediaTypesParam & LROsCustomHeaderPost202Retry200BodyParam & RequestParameters; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index 25b3828b54..58eab3afa9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -619,7 +619,7 @@ export interface FineTuningOperations { // @public export interface Image { - b64_Json?: Uint8Array; + b64Json?: Uint8Array; url?: string; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index 27f753de2b..613835d627 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -324,13 +324,13 @@ export interface Image { /** The URL of the generated image, if `response_format` is `url` (default). */ url?: string; /** The base64-encoded JSON of the generated image, if `response_format` is `b64_json`. */ - b64_Json?: Uint8Array; + b64Json?: Uint8Array; } export function imageDeserializer(item: any): Image { return { url: item["url"], - b64_Json: !item["b64_json"] + b64Json: !item["b64_json"] ? item["b64_json"] : typeof item["b64_json"] === "string" ? stringToUint8Array(item["b64_json"], "base64") diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index f269a5ac53..7f1af1bcb9 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -106,13 +106,13 @@ export enum KnownExtensibleString { Pascalcase4 = "Pascalcase4", PascalCase_5 = "pascal_case_5", PascalCase6 = "pascal_case6", - PascalCase7 = "_pascal_case7", + _PascalCase7 = "_pascal_case7", PascalCase8 = "pascal, case8", MAXOfMLD = "MAX_of_MLD", YESORNO1 = "YES OR NO", YesOrNo2 = "YES OR NO", ValidationSuccess = "VALIDATION_SUCCESS", - PascalCase6666 = "___pascal____case6666", + _PascalCase6666 = "___pascal____case6666", _10Pascal = "_10Pascal", Num090 = "090", Num10 = "10", From c1042347f7b64f2cad43f9acbcda283c263e2cb0 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 2 Jan 2025 11:43:58 +0800 Subject: [PATCH 76/91] merge to the latest main --- .../sdk/test/arm-test/eslint.config.mjs | 5 +- .../sdk/test/arm-test/package.json | 78 +- .../review/arm-networkanalytics.api.md | 12 +- .../arm-test/src/api/dataProducts/index.ts | 596 +- .../src/api/dataProductsCatalogs/index.ts | 120 +- .../test/arm-test/src/api/dataTypes/index.ts | 370 +- .../sdk/test/arm-test/src/api/index.ts | 42 +- .../src/api/networkAnalyticsContext.ts | 17 +- .../test/arm-test/src/api/operations/index.ts | 9 +- .../sdk/test/arm-test/src/api/options.ts | 64 +- .../src/classic/dataProducts/index.ts | 276 +- .../src/classic/dataProductsCatalogs/index.ts | 51 +- .../arm-test/src/classic/dataTypes/index.ts | 164 +- .../sdk/test/arm-test/src/index.ts | 42 +- .../sdk/test/arm-test/src/models/models.ts | 28 +- .../arm-test/src/networkAnalyticsClient.ts | 45 +- .../test/arm-test/src/restorePollerHelpers.ts | 40 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../ai/generated/typespec-ts/package.json | 40 +- .../typespec-ts/review/ai-client.api.md | 4 +- .../typespec-ts/src/api/agents/index.ts | 2247 ++++--- .../typespec-ts/src/api/azureAIContext.ts | 20 +- .../typespec-ts/src/api/connections/index.ts | 100 +- .../typespec-ts/src/api/evaluations/index.ts | 285 +- .../ai/generated/typespec-ts/src/api/index.ts | 100 +- .../generated/typespec-ts/src/api/options.ts | 632 +- .../typespec-ts/src/azureAIClient.ts | 26 +- .../typespec-ts/src/classic/agents/index.ts | 852 +-- .../src/classic/connections/index.ts | 30 +- .../src/classic/evaluations/index.ts | 122 +- .../ai/generated/typespec-ts/src/index.ts | 100 +- .../typespec-ts/src/models/models.ts | 126 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/package.json | 40 +- .../review/ai-anomaly-detector.api.md | 2 +- .../typespec-ts/src/anomalyDetectorClient.ts | 16 +- .../src/api/anomalyDetectorContext.ts | 8 +- .../generated/typespec-ts/src/api/index.ts | 18 +- .../typespec-ts/src/api/multivariate/index.ts | 297 +- .../generated/typespec-ts/src/api/options.ts | 24 +- .../typespec-ts/src/api/univariate/index.ts | 89 +- .../src/classic/multivariate/index.ts | 156 +- .../src/classic/univariate/index.ts | 50 +- .../generated/typespec-ts/src/index.ts | 18 +- .../typespec-ts/src/models/models.ts | 17 +- .../spec/multivariate/models.tsp | 2 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/review/batch.api.md | 406 +- .../typespec-ts/src/api/batchContext.ts | 32 +- .../generated/typespec-ts/src/api/index.ts | 300 +- .../typespec-ts/src/api/operations.ts | 5731 ++++++++++------- .../generated/typespec-ts/src/api/options.ts | 2020 ++++-- .../generated/typespec-ts/src/batchClient.ts | 1648 ++--- .../generated/typespec-ts/src/index.ts | 150 +- .../typespec-ts/src/models/models.ts | 50 +- .../test/batch_modular/spec/models.tsp | 26 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../review/ai-chat-protocol.api.md | 2 +- .../src/api/chatProtocolContext.ts | 3 +- .../generated/typespec-ts/src/api/index.ts | 4 +- .../typespec-ts/src/api/operations.ts | 66 +- .../generated/typespec-ts/src/api/options.ts | 4 +- .../typespec-ts/src/chatProtocolClient.ts | 20 +- .../generated/typespec-ts/src/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../test/confidentialLedger/spec/main.tsp | 2 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../review/ai-content-safety.api.md | 3 +- .../src/api/contentSafetyContext.ts | 8 +- .../generated/typespec-ts/src/api/index.ts | 36 +- .../typespec-ts/src/api/operations.ts | 429 +- .../generated/typespec-ts/src/api/options.ts | 39 +- .../typespec-ts/src/contentSafetyClient.ts | 148 +- .../generated/typespec-ts/src/index.ts | 18 +- .../typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../typespec-ts/review/eventgrid.api.md | 7 +- .../typespec-ts/src/api/eventGridContext.ts | 11 +- .../generated/typespec-ts/src/api/index.ts | 20 +- .../typespec-ts/src/api/operations.ts | 276 +- .../generated/typespec-ts/src/api/options.ts | 30 +- .../typespec-ts/src/eventGridClient.ts | 104 +- .../generated/typespec-ts/src/index.ts | 10 +- .../typespec-ts/src/models/models.ts | 4 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../health-insights-radiologyinsights.api.md | 27 +- .../typespec-ts/src/api/operations.ts | 64 +- .../generated/typespec-ts/src/api/options.ts | 6 +- .../src/api/radiologyInsightsContext.ts | 8 +- .../generated/typespec-ts/src/index.ts | 3 - .../generated/typespec-ts/src/models/index.ts | 3 - .../typespec-ts/src/models/models.ts | 97 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/package.json | 78 +- .../review/hierarchy-generic.api.md | 10 +- .../typespec-ts/src/api/b/c/index.ts | 7 +- .../typespec-ts/src/api/b/e/c/index.ts | 7 +- .../generated/typespec-ts/src/api/b/index.ts | 7 +- .../generated/typespec-ts/src/api/d/index.ts | 1 + .../typespec-ts/src/api/fooContext.ts | 8 +- .../generated/typespec-ts/src/api/index.ts | 8 +- .../typespec-ts/src/api/operations.ts | 1 + .../generated/typespec-ts/src/api/options.ts | 8 +- .../typespec-ts/src/classic/b/c/index.ts | 6 +- .../typespec-ts/src/classic/b/e/c/index.ts | 6 +- .../typespec-ts/src/classic/b/index.ts | 10 +- .../generated/typespec-ts/src/fooClient.ts | 14 +- .../generated/typespec-ts/src/index.ts | 10 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 12 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../typespec-ts/review/load-testing.api.md | 9 - .../generated/typespec-ts/src/index.ts | 62 +- .../src/loadTestAdministration/api/index.ts | 44 +- .../api/loadTestAdministrationContext.ts | 8 +- .../loadTestAdministration/api/operations.ts | 517 +- .../src/loadTestAdministration/api/options.ts | 65 +- .../src/loadTestAdministration/index.ts | 22 +- .../loadTestAdministrationClient.ts | 200 +- .../typespec-ts/src/loadTestRun/api/index.ts | 52 +- .../src/loadTestRun/api/loadTestRunContext.ts | 8 +- .../src/loadTestRun/api/operations.ts | 676 +- .../src/loadTestRun/api/options.ts | 114 +- .../typespec-ts/src/loadTestRun/index.ts | 26 +- .../src/loadTestRun/loadTestRunClient.ts | 242 +- .../testProfileAdministration/api/index.ts | 12 +- .../api/operations.ts | 171 +- .../testProfileAdministration/api/options.ts | 23 +- .../api/testProfileAdministrationContext.ts | 8 +- .../src/testProfileAdministration/index.ts | 6 +- .../testProfileAdministrationClient.ts | 54 +- .../src/testProfileRun/api/index.ts | 16 +- .../src/testProfileRun/api/operations.ts | 192 +- .../src/testProfileRun/api/options.ts | 21 +- .../api/testProfileRunContext.ts | 8 +- .../typespec-ts/src/testProfileRun/index.ts | 8 +- .../testProfileRun/testProfileRunClient.ts | 70 +- .../test/loadtesting_modular/tspconfig.yaml | 1 - .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/package.json | 238 +- .../typespec-ts/review/openai-generic.api.md | 10 - .../src/api/audio/transcriptions/index.ts | 6 +- .../src/api/audio/translations/index.ts | 6 +- .../src/api/chat/completions/index.ts | 5 + .../typespec-ts/src/api/completions/index.ts | 5 + .../typespec-ts/src/api/edits/index.ts | 5 + .../typespec-ts/src/api/embeddings/index.ts | 5 + .../typespec-ts/src/api/files/index.ts | 152 +- .../typespec-ts/src/api/fineTunes/index.ts | 125 +- .../src/api/fineTuning/jobs/index.ts | 135 +- .../typespec-ts/src/api/images/index.ts | 61 +- .../generated/typespec-ts/src/api/index.ts | 54 +- .../typespec-ts/src/api/models/index.ts | 82 +- .../typespec-ts/src/api/moderations/index.ts | 5 + .../typespec-ts/src/api/openAIContext.ts | 2 +- .../generated/typespec-ts/src/api/options.ts | 116 +- .../typespec-ts/src/classic/audio/index.ts | 4 +- .../typespec-ts/src/classic/files/index.ts | 52 +- .../src/classic/fineTunes/index.ts | 56 +- .../src/classic/fineTuning/jobs/index.ts | 70 +- .../typespec-ts/src/classic/images/index.ts | 30 +- .../typespec-ts/src/classic/models/index.ts | 22 +- .../generated/typespec-ts/src/index.ts | 54 +- .../typespec-ts/src/models/models.ts | 18 +- .../generated/typespec-ts/src/openAIClient.ts | 106 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../typespec-ts/review/openai_modular.api.md | 12 +- .../generated/typespec-ts/src/api/index.ts | 32 +- .../typespec-ts/src/api/openAIContext.ts | 8 +- .../typespec-ts/src/api/operations.ts | 354 +- .../generated/typespec-ts/src/api/options.ts | 36 +- .../generated/typespec-ts/src/index.ts | 16 +- .../typespec-ts/src/models/models.ts | 44 +- .../generated/typespec-ts/src/openAIClient.ts | 182 +- .../generated/typespec-ts/package.json | 240 +- .../review/openai-non-branded.api.md | 34 +- .../src/api/audio/transcriptions/index.ts | 6 +- .../src/api/audio/translations/index.ts | 6 +- .../src/api/chat/completions/index.ts | 5 + .../typespec-ts/src/api/completions/index.ts | 5 + .../typespec-ts/src/api/edits/index.ts | 5 + .../typespec-ts/src/api/embeddings/index.ts | 5 + .../typespec-ts/src/api/files/index.ts | 152 +- .../typespec-ts/src/api/fineTunes/index.ts | 125 +- .../src/api/fineTuning/jobs/index.ts | 135 +- .../typespec-ts/src/api/images/index.ts | 61 +- .../generated/typespec-ts/src/api/index.ts | 54 +- .../typespec-ts/src/api/models/index.ts | 82 +- .../typespec-ts/src/api/moderations/index.ts | 5 + .../typespec-ts/src/api/openAIContext.ts | 3 +- .../generated/typespec-ts/src/api/options.ts | 116 +- .../typespec-ts/src/classic/audio/index.ts | 4 +- .../typespec-ts/src/classic/files/index.ts | 52 +- .../src/classic/fineTunes/index.ts | 56 +- .../src/classic/fineTuning/jobs/index.ts | 70 +- .../typespec-ts/src/classic/images/index.ts | 30 +- .../typespec-ts/src/classic/models/index.ts | 22 +- .../generated/typespec-ts/src/index.ts | 54 +- .../typespec-ts/src/models/models.ts | 114 +- .../generated/typespec-ts/src/openAIClient.ts | 106 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../review/overload_modular.api.md | 6 +- .../src/api/fooOperations/index.ts | 42 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../generated/typespec-ts/src/api/options.ts | 12 +- .../src/api/widgetManagerContext.ts | 8 +- .../src/classic/fooOperations/index.ts | 20 +- .../generated/typespec-ts/src/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../typespec-ts/src/widgetManagerClient.ts | 2 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../src/api/confidentialLedger/index.ts | 9 +- .../src/api/parametrizedHostContext.ts | 7 +- .../typespec-ts/src/parametrizedHostClient.ts | 2 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../typespec-ts/review/schema-registry.api.md | 4 +- .../generated/typespec-ts/src/api/index.ts | 10 +- .../generated/typespec-ts/src/api/options.ts | 12 +- .../src/api/schemaOperations/index.ts | 277 +- .../src/api/schemaRegistryContext.ts | 12 +- .../src/classic/schemaOperations/index.ts | 116 +- .../generated/typespec-ts/src/index.ts | 10 +- .../typespec-ts/src/schemaRegistryClient.ts | 6 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/src/api/a/index.ts | 116 +- .../typespec-ts/src/api/demoServiceContext.ts | 8 +- .../generated/typespec-ts/src/api/index.ts | 6 +- .../generated/typespec-ts/src/api/options.ts | 8 +- .../typespec-ts/src/classic/a/index.ts | 50 +- .../typespec-ts/src/demoServiceClient.ts | 2 +- .../spread/generated/typespec-ts/src/index.ts | 6 +- .../generated/openapi/openapi.json | 669 +- .../generated/typespec-ts/README.md | 4 +- .../generated/typespec-ts/package.json | 99 +- .../review/todo-non-branded.api.md | 615 +- .../generated/typespec-ts/src/api/index.ts | 17 + .../generated/typespec-ts/src/api/options.ts | 37 + .../typespec-ts/src/api/todoContext.ts | 49 + .../src/api/todoItems/attachments/index.ts | 113 + .../typespec-ts/src/api/todoItems/index.ts | 297 + .../typespec-ts/src/api/users/index.ts | 62 + .../typespec-ts/src/classic/index.ts | 5 + .../classic/todoItems/attachments/index.ts | 46 + .../src/classic/todoItems/index.ts | 112 + .../typespec-ts/src/classic/users/index.ts | 32 + .../src/helpers/serializerHelpers.ts | 39 + .../generated/typespec-ts/src/index.ts | 44 +- .../generated/typespec-ts/src/models/index.ts | 14 + .../typespec-ts/src/models/models.ts | 424 ++ .../src/static-helpers/pagingHelpers.ts | 273 + .../generated/typespec-ts/src/todoClient.ts | 75 +- .../generated/typespec-ts/tsconfig.json | 5 +- .../test/todo_non_branded/spec/main.tsp | 200 +- .../@typespec/openapi3/openapi.yaml | 595 ++ .../test/todo_non_branded/tspconfig.yaml | 2 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/eslint.config.mjs | 5 +- .../generated/typespec-ts/package.json | 40 +- .../typespec-ts/review/widget_dpg.api.md | 4 +- .../typespec-ts/src/api/budgets/index.ts | 11 +- .../generated/typespec-ts/src/api/index.ts | 18 +- .../generated/typespec-ts/src/api/options.ts | 52 +- .../src/api/widgetServiceContext.ts | 37 +- .../typespec-ts/src/api/widgets/index.ts | 473 +- .../typespec-ts/src/classic/widgets/index.ts | 180 +- .../generated/typespec-ts/src/index.ts | 18 +- .../typespec-ts/src/models/models.ts | 2 +- .../typespec-ts/src/restorePollerHelpers.ts | 14 +- .../typespec-ts/src/widgetServiceClient.ts | 16 +- .../test/widget_dpg/spec/main.tsp | 2 +- 278 files changed, 18030 insertions(+), 13233 deletions(-) create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/options.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoContext.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/attachments/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/users/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/attachments/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/users/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/helpers/serializerHelpers.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/index.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/models.ts create mode 100644 packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/static-helpers/pagingHelpers.ts create mode 100644 packages/typespec-test/test/todo_non_branded/tsp-output/@typespec/openapi3/openapi.yaml diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/eslint.config.mjs b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/eslint.config.mjs +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/package.json b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/package.json index 181b82aaae..4e9cd468bd 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/package.json +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/package.json @@ -12,10 +12,10 @@ "./package.json": "./package.json", ".": "./src/index.ts", "./models": "./src/models/index.ts", - "./api/operations": "./src/api/operations/index.ts", - "./api/dataProductsCatalogs": "./src/api/dataProductsCatalogs/index.ts", + "./api/dataProducts": "./src/api/dataProducts/index.ts", "./api/dataTypes": "./src/api/dataTypes/index.ts", - "./api/dataProducts": "./src/api/dataProducts/index.ts" + "./api/dataProductsCatalogs": "./src/api/dataProductsCatalogs/index.ts", + "./api/operations": "./src/api/operations/index.ts" }, "dialects": [ "esm", @@ -127,40 +127,22 @@ "default": "./dist/commonjs/models/index.js" } }, - "./api/operations": { - "browser": { - "types": "./dist/browser/api/operations/index.d.ts", - "default": "./dist/browser/api/operations/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/operations/index.d.ts", - "default": "./dist/react-native/api/operations/index.js" - }, - "import": { - "types": "./dist/esm/api/operations/index.d.ts", - "default": "./dist/esm/api/operations/index.js" - }, - "require": { - "types": "./dist/commonjs/api/operations/index.d.ts", - "default": "./dist/commonjs/api/operations/index.js" - } - }, - "./api/dataProductsCatalogs": { + "./api/dataProducts": { "browser": { - "types": "./dist/browser/api/dataProductsCatalogs/index.d.ts", - "default": "./dist/browser/api/dataProductsCatalogs/index.js" + "types": "./dist/browser/api/dataProducts/index.d.ts", + "default": "./dist/browser/api/dataProducts/index.js" }, "react-native": { - "types": "./dist/react-native/api/dataProductsCatalogs/index.d.ts", - "default": "./dist/react-native/api/dataProductsCatalogs/index.js" + "types": "./dist/react-native/api/dataProducts/index.d.ts", + "default": "./dist/react-native/api/dataProducts/index.js" }, "import": { - "types": "./dist/esm/api/dataProductsCatalogs/index.d.ts", - "default": "./dist/esm/api/dataProductsCatalogs/index.js" + "types": "./dist/esm/api/dataProducts/index.d.ts", + "default": "./dist/esm/api/dataProducts/index.js" }, "require": { - "types": "./dist/commonjs/api/dataProductsCatalogs/index.d.ts", - "default": "./dist/commonjs/api/dataProductsCatalogs/index.js" + "types": "./dist/commonjs/api/dataProducts/index.d.ts", + "default": "./dist/commonjs/api/dataProducts/index.js" } }, "./api/dataTypes": { @@ -181,22 +163,40 @@ "default": "./dist/commonjs/api/dataTypes/index.js" } }, - "./api/dataProducts": { + "./api/dataProductsCatalogs": { "browser": { - "types": "./dist/browser/api/dataProducts/index.d.ts", - "default": "./dist/browser/api/dataProducts/index.js" + "types": "./dist/browser/api/dataProductsCatalogs/index.d.ts", + "default": "./dist/browser/api/dataProductsCatalogs/index.js" }, "react-native": { - "types": "./dist/react-native/api/dataProducts/index.d.ts", - "default": "./dist/react-native/api/dataProducts/index.js" + "types": "./dist/react-native/api/dataProductsCatalogs/index.d.ts", + "default": "./dist/react-native/api/dataProductsCatalogs/index.js" }, "import": { - "types": "./dist/esm/api/dataProducts/index.d.ts", - "default": "./dist/esm/api/dataProducts/index.js" + "types": "./dist/esm/api/dataProductsCatalogs/index.d.ts", + "default": "./dist/esm/api/dataProductsCatalogs/index.js" }, "require": { - "types": "./dist/commonjs/api/dataProducts/index.d.ts", - "default": "./dist/commonjs/api/dataProducts/index.js" + "types": "./dist/commonjs/api/dataProductsCatalogs/index.d.ts", + "default": "./dist/commonjs/api/dataProductsCatalogs/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/operations/index.d.ts", + "default": "./dist/react-native/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" } } }, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md index 5329bc3b83..a58f736b62 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md @@ -365,9 +365,9 @@ export enum KnownManagedServiceIdentityType { // @public export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" + "user,system" = "user,system", + system = "system", + user = "user" } // @public @@ -383,7 +383,7 @@ export enum KnownProvisioningState { // @public export enum KnownVersions { - V2023_11_15 = "2023-11-15" + v2023_11_15 = "2023-11-15" } // @public @@ -426,8 +426,8 @@ export interface NetworkAnalyticsClientOptionalParams extends ClientOptions { // @public export interface Operation { - actionType?: ActionType; - readonly display?: OperationDisplay; + readonly actionType?: ActionType; + display?: OperationDisplay; readonly isDataAction?: boolean; readonly name?: string; readonly origin?: Origin; diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProducts/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProducts/index.ts index 8618b2b551..1d1fe53058 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProducts/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProducts/index.ts @@ -51,187 +51,194 @@ import { } from "@azure-rest/core-client"; import { PollerLike, OperationState } from "@azure/core-lro"; -export function _createSend( +export function _listBySubscriptionSend( context: Client, - subscriptionId: string, - resourceGroupName: string, - dataProductName: string, - resource: DataProduct, - options: DataProductsCreateOptionalParams = { requestOptions: {} }, + options: DataProductsListBySubscriptionOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", - subscriptionId, - resourceGroupName, - dataProductName, + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProducts", + context.subscriptionId, ) - .put({ + .get({ ...operationOptionsToRequestParameters(options), - body: dataProductSerializer(resource), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createDeserialize( +export async function _listBySubscriptionDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; +): Promise<_DataProductListResult> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dataProductDeserializer(result.body); + return _dataProductListResultDeserializer(result.body); } -/** Create data product resource. */ -export function create( +/** List data products by subscription. */ +export function listBySubscription( context: Client, - subscriptionId: string, - resourceGroupName: string, - dataProductName: string, - resource: DataProduct, - options: DataProductsCreateOptionalParams = { requestOptions: {} }, -): PollerLike, DataProduct> { - return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _createSend( - context, - subscriptionId, - resourceGroupName, - dataProductName, - resource, - options, - ), - resourceLocationConfig: "azure-async-operation", - }) as PollerLike, DataProduct>; + options: DataProductsListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); } -export function _getSend( +export function _listByResourceGroupSend( context: Client, - subscriptionId: string, resourceGroupName: string, - dataProductName: string, - options: DataProductsGetOptionalParams = { requestOptions: {} }, + options: DataProductsListByResourceGroupOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts", + context.subscriptionId, resourceGroupName, - dataProductName, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getDeserialize( +export async function _listByResourceGroupDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_DataProductListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dataProductDeserializer(result.body); + return _dataProductListResultDeserializer(result.body); } -/** Retrieve data product resource. */ -export async function get( +/** List data products by resource group. */ +export function listByResourceGroup( context: Client, - subscriptionId: string, resourceGroupName: string, - dataProductName: string, - options: DataProductsGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSend( + options: DataProductsListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - subscriptionId, - resourceGroupName, - dataProductName, - options, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, ); - return _getDeserialize(result); } -export function _updateSend( +export function _listRolesAssignmentsSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - properties: DataProductUpdate, - options: DataProductsUpdateOptionalParams = { requestOptions: {} }, + body: Record, + options: DataProductsListRolesAssignmentsOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/listRolesAssignments", + context.subscriptionId, resourceGroupName, dataProductName, ) - .patch({ + .post({ ...operationOptionsToRequestParameters(options), - body: dataProductUpdateSerializer(properties), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: _listRolesAssignmentsRequestSerializer(body), }); } -export async function _updateDeserialize( +export async function _listRolesAssignmentsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "202"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dataProductDeserializer(result.body); + return listRoleAssignmentsDeserializer(result.body); } -/** Update data product resource. */ -export function update( +/** List user roles associated with the data product. */ +export async function listRolesAssignments( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - properties: DataProductUpdate, - options: DataProductsUpdateOptionalParams = { requestOptions: {} }, -): PollerLike, DataProduct> { - return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _updateSend( - context, - subscriptionId, - resourceGroupName, - dataProductName, - properties, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, DataProduct>; + body: Record, + options: DataProductsListRolesAssignmentsOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _listRolesAssignmentsSend( + context, + resourceGroupName, + dataProductName, + body, + options, + ); + return _listRolesAssignmentsDeserialize(result); } -export function _$deleteSend( +export function _removeUserRoleSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - options: DataProductsDeleteOptionalParams = { requestOptions: {} }, + body: RoleAssignmentDetail, + options: DataProductsRemoveUserRoleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/removeUserRole", + context.subscriptionId, resourceGroupName, dataProductName, ) - .delete({ ...operationOptionsToRequestParameters(options) }); + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: roleAssignmentDetailSerializer(body), + }); } -export async function _$deleteDeserialize( +export async function _removeUserRoleDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202", "204", "200"]; + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -239,98 +246,81 @@ export async function _$deleteDeserialize( return; } -/** Delete data product resource. */ -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export function $delete( +/** Remove role from the data product. */ +export async function removeUserRole( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - options: DataProductsDeleteOptionalParams = { requestOptions: {} }, -): PollerLike, void> { - return getLongRunningPoller( + body: RoleAssignmentDetail, + options: DataProductsRemoveUserRoleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _removeUserRoleSend( context, - _$deleteDeserialize, - ["202", "204", "200"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _$deleteSend( - context, - subscriptionId, - resourceGroupName, - dataProductName, - options, - ), - resourceLocationConfig: "location", - }, - ) as PollerLike, void>; + resourceGroupName, + dataProductName, + body, + options, + ); + return _removeUserRoleDeserialize(result); } -export function _generateStorageAccountSasTokenSend( +export function _addUserRoleSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: AccountSas, - options: DataProductsGenerateStorageAccountSasTokenOptionalParams = { - requestOptions: {}, - }, + body: RoleAssignmentCommonProperties, + options: DataProductsAddUserRoleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/generateStorageAccountSasToken", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/addUserRole", + context.subscriptionId, resourceGroupName, dataProductName, ) .post({ ...operationOptionsToRequestParameters(options), - body: accountSasSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: roleAssignmentCommonPropertiesSerializer(body), }); } -export async function _generateStorageAccountSasTokenDeserialize( +export async function _addUserRoleDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return accountSasTokenDeserializer(result.body); + return roleAssignmentDetailDeserializer(result.body); } -/** Generate sas token for storage account. */ -export async function generateStorageAccountSasToken( +/** Assign role to the data product. */ +export async function addUserRole( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: AccountSas, - options: DataProductsGenerateStorageAccountSasTokenOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _generateStorageAccountSasTokenSend( + body: RoleAssignmentCommonProperties, + options: DataProductsAddUserRoleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _addUserRoleSend( context, - subscriptionId, resourceGroupName, dataProductName, body, options, ); - return _generateStorageAccountSasTokenDeserialize(result); + return _addUserRoleDeserialize(result); } export function _rotateKeySend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, body: KeyVaultInfo, @@ -339,12 +329,18 @@ export function _rotateKeySend( return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/rotateKey", - subscriptionId, + context.subscriptionId, resourceGroupName, dataProductName, ) .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: keyVaultInfoSerializer(body), }); } @@ -363,7 +359,6 @@ export async function _rotateKeyDeserialize( /** Initiate key rotation on Data Product. */ export async function rotateKey( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, body: KeyVaultInfo, @@ -371,7 +366,6 @@ export async function rotateKey( ): Promise { const result = await _rotateKeySend( context, - subscriptionId, resourceGroupName, dataProductName, body, @@ -380,83 +374,92 @@ export async function rotateKey( return _rotateKeyDeserialize(result); } -export function _addUserRoleSend( +export function _generateStorageAccountSasTokenSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: RoleAssignmentCommonProperties, - options: DataProductsAddUserRoleOptionalParams = { requestOptions: {} }, + body: AccountSas, + options: DataProductsGenerateStorageAccountSasTokenOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/addUserRole", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/generateStorageAccountSasToken", + context.subscriptionId, resourceGroupName, dataProductName, ) .post({ ...operationOptionsToRequestParameters(options), - body: roleAssignmentCommonPropertiesSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: accountSasSerializer(body), }); } -export async function _addUserRoleDeserialize( +export async function _generateStorageAccountSasTokenDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return roleAssignmentDetailDeserializer(result.body); + return accountSasTokenDeserializer(result.body); } -/** Assign role to the data product. */ -export async function addUserRole( +/** Generate sas token for storage account. */ +export async function generateStorageAccountSasToken( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: RoleAssignmentCommonProperties, - options: DataProductsAddUserRoleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _addUserRoleSend( + body: AccountSas, + options: DataProductsGenerateStorageAccountSasTokenOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _generateStorageAccountSasTokenSend( context, - subscriptionId, resourceGroupName, dataProductName, body, options, ); - return _addUserRoleDeserialize(result); + return _generateStorageAccountSasTokenDeserialize(result); } -export function _removeUserRoleSend( +export function _$deleteSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: RoleAssignmentDetail, - options: DataProductsRemoveUserRoleOptionalParams = { requestOptions: {} }, + options: DataProductsDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/removeUserRole", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", + context.subscriptionId, resourceGroupName, dataProductName, ) - .post({ + .delete({ ...operationOptionsToRequestParameters(options), - body: roleAssignmentDetailSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _removeUserRoleDeserialize( +export async function _$deleteDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["204"]; + const expectedStatuses = ["202", "204", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -464,173 +467,198 @@ export async function _removeUserRoleDeserialize( return; } -/** Remove role from the data product. */ -export async function removeUserRole( +/** Delete data product resource. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: RoleAssignmentDetail, - options: DataProductsRemoveUserRoleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _removeUserRoleSend( + options: DataProductsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( context, - subscriptionId, - resourceGroupName, - dataProductName, - body, - options, - ); - return _removeUserRoleDeserialize(result); + _$deleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, dataProductName, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; } -export function _listRolesAssignmentsSend( +export function _updateSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: Record, - options: DataProductsListRolesAssignmentsOptionalParams = { - requestOptions: {}, - }, + properties: DataProductUpdate, + options: DataProductsUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/listRolesAssignments", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", + context.subscriptionId, resourceGroupName, dataProductName, ) - .post({ + .patch({ ...operationOptionsToRequestParameters(options), - body: _listRolesAssignmentsRequestSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: dataProductUpdateSerializer(properties), }); } -export async function _listRolesAssignmentsDeserialize( +export async function _updateDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["200", "202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listRoleAssignmentsDeserializer(result.body); + return dataProductDeserializer(result.body); } -/** List user roles associated with the data product. */ -export async function listRolesAssignments( +/** Update data product resource. */ +export function update( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - body: Record, - options: DataProductsListRolesAssignmentsOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _listRolesAssignmentsSend( - context, - subscriptionId, - resourceGroupName, - dataProductName, - body, - options, - ); - return _listRolesAssignmentsDeserialize(result); + properties: DataProductUpdate, + options: DataProductsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DataProduct> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + dataProductName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, DataProduct>; } -export function _listByResourceGroupSend( +export function _getSend( context: Client, - subscriptionId: string, resourceGroupName: string, - options: DataProductsListByResourceGroupOptionalParams = { - requestOptions: {}, - }, + dataProductName: string, + options: DataProductsGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", + context.subscriptionId, resourceGroupName, + dataProductName, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _listByResourceGroupDeserialize( +export async function _getDeserialize( result: PathUncheckedResponse, -): Promise<_DataProductListResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _dataProductListResultDeserializer(result.body); + return dataProductDeserializer(result.body); } -/** List data products by resource group. */ -export function listByResourceGroup( +/** Retrieve data product resource. */ +export async function get( context: Client, - subscriptionId: string, resourceGroupName: string, - options: DataProductsListByResourceGroupOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( + dataProductName: string, + options: DataProductsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( context, - () => - _listByResourceGroupSend( - context, - subscriptionId, - resourceGroupName, - options, - ), - _listByResourceGroupDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, + resourceGroupName, + dataProductName, + options, ); + return _getDeserialize(result); } -export function _listBySubscriptionSend( +export function _createSend( context: Client, - subscriptionId: string, - options: DataProductsListBySubscriptionOptionalParams = { - requestOptions: {}, - }, + resourceGroupName: string, + dataProductName: string, + resource: DataProduct, + options: DataProductsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProducts", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}", + context.subscriptionId, + resourceGroupName, + dataProductName, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: dataProductSerializer(resource), + }); } -export async function _listBySubscriptionDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, -): Promise<_DataProductListResult> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["200", "201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _dataProductListResultDeserializer(result.body); + return dataProductDeserializer(result.body); } -/** List data products by subscription. */ -export function listBySubscription( +/** Create data product resource. */ +export function create( context: Client, - subscriptionId: string, - options: DataProductsListBySubscriptionOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listBySubscriptionSend(context, subscriptionId, options), - _listBySubscriptionDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); + resourceGroupName: string, + dataProductName: string, + resource: DataProduct, + options: DataProductsCreateOptionalParams = { requestOptions: {} }, +): PollerLike, DataProduct> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend( + context, + resourceGroupName, + dataProductName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, DataProduct>; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProductsCatalogs/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProductsCatalogs/index.ts index 832580feac..674a845b38 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProductsCatalogs/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataProductsCatalogs/index.ts @@ -24,51 +24,56 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _getSend( +export function _listBySubscriptionSend( context: Client, - subscriptionId: string, - resourceGroupName: string, - options: DataProductsCatalogsGetOptionalParams = { requestOptions: {} }, + options: DataProductsCatalogsListBySubscriptionOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default", - subscriptionId, - resourceGroupName, + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs", + context.subscriptionId, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getDeserialize( +export async function _listBySubscriptionDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_DataProductsCatalogListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dataProductsCatalogDeserializer(result.body); + return _dataProductsCatalogListResultDeserializer(result.body); } -/** Retrieve data type resource. */ -export async function get( +/** List data catalog by subscription. */ +export function listBySubscription( context: Client, - subscriptionId: string, - resourceGroupName: string, - options: DataProductsCatalogsGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSend( + options: DataProductsCatalogsListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - subscriptionId, - resourceGroupName, - options, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, ); - return _getDeserialize(result); } export function _listByResourceGroupSend( context: Client, - subscriptionId: string, resourceGroupName: string, options: DataProductsCatalogsListByResourceGroupOptionalParams = { requestOptions: {}, @@ -77,10 +82,17 @@ export function _listByResourceGroupSend( return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs", - subscriptionId, + context.subscriptionId, resourceGroupName, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _listByResourceGroupDeserialize( @@ -97,7 +109,6 @@ export async function _listByResourceGroupDeserialize( /** List data catalog by resource group. */ export function listByResourceGroup( context: Client, - subscriptionId: string, resourceGroupName: string, options: DataProductsCatalogsListByResourceGroupOptionalParams = { requestOptions: {}, @@ -105,58 +116,51 @@ export function listByResourceGroup( ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => - _listByResourceGroupSend( - context, - subscriptionId, - resourceGroupName, - options, - ), + () => _listByResourceGroupSend(context, resourceGroupName, options), _listByResourceGroupDeserialize, ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _listBySubscriptionSend( +export function _getSend( context: Client, - subscriptionId: string, - options: DataProductsCatalogsListBySubscriptionOptionalParams = { - requestOptions: {}, - }, + resourceGroupName: string, + options: DataProductsCatalogsGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default", + context.subscriptionId, + resourceGroupName, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _listBySubscriptionDeserialize( +export async function _getDeserialize( result: PathUncheckedResponse, -): Promise<_DataProductsCatalogListResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _dataProductsCatalogListResultDeserializer(result.body); + return dataProductsCatalogDeserializer(result.body); } -/** List data catalog by subscription. */ -export function listBySubscription( +/** Retrieve data type resource. */ +export async function get( context: Client, - subscriptionId: string, - options: DataProductsCatalogsListBySubscriptionOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listBySubscriptionSend(context, subscriptionId, options), - _listBySubscriptionDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); + resourceGroupName: string, + options: DataProductsCatalogsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, options); + return _getDeserialize(result); } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataTypes/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataTypes/index.ts index 0e1f70a78f..a6244da7f9 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataTypes/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/dataTypes/index.ts @@ -38,181 +38,196 @@ import { } from "@azure-rest/core-client"; import { PollerLike, OperationState } from "@azure/core-lro"; -export function _createSend( +export function _listByDataProductSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - dataTypeName: string, - resource: DataType, - options: DataTypesCreateOptionalParams = { requestOptions: {} }, + options: DataTypesListByDataProductOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes", + context.subscriptionId, resourceGroupName, dataProductName, - dataTypeName, ) - .put({ + .get({ ...operationOptionsToRequestParameters(options), - body: dataTypeSerializer(resource), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createDeserialize( +export async function _listByDataProductDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; +): Promise<_DataTypeListResult> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dataTypeDeserializer(result.body); + return _dataTypeListResultDeserializer(result.body); } -/** Create data type resource. */ -export function create( +/** List data type by parent resource. */ +export function listByDataProduct( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - dataTypeName: string, - resource: DataType, - options: DataTypesCreateOptionalParams = { requestOptions: {} }, -): PollerLike, DataType> { - return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _createSend( + options: DataTypesListByDataProductOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listByDataProductSend( context, - subscriptionId, resourceGroupName, dataProductName, - dataTypeName, - resource, options, ), - resourceLocationConfig: "azure-async-operation", - }) as PollerLike, DataType>; + _listByDataProductDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); } -export function _getSend( +export function _generateStorageContainerSasTokenSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - options: DataTypesGetOptionalParams = { requestOptions: {} }, + body: ContainerSaS, + options: DataTypesGenerateStorageContainerSasTokenOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}/generateStorageContainerSasToken", + context.subscriptionId, resourceGroupName, dataProductName, dataTypeName, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: containerSaSSerializer(body), + }); } -export async function _getDeserialize( +export async function _generateStorageContainerSasTokenDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dataTypeDeserializer(result.body); + return containerSasTokenDeserializer(result.body); } -/** Retrieve data type resource. */ -export async function get( +/** Generate sas token for storage container. */ +export async function generateStorageContainerSasToken( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - options: DataTypesGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSend( + body: ContainerSaS, + options: DataTypesGenerateStorageContainerSasTokenOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _generateStorageContainerSasTokenSend( context, - subscriptionId, resourceGroupName, dataProductName, dataTypeName, + body, options, ); - return _getDeserialize(result); + return _generateStorageContainerSasTokenDeserialize(result); } -export function _updateSend( +export function _deleteDataSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - properties: DataTypeUpdate, - options: DataTypesUpdateOptionalParams = { requestOptions: {} }, + body: Record, + options: DataTypesDeleteDataOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}/deleteData", + context.subscriptionId, resourceGroupName, dataProductName, dataTypeName, ) - .patch({ + .post({ ...operationOptionsToRequestParameters(options), - body: dataTypeUpdateSerializer(properties), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: _deleteDataRequestSerializer(body), }); } -export async function _updateDeserialize( +export async function _deleteDataDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "202"]; +): Promise { + const expectedStatuses = ["202", "204", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dataTypeDeserializer(result.body); + return; } -/** Update data type resource. */ -export function update( +/** Delete data for data type. */ +export function deleteData( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - properties: DataTypeUpdate, - options: DataTypesUpdateOptionalParams = { requestOptions: {} }, -): PollerLike, DataType> { - return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _updateSend( - context, - subscriptionId, - resourceGroupName, - dataProductName, - dataTypeName, - properties, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, DataType>; + body: Record, + options: DataTypesDeleteDataOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _deleteDataDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _deleteDataSend( + context, + resourceGroupName, + dataProductName, + dataTypeName, + body, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; } export function _$deleteSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, @@ -221,12 +236,19 @@ export function _$deleteSend( return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}", - subscriptionId, + context.subscriptionId, resourceGroupName, dataProductName, dataTypeName, ) - .delete({ ...operationOptionsToRequestParameters(options) }); + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _$deleteDeserialize( @@ -248,7 +270,6 @@ export async function _$deleteDeserialize( */ export function $delete( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, @@ -264,7 +285,6 @@ export function $delete( getInitialResponse: () => _$deleteSend( context, - subscriptionId, resourceGroupName, dataProductName, dataTypeName, @@ -275,180 +295,184 @@ export function $delete( ) as PollerLike, void>; } -export function _deleteDataSend( +export function _updateSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: Record, - options: DataTypesDeleteDataOptionalParams = { requestOptions: {} }, + properties: DataTypeUpdate, + options: DataTypesUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}/deleteData", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}", + context.subscriptionId, resourceGroupName, dataProductName, dataTypeName, ) - .post({ + .patch({ ...operationOptionsToRequestParameters(options), - body: _deleteDataRequestSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: dataTypeUpdateSerializer(properties), }); } -export async function _deleteDataDeserialize( +export async function _updateDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202", "204", "200"]; +): Promise { + const expectedStatuses = ["200", "202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return dataTypeDeserializer(result.body); } -/** Delete data for data type. */ -export function deleteData( +/** Update data type resource. */ +export function update( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: Record, - options: DataTypesDeleteDataOptionalParams = { requestOptions: {} }, -): PollerLike, void> { - return getLongRunningPoller( - context, - _deleteDataDeserialize, - ["202", "204", "200"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _deleteDataSend( - context, - subscriptionId, - resourceGroupName, - dataProductName, - dataTypeName, - body, - options, - ), - resourceLocationConfig: "location", - }, - ) as PollerLike, void>; + properties: DataTypeUpdate, + options: DataTypesUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DataType> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + dataProductName, + dataTypeName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, DataType>; } -export function _generateStorageContainerSasTokenSend( +export function _getSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: ContainerSaS, - options: DataTypesGenerateStorageContainerSasTokenOptionalParams = { - requestOptions: {}, - }, + options: DataTypesGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}/generateStorageContainerSasToken", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}", + context.subscriptionId, resourceGroupName, dataProductName, dataTypeName, ) - .post({ + .get({ ...operationOptionsToRequestParameters(options), - body: containerSaSSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _generateStorageContainerSasTokenDeserialize( +export async function _getDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return containerSasTokenDeserializer(result.body); + return dataTypeDeserializer(result.body); } -/** Generate sas token for storage container. */ -export async function generateStorageContainerSasToken( +/** Retrieve data type resource. */ +export async function get( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: ContainerSaS, - options: DataTypesGenerateStorageContainerSasTokenOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _generateStorageContainerSasTokenSend( + options: DataTypesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( context, - subscriptionId, resourceGroupName, dataProductName, dataTypeName, - body, options, ); - return _generateStorageContainerSasTokenDeserialize(result); + return _getDeserialize(result); } -export function _listByDataProductSend( +export function _createSend( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - options: DataTypesListByDataProductOptionalParams = { requestOptions: {} }, + dataTypeName: string, + resource: DataType, + options: DataTypesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes", - subscriptionId, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}", + context.subscriptionId, resourceGroupName, dataProductName, + dataTypeName, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: dataTypeSerializer(resource), + }); } -export async function _listByDataProductDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, -): Promise<_DataTypeListResult> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["200", "201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _dataTypeListResultDeserializer(result.body); + return dataTypeDeserializer(result.body); } -/** List data type by parent resource. */ -export function listByDataProduct( +/** Create data type resource. */ +export function create( context: Client, - subscriptionId: string, resourceGroupName: string, dataProductName: string, - options: DataTypesListByDataProductOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => - _listByDataProductSend( + dataTypeName: string, + resource: DataType, + options: DataTypesCreateOptionalParams = { requestOptions: {} }, +): PollerLike, DataType> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend( context, - subscriptionId, resourceGroupName, dataProductName, + dataTypeName, + resource, options, ), - _listByDataProductDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, DataType>; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/index.ts index 40148cb69c..1d3346b318 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/index.ts @@ -7,26 +7,26 @@ export { NetworkAnalyticsClientOptionalParams, } from "./networkAnalyticsContext.js"; export { - OperationsListOptionalParams, - DataProductsCatalogsGetOptionalParams, - DataProductsCatalogsListByResourceGroupOptionalParams, - DataProductsCatalogsListBySubscriptionOptionalParams, - DataTypesCreateOptionalParams, - DataTypesGetOptionalParams, - DataTypesUpdateOptionalParams, - DataTypesDeleteOptionalParams, - DataTypesDeleteDataOptionalParams, - DataTypesGenerateStorageContainerSasTokenOptionalParams, - DataTypesListByDataProductOptionalParams, - DataProductsCreateOptionalParams, - DataProductsGetOptionalParams, - DataProductsUpdateOptionalParams, - DataProductsDeleteOptionalParams, - DataProductsGenerateStorageAccountSasTokenOptionalParams, - DataProductsRotateKeyOptionalParams, - DataProductsAddUserRoleOptionalParams, - DataProductsRemoveUserRoleOptionalParams, - DataProductsListRolesAssignmentsOptionalParams, - DataProductsListByResourceGroupOptionalParams, DataProductsListBySubscriptionOptionalParams, + DataProductsListByResourceGroupOptionalParams, + DataProductsListRolesAssignmentsOptionalParams, + DataProductsRemoveUserRoleOptionalParams, + DataProductsAddUserRoleOptionalParams, + DataProductsRotateKeyOptionalParams, + DataProductsGenerateStorageAccountSasTokenOptionalParams, + DataProductsDeleteOptionalParams, + DataProductsUpdateOptionalParams, + DataProductsGetOptionalParams, + DataProductsCreateOptionalParams, + DataTypesListByDataProductOptionalParams, + DataTypesGenerateStorageContainerSasTokenOptionalParams, + DataTypesDeleteDataOptionalParams, + DataTypesDeleteOptionalParams, + DataTypesUpdateOptionalParams, + DataTypesGetOptionalParams, + DataTypesCreateOptionalParams, + DataProductsCatalogsListBySubscriptionOptionalParams, + DataProductsCatalogsListByResourceGroupOptionalParams, + DataProductsCatalogsGetOptionalParams, + OperationsListOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsContext.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsContext.ts index 17097bfcd7..1ebeda066f 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsContext.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsContext.ts @@ -6,7 +6,13 @@ import { KnownVersions } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface NetworkAnalyticsContext extends Client {} +export interface NetworkAnalyticsContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} /** Optional parameters for the client. */ export interface NetworkAnalyticsClientOptionalParams extends ClientOptions { @@ -17,10 +23,11 @@ export interface NetworkAnalyticsClientOptionalParams extends ClientOptions { export function createNetworkAnalytics( credential: TokenCredential, + subscriptionId: string, options: NetworkAnalyticsClientOptionalParams = {}, ): NetworkAnalyticsContext { const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; + options.endpoint ?? options.baseUrl ?? "https://management.azure.com"; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-arm-networkanalytics/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions @@ -52,5 +59,9 @@ export function createNetworkAnalytics( return next(req); }, }); - return clientContext; + return { + ...clientContext, + apiVersion, + subscriptionId, + } as NetworkAnalyticsContext; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/operations/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/operations/index.ts index 7b12dfd9dc..ba69d03fde 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/operations/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/operations/index.ts @@ -27,7 +27,14 @@ export function _listSend( ): StreamableMethod { return context .path("/providers/Microsoft.NetworkAnalytics/operations") - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _listDeserialize( diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/options.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/options.ts index d93bfef490..c8e5e96a77 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/options.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/options.ts @@ -4,99 +4,99 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface OperationsListOptionalParams extends OperationOptions {} +export interface DataProductsListBySubscriptionOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsCatalogsGetOptionalParams +export interface DataProductsListByResourceGroupOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsCatalogsListByResourceGroupOptionalParams +export interface DataProductsListRolesAssignmentsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsCatalogsListBySubscriptionOptionalParams +export interface DataProductsRemoveUserRoleOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataTypesCreateOptionalParams extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} +export interface DataProductsAddUserRoleOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface DataTypesGetOptionalParams extends OperationOptions {} +export interface DataProductsRotateKeyOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataTypesUpdateOptionalParams extends OperationOptions { +export interface DataProductsGenerateStorageAccountSasTokenOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DataProductsDeleteOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface DataTypesDeleteOptionalParams extends OperationOptions { +export interface DataProductsUpdateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface DataTypesDeleteDataOptionalParams extends OperationOptions { +export interface DataProductsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DataProductsCreateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface DataTypesGenerateStorageContainerSasTokenOptionalParams +export interface DataTypesListByDataProductOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataTypesListByDataProductOptionalParams +export interface DataTypesGenerateStorageContainerSasTokenOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsCreateOptionalParams extends OperationOptions { +export interface DataTypesDeleteDataOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface DataProductsGetOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface DataProductsUpdateOptionalParams extends OperationOptions { +export interface DataTypesDeleteOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface DataProductsDeleteOptionalParams extends OperationOptions { +export interface DataTypesUpdateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface DataProductsGenerateStorageAccountSasTokenOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface DataProductsRotateKeyOptionalParams extends OperationOptions {} +export interface DataTypesGetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsAddUserRoleOptionalParams - extends OperationOptions {} +export interface DataTypesCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} /** Optional parameters. */ -export interface DataProductsRemoveUserRoleOptionalParams +export interface DataProductsCatalogsListBySubscriptionOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsListRolesAssignmentsOptionalParams +export interface DataProductsCatalogsListByResourceGroupOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsListByResourceGroupOptionalParams +export interface DataProductsCatalogsGetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DataProductsListBySubscriptionOptionalParams - extends OperationOptions {} +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProducts/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProducts/index.ts index 5c31e36ded..e57e918d4f 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProducts/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProducts/index.ts @@ -3,17 +3,17 @@ import { NetworkAnalyticsContext } from "../../api/networkAnalyticsContext.js"; import { - create, - get, - update, - $delete, - generateStorageAccountSasToken, - rotateKey, - addUserRole, - removeUserRole, - listRolesAssignments, - listByResourceGroup, listBySubscription, + listByResourceGroup, + listRolesAssignments, + removeUserRole, + addUserRole, + rotateKey, + generateStorageAccountSasToken, + $delete, + update, + get, + create, } from "../../api/dataProducts/index.js"; import { DataProduct, @@ -28,52 +28,58 @@ import { import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { - DataProductsCreateOptionalParams, - DataProductsGetOptionalParams, - DataProductsUpdateOptionalParams, - DataProductsDeleteOptionalParams, - DataProductsGenerateStorageAccountSasTokenOptionalParams, - DataProductsRotateKeyOptionalParams, - DataProductsAddUserRoleOptionalParams, - DataProductsRemoveUserRoleOptionalParams, - DataProductsListRolesAssignmentsOptionalParams, - DataProductsListByResourceGroupOptionalParams, DataProductsListBySubscriptionOptionalParams, + DataProductsListByResourceGroupOptionalParams, + DataProductsListRolesAssignmentsOptionalParams, + DataProductsRemoveUserRoleOptionalParams, + DataProductsAddUserRoleOptionalParams, + DataProductsRotateKeyOptionalParams, + DataProductsGenerateStorageAccountSasTokenOptionalParams, + DataProductsDeleteOptionalParams, + DataProductsUpdateOptionalParams, + DataProductsGetOptionalParams, + DataProductsCreateOptionalParams, } from "../../api/options.js"; /** Interface representing a DataProducts operations. */ export interface DataProductsOperations { - /** Create data product resource. */ - create: ( + /** List data products by subscription. */ + listBySubscription: ( + options?: DataProductsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** List data products by resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DataProductsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** List user roles associated with the data product. */ + listRolesAssignments: ( resourceGroupName: string, dataProductName: string, - resource: DataProduct, - options?: DataProductsCreateOptionalParams, - ) => PollerLike, DataProduct>; - /** Retrieve data product resource. */ - get: ( + body: Record, + options?: DataProductsListRolesAssignmentsOptionalParams, + ) => Promise; + /** Remove role from the data product. */ + removeUserRole: ( resourceGroupName: string, dataProductName: string, - options?: DataProductsGetOptionalParams, - ) => Promise; - /** Update data product resource. */ - update: ( + body: RoleAssignmentDetail, + options?: DataProductsRemoveUserRoleOptionalParams, + ) => Promise; + /** Assign role to the data product. */ + addUserRole: ( resourceGroupName: string, dataProductName: string, - properties: DataProductUpdate, - options?: DataProductsUpdateOptionalParams, - ) => PollerLike, DataProduct>; - /** Delete data product resource. */ - /** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ - delete: ( + body: RoleAssignmentCommonProperties, + options?: DataProductsAddUserRoleOptionalParams, + ) => Promise; + /** Initiate key rotation on Data Product. */ + rotateKey: ( resourceGroupName: string, dataProductName: string, - options?: DataProductsDeleteOptionalParams, - ) => PollerLike, void>; + body: KeyVaultInfo, + options?: DataProductsRotateKeyOptionalParams, + ) => Promise; /** Generate sas token for storage account. */ generateStorageAccountSasToken: ( resourceGroupName: string, @@ -81,96 +87,87 @@ export interface DataProductsOperations { body: AccountSas, options?: DataProductsGenerateStorageAccountSasTokenOptionalParams, ) => Promise; - /** Initiate key rotation on Data Product. */ - rotateKey: ( + /** Delete data product resource. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( resourceGroupName: string, dataProductName: string, - body: KeyVaultInfo, - options?: DataProductsRotateKeyOptionalParams, - ) => Promise; - /** Assign role to the data product. */ - addUserRole: ( + options?: DataProductsDeleteOptionalParams, + ) => PollerLike, void>; + /** Update data product resource. */ + update: ( resourceGroupName: string, dataProductName: string, - body: RoleAssignmentCommonProperties, - options?: DataProductsAddUserRoleOptionalParams, - ) => Promise; - /** Remove role from the data product. */ - removeUserRole: ( + properties: DataProductUpdate, + options?: DataProductsUpdateOptionalParams, + ) => PollerLike, DataProduct>; + /** Retrieve data product resource. */ + get: ( resourceGroupName: string, dataProductName: string, - body: RoleAssignmentDetail, - options?: DataProductsRemoveUserRoleOptionalParams, - ) => Promise; - /** List user roles associated with the data product. */ - listRolesAssignments: ( + options?: DataProductsGetOptionalParams, + ) => Promise; + /** Create data product resource. */ + create: ( resourceGroupName: string, dataProductName: string, - body: Record, - options?: DataProductsListRolesAssignmentsOptionalParams, - ) => Promise; - /** List data products by resource group. */ - listByResourceGroup: ( - resourceGroupName: string, - options?: DataProductsListByResourceGroupOptionalParams, - ) => PagedAsyncIterableIterator; - /** List data products by subscription. */ - listBySubscription: ( - options?: DataProductsListBySubscriptionOptionalParams, - ) => PagedAsyncIterableIterator; + resource: DataProduct, + options?: DataProductsCreateOptionalParams, + ) => PollerLike, DataProduct>; } -export function getDataProducts( - context: NetworkAnalyticsContext, - subscriptionId: string, -) { +export function getDataProducts(context: NetworkAnalyticsContext) { return { - create: ( + listBySubscription: ( + options?: DataProductsListBySubscriptionOptionalParams, + ) => listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: DataProductsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + listRolesAssignments: ( resourceGroupName: string, dataProductName: string, - resource: DataProduct, - options?: DataProductsCreateOptionalParams, + body: Record, + options?: DataProductsListRolesAssignmentsOptionalParams, ) => - create( + listRolesAssignments( context, - subscriptionId, resourceGroupName, dataProductName, - resource, + body, options, ), - get: ( - resourceGroupName: string, - dataProductName: string, - options?: DataProductsGetOptionalParams, - ) => - get(context, subscriptionId, resourceGroupName, dataProductName, options), - update: ( + removeUserRole: ( resourceGroupName: string, dataProductName: string, - properties: DataProductUpdate, - options?: DataProductsUpdateOptionalParams, + body: RoleAssignmentDetail, + options?: DataProductsRemoveUserRoleOptionalParams, ) => - update( + removeUserRole( context, - subscriptionId, resourceGroupName, dataProductName, - properties, + body, options, ), - delete: ( + addUserRole: ( resourceGroupName: string, dataProductName: string, - options?: DataProductsDeleteOptionalParams, + body: RoleAssignmentCommonProperties, + options?: DataProductsAddUserRoleOptionalParams, ) => - $delete( - context, - subscriptionId, - resourceGroupName, - dataProductName, - options, - ), + addUserRole(context, resourceGroupName, dataProductName, body, options), + rotateKey: ( + resourceGroupName: string, + dataProductName: string, + body: KeyVaultInfo, + options?: DataProductsRotateKeyOptionalParams, + ) => rotateKey(context, resourceGroupName, dataProductName, body, options), generateStorageAccountSasToken: ( resourceGroupName: string, dataProductName: string, @@ -179,84 +176,41 @@ export function getDataProducts( ) => generateStorageAccountSasToken( context, - subscriptionId, resourceGroupName, dataProductName, body, options, ), - rotateKey: ( + delete: ( resourceGroupName: string, dataProductName: string, - body: KeyVaultInfo, - options?: DataProductsRotateKeyOptionalParams, - ) => - rotateKey( - context, - subscriptionId, - resourceGroupName, - dataProductName, - body, - options, - ), - addUserRole: ( + options?: DataProductsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, dataProductName, options), + update: ( resourceGroupName: string, dataProductName: string, - body: RoleAssignmentCommonProperties, - options?: DataProductsAddUserRoleOptionalParams, + properties: DataProductUpdate, + options?: DataProductsUpdateOptionalParams, ) => - addUserRole( - context, - subscriptionId, - resourceGroupName, - dataProductName, - body, - options, - ), - removeUserRole: ( + update(context, resourceGroupName, dataProductName, properties, options), + get: ( resourceGroupName: string, dataProductName: string, - body: RoleAssignmentDetail, - options?: DataProductsRemoveUserRoleOptionalParams, - ) => - removeUserRole( - context, - subscriptionId, - resourceGroupName, - dataProductName, - body, - options, - ), - listRolesAssignments: ( + options?: DataProductsGetOptionalParams, + ) => get(context, resourceGroupName, dataProductName, options), + create: ( resourceGroupName: string, dataProductName: string, - body: Record, - options?: DataProductsListRolesAssignmentsOptionalParams, - ) => - listRolesAssignments( - context, - subscriptionId, - resourceGroupName, - dataProductName, - body, - options, - ), - listByResourceGroup: ( - resourceGroupName: string, - options?: DataProductsListByResourceGroupOptionalParams, - ) => - listByResourceGroup(context, subscriptionId, resourceGroupName, options), - listBySubscription: ( - options?: DataProductsListBySubscriptionOptionalParams, - ) => listBySubscription(context, subscriptionId, options), + resource: DataProduct, + options?: DataProductsCreateOptionalParams, + ) => create(context, resourceGroupName, dataProductName, resource, options), }; } export function getDataProductsOperations( context: NetworkAnalyticsContext, - subscriptionId: string, ): DataProductsOperations { return { - ...getDataProducts(context, subscriptionId), + ...getDataProducts(context), }; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProductsCatalogs/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProductsCatalogs/index.ts index d7048a6b20..122ef0bfbc 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProductsCatalogs/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataProductsCatalogs/index.ts @@ -3,61 +3,56 @@ import { NetworkAnalyticsContext } from "../../api/networkAnalyticsContext.js"; import { - get, - listByResourceGroup, listBySubscription, + listByResourceGroup, + get, } from "../../api/dataProductsCatalogs/index.js"; import { DataProductsCatalog } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { - DataProductsCatalogsGetOptionalParams, - DataProductsCatalogsListByResourceGroupOptionalParams, DataProductsCatalogsListBySubscriptionOptionalParams, + DataProductsCatalogsListByResourceGroupOptionalParams, + DataProductsCatalogsGetOptionalParams, } from "../../api/options.js"; /** Interface representing a DataProductsCatalogs operations. */ export interface DataProductsCatalogsOperations { - /** Retrieve data type resource. */ - get: ( - resourceGroupName: string, - options?: DataProductsCatalogsGetOptionalParams, - ) => Promise; + /** List data catalog by subscription. */ + listBySubscription: ( + options?: DataProductsCatalogsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; /** List data catalog by resource group. */ listByResourceGroup: ( resourceGroupName: string, options?: DataProductsCatalogsListByResourceGroupOptionalParams, ) => PagedAsyncIterableIterator; - /** List data catalog by subscription. */ - listBySubscription: ( - options?: DataProductsCatalogsListBySubscriptionOptionalParams, - ) => PagedAsyncIterableIterator; + /** Retrieve data type resource. */ + get: ( + resourceGroupName: string, + options?: DataProductsCatalogsGetOptionalParams, + ) => Promise; } -export function getDataProductsCatalogs( - context: NetworkAnalyticsContext, - subscriptionId: string, -) { +export function getDataProductsCatalogs(context: NetworkAnalyticsContext) { return { - get: ( - resourceGroupName: string, - options?: DataProductsCatalogsGetOptionalParams, - ) => get(context, subscriptionId, resourceGroupName, options), + listBySubscription: ( + options?: DataProductsCatalogsListBySubscriptionOptionalParams, + ) => listBySubscription(context, options), listByResourceGroup: ( resourceGroupName: string, options?: DataProductsCatalogsListByResourceGroupOptionalParams, - ) => - listByResourceGroup(context, subscriptionId, resourceGroupName, options), - listBySubscription: ( - options?: DataProductsCatalogsListBySubscriptionOptionalParams, - ) => listBySubscription(context, subscriptionId, options), + ) => listByResourceGroup(context, resourceGroupName, options), + get: ( + resourceGroupName: string, + options?: DataProductsCatalogsGetOptionalParams, + ) => get(context, resourceGroupName, options), }; } export function getDataProductsCatalogsOperations( context: NetworkAnalyticsContext, - subscriptionId: string, ): DataProductsCatalogsOperations { return { - ...getDataProductsCatalogs(context, subscriptionId), + ...getDataProductsCatalogs(context), }; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataTypes/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataTypes/index.ts index ee6fad5bd4..bc9a766948 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataTypes/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/classic/dataTypes/index.ts @@ -3,13 +3,13 @@ import { NetworkAnalyticsContext } from "../../api/networkAnalyticsContext.js"; import { - create, - get, - update, - $delete, - deleteData, - generateStorageContainerSasToken, listByDataProduct, + generateStorageContainerSasToken, + deleteData, + $delete, + update, + get, + create, } from "../../api/dataTypes/index.js"; import { DataType, @@ -20,40 +20,39 @@ import { import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { - DataTypesCreateOptionalParams, - DataTypesGetOptionalParams, - DataTypesUpdateOptionalParams, - DataTypesDeleteOptionalParams, - DataTypesDeleteDataOptionalParams, - DataTypesGenerateStorageContainerSasTokenOptionalParams, DataTypesListByDataProductOptionalParams, + DataTypesGenerateStorageContainerSasTokenOptionalParams, + DataTypesDeleteDataOptionalParams, + DataTypesDeleteOptionalParams, + DataTypesUpdateOptionalParams, + DataTypesGetOptionalParams, + DataTypesCreateOptionalParams, } from "../../api/options.js"; /** Interface representing a DataTypes operations. */ export interface DataTypesOperations { - /** Create data type resource. */ - create: ( + /** List data type by parent resource. */ + listByDataProduct: ( resourceGroupName: string, dataProductName: string, - dataTypeName: string, - resource: DataType, - options?: DataTypesCreateOptionalParams, - ) => PollerLike, DataType>; - /** Retrieve data type resource. */ - get: ( + options?: DataTypesListByDataProductOptionalParams, + ) => PagedAsyncIterableIterator; + /** Generate sas token for storage container. */ + generateStorageContainerSasToken: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - options?: DataTypesGetOptionalParams, - ) => Promise; - /** Update data type resource. */ - update: ( + body: ContainerSaS, + options?: DataTypesGenerateStorageContainerSasTokenOptionalParams, + ) => Promise; + /** Delete data for data type. */ + deleteData: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - properties: DataTypeUpdate, - options?: DataTypesUpdateOptionalParams, - ) => PollerLike, DataType>; + body: Record, + options?: DataTypesDeleteDataOptionalParams, + ) => PollerLike, void>; /** Delete data type resource. */ /** * @fixme delete is a reserved word that cannot be used as an operation name. @@ -66,79 +65,67 @@ export interface DataTypesOperations { dataTypeName: string, options?: DataTypesDeleteOptionalParams, ) => PollerLike, void>; - /** Delete data for data type. */ - deleteData: ( + /** Update data type resource. */ + update: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: Record, - options?: DataTypesDeleteDataOptionalParams, - ) => PollerLike, void>; - /** Generate sas token for storage container. */ - generateStorageContainerSasToken: ( + properties: DataTypeUpdate, + options?: DataTypesUpdateOptionalParams, + ) => PollerLike, DataType>; + /** Retrieve data type resource. */ + get: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: ContainerSaS, - options?: DataTypesGenerateStorageContainerSasTokenOptionalParams, - ) => Promise; - /** List data type by parent resource. */ - listByDataProduct: ( + options?: DataTypesGetOptionalParams, + ) => Promise; + /** Create data type resource. */ + create: ( resourceGroupName: string, dataProductName: string, - options?: DataTypesListByDataProductOptionalParams, - ) => PagedAsyncIterableIterator; + dataTypeName: string, + resource: DataType, + options?: DataTypesCreateOptionalParams, + ) => PollerLike, DataType>; } -export function getDataTypes( - context: NetworkAnalyticsContext, - subscriptionId: string, -) { +export function getDataTypes(context: NetworkAnalyticsContext) { return { - create: ( + listByDataProduct: ( resourceGroupName: string, dataProductName: string, - dataTypeName: string, - resource: DataType, - options?: DataTypesCreateOptionalParams, + options?: DataTypesListByDataProductOptionalParams, ) => - create( - context, - subscriptionId, - resourceGroupName, - dataProductName, - dataTypeName, - resource, - options, - ), - get: ( + listByDataProduct(context, resourceGroupName, dataProductName, options), + generateStorageContainerSasToken: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - options?: DataTypesGetOptionalParams, + body: ContainerSaS, + options?: DataTypesGenerateStorageContainerSasTokenOptionalParams, ) => - get( + generateStorageContainerSasToken( context, - subscriptionId, resourceGroupName, dataProductName, dataTypeName, + body, options, ), - update: ( + deleteData: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - properties: DataTypeUpdate, - options?: DataTypesUpdateOptionalParams, + body: Record, + options?: DataTypesDeleteDataOptionalParams, ) => - update( + deleteData( context, - subscriptionId, resourceGroupName, dataProductName, dataTypeName, - properties, + body, options, ), delete: ( @@ -149,54 +136,46 @@ export function getDataTypes( ) => $delete( context, - subscriptionId, resourceGroupName, dataProductName, dataTypeName, options, ), - deleteData: ( + update: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: Record, - options?: DataTypesDeleteDataOptionalParams, + properties: DataTypeUpdate, + options?: DataTypesUpdateOptionalParams, ) => - deleteData( + update( context, - subscriptionId, resourceGroupName, dataProductName, dataTypeName, - body, + properties, options, ), - generateStorageContainerSasToken: ( + get: ( resourceGroupName: string, dataProductName: string, dataTypeName: string, - body: ContainerSaS, - options?: DataTypesGenerateStorageContainerSasTokenOptionalParams, + options?: DataTypesGetOptionalParams, ) => - generateStorageContainerSasToken( - context, - subscriptionId, - resourceGroupName, - dataProductName, - dataTypeName, - body, - options, - ), - listByDataProduct: ( + get(context, resourceGroupName, dataProductName, dataTypeName, options), + create: ( resourceGroupName: string, dataProductName: string, - options?: DataTypesListByDataProductOptionalParams, + dataTypeName: string, + resource: DataType, + options?: DataTypesCreateOptionalParams, ) => - listByDataProduct( + create( context, - subscriptionId, resourceGroupName, dataProductName, + dataTypeName, + resource, options, ), }; @@ -204,9 +183,8 @@ export function getDataTypes( export function getDataTypesOperations( context: NetworkAnalyticsContext, - subscriptionId: string, ): DataTypesOperations { return { - ...getDataTypes(context, subscriptionId), + ...getDataTypes(context), }; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts index ffc8e35dae..3ae1eb52fe 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts @@ -67,28 +67,28 @@ export { } from "./models/index.js"; export { NetworkAnalyticsClientOptionalParams, - OperationsListOptionalParams, - DataProductsCatalogsGetOptionalParams, - DataProductsCatalogsListByResourceGroupOptionalParams, - DataProductsCatalogsListBySubscriptionOptionalParams, - DataTypesCreateOptionalParams, - DataTypesGetOptionalParams, - DataTypesUpdateOptionalParams, - DataTypesDeleteOptionalParams, - DataTypesDeleteDataOptionalParams, - DataTypesGenerateStorageContainerSasTokenOptionalParams, - DataTypesListByDataProductOptionalParams, - DataProductsCreateOptionalParams, - DataProductsGetOptionalParams, - DataProductsUpdateOptionalParams, - DataProductsDeleteOptionalParams, - DataProductsGenerateStorageAccountSasTokenOptionalParams, - DataProductsRotateKeyOptionalParams, - DataProductsAddUserRoleOptionalParams, - DataProductsRemoveUserRoleOptionalParams, - DataProductsListRolesAssignmentsOptionalParams, - DataProductsListByResourceGroupOptionalParams, DataProductsListBySubscriptionOptionalParams, + DataProductsListByResourceGroupOptionalParams, + DataProductsListRolesAssignmentsOptionalParams, + DataProductsRemoveUserRoleOptionalParams, + DataProductsAddUserRoleOptionalParams, + DataProductsRotateKeyOptionalParams, + DataProductsGenerateStorageAccountSasTokenOptionalParams, + DataProductsDeleteOptionalParams, + DataProductsUpdateOptionalParams, + DataProductsGetOptionalParams, + DataProductsCreateOptionalParams, + DataTypesListByDataProductOptionalParams, + DataTypesGenerateStorageContainerSasTokenOptionalParams, + DataTypesDeleteDataOptionalParams, + DataTypesDeleteOptionalParams, + DataTypesUpdateOptionalParams, + DataTypesGetOptionalParams, + DataTypesCreateOptionalParams, + DataProductsCatalogsListBySubscriptionOptionalParams, + DataProductsCatalogsListByResourceGroupOptionalParams, + DataProductsCatalogsGetOptionalParams, + OperationsListOptionalParams, } from "./api/index.js"; export { DataProductsOperations, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts index ecba90cf82..3dcc69ebff 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts @@ -271,7 +271,7 @@ export function dataProductNetworkAclsSerializer( virtualNetworkRule: virtualNetworkRuleArraySerializer( item["virtualNetworkRule"], ), - ipRules: ipRulesArraySerializer(item["ipRules"]), + ipRules: iPRulesArraySerializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -286,7 +286,7 @@ export function dataProductNetworkAclsDeserializer( virtualNetworkRule: virtualNetworkRuleArrayDeserializer( item["virtualNetworkRule"], ), - ipRules: ipRulesArrayDeserializer(item["ipRules"]), + ipRules: iPRulesArrayDeserializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -332,15 +332,15 @@ export function virtualNetworkRuleDeserializer(item: any): VirtualNetworkRule { }; } -export function ipRulesArraySerializer(result: Array): any[] { +export function iPRulesArraySerializer(result: Array): any[] { return result.map((item) => { - return ipRulesSerializer(item); + return iPRulesSerializer(item); }); } -export function ipRulesArrayDeserializer(result: Array): any[] { +export function iPRulesArrayDeserializer(result: Array): any[] { return result.map((item) => { - return ipRulesDeserializer(item); + return iPRulesDeserializer(item); }); } @@ -352,11 +352,11 @@ export interface IPRules { action: string; } -export function ipRulesSerializer(item: IPRules): any { +export function iPRulesSerializer(item: IPRules): any { return { value: item["value"], action: item["action"] }; } -export function ipRulesDeserializer(item: any): IPRules { +export function iPRulesDeserializer(item: any): IPRules { return { value: item["value"], action: item["action"], @@ -1292,11 +1292,11 @@ export interface Operation { /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ readonly isDataAction?: boolean; /** Localized display information for this particular operation. */ - readonly display?: OperationDisplay; + display?: OperationDisplay; /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ readonly origin?: Origin; /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ - actionType?: ActionType; + readonly actionType?: ActionType; } export function operationDeserializer(item: any): Operation { @@ -1335,11 +1335,11 @@ export function operationDisplayDeserializer(item: any): OperationDisplay { /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ export enum KnownOrigin { /** Indicates the operation is initiated by a user. */ - User = "user", + user = "user", /** Indicates the operation is initiated by a system. */ - System = "system", + system = "system", /** Indicates the operation is initiated by a user or system. */ - UserSystem = "user,system", + "user,system" = "user,system", } /** @@ -1371,5 +1371,5 @@ export type ActionType = string; /** The available API versions for the Microsoft.NetworkAnalytics RP. */ export enum KnownVersions { /** The 2023-11-15 stable version. */ - V2023_11_15 = "2023-11-15", + v2023_11_15 = "2023-11-15", } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/networkAnalyticsClient.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/networkAnalyticsClient.ts index 3c50cba66f..6b314c7661 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/networkAnalyticsClient.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/networkAnalyticsClient.ts @@ -2,21 +2,21 @@ // Licensed under the MIT License. import { - getOperationsOperations, - OperationsOperations, -} from "./classic/operations/index.js"; -import { - getDataProductsCatalogsOperations, - DataProductsCatalogsOperations, -} from "./classic/dataProductsCatalogs/index.js"; + getDataProductsOperations, + DataProductsOperations, +} from "./classic/dataProducts/index.js"; import { getDataTypesOperations, DataTypesOperations, } from "./classic/dataTypes/index.js"; import { - getDataProductsOperations, - DataProductsOperations, -} from "./classic/dataProducts/index.js"; + getDataProductsCatalogsOperations, + DataProductsCatalogsOperations, +} from "./classic/dataProductsCatalogs/index.js"; +import { + getOperationsOperations, + OperationsOperations, +} from "./classic/operations/index.js"; import { createNetworkAnalytics, NetworkAnalyticsContext, @@ -41,26 +41,23 @@ export class NetworkAnalyticsClient { const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` : `azsdk-js-client`; - this._client = createNetworkAnalytics(credential, { + this._client = createNetworkAnalytics(credential, subscriptionId, { ...options, userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; + this.dataProducts = getDataProductsOperations(this._client); + this.dataTypes = getDataTypesOperations(this._client); + this.dataProductsCatalogs = getDataProductsCatalogsOperations(this._client); this.operations = getOperationsOperations(this._client); - this.dataProductsCatalogs = getDataProductsCatalogsOperations( - this._client, - subscriptionId, - ); - this.dataTypes = getDataTypesOperations(this._client, subscriptionId); - this.dataProducts = getDataProductsOperations(this._client, subscriptionId); } - /** The operation groups for Operations */ - public readonly operations: OperationsOperations; - /** The operation groups for DataProductsCatalogs */ - public readonly dataProductsCatalogs: DataProductsCatalogsOperations; - /** The operation groups for DataTypes */ - public readonly dataTypes: DataTypesOperations; - /** The operation groups for DataProducts */ + /** The operation groups for dataProducts */ public readonly dataProducts: DataProductsOperations; + /** The operation groups for dataTypes */ + public readonly dataTypes: DataTypesOperations; + /** The operation groups for dataProductsCatalogs */ + public readonly dataProductsCatalogs: DataProductsCatalogsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; } diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/restorePollerHelpers.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/restorePollerHelpers.ts index 9a0c76fdf0..c2b51a730a 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/restorePollerHelpers.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/restorePollerHelpers.ts @@ -3,16 +3,16 @@ import { NetworkAnalyticsClient } from "./networkAnalyticsClient.js"; import { - _createDeserialize, - _updateDeserialize, _$deleteDeserialize, + _updateDeserialize, + _createDeserialize, +} from "./api/dataProducts/index.js"; +import { _deleteDataDeserialize, + _$deleteDeserialize as _$deleteDeserializeDataTypes, + _updateDeserialize as _updateDeserializeDataTypes, + _createDeserialize as _createDeserializeDataTypes, } from "./api/dataTypes/index.js"; -import { - _createDeserialize as _createDeserializeDataProducts, - _updateDeserialize as _updateDeserializeDataProducts, - _$deleteDeserialize as _$deleteDeserializeDataProducts, -} from "./api/dataProducts/index.js"; import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; import { OperationOptions, @@ -91,34 +91,34 @@ interface DeserializationHelper { } const deserializeMap: Record = { - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}": - { deserializer: _createDeserialize, expectedStatuses: ["200", "201"] }, - "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}": - { deserializer: _updateDeserialize, expectedStatuses: ["200", "202"] }, - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}": + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": { deserializer: _$deleteDeserialize, expectedStatuses: ["202", "204", "200"], }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": + { deserializer: _updateDeserialize, expectedStatuses: ["200", "202"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": + { deserializer: _createDeserialize, expectedStatuses: ["200", "201"] }, "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}/deleteData": { deserializer: _deleteDataDeserialize, expectedStatuses: ["202", "204", "200"], }, - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}": { - deserializer: _createDeserializeDataProducts, - expectedStatuses: ["200", "201"], + deserializer: _$deleteDeserializeDataTypes, + expectedStatuses: ["202", "204", "200"], }, - "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}": { - deserializer: _updateDeserializeDataProducts, + deserializer: _updateDeserializeDataTypes, expectedStatuses: ["200", "202"], }, - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}": + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}/dataTypes/{dataTypeName}": { - deserializer: _$deleteDeserializeDataProducts, - expectedStatuses: ["202", "204", "200"], + deserializer: _createDeserializeDataTypes, + expectedStatuses: ["200", "201"], }, }; diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/ai/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/ai/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/package.json b/packages/typespec-test/test/ai/generated/typespec-ts/package.json index a9a2f0b9b4..91fc31367a 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/ai/generated/typespec-ts/package.json @@ -13,9 +13,9 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/agents": "./src/api/agents/index.ts", + "./api/evaluations": "./src/api/evaluations/index.ts", "./api/connections": "./src/api/connections/index.ts", - "./api/evaluations": "./src/api/evaluations/index.ts" + "./api/agents": "./src/api/agents/index.ts" }, "dialects": [ "esm", @@ -127,22 +127,22 @@ "default": "./dist/commonjs/api/index.js" } }, - "./api/agents": { + "./api/evaluations": { "browser": { - "types": "./dist/browser/api/agents/index.d.ts", - "default": "./dist/browser/api/agents/index.js" + "types": "./dist/browser/api/evaluations/index.d.ts", + "default": "./dist/browser/api/evaluations/index.js" }, "react-native": { - "types": "./dist/react-native/api/agents/index.d.ts", - "default": "./dist/react-native/api/agents/index.js" + "types": "./dist/react-native/api/evaluations/index.d.ts", + "default": "./dist/react-native/api/evaluations/index.js" }, "import": { - "types": "./dist/esm/api/agents/index.d.ts", - "default": "./dist/esm/api/agents/index.js" + "types": "./dist/esm/api/evaluations/index.d.ts", + "default": "./dist/esm/api/evaluations/index.js" }, "require": { - "types": "./dist/commonjs/api/agents/index.d.ts", - "default": "./dist/commonjs/api/agents/index.js" + "types": "./dist/commonjs/api/evaluations/index.d.ts", + "default": "./dist/commonjs/api/evaluations/index.js" } }, "./api/connections": { @@ -163,22 +163,22 @@ "default": "./dist/commonjs/api/connections/index.js" } }, - "./api/evaluations": { + "./api/agents": { "browser": { - "types": "./dist/browser/api/evaluations/index.d.ts", - "default": "./dist/browser/api/evaluations/index.js" + "types": "./dist/browser/api/agents/index.d.ts", + "default": "./dist/browser/api/agents/index.js" }, "react-native": { - "types": "./dist/react-native/api/evaluations/index.d.ts", - "default": "./dist/react-native/api/evaluations/index.js" + "types": "./dist/react-native/api/agents/index.d.ts", + "default": "./dist/react-native/api/agents/index.js" }, "import": { - "types": "./dist/esm/api/evaluations/index.d.ts", - "default": "./dist/esm/api/evaluations/index.js" + "types": "./dist/esm/api/agents/index.d.ts", + "default": "./dist/esm/api/agents/index.js" }, "require": { - "types": "./dist/commonjs/api/evaluations/index.d.ts", - "default": "./dist/commonjs/api/evaluations/index.js" + "types": "./dist/commonjs/api/agents/index.d.ts", + "default": "./dist/commonjs/api/agents/index.js" } } }, diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md index 2c60227cdd..54365dac32 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md +++ b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md @@ -363,7 +363,6 @@ export interface AgentsUpdateThreadOptionalParams extends OperationOptions { // @public export interface AgentsUploadFileOptionalParams extends OperationOptions { - contentType?: string; filename?: string; } @@ -633,7 +632,6 @@ export interface EvaluationsOperations { // @public export interface EvaluationsUpdateOptionalParams extends OperationOptions { clientRequestId?: string; - contentType?: string; } // @public @@ -723,7 +721,7 @@ export type InputDataUnion = AppInsightsConfiguration | Dataset | InputData; // @public export enum KnownVersions { - "V2024-07-01-Preview" = "2024-07-01-preview" + "2024-07-01-preview" = "2024-07-01-preview" } // @public diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts index aa87b78c7a..fa6e25d463 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts @@ -45,38 +45,37 @@ import { AzureAIContext as Client, } from "../index.js"; import { - toolDefinitionUnionSerializer, - codeInterpreterToolResourceSerializer, - fileSearchToolResourceSerializer, - connectionListResourceSerializer, - azureAISearchResourceSerializer, + toolResourcesSerializer, + toolDefinitionUnionArraySerializer, + agentsApiResponseFormatOptionSerializer, Agent, agentDeserializer, OpenAIPageableListOfAgent, openAIPageableListOfAgentDeserializer, AgentDeletionStatus, agentDeletionStatusDeserializer, - threadMessageOptionsSerializer, MessageRole, - messageAttachmentSerializer, + messageAttachmentArraySerializer, threadMessageOptionsArraySerializer, AgentThread, agentThreadDeserializer, ThreadDeletionStatus, threadDeletionStatusDeserializer, ThreadMessage, - threadMessageSerializer, threadMessageDeserializer, OpenAIPageableListOfThreadMessage, openAIPageableListOfThreadMessageDeserializer, + threadMessageArraySerializer, + truncationObjectSerializer, + agentsApiToolChoiceOptionSerializer, ThreadRun, threadRunDeserializer, - updateCodeInterpreterToolResourceOptionsSerializer, - updateFileSearchToolResourceOptionsSerializer, + updateToolResourcesOptionsSerializer, OpenAIPageableListOfThreadRun, openAIPageableListOfThreadRunDeserializer, ToolOutput, - toolOutputSerializer, + toolOutputArraySerializer, + agentThreadCreationOptionsSerializer, RunStep, runStepDeserializer, OpenAIPageableListOfRunStep, @@ -94,6 +93,8 @@ import { openAIPageableListOfVectorStoreDeserializer, VectorStore, vectorStoreDeserializer, + vectorStoreExpirationPolicySerializer, + vectorStoreChunkingStrategyRequestUnionSerializer, VectorStoreDeletionStatus, vectorStoreDeletionStatusDeserializer, OpenAIPageableListOfVectorStoreFile, @@ -113,93 +114,29 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; -export function _createAgentSend( - context: Client, - model: string, - options: AgentsCreateAgentOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context.path("/assistants").post({ - ...operationOptionsToRequestParameters(options), - body: { - model: model, - name: options?.name, - description: options?.description, - instructions: options?.instructions, - tools: !options?.tools - ? options?.tools - : options?.tools.map((p: any) => { - return toolDefinitionUnionSerializer(p); - }), - tool_resources: { - code_interpreter: !options?.toolResources?.["codeInterpreter"] - ? options?.toolResources?.["codeInterpreter"] - : codeInterpreterToolResourceSerializer( - options?.toolResources?.["codeInterpreter"], - ), - file_search: !options?.toolResources?.["fileSearch"] - ? options?.toolResources?.["fileSearch"] - : fileSearchToolResourceSerializer( - options?.toolResources?.["fileSearch"], - ), - bing_grounding: !options?.toolResources?.["bingGrounding"] - ? options?.toolResources?.["bingGrounding"] - : connectionListResourceSerializer( - options?.toolResources?.["bingGrounding"], - ), - microsoft_fabric: !options?.toolResources?.["microsoftFabric"] - ? options?.toolResources?.["microsoftFabric"] - : connectionListResourceSerializer( - options?.toolResources?.["microsoftFabric"], - ), - sharepoint: !options?.toolResources?.["sharePoint"] - ? options?.toolResources?.["sharePoint"] - : connectionListResourceSerializer( - options?.toolResources?.["sharePoint"], - ), - azure_ai_search: !options?.toolResources?.["azureAISearch"] - ? options?.toolResources?.["azureAISearch"] - : azureAISearchResourceSerializer( - options?.toolResources?.["azureAISearch"], - ), - }, - temperature: options?.temperature, - top_p: options?.topP, - response_format: options?.responseFormat as any, - metadata: options?.metadata, - }, - }); -} - -export async function _createAgentDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return agentDeserializer(result.body); -} - -/** Creates a new agent. */ -export async function createAgent( - context: Client, - model: string, - options: AgentsCreateAgentOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createAgentSend(context, model, options); - return _createAgentDeserialize(result); -} - -export function _listAgentsSend( +export function _listVectorStoreFileBatchFilesSend( context: Client, - options: AgentsListAgentsOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + batchId: string, + options: AgentsListVectorStoreFileBatchFilesOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/assistants") + .path( + "/vector_stores/{vectorStoreId}/file_batches/{batchId}/files", + vectorStoreId, + batchId, + ) .get({ ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { + "api-version": context.apiVersion, + filter: options?.filter, limit: options?.limit, order: options?.order, after: options?.after, @@ -208,601 +145,586 @@ export function _listAgentsSend( }); } -export async function _listAgentsDeserialize( +export async function _listVectorStoreFileBatchFilesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIPageableListOfAgentDeserializer(result.body); + return openAIPageableListOfVectorStoreFileDeserializer(result.body); } -/** Gets a list of agents that were previously created. */ -export async function listAgents( +/** Returns a list of vector store files in a batch. */ +export async function listVectorStoreFileBatchFiles( context: Client, - options: AgentsListAgentsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listAgentsSend(context, options); - return _listAgentsDeserialize(result); + vectorStoreId: string, + batchId: string, + options: AgentsListVectorStoreFileBatchFilesOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _listVectorStoreFileBatchFilesSend( + context, + vectorStoreId, + batchId, + options, + ); + return _listVectorStoreFileBatchFilesDeserialize(result); } -export function _getAgentSend( +export function _cancelVectorStoreFileBatchSend( context: Client, - assistantId: string, - options: AgentsGetAgentOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + batchId: string, + options: AgentsCancelVectorStoreFileBatchOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/assistants/{assistantId}", assistantId) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _getAgentDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return agentDeserializer(result.body); -} - -/** Retrieves an existing agent. */ -export async function getAgent( - context: Client, - assistantId: string, - options: AgentsGetAgentOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getAgentSend(context, assistantId, options); - return _getAgentDeserialize(result); -} - -export function _updateAgentSend( - context: Client, - assistantId: string, - options: AgentsUpdateAgentOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context.path("/assistants/{assistantId}", assistantId).post({ - ...operationOptionsToRequestParameters(options), - body: { - model: options?.model, - name: options?.name, - description: options?.description, - instructions: options?.instructions, - tools: !options?.tools - ? options?.tools - : options?.tools.map((p: any) => { - return toolDefinitionUnionSerializer(p); - }), - tool_resources: { - code_interpreter: !options?.toolResources?.["codeInterpreter"] - ? options?.toolResources?.["codeInterpreter"] - : codeInterpreterToolResourceSerializer( - options?.toolResources?.["codeInterpreter"], - ), - file_search: !options?.toolResources?.["fileSearch"] - ? options?.toolResources?.["fileSearch"] - : fileSearchToolResourceSerializer( - options?.toolResources?.["fileSearch"], - ), - bing_grounding: !options?.toolResources?.["bingGrounding"] - ? options?.toolResources?.["bingGrounding"] - : connectionListResourceSerializer( - options?.toolResources?.["bingGrounding"], - ), - microsoft_fabric: !options?.toolResources?.["microsoftFabric"] - ? options?.toolResources?.["microsoftFabric"] - : connectionListResourceSerializer( - options?.toolResources?.["microsoftFabric"], - ), - sharepoint: !options?.toolResources?.["sharePoint"] - ? options?.toolResources?.["sharePoint"] - : connectionListResourceSerializer( - options?.toolResources?.["sharePoint"], - ), - azure_ai_search: !options?.toolResources?.["azureAISearch"] - ? options?.toolResources?.["azureAISearch"] - : azureAISearchResourceSerializer( - options?.toolResources?.["azureAISearch"], - ), + .path( + "/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel", + vectorStoreId, + batchId, + ) + .post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, - temperature: options?.temperature, - top_p: options?.topP, - response_format: options?.responseFormat as any, - metadata: options?.metadata, - }, - }); + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _updateAgentDeserialize( +export async function _cancelVectorStoreFileBatchDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return agentDeserializer(result.body); + return vectorStoreFileBatchDeserializer(result.body); } -/** Modifies an existing agent. */ -export async function updateAgent( +/** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */ +export async function cancelVectorStoreFileBatch( context: Client, - assistantId: string, - options: AgentsUpdateAgentOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updateAgentSend(context, assistantId, options); - return _updateAgentDeserialize(result); + vectorStoreId: string, + batchId: string, + options: AgentsCancelVectorStoreFileBatchOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _cancelVectorStoreFileBatchSend( + context, + vectorStoreId, + batchId, + options, + ); + return _cancelVectorStoreFileBatchDeserialize(result); } -export function _deleteAgentSend( +export function _getVectorStoreFileBatchSend( context: Client, - assistantId: string, - options: AgentsDeleteAgentOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + batchId: string, + options: AgentsGetVectorStoreFileBatchOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/assistants/{assistantId}", assistantId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path( + "/vector_stores/{vectorStoreId}/file_batches/{batchId}", + vectorStoreId, + batchId, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _deleteAgentDeserialize( +export async function _getVectorStoreFileBatchDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return agentDeletionStatusDeserializer(result.body); + return vectorStoreFileBatchDeserializer(result.body); } -/** Deletes an agent. */ -export async function deleteAgent( +/** Retrieve a vector store file batch. */ +export async function getVectorStoreFileBatch( context: Client, - assistantId: string, - options: AgentsDeleteAgentOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteAgentSend(context, assistantId, options); - return _deleteAgentDeserialize(result); + vectorStoreId: string, + batchId: string, + options: AgentsGetVectorStoreFileBatchOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getVectorStoreFileBatchSend( + context, + vectorStoreId, + batchId, + options, + ); + return _getVectorStoreFileBatchDeserialize(result); } -export function _createThreadSend( +export function _createVectorStoreFileBatchSend( context: Client, - options: AgentsCreateThreadOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + fileIds: string[], + options: AgentsCreateVectorStoreFileBatchOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { - return context.path("/threads").post({ - ...operationOptionsToRequestParameters(options), - body: { - messages: !options?.messages - ? options?.messages - : options?.messages.map((p: any) => { - return threadMessageOptionsSerializer(p); - }), - tool_resources: { - code_interpreter: !options?.toolResources?.["codeInterpreter"] - ? options?.toolResources?.["codeInterpreter"] - : codeInterpreterToolResourceSerializer( - options?.toolResources?.["codeInterpreter"], - ), - file_search: !options?.toolResources?.["fileSearch"] - ? options?.toolResources?.["fileSearch"] - : fileSearchToolResourceSerializer( - options?.toolResources?.["fileSearch"], - ), - bing_grounding: !options?.toolResources?.["bingGrounding"] - ? options?.toolResources?.["bingGrounding"] - : connectionListResourceSerializer( - options?.toolResources?.["bingGrounding"], - ), - microsoft_fabric: !options?.toolResources?.["microsoftFabric"] - ? options?.toolResources?.["microsoftFabric"] - : connectionListResourceSerializer( - options?.toolResources?.["microsoftFabric"], - ), - sharepoint: !options?.toolResources?.["sharePoint"] - ? options?.toolResources?.["sharePoint"] - : connectionListResourceSerializer( - options?.toolResources?.["sharePoint"], - ), - azure_ai_search: !options?.toolResources?.["azureAISearch"] - ? options?.toolResources?.["azureAISearch"] - : azureAISearchResourceSerializer( - options?.toolResources?.["azureAISearch"], + return context + .path("/vector_stores/{vectorStoreId}/file_batches", vectorStoreId) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + file_ids: fileIds.map((p: any) => { + return p; + }), + chunking_strategy: !options?.chunkingStrategy + ? options?.chunkingStrategy + : vectorStoreChunkingStrategyRequestUnionSerializer( + options?.chunkingStrategy, ), }, - metadata: options?.metadata, - }, - }); + }); } -export async function _createThreadDeserialize( +export async function _createVectorStoreFileBatchDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return agentThreadDeserializer(result.body); + return vectorStoreFileBatchDeserializer(result.body); } -/** Creates a new thread. Threads contain messages and can be run by agents. */ -export async function createThread( +/** Create a vector store file batch. */ +export async function createVectorStoreFileBatch( context: Client, - options: AgentsCreateThreadOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createThreadSend(context, options); - return _createThreadDeserialize(result); + vectorStoreId: string, + fileIds: string[], + options: AgentsCreateVectorStoreFileBatchOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _createVectorStoreFileBatchSend( + context, + vectorStoreId, + fileIds, + options, + ); + return _createVectorStoreFileBatchDeserialize(result); } -export function _getThreadSend( +export function _deleteVectorStoreFileSend( context: Client, - threadId: string, - options: AgentsGetThreadOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + fileId: string, + options: AgentsDeleteVectorStoreFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}", threadId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path( + "/vector_stores/{vectorStoreId}/files/{fileId}", + vectorStoreId, + fileId, + ) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getThreadDeserialize( +export async function _deleteVectorStoreFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return agentThreadDeserializer(result.body); + return vectorStoreFileDeletionStatusDeserializer(result.body); } -/** Gets information about an existing thread. */ -export async function getThread( +/** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + * To delete the file, use the delete file endpoint. + */ +export async function deleteVectorStoreFile( context: Client, - threadId: string, - options: AgentsGetThreadOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getThreadSend(context, threadId, options); - return _getThreadDeserialize(result); + vectorStoreId: string, + fileId: string, + options: AgentsDeleteVectorStoreFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteVectorStoreFileSend( + context, + vectorStoreId, + fileId, + options, + ); + return _deleteVectorStoreFileDeserialize(result); } -export function _updateThreadSend( +export function _getVectorStoreFileSend( context: Client, - threadId: string, - options: AgentsUpdateThreadOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + fileId: string, + options: AgentsGetVectorStoreFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}", threadId) - .post({ + .path( + "/vector_stores/{vectorStoreId}/files/{fileId}", + vectorStoreId, + fileId, + ) + .get({ ...operationOptionsToRequestParameters(options), - body: { - tool_resources: { - code_interpreter: !options?.toolResources?.["codeInterpreter"] - ? options?.toolResources?.["codeInterpreter"] - : codeInterpreterToolResourceSerializer( - options?.toolResources?.["codeInterpreter"], - ), - file_search: !options?.toolResources?.["fileSearch"] - ? options?.toolResources?.["fileSearch"] - : fileSearchToolResourceSerializer( - options?.toolResources?.["fileSearch"], - ), - bing_grounding: !options?.toolResources?.["bingGrounding"] - ? options?.toolResources?.["bingGrounding"] - : connectionListResourceSerializer( - options?.toolResources?.["bingGrounding"], - ), - microsoft_fabric: !options?.toolResources?.["microsoftFabric"] - ? options?.toolResources?.["microsoftFabric"] - : connectionListResourceSerializer( - options?.toolResources?.["microsoftFabric"], - ), - sharepoint: !options?.toolResources?.["sharePoint"] - ? options?.toolResources?.["sharePoint"] - : connectionListResourceSerializer( - options?.toolResources?.["sharePoint"], - ), - azure_ai_search: !options?.toolResources?.["azureAISearch"] - ? options?.toolResources?.["azureAISearch"] - : azureAISearchResourceSerializer( - options?.toolResources?.["azureAISearch"], - ), - }, - metadata: options?.metadata, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _updateThreadDeserialize( +export async function _getVectorStoreFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return agentThreadDeserializer(result.body); + return vectorStoreFileDeserializer(result.body); } -/** Modifies an existing thread. */ -export async function updateThread( +/** Retrieves a vector store file. */ +export async function getVectorStoreFile( context: Client, - threadId: string, - options: AgentsUpdateThreadOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updateThreadSend(context, threadId, options); - return _updateThreadDeserialize(result); + vectorStoreId: string, + fileId: string, + options: AgentsGetVectorStoreFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getVectorStoreFileSend( + context, + vectorStoreId, + fileId, + options, + ); + return _getVectorStoreFileDeserialize(result); } -export function _deleteThreadSend( +export function _createVectorStoreFileSend( context: Client, - threadId: string, - options: AgentsDeleteThreadOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + fileId: string, + options: AgentsCreateVectorStoreFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}", threadId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/vector_stores/{vectorStoreId}/files", vectorStoreId) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + file_id: fileId, + chunking_strategy: !options?.chunkingStrategy + ? options?.chunkingStrategy + : vectorStoreChunkingStrategyRequestUnionSerializer( + options?.chunkingStrategy, + ), + }, + }); } -export async function _deleteThreadDeserialize( +export async function _createVectorStoreFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadDeletionStatusDeserializer(result.body); + return vectorStoreFileDeserializer(result.body); } -/** Deletes an existing thread. */ -export async function deleteThread( +/** Create a vector store file by attaching a file to a vector store. */ +export async function createVectorStoreFile( context: Client, - threadId: string, - options: AgentsDeleteThreadOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteThreadSend(context, threadId, options); - return _deleteThreadDeserialize(result); + vectorStoreId: string, + fileId: string, + options: AgentsCreateVectorStoreFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createVectorStoreFileSend( + context, + vectorStoreId, + fileId, + options, + ); + return _createVectorStoreFileDeserialize(result); } -export function _createMessageSend( - context: Client, - threadId: string, - role: MessageRole, - content: string, - options: AgentsCreateMessageOptionalParams = { requestOptions: {} }, +export function _listVectorStoreFilesSend( + context: Client, + vectorStoreId: string, + options: AgentsListVectorStoreFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/threads/{threadId}/messages", threadId).post({ - ...operationOptionsToRequestParameters(options), - body: { - role: role, - content: content, - attachments: !options?.attachments - ? options?.attachments - : options?.attachments.map((p: any) => { - return messageAttachmentSerializer(p); - }), - metadata: options?.metadata, - }, - }); + return context + .path("/vector_stores/{vectorStoreId}/files", vectorStoreId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + filter: options?.filter, + limit: options?.limit, + order: options?.order, + after: options?.after, + before: options?.before, + }, + }); } -export async function _createMessageDeserialize( +export async function _listVectorStoreFilesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadMessageDeserializer(result.body); + return openAIPageableListOfVectorStoreFileDeserializer(result.body); } -/** Creates a new message on a specified thread. */ -export async function createMessage( +/** Returns a list of vector store files. */ +export async function listVectorStoreFiles( context: Client, - threadId: string, - role: MessageRole, - content: string, - options: AgentsCreateMessageOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createMessageSend( + vectorStoreId: string, + options: AgentsListVectorStoreFilesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listVectorStoreFilesSend( context, - threadId, - role, - content, + vectorStoreId, options, ); - return _createMessageDeserialize(result); + return _listVectorStoreFilesDeserialize(result); } -export function _listMessagesSend( +export function _deleteVectorStoreSend( context: Client, - threadId: string, - options: AgentsListMessagesOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + options: AgentsDeleteVectorStoreOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/messages", threadId) - .get({ + .path("/vector_stores/{vectorStoreId}", vectorStoreId) + .delete({ ...operationOptionsToRequestParameters(options), - queryParameters: { - runId: options?.runId, - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _listMessagesDeserialize( +export async function _deleteVectorStoreDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIPageableListOfThreadMessageDeserializer(result.body); + return vectorStoreDeletionStatusDeserializer(result.body); } -/** Gets a list of messages that exist on a thread. */ -export async function listMessages( +/** Deletes the vector store object matching the specified ID. */ +export async function deleteVectorStore( context: Client, - threadId: string, - options: AgentsListMessagesOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listMessagesSend(context, threadId, options); - return _listMessagesDeserialize(result); + vectorStoreId: string, + options: AgentsDeleteVectorStoreOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteVectorStoreSend(context, vectorStoreId, options); + return _deleteVectorStoreDeserialize(result); } -export function _getMessageSend( +export function _modifyVectorStoreSend( context: Client, - threadId: string, - messageId: string, - options: AgentsGetMessageOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + options: AgentsModifyVectorStoreOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/messages/{messageId}", threadId, messageId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/vector_stores/{vectorStoreId}", vectorStoreId) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + name: options?.name, + expires_after: !options?.expiresAfter + ? options?.expiresAfter + : vectorStoreExpirationPolicySerializer(options?.expiresAfter), + metadata: options?.metadata, + }, + }); } -export async function _getMessageDeserialize( +export async function _modifyVectorStoreDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadMessageDeserializer(result.body); + return vectorStoreDeserializer(result.body); } -/** Gets an existing message from an existing thread. */ -export async function getMessage( +/** The ID of the vector store to modify. */ +export async function modifyVectorStore( context: Client, - threadId: string, - messageId: string, - options: AgentsGetMessageOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getMessageSend(context, threadId, messageId, options); - return _getMessageDeserialize(result); + vectorStoreId: string, + options: AgentsModifyVectorStoreOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modifyVectorStoreSend(context, vectorStoreId, options); + return _modifyVectorStoreDeserialize(result); } -export function _updateMessageSend( +export function _getVectorStoreSend( context: Client, - threadId: string, - messageId: string, - options: AgentsUpdateMessageOptionalParams = { requestOptions: {} }, + vectorStoreId: string, + options: AgentsGetVectorStoreOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/messages/{messageId}", threadId, messageId) - .post({ + .path("/vector_stores/{vectorStoreId}", vectorStoreId) + .get({ ...operationOptionsToRequestParameters(options), - body: { metadata: options?.metadata }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _updateMessageDeserialize( +export async function _getVectorStoreDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadMessageDeserializer(result.body); + return vectorStoreDeserializer(result.body); } -/** Modifies an existing message on an existing thread. */ -export async function updateMessage( +/** Returns the vector store object matching the specified ID. */ +export async function getVectorStore( context: Client, - threadId: string, - messageId: string, - options: AgentsUpdateMessageOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updateMessageSend( - context, - threadId, - messageId, - options, - ); - return _updateMessageDeserialize(result); + vectorStoreId: string, + options: AgentsGetVectorStoreOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getVectorStoreSend(context, vectorStoreId, options); + return _getVectorStoreDeserialize(result); } -export function _createRunSend( +export function _createVectorStoreSend( context: Client, - threadId: string, - assistantId: string, - options: AgentsCreateRunOptionalParams = { requestOptions: {} }, + options: AgentsCreateVectorStoreOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/threads/{threadId}/runs", threadId).post({ + return context.path("/vector_stores").post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + queryParameters: { "api-version": context.apiVersion }, body: { - assistant_id: assistantId, - model: options?.model, - instructions: options?.instructions, - additional_instructions: options?.additionalInstructions, - additional_messages: !options?.additionalMessages - ? options?.additionalMessages - : options?.additionalMessages.map((p: any) => { - return threadMessageSerializer(p); - }), - tools: !options?.tools - ? options?.tools - : options?.tools.map((p: any) => { - return toolDefinitionUnionSerializer(p); + file_ids: !options?.fileIds + ? options?.fileIds + : options?.fileIds.map((p: any) => { + return p; }), - stream: options?.stream, - temperature: options?.temperature, - top_p: options?.topP, - max_prompt_tokens: options?.maxPromptTokens, - max_completion_tokens: options?.maxCompletionTokens, - truncation_strategy: { - type: options?.truncationStrategy?.["type"], - last_messages: options?.truncationStrategy?.["lastMessages"], - }, - tool_choice: options?.toolChoice as any, - response_format: options?.responseFormat as any, + name: options?.name, + expires_after: !options?.expiresAfter + ? options?.expiresAfter + : vectorStoreExpirationPolicySerializer(options?.expiresAfter), + chunking_strategy: !options?.chunkingStrategy + ? options?.chunkingStrategy + : vectorStoreChunkingStrategyRequestUnionSerializer( + options?.chunkingStrategy, + ), metadata: options?.metadata, }, }); } -export async function _createRunDeserialize( +export async function _createVectorStoreDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadRunDeserializer(result.body); + return vectorStoreDeserializer(result.body); } -/** Creates a new run for an agent thread. */ -export async function createRun( +/** Creates a vector store. */ +export async function createVectorStore( context: Client, - threadId: string, - assistantId: string, - options: AgentsCreateRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createRunSend(context, threadId, assistantId, options); - return _createRunDeserialize(result); + options: AgentsCreateVectorStoreOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createVectorStoreSend(context, options); + return _createVectorStoreDeserialize(result); } -export function _listRunsSend( +export function _listVectorStoresSend( context: Client, - threadId: string, - options: AgentsListRunsOptionalParams = { requestOptions: {} }, + options: AgentsListVectorStoresOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/runs", threadId) + .path("/vector_stores") .get({ ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { + "api-version": context.apiVersion, limit: options?.limit, order: options?.order, after: options?.after, @@ -811,272 +733,269 @@ export function _listRunsSend( }); } -export async function _listRunsDeserialize( +export async function _listVectorStoresDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIPageableListOfThreadRunDeserializer(result.body); + return openAIPageableListOfVectorStoreDeserializer(result.body); } -/** Gets a list of runs for a specified thread. */ -export async function listRuns( +/** Returns a list of vector stores. */ +export async function listVectorStores( context: Client, - threadId: string, - options: AgentsListRunsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listRunsSend(context, threadId, options); - return _listRunsDeserialize(result); + options: AgentsListVectorStoresOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listVectorStoresSend(context, options); + return _listVectorStoresDeserialize(result); } -export function _getRunSend( +export function _getFileContentSend( + context: Client, + fileId: string, + options: AgentsGetFileContentOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/files/{fileId}/content", fileId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _getFileContentDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return fileContentResponseDeserializer(result.body); +} + +/** Returns information about a specific file. Does not retrieve file content. */ +export async function getFileContent( + context: Client, + fileId: string, + options: AgentsGetFileContentOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getFileContentSend(context, fileId, options); + return _getFileContentDeserialize(result); +} + +export function _getFileSend( context: Client, - threadId: string, - runId: string, - options: AgentsGetRunOptionalParams = { requestOptions: {} }, + fileId: string, + options: AgentsGetFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/runs/{runId}", threadId, runId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/files/{fileId}", fileId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getRunDeserialize( +export async function _getFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadRunDeserializer(result.body); + return openAIFileDeserializer(result.body); } -/** Gets an existing run from an existing thread. */ -export async function getRun( +/** Returns information about a specific file. Does not retrieve file content. */ +export async function getFile( context: Client, - threadId: string, - runId: string, - options: AgentsGetRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getRunSend(context, threadId, runId, options); - return _getRunDeserialize(result); + fileId: string, + options: AgentsGetFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getFileSend(context, fileId, options); + return _getFileDeserialize(result); } -export function _updateRunSend( +export function _deleteFileSend( context: Client, - threadId: string, - runId: string, - options: AgentsUpdateRunOptionalParams = { requestOptions: {} }, + fileId: string, + options: AgentsDeleteFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/runs/{runId}", threadId, runId) - .post({ + .path("/files/{fileId}", fileId) + .delete({ ...operationOptionsToRequestParameters(options), - body: { metadata: options?.metadata }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _updateRunDeserialize( +export async function _deleteFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadRunDeserializer(result.body); + return fileDeletionStatusDeserializer(result.body); } -/** Modifies an existing thread run. */ -export async function updateRun( +/** Delete a previously uploaded file. */ +export async function deleteFile( context: Client, - threadId: string, - runId: string, - options: AgentsUpdateRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updateRunSend(context, threadId, runId, options); - return _updateRunDeserialize(result); + fileId: string, + options: AgentsDeleteFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteFileSend(context, fileId, options); + return _deleteFileDeserialize(result); } -export function _submitToolOutputsToRunSend( +export function _uploadFileSend( context: Client, - threadId: string, - runId: string, - toolOutputs: ToolOutput[], - options: AgentsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} }, + file: Uint8Array, + purpose: FilePurpose, + options: AgentsUploadFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/threads/{threadId}/runs/{runId}/submit_tool_outputs", - threadId, - runId, - ) + .path("/files") .post({ ...operationOptionsToRequestParameters(options), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: { - tool_outputs: toolOutputs.map((p: any) => { - return toolOutputSerializer(p); - }), - stream: options?.stream, + file: uint8ArrayToString(file, "base64"), + purpose: purpose, + filename: options?.filename, }, }); } -export async function _submitToolOutputsToRunDeserialize( +export async function _uploadFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadRunDeserializer(result.body); + return openAIFileDeserializer(result.body); } -/** Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. */ -export async function submitToolOutputsToRun( +/** Uploads a file for use by other operations. */ +export async function uploadFile( context: Client, - threadId: string, - runId: string, - toolOutputs: ToolOutput[], - options: AgentsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _submitToolOutputsToRunSend( - context, - threadId, - runId, - toolOutputs, - options, - ); - return _submitToolOutputsToRunDeserialize(result); + file: Uint8Array, + purpose: FilePurpose, + options: AgentsUploadFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _uploadFileSend(context, file, purpose, options); + return _uploadFileDeserialize(result); } -export function _cancelRunSend( +export function _listFilesSend( context: Client, - threadId: string, - runId: string, - options: AgentsCancelRunOptionalParams = { requestOptions: {} }, + options: AgentsListFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/runs/{runId}/cancel", threadId, runId) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/files") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + purpose: options?.purpose, + }, + }); } -export async function _cancelRunDeserialize( +export async function _listFilesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadRunDeserializer(result.body); + return fileListResponseDeserializer(result.body); } -/** Cancels a run of an in progress thread. */ -export async function cancelRun( +/** Gets a list of previously uploaded files. */ +export async function listFiles( context: Client, - threadId: string, - runId: string, - options: AgentsCancelRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _cancelRunSend(context, threadId, runId, options); - return _cancelRunDeserialize(result); + options: AgentsListFilesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listFilesSend(context, options); + return _listFilesDeserialize(result); } -export function _createThreadAndRunSend( +export function _listRunStepsSend( context: Client, - assistantId: string, - options: AgentsCreateThreadAndRunOptionalParams = { requestOptions: {} }, + threadId: string, + runId: string, + options: AgentsListRunStepsOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/threads/runs").post({ - ...operationOptionsToRequestParameters(options), - body: { - assistant_id: assistantId, - thread: { - messages: !options?.thread?.["messages"] - ? options?.thread?.["messages"] - : threadMessageOptionsArraySerializer(options?.thread?.["messages"]), - tool_resources: options?.thread?.["toolResources"], - metadata: options?.thread?.["metadata"], - }, - model: options?.model, - instructions: options?.instructions, - tools: !options?.tools - ? options?.tools - : options?.tools.map((p: any) => { - return toolDefinitionUnionSerializer(p); - }), - tool_resources: { - code_interpreter: !options?.toolResources?.["codeInterpreter"] - ? options?.toolResources?.["codeInterpreter"] - : updateCodeInterpreterToolResourceOptionsSerializer( - options?.toolResources?.["codeInterpreter"], - ), - file_search: !options?.toolResources?.["fileSearch"] - ? options?.toolResources?.["fileSearch"] - : updateFileSearchToolResourceOptionsSerializer( - options?.toolResources?.["fileSearch"], - ), - bing_grounding: !options?.toolResources?.["bingGrounding"] - ? options?.toolResources?.["bingGrounding"] - : connectionListResourceSerializer( - options?.toolResources?.["bingGrounding"], - ), - microsoft_fabric: !options?.toolResources?.["microsoftFabric"] - ? options?.toolResources?.["microsoftFabric"] - : connectionListResourceSerializer( - options?.toolResources?.["microsoftFabric"], - ), - sharepoint: !options?.toolResources?.["sharePoint"] - ? options?.toolResources?.["sharePoint"] - : connectionListResourceSerializer( - options?.toolResources?.["sharePoint"], - ), - azure_ai_search: !options?.toolResources?.["azureAISearch"] - ? options?.toolResources?.["azureAISearch"] - : azureAISearchResourceSerializer( - options?.toolResources?.["azureAISearch"], - ), + return context + .path("/threads/{threadId}/runs/{runId}/steps", threadId, runId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, - stream: options?.stream, - temperature: options?.temperature, - top_p: options?.topP, - max_prompt_tokens: options?.maxPromptTokens, - max_completion_tokens: options?.maxCompletionTokens, - truncation_strategy: { - type: options?.truncationStrategy?.["type"], - last_messages: options?.truncationStrategy?.["lastMessages"], + queryParameters: { + "api-version": context.apiVersion, + limit: options?.limit, + order: options?.order, + after: options?.after, + before: options?.before, }, - tool_choice: options?.toolChoice as any, - response_format: options?.responseFormat as any, - metadata: options?.metadata, - }, - }); + }); } -export async function _createThreadAndRunDeserialize( +export async function _listRunStepsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return threadRunDeserializer(result.body); + return openAIPageableListOfRunStepDeserializer(result.body); } -/** Creates a new agent thread and immediately starts a run using that new thread. */ -export async function createThreadAndRun( +/** Gets a list of run steps from a thread run. */ +export async function listRunSteps( context: Client, - assistantId: string, - options: AgentsCreateThreadAndRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createThreadAndRunSend(context, assistantId, options); - return _createThreadAndRunDeserialize(result); + threadId: string, + runId: string, + options: AgentsListRunStepsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listRunStepsSend(context, threadId, runId, options); + return _listRunStepsDeserialize(result); } export function _getRunStepSend( @@ -1093,7 +1012,14 @@ export function _getRunStepSend( runId, stepId, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _getRunStepDeserialize( @@ -1125,760 +1051,949 @@ export async function getRunStep( return _getRunStepDeserialize(result); } -export function _listRunStepsSend( +export function _createThreadAndRunSend( + context: Client, + assistantId: string, + options: AgentsCreateThreadAndRunOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/threads/runs") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + assistant_id: assistantId, + thread: !options?.thread + ? options?.thread + : agentThreadCreationOptionsSerializer(options?.thread), + model: options?.model, + instructions: options?.instructions, + tools: !options?.tools + ? options?.tools + : toolDefinitionUnionArraySerializer(options?.tools), + tool_resources: !options?.toolResources + ? options?.toolResources + : updateToolResourcesOptionsSerializer(options?.toolResources), + stream: options?.stream, + temperature: options?.temperature, + top_p: options?.topP, + max_prompt_tokens: options?.maxPromptTokens, + max_completion_tokens: options?.maxCompletionTokens, + truncation_strategy: !options?.truncationStrategy + ? options?.truncationStrategy + : truncationObjectSerializer(options?.truncationStrategy), + tool_choice: !options?.toolChoice + ? options?.toolChoice + : agentsApiToolChoiceOptionSerializer(options?.toolChoice), + response_format: !options?.responseFormat + ? options?.responseFormat + : agentsApiResponseFormatOptionSerializer(options?.responseFormat), + metadata: options?.metadata, + }, + }); +} + +export async function _createThreadAndRunDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return threadRunDeserializer(result.body); +} + +/** Creates a new agent thread and immediately starts a run using that new thread. */ +export async function createThreadAndRun( + context: Client, + assistantId: string, + options: AgentsCreateThreadAndRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createThreadAndRunSend(context, assistantId, options); + return _createThreadAndRunDeserialize(result); +} + +export function _cancelRunSend( context: Client, threadId: string, runId: string, - options: AgentsListRunStepsOptionalParams = { requestOptions: {} }, + options: AgentsCancelRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/threads/{threadId}/runs/{runId}/steps", threadId, runId) - .get({ + .path("/threads/{threadId}/runs/{runId}/cancel", threadId, runId) + .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _listRunStepsDeserialize( +export async function _cancelRunDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIPageableListOfRunStepDeserializer(result.body); + return threadRunDeserializer(result.body); } -/** Gets a list of run steps from a thread run. */ -export async function listRunSteps( +/** Cancels a run of an in progress thread. */ +export async function cancelRun( context: Client, threadId: string, runId: string, - options: AgentsListRunStepsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listRunStepsSend(context, threadId, runId, options); - return _listRunStepsDeserialize(result); + options: AgentsCancelRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _cancelRunSend(context, threadId, runId, options); + return _cancelRunDeserialize(result); } -export function _listFilesSend( +export function _submitToolOutputsToRunSend( context: Client, - options: AgentsListFilesOptionalParams = { requestOptions: {} }, + threadId: string, + runId: string, + toolOutputs: ToolOutput[], + options: AgentsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files") - .get({ + .path( + "/threads/{threadId}/runs/{runId}/submit_tool_outputs", + threadId, + runId, + ) + .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { purpose: options?.purpose }, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + tool_outputs: toolOutputArraySerializer(toolOutputs), + stream: options?.stream, + }, }); } -export async function _listFilesDeserialize( +export async function _submitToolOutputsToRunDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return fileListResponseDeserializer(result.body); + return threadRunDeserializer(result.body); } -/** Gets a list of previously uploaded files. */ -export async function listFiles( +/** Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. */ +export async function submitToolOutputsToRun( context: Client, - options: AgentsListFilesOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listFilesSend(context, options); - return _listFilesDeserialize(result); + threadId: string, + runId: string, + toolOutputs: ToolOutput[], + options: AgentsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _submitToolOutputsToRunSend( + context, + threadId, + runId, + toolOutputs, + options, + ); + return _submitToolOutputsToRunDeserialize(result); } -export function _uploadFileSend( +export function _updateRunSend( context: Client, - file: Uint8Array, - purpose: FilePurpose, - options: AgentsUploadFileOptionalParams = { requestOptions: {} }, + threadId: string, + runId: string, + options: AgentsUpdateRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files") + .path("/threads/{threadId}/runs/{runId}", threadId, runId) .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: { - file: uint8ArrayToString(file, "base64"), - purpose: purpose, - filename: options?.filename, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, + body: { metadata: options?.metadata }, }); } -export async function _uploadFileDeserialize( +export async function _updateRunDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return threadRunDeserializer(result.body); } -/** Uploads a file for use by other operations. */ -export async function uploadFile( +/** Modifies an existing thread run. */ +export async function updateRun( context: Client, - file: Uint8Array, - purpose: FilePurpose, - options: AgentsUploadFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _uploadFileSend(context, file, purpose, options); - return _uploadFileDeserialize(result); + threadId: string, + runId: string, + options: AgentsUpdateRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateRunSend(context, threadId, runId, options); + return _updateRunDeserialize(result); } -export function _deleteFileSend( +export function _getRunSend( context: Client, - fileId: string, - options: AgentsDeleteFileOptionalParams = { requestOptions: {} }, + threadId: string, + runId: string, + options: AgentsGetRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files/{fileId}", fileId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/threads/{threadId}/runs/{runId}", threadId, runId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _deleteFileDeserialize( +export async function _getRunDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return fileDeletionStatusDeserializer(result.body); + return threadRunDeserializer(result.body); } -/** Delete a previously uploaded file. */ -export async function deleteFile( +/** Gets an existing run from an existing thread. */ +export async function getRun( context: Client, - fileId: string, - options: AgentsDeleteFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteFileSend(context, fileId, options); - return _deleteFileDeserialize(result); + threadId: string, + runId: string, + options: AgentsGetRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getRunSend(context, threadId, runId, options); + return _getRunDeserialize(result); } -export function _getFileSend( +export function _listRunsSend( context: Client, - fileId: string, - options: AgentsGetFileOptionalParams = { requestOptions: {} }, + threadId: string, + options: AgentsListRunsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files/{fileId}", fileId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/threads/{threadId}/runs", threadId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + limit: options?.limit, + order: options?.order, + after: options?.after, + before: options?.before, + }, + }); } -export async function _getFileDeserialize( +export async function _listRunsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return openAIPageableListOfThreadRunDeserializer(result.body); } -/** Returns information about a specific file. Does not retrieve file content. */ -export async function getFile( +/** Gets a list of runs for a specified thread. */ +export async function listRuns( context: Client, - fileId: string, - options: AgentsGetFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getFileSend(context, fileId, options); - return _getFileDeserialize(result); + threadId: string, + options: AgentsListRunsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listRunsSend(context, threadId, options); + return _listRunsDeserialize(result); } -export function _getFileContentSend( +export function _createRunSend( context: Client, - fileId: string, - options: AgentsGetFileContentOptionalParams = { requestOptions: {} }, + threadId: string, + assistantId: string, + options: AgentsCreateRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files/{fileId}/content", fileId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/threads/{threadId}/runs", threadId) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + assistant_id: assistantId, + model: options?.model, + instructions: options?.instructions, + additional_instructions: options?.additionalInstructions, + additional_messages: !options?.additionalMessages + ? options?.additionalMessages + : threadMessageArraySerializer(options?.additionalMessages), + tools: !options?.tools + ? options?.tools + : toolDefinitionUnionArraySerializer(options?.tools), + stream: options?.stream, + temperature: options?.temperature, + top_p: options?.topP, + max_prompt_tokens: options?.maxPromptTokens, + max_completion_tokens: options?.maxCompletionTokens, + truncation_strategy: !options?.truncationStrategy + ? options?.truncationStrategy + : truncationObjectSerializer(options?.truncationStrategy), + tool_choice: !options?.toolChoice + ? options?.toolChoice + : agentsApiToolChoiceOptionSerializer(options?.toolChoice), + response_format: !options?.responseFormat + ? options?.responseFormat + : agentsApiResponseFormatOptionSerializer(options?.responseFormat), + metadata: options?.metadata, + }, + }); } -export async function _getFileContentDeserialize( +export async function _createRunDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return fileContentResponseDeserializer(result.body); + return threadRunDeserializer(result.body); } -/** Returns information about a specific file. Does not retrieve file content. */ -export async function getFileContent( +/** Creates a new run for an agent thread. */ +export async function createRun( context: Client, - fileId: string, - options: AgentsGetFileContentOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getFileContentSend(context, fileId, options); - return _getFileContentDeserialize(result); + threadId: string, + assistantId: string, + options: AgentsCreateRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createRunSend(context, threadId, assistantId, options); + return _createRunDeserialize(result); } -export function _listVectorStoresSend( +export function _updateMessageSend( context: Client, - options: AgentsListVectorStoresOptionalParams = { requestOptions: {} }, + threadId: string, + messageId: string, + options: AgentsUpdateMessageOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/vector_stores") - .get({ + .path("/threads/{threadId}/messages/{messageId}", threadId, messageId) + .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, + body: { metadata: options?.metadata }, }); } -export async function _listVectorStoresDeserialize( +export async function _updateMessageDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIPageableListOfVectorStoreDeserializer(result.body); + return threadMessageDeserializer(result.body); } -/** Returns a list of vector stores. */ -export async function listVectorStores( +/** Modifies an existing message on an existing thread. */ +export async function updateMessage( context: Client, - options: AgentsListVectorStoresOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listVectorStoresSend(context, options); - return _listVectorStoresDeserialize(result); + threadId: string, + messageId: string, + options: AgentsUpdateMessageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateMessageSend( + context, + threadId, + messageId, + options, + ); + return _updateMessageDeserialize(result); } -export function _createVectorStoreSend( +export function _getMessageSend( context: Client, - options: AgentsCreateVectorStoreOptionalParams = { requestOptions: {} }, + threadId: string, + messageId: string, + options: AgentsGetMessageOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/vector_stores").post({ - ...operationOptionsToRequestParameters(options), - body: { - file_ids: !options?.fileIds - ? options?.fileIds - : options?.fileIds.map((p: any) => { - return p; - }), - name: options?.name, - expires_after: { - anchor: options?.expiresAfter?.["anchor"], - days: options?.expiresAfter?.["days"], + return context + .path("/threads/{threadId}/messages/{messageId}", threadId, messageId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, - chunking_strategy: { type: options?.chunkingStrategy?.["type"] }, - metadata: options?.metadata, - }, - }); + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _createVectorStoreDeserialize( +export async function _getMessageDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreDeserializer(result.body); + return threadMessageDeserializer(result.body); } -/** Creates a vector store. */ -export async function createVectorStore( +/** Gets an existing message from an existing thread. */ +export async function getMessage( context: Client, - options: AgentsCreateVectorStoreOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createVectorStoreSend(context, options); - return _createVectorStoreDeserialize(result); + threadId: string, + messageId: string, + options: AgentsGetMessageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getMessageSend(context, threadId, messageId, options); + return _getMessageDeserialize(result); } -export function _getVectorStoreSend( +export function _listMessagesSend( context: Client, - vectorStoreId: string, - options: AgentsGetVectorStoreOptionalParams = { requestOptions: {} }, + threadId: string, + options: AgentsListMessagesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/vector_stores/{vectorStoreId}", vectorStoreId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/threads/{threadId}/messages", threadId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + runId: options?.runId, + limit: options?.limit, + order: options?.order, + after: options?.after, + before: options?.before, + }, + }); } -export async function _getVectorStoreDeserialize( +export async function _listMessagesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreDeserializer(result.body); + return openAIPageableListOfThreadMessageDeserializer(result.body); } -/** Returns the vector store object matching the specified ID. */ -export async function getVectorStore( +/** Gets a list of messages that exist on a thread. */ +export async function listMessages( context: Client, - vectorStoreId: string, - options: AgentsGetVectorStoreOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getVectorStoreSend(context, vectorStoreId, options); - return _getVectorStoreDeserialize(result); + threadId: string, + options: AgentsListMessagesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listMessagesSend(context, threadId, options); + return _listMessagesDeserialize(result); } -export function _modifyVectorStoreSend( +export function _createMessageSend( context: Client, - vectorStoreId: string, - options: AgentsModifyVectorStoreOptionalParams = { requestOptions: {} }, + threadId: string, + role: MessageRole, + content: string, + options: AgentsCreateMessageOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/vector_stores/{vectorStoreId}", vectorStoreId) + .path("/threads/{threadId}/messages", threadId) .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: { - name: options?.name, - expires_after: { - anchor: options?.expiresAfter?.["anchor"], - days: options?.expiresAfter?.["days"], - }, + role: role, + content: content, + attachments: !options?.attachments + ? options?.attachments + : messageAttachmentArraySerializer(options?.attachments), metadata: options?.metadata, }, }); } -export async function _modifyVectorStoreDeserialize( +export async function _createMessageDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreDeserializer(result.body); + return threadMessageDeserializer(result.body); } -/** The ID of the vector store to modify. */ -export async function modifyVectorStore( +/** Creates a new message on a specified thread. */ +export async function createMessage( context: Client, - vectorStoreId: string, - options: AgentsModifyVectorStoreOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _modifyVectorStoreSend(context, vectorStoreId, options); - return _modifyVectorStoreDeserialize(result); + threadId: string, + role: MessageRole, + content: string, + options: AgentsCreateMessageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createMessageSend( + context, + threadId, + role, + content, + options, + ); + return _createMessageDeserialize(result); } -export function _deleteVectorStoreSend( +export function _deleteThreadSend( context: Client, - vectorStoreId: string, - options: AgentsDeleteVectorStoreOptionalParams = { requestOptions: {} }, + threadId: string, + options: AgentsDeleteThreadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/vector_stores/{vectorStoreId}", vectorStoreId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/threads/{threadId}", threadId) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _deleteVectorStoreDeserialize( +export async function _deleteThreadDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreDeletionStatusDeserializer(result.body); + return threadDeletionStatusDeserializer(result.body); } -/** Deletes the vector store object matching the specified ID. */ -export async function deleteVectorStore( +/** Deletes an existing thread. */ +export async function deleteThread( context: Client, - vectorStoreId: string, - options: AgentsDeleteVectorStoreOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteVectorStoreSend(context, vectorStoreId, options); - return _deleteVectorStoreDeserialize(result); + threadId: string, + options: AgentsDeleteThreadOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteThreadSend(context, threadId, options); + return _deleteThreadDeserialize(result); } -export function _listVectorStoreFilesSend( +export function _updateThreadSend( context: Client, - vectorStoreId: string, - options: AgentsListVectorStoreFilesOptionalParams = { requestOptions: {} }, + threadId: string, + options: AgentsUpdateThreadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/vector_stores/{vectorStoreId}/files", vectorStoreId) - .get({ + .path("/threads/{threadId}", threadId) + .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { - filter: options?.filter, - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + tool_resources: !options?.toolResources + ? options?.toolResources + : toolResourcesSerializer(options?.toolResources), + metadata: options?.metadata, }, }); } -export async function _listVectorStoreFilesDeserialize( +export async function _updateThreadDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIPageableListOfVectorStoreFileDeserializer(result.body); + return agentThreadDeserializer(result.body); } -/** Returns a list of vector store files. */ -export async function listVectorStoreFiles( +/** Modifies an existing thread. */ +export async function updateThread( context: Client, - vectorStoreId: string, - options: AgentsListVectorStoreFilesOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listVectorStoreFilesSend( - context, - vectorStoreId, - options, - ); - return _listVectorStoreFilesDeserialize(result); + threadId: string, + options: AgentsUpdateThreadOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateThreadSend(context, threadId, options); + return _updateThreadDeserialize(result); } -export function _createVectorStoreFileSend( +export function _getThreadSend( context: Client, - vectorStoreId: string, - fileId: string, - options: AgentsCreateVectorStoreFileOptionalParams = { requestOptions: {} }, + threadId: string, + options: AgentsGetThreadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/vector_stores/{vectorStoreId}/files", vectorStoreId) - .post({ + .path("/threads/{threadId}", threadId) + .get({ ...operationOptionsToRequestParameters(options), - body: { - file_id: fileId, - chunking_strategy: { type: options?.chunkingStrategy?.["type"] }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createVectorStoreFileDeserialize( +export async function _getThreadDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreFileDeserializer(result.body); + return agentThreadDeserializer(result.body); } -/** Create a vector store file by attaching a file to a vector store. */ -export async function createVectorStoreFile( +/** Gets information about an existing thread. */ +export async function getThread( context: Client, - vectorStoreId: string, - fileId: string, - options: AgentsCreateVectorStoreFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createVectorStoreFileSend( - context, - vectorStoreId, - fileId, - options, - ); - return _createVectorStoreFileDeserialize(result); + threadId: string, + options: AgentsGetThreadOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getThreadSend(context, threadId, options); + return _getThreadDeserialize(result); } -export function _getVectorStoreFileSend( +export function _createThreadSend( context: Client, - vectorStoreId: string, - fileId: string, - options: AgentsGetVectorStoreFileOptionalParams = { requestOptions: {} }, + options: AgentsCreateThreadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/vector_stores/{vectorStoreId}/files/{fileId}", - vectorStoreId, - fileId, - ) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/threads") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + messages: !options?.messages + ? options?.messages + : threadMessageOptionsArraySerializer(options?.messages), + tool_resources: !options?.toolResources + ? options?.toolResources + : toolResourcesSerializer(options?.toolResources), + metadata: options?.metadata, + }, + }); } -export async function _getVectorStoreFileDeserialize( +export async function _createThreadDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreFileDeserializer(result.body); + return agentThreadDeserializer(result.body); } -/** Retrieves a vector store file. */ -export async function getVectorStoreFile( +/** Creates a new thread. Threads contain messages and can be run by agents. */ +export async function createThread( context: Client, - vectorStoreId: string, - fileId: string, - options: AgentsGetVectorStoreFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getVectorStoreFileSend( - context, - vectorStoreId, - fileId, - options, - ); - return _getVectorStoreFileDeserialize(result); + options: AgentsCreateThreadOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createThreadSend(context, options); + return _createThreadDeserialize(result); } -export function _deleteVectorStoreFileSend( +export function _deleteAgentSend( context: Client, - vectorStoreId: string, - fileId: string, - options: AgentsDeleteVectorStoreFileOptionalParams = { requestOptions: {} }, + assistantId: string, + options: AgentsDeleteAgentOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/vector_stores/{vectorStoreId}/files/{fileId}", - vectorStoreId, - fileId, - ) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/assistants/{assistantId}", assistantId) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _deleteVectorStoreFileDeserialize( +export async function _deleteAgentDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreFileDeletionStatusDeserializer(result.body); + return agentDeletionStatusDeserializer(result.body); } -/** - * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. - * To delete the file, use the delete file endpoint. - */ -export async function deleteVectorStoreFile( +/** Deletes an agent. */ +export async function deleteAgent( context: Client, - vectorStoreId: string, - fileId: string, - options: AgentsDeleteVectorStoreFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteVectorStoreFileSend( - context, - vectorStoreId, - fileId, - options, - ); - return _deleteVectorStoreFileDeserialize(result); + assistantId: string, + options: AgentsDeleteAgentOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteAgentSend(context, assistantId, options); + return _deleteAgentDeserialize(result); } -export function _createVectorStoreFileBatchSend( +export function _updateAgentSend( context: Client, - vectorStoreId: string, - fileIds: string[], - options: AgentsCreateVectorStoreFileBatchOptionalParams = { - requestOptions: {}, - }, + assistantId: string, + options: AgentsUpdateAgentOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/vector_stores/{vectorStoreId}/file_batches", vectorStoreId) + .path("/assistants/{assistantId}", assistantId) .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: { - file_ids: fileIds.map((p: any) => { - return p; - }), - chunking_strategy: { type: options?.chunkingStrategy?.["type"] }, + model: options?.model, + name: options?.name, + description: options?.description, + instructions: options?.instructions, + tools: !options?.tools + ? options?.tools + : toolDefinitionUnionArraySerializer(options?.tools), + tool_resources: !options?.toolResources + ? options?.toolResources + : toolResourcesSerializer(options?.toolResources), + temperature: options?.temperature, + top_p: options?.topP, + response_format: !options?.responseFormat + ? options?.responseFormat + : agentsApiResponseFormatOptionSerializer(options?.responseFormat), + metadata: options?.metadata, }, }); } -export async function _createVectorStoreFileBatchDeserialize( +export async function _updateAgentDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreFileBatchDeserializer(result.body); + return agentDeserializer(result.body); } -/** Create a vector store file batch. */ -export async function createVectorStoreFileBatch( +/** Modifies an existing agent. */ +export async function updateAgent( context: Client, - vectorStoreId: string, - fileIds: string[], - options: AgentsCreateVectorStoreFileBatchOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _createVectorStoreFileBatchSend( - context, - vectorStoreId, - fileIds, - options, - ); - return _createVectorStoreFileBatchDeserialize(result); + assistantId: string, + options: AgentsUpdateAgentOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateAgentSend(context, assistantId, options); + return _updateAgentDeserialize(result); } -export function _getVectorStoreFileBatchSend( +export function _getAgentSend( context: Client, - vectorStoreId: string, - batchId: string, - options: AgentsGetVectorStoreFileBatchOptionalParams = { requestOptions: {} }, + assistantId: string, + options: AgentsGetAgentOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/vector_stores/{vectorStoreId}/file_batches/{batchId}", - vectorStoreId, - batchId, - ) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/assistants/{assistantId}", assistantId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getVectorStoreFileBatchDeserialize( +export async function _getAgentDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreFileBatchDeserializer(result.body); + return agentDeserializer(result.body); } -/** Retrieve a vector store file batch. */ -export async function getVectorStoreFileBatch( +/** Retrieves an existing agent. */ +export async function getAgent( context: Client, - vectorStoreId: string, - batchId: string, - options: AgentsGetVectorStoreFileBatchOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getVectorStoreFileBatchSend( - context, - vectorStoreId, - batchId, - options, - ); - return _getVectorStoreFileBatchDeserialize(result); + assistantId: string, + options: AgentsGetAgentOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getAgentSend(context, assistantId, options); + return _getAgentDeserialize(result); } -export function _cancelVectorStoreFileBatchSend( +export function _listAgentsSend( context: Client, - vectorStoreId: string, - batchId: string, - options: AgentsCancelVectorStoreFileBatchOptionalParams = { - requestOptions: {}, - }, + options: AgentsListAgentsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel", - vectorStoreId, - batchId, - ) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/assistants") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + limit: options?.limit, + order: options?.order, + after: options?.after, + before: options?.before, + }, + }); } -export async function _cancelVectorStoreFileBatchDeserialize( +export async function _listAgentsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return vectorStoreFileBatchDeserializer(result.body); + return openAIPageableListOfAgentDeserializer(result.body); } -/** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */ -export async function cancelVectorStoreFileBatch( +/** Gets a list of agents that were previously created. */ +export async function listAgents( context: Client, - vectorStoreId: string, - batchId: string, - options: AgentsCancelVectorStoreFileBatchOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _cancelVectorStoreFileBatchSend( - context, - vectorStoreId, - batchId, - options, - ); - return _cancelVectorStoreFileBatchDeserialize(result); + options: AgentsListAgentsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listAgentsSend(context, options); + return _listAgentsDeserialize(result); } -export function _listVectorStoreFileBatchFilesSend( +export function _createAgentSend( context: Client, - vectorStoreId: string, - batchId: string, - options: AgentsListVectorStoreFileBatchFilesOptionalParams = { - requestOptions: {}, - }, + model: string, + options: AgentsCreateAgentOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/vector_stores/{vectorStoreId}/file_batches/{batchId}/files", - vectorStoreId, - batchId, - ) - .get({ + .path("/assistants") + .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { - filter: options?.filter, - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + model: model, + name: options?.name, + description: options?.description, + instructions: options?.instructions, + tools: !options?.tools + ? options?.tools + : toolDefinitionUnionArraySerializer(options?.tools), + tool_resources: !options?.toolResources + ? options?.toolResources + : toolResourcesSerializer(options?.toolResources), + temperature: options?.temperature, + top_p: options?.topP, + response_format: !options?.responseFormat + ? options?.responseFormat + : agentsApiResponseFormatOptionSerializer(options?.responseFormat), + metadata: options?.metadata, }, }); } -export async function _listVectorStoreFileBatchFilesDeserialize( +export async function _createAgentDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIPageableListOfVectorStoreFileDeserializer(result.body); + return agentDeserializer(result.body); } -/** Returns a list of vector store files in a batch. */ -export async function listVectorStoreFileBatchFiles( +/** Creates a new agent. */ +export async function createAgent( context: Client, - vectorStoreId: string, - batchId: string, - options: AgentsListVectorStoreFileBatchFilesOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _listVectorStoreFileBatchFilesSend( - context, - vectorStoreId, - batchId, - options, - ); - return _listVectorStoreFileBatchFilesDeserialize(result); + model: string, + options: AgentsCreateAgentOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createAgentSend(context, model, options); + return _createAgentDeserialize(result); } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/azureAIContext.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/azureAIContext.ts index 7209c2dad1..f963473440 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/azureAIContext.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/azureAIContext.ts @@ -6,7 +6,17 @@ import { KnownVersions } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface AzureAIContext extends Client {} +export interface AzureAIContext extends Client { + /** The Azure subscription ID. */ + subscriptionId: string; + /** The name of the Azure Resource Group. */ + resourceGroupName: string; + /** The Azure AI Studio project name. */ + projectName: string; + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface AzureAIClientOptionalParams extends ClientOptions { @@ -60,5 +70,11 @@ export function createAzureAI( return next(req); }, }); - return clientContext; + return { + ...clientContext, + subscriptionId, + resourceGroupName, + projectName, + apiVersion, + } as AzureAIContext; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts index 268a08507d..3db0b95d89 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts @@ -20,40 +20,51 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _listSend( +export function _listSecretsSend( context: Client, - options: ConnectionsListOptionalParams = { requestOptions: {} }, + connectionName: string, + ignored: string, + options: ConnectionsListSecretsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/connections") - .get({ + .path("/connections/{connectionName}/listsecrets", connectionName) + .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { - category: options?.category, - includeAll: options?.includeAll, - target: options?.target, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, + body: { ignored: ignored }, }); } -export async function _listDeserialize( +export async function _listSecretsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return connectionsListResponseDeserializer(result.body); + return connectionsListSecretsResponseDeserializer(result.body); } -/** List the details of all the connections (not including their credentials) */ -export async function list( +/** Get the details of a single connection, including credentials (if available). */ +export async function listSecrets( context: Client, - options: ConnectionsListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + connectionName: string, + ignored: string, + options: ConnectionsListSecretsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSecretsSend( + context, + connectionName, + ignored, + options, + ); + return _listSecretsDeserialize(result); } export function _getSend( @@ -63,7 +74,14 @@ export function _getSend( ): StreamableMethod { return context .path("/connections/{connectionName}", connectionName) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _getDeserialize( @@ -87,43 +105,43 @@ export async function get( return _getDeserialize(result); } -export function _listSecretsSend( +export function _listSend( context: Client, - connectionName: string, - ignored: string, - options: ConnectionsListSecretsOptionalParams = { requestOptions: {} }, + options: ConnectionsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/connections/{connectionName}/listsecrets", connectionName) - .post({ + .path("/connections") + .get({ ...operationOptionsToRequestParameters(options), - body: { ignored: ignored }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + category: options?.category, + includeAll: options?.includeAll, + target: options?.target, + }, }); } -export async function _listSecretsDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return connectionsListSecretsResponseDeserializer(result.body); + return connectionsListResponseDeserializer(result.body); } -/** Get the details of a single connection, including credentials (if available). */ -export async function listSecrets( +/** List the details of all the connections (not including their credentials) */ +export async function list( context: Client, - connectionName: string, - ignored: string, - options: ConnectionsListSecretsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSecretsSend( - context, - connectionName, - ignored, - options, - ); - return _listSecretsDeserialize(result); + options: ConnectionsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts index 810d12b0a4..3039efc37c 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts @@ -35,92 +35,64 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _getSend( +export function _deleteScheduleSend( context: Client, id: string, - options: EvaluationsGetOptionalParams = { requestOptions: {} }, + options: EvaluationsDeleteScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/evaluations/runs/{id}", id) - .get({ + .path("/evaluations/schedules/{id}", id) + .delete({ ...operationOptionsToRequestParameters(options), headers: { ...(options?.clientRequestId !== undefined ? { "x-ms-client-request-id": options?.clientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _getDeserialize( +export async function _deleteScheduleDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return evaluationDeserializer(result.body); + return; } -/** Resource read operation template. */ -export async function get( +/** Resource delete operation template. */ +export async function deleteSchedule( context: Client, id: string, - options: EvaluationsGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSend(context, id, options); - return _getDeserialize(result); -} - -export function _createSend( - context: Client, - evaluation: Evaluation, - options: EvaluationsCreateOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/evaluations/runs:run") - .post({ - ...operationOptionsToRequestParameters(options), - body: evaluationSerializer(evaluation), - }); -} - -export async function _createDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return evaluationDeserializer(result.body); -} - -/** Run the evaluation. */ -export async function create( - context: Client, - evaluation: Evaluation, - options: EvaluationsCreateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createSend(context, evaluation, options); - return _createDeserialize(result); + options: EvaluationsDeleteScheduleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteScheduleSend(context, id, options); + return _deleteScheduleDeserialize(result); } -export function _listSend( +export function _listScheduleSend( context: Client, - options: EvaluationsListOptionalParams = { requestOptions: {} }, + options: EvaluationsListScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/evaluations/runs") + .path("/evaluations/schedules") .get({ ...operationOptionsToRequestParameters(options), headers: { ...(options?.clientRequestId !== undefined ? { "x-ms-client-request-id": options?.clientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { + "api-version": context.apiVersion, top: options?.top, skip: options?.skip, maxpagesize: options?.maxpagesize, @@ -128,72 +100,83 @@ export function _listSend( }); } -export async function _listDeserialize( +export async function _listScheduleDeserialize( result: PathUncheckedResponse, -): Promise<_PagedEvaluation> { +): Promise<_PagedEvaluationSchedule> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedEvaluationDeserializer(result.body); + return _pagedEvaluationScheduleDeserializer(result.body); } /** Resource list operation template. */ -export function list( +export function listSchedule( context: Client, - options: EvaluationsListOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + options: EvaluationsListScheduleOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listSend(context, options), - _listDeserialize, + () => _listScheduleSend(context, options), + _listScheduleDeserialize, ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _updateSend( +export function _createOrReplaceScheduleSend( context: Client, id: string, - resource: Evaluation, - options: EvaluationsUpdateOptionalParams = { requestOptions: {} }, + resource: EvaluationSchedule, + options: EvaluationsCreateOrReplaceScheduleOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/evaluations/runs/{id}", id) - .patch({ + .path("/evaluations/schedules/{id}", id) + .put({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", + contentType: "application/json", headers: { ...(options?.clientRequestId !== undefined ? { "x-ms-client-request-id": options?.clientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, - body: evaluationSerializer(resource), + queryParameters: { "api-version": context.apiVersion }, + body: evaluationScheduleSerializer(resource), }); } -export async function _updateDeserialize( +export async function _createOrReplaceScheduleDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return evaluationDeserializer(result.body); + return evaluationScheduleDeserializer(result.body); } -/** Resource update operation template. */ -export async function update( +/** Create or replace operation template. */ +export async function createOrReplaceSchedule( context: Client, id: string, - resource: Evaluation, - options: EvaluationsUpdateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updateSend(context, id, resource, options); - return _updateDeserialize(result); + resource: EvaluationSchedule, + options: EvaluationsCreateOrReplaceScheduleOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _createOrReplaceScheduleSend( + context, + id, + resource, + options, + ); + return _createOrReplaceScheduleDeserialize(result); } export function _getScheduleSend( @@ -209,7 +192,10 @@ export function _getScheduleSend( ...(options?.clientRequestId !== undefined ? { "x-ms-client-request-id": options?.clientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } @@ -234,70 +220,68 @@ export async function getSchedule( return _getScheduleDeserialize(result); } -export function _createOrReplaceScheduleSend( +export function _updateSend( context: Client, id: string, - resource: EvaluationSchedule, - options: EvaluationsCreateOrReplaceScheduleOptionalParams = { - requestOptions: {}, - }, + resource: Evaluation, + options: EvaluationsUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/evaluations/schedules/{id}", id) - .put({ + .path("/evaluations/runs/{id}", id) + .patch({ ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", headers: { ...(options?.clientRequestId !== undefined ? { "x-ms-client-request-id": options?.clientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, - body: evaluationScheduleSerializer(resource), + queryParameters: { "api-version": context.apiVersion }, + body: evaluationSerializer(resource), }); } -export async function _createOrReplaceScheduleDeserialize( +export async function _updateDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return evaluationScheduleDeserializer(result.body); + return evaluationDeserializer(result.body); } -/** Create or replace operation template. */ -export async function createOrReplaceSchedule( +/** Resource update operation template. */ +export async function update( context: Client, id: string, - resource: EvaluationSchedule, - options: EvaluationsCreateOrReplaceScheduleOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _createOrReplaceScheduleSend( - context, - id, - resource, - options, - ); - return _createOrReplaceScheduleDeserialize(result); + resource: Evaluation, + options: EvaluationsUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateSend(context, id, resource, options); + return _updateDeserialize(result); } -export function _listScheduleSend( +export function _listSend( context: Client, - options: EvaluationsListScheduleOptionalParams = { requestOptions: {} }, + options: EvaluationsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/evaluations/schedules") + .path("/evaluations/runs") .get({ ...operationOptionsToRequestParameters(options), headers: { ...(options?.clientRequestId !== undefined ? { "x-ms-client-request-id": options?.clientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { + "api-version": context.apiVersion, top: options?.top, skip: options?.skip, maxpagesize: options?.maxpagesize, @@ -305,65 +289,108 @@ export function _listScheduleSend( }); } -export async function _listScheduleDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise<_PagedEvaluationSchedule> { +): Promise<_PagedEvaluation> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedEvaluationScheduleDeserializer(result.body); + return _pagedEvaluationDeserializer(result.body); } /** Resource list operation template. */ -export function listSchedule( +export function list( context: Client, - options: EvaluationsListScheduleOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + options: EvaluationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listScheduleSend(context, options), - _listScheduleDeserialize, + () => _listSend(context, options), + _listDeserialize, ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _deleteScheduleSend( +export function _createSend( + context: Client, + evaluation: Evaluation, + options: EvaluationsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/evaluations/runs:run") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { apiVersion: context.apiVersion }, + body: evaluationSerializer(evaluation), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return evaluationDeserializer(result.body); +} + +/** Run the evaluation. */ +export async function create( + context: Client, + evaluation: Evaluation, + options: EvaluationsCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend(context, evaluation, options); + return _createDeserialize(result); +} + +export function _getSend( context: Client, id: string, - options: EvaluationsDeleteScheduleOptionalParams = { requestOptions: {} }, + options: EvaluationsGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/evaluations/schedules/{id}", id) - .delete({ + .path("/evaluations/runs/{id}", id) + .get({ ...operationOptionsToRequestParameters(options), headers: { ...(options?.clientRequestId !== undefined ? { "x-ms-client-request-id": options?.clientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _deleteScheduleDeserialize( +export async function _getDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return evaluationDeserializer(result.body); } -/** Resource delete operation template. */ -export async function deleteSchedule( +/** Resource read operation template. */ +export async function get( context: Client, id: string, - options: EvaluationsDeleteScheduleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteScheduleSend(context, id, options); - return _deleteScheduleDeserialize(result); + options: EvaluationsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, id, options); + return _getDeserialize(result); } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts index c9da69e867..ee27dc77f0 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts @@ -7,55 +7,55 @@ export { AzureAIClientOptionalParams, } from "./azureAIContext.js"; export { - AgentsCreateAgentOptionalParams, - AgentsListAgentsOptionalParams, - AgentsGetAgentOptionalParams, - AgentsUpdateAgentOptionalParams, - AgentsDeleteAgentOptionalParams, - AgentsCreateThreadOptionalParams, - AgentsGetThreadOptionalParams, - AgentsUpdateThreadOptionalParams, - AgentsDeleteThreadOptionalParams, - AgentsCreateMessageOptionalParams, - AgentsListMessagesOptionalParams, - AgentsGetMessageOptionalParams, - AgentsUpdateMessageOptionalParams, - AgentsCreateRunOptionalParams, - AgentsListRunsOptionalParams, - AgentsGetRunOptionalParams, - AgentsUpdateRunOptionalParams, - AgentsSubmitToolOutputsToRunOptionalParams, - AgentsCancelRunOptionalParams, - AgentsCreateThreadAndRunOptionalParams, - AgentsGetRunStepOptionalParams, - AgentsListRunStepsOptionalParams, - AgentsListFilesOptionalParams, - AgentsUploadFileOptionalParams, - AgentsDeleteFileOptionalParams, - AgentsGetFileOptionalParams, - AgentsGetFileContentOptionalParams, - AgentsListVectorStoresOptionalParams, - AgentsCreateVectorStoreOptionalParams, - AgentsGetVectorStoreOptionalParams, - AgentsModifyVectorStoreOptionalParams, - AgentsDeleteVectorStoreOptionalParams, - AgentsListVectorStoreFilesOptionalParams, - AgentsCreateVectorStoreFileOptionalParams, - AgentsGetVectorStoreFileOptionalParams, - AgentsDeleteVectorStoreFileOptionalParams, - AgentsCreateVectorStoreFileBatchOptionalParams, - AgentsGetVectorStoreFileBatchOptionalParams, - AgentsCancelVectorStoreFileBatchOptionalParams, - AgentsListVectorStoreFileBatchFilesOptionalParams, - ConnectionsListOptionalParams, - ConnectionsGetOptionalParams, - ConnectionsListSecretsOptionalParams, - EvaluationsGetOptionalParams, - EvaluationsCreateOptionalParams, - EvaluationsListOptionalParams, - EvaluationsUpdateOptionalParams, - EvaluationsGetScheduleOptionalParams, - EvaluationsCreateOrReplaceScheduleOptionalParams, - EvaluationsListScheduleOptionalParams, EvaluationsDeleteScheduleOptionalParams, + EvaluationsListScheduleOptionalParams, + EvaluationsCreateOrReplaceScheduleOptionalParams, + EvaluationsGetScheduleOptionalParams, + EvaluationsUpdateOptionalParams, + EvaluationsListOptionalParams, + EvaluationsCreateOptionalParams, + EvaluationsGetOptionalParams, + ConnectionsListSecretsOptionalParams, + ConnectionsGetOptionalParams, + ConnectionsListOptionalParams, + AgentsListVectorStoreFileBatchFilesOptionalParams, + AgentsCancelVectorStoreFileBatchOptionalParams, + AgentsGetVectorStoreFileBatchOptionalParams, + AgentsCreateVectorStoreFileBatchOptionalParams, + AgentsDeleteVectorStoreFileOptionalParams, + AgentsGetVectorStoreFileOptionalParams, + AgentsCreateVectorStoreFileOptionalParams, + AgentsListVectorStoreFilesOptionalParams, + AgentsDeleteVectorStoreOptionalParams, + AgentsModifyVectorStoreOptionalParams, + AgentsGetVectorStoreOptionalParams, + AgentsCreateVectorStoreOptionalParams, + AgentsListVectorStoresOptionalParams, + AgentsGetFileContentOptionalParams, + AgentsGetFileOptionalParams, + AgentsDeleteFileOptionalParams, + AgentsUploadFileOptionalParams, + AgentsListFilesOptionalParams, + AgentsListRunStepsOptionalParams, + AgentsGetRunStepOptionalParams, + AgentsCreateThreadAndRunOptionalParams, + AgentsCancelRunOptionalParams, + AgentsSubmitToolOutputsToRunOptionalParams, + AgentsUpdateRunOptionalParams, + AgentsGetRunOptionalParams, + AgentsListRunsOptionalParams, + AgentsCreateRunOptionalParams, + AgentsUpdateMessageOptionalParams, + AgentsGetMessageOptionalParams, + AgentsListMessagesOptionalParams, + AgentsCreateMessageOptionalParams, + AgentsDeleteThreadOptionalParams, + AgentsUpdateThreadOptionalParams, + AgentsGetThreadOptionalParams, + AgentsCreateThreadOptionalParams, + AgentsDeleteAgentOptionalParams, + AgentsUpdateAgentOptionalParams, + AgentsGetAgentOptionalParams, + AgentsListAgentsOptionalParams, + AgentsCreateAgentOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts index 58cbb95b16..3d864d1f2b 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OperationOptions } from "@azure-rest/core-client"; import { ConnectionType, ToolDefinitionUnion, @@ -20,137 +19,90 @@ import { ListSortOrder, VectorStoreFileStatusFilter, } from "../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface AgentsCreateAgentOptionalParams extends OperationOptions { - /** The name of the new agent. */ - name?: string | null; - /** The description of the new agent. */ - description?: string | null; - /** The system instructions for the new agent to use. */ - instructions?: string | null; - /** The collection of tools to enable for the new agent. */ - tools?: ToolDefinitionUnion[]; - /** - * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - */ - toolResources?: ToolResources | null; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - * while lower values like 0.2 will make it more focused and deterministic. - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP?: number | null; - /** The response format of the tool calls used by this agent. */ - responseFormat?: AgentsApiResponseFormatOption | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; +export interface EvaluationsDeleteScheduleOptionalParams + extends OperationOptions { + /** An opaque, globally-unique, client-generated string identifier for the request. */ + clientRequestId?: string; } /** Optional parameters. */ -export interface AgentsListAgentsOptionalParams extends OperationOptions { - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; +export interface EvaluationsListScheduleOptionalParams + extends OperationOptions { + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; + /** An opaque, globally-unique, client-generated string identifier for the request. */ + clientRequestId?: string; } /** Optional parameters. */ -export interface AgentsGetAgentOptionalParams extends OperationOptions {} +export interface EvaluationsCreateOrReplaceScheduleOptionalParams + extends OperationOptions { + /** An opaque, globally-unique, client-generated string identifier for the request. */ + clientRequestId?: string; +} /** Optional parameters. */ -export interface AgentsUpdateAgentOptionalParams extends OperationOptions { - /** The ID of the model to use. */ - model?: string; - /** The modified name for the agent to use. */ - name?: string | null; - /** The modified description for the agent to use. */ - description?: string | null; - /** The modified system instructions for the new agent to use. */ - instructions?: string | null; - /** The modified collection of tools to enable for the agent. */ - tools?: ToolDefinitionUnion[]; - /** - * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, - * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - */ - toolResources?: ToolResources; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - * while lower values like 0.2 will make it more focused and deterministic. - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP?: number | null; - /** The response format of the tool calls used by this agent. */ - responseFormat?: AgentsApiResponseFormatOption | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; +export interface EvaluationsGetScheduleOptionalParams extends OperationOptions { + /** An opaque, globally-unique, client-generated string identifier for the request. */ + clientRequestId?: string; } /** Optional parameters. */ -export interface AgentsDeleteAgentOptionalParams extends OperationOptions {} +export interface EvaluationsUpdateOptionalParams extends OperationOptions { + /** An opaque, globally-unique, client-generated string identifier for the request. */ + clientRequestId?: string; +} /** Optional parameters. */ -export interface AgentsCreateThreadOptionalParams extends OperationOptions { - /** The initial messages to associate with the new thread. */ - messages?: ThreadMessageOptions[]; - /** - * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - * a list of vector store IDs. - */ - toolResources?: ToolResources | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; +export interface EvaluationsListOptionalParams extends OperationOptions { + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; + /** An opaque, globally-unique, client-generated string identifier for the request. */ + clientRequestId?: string; } /** Optional parameters. */ -export interface AgentsGetThreadOptionalParams extends OperationOptions {} +export interface EvaluationsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AgentsUpdateThreadOptionalParams extends OperationOptions { - /** - * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - * a list of vector store IDs - */ - toolResources?: ToolResources | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; +export interface EvaluationsGetOptionalParams extends OperationOptions { + /** An opaque, globally-unique, client-generated string identifier for the request. */ + clientRequestId?: string; } /** Optional parameters. */ -export interface AgentsDeleteThreadOptionalParams extends OperationOptions {} +export interface ConnectionsListSecretsOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface AgentsCreateMessageOptionalParams extends OperationOptions { - /** A list of files attached to the message, and the tools they should be added to. */ - attachments?: MessageAttachment[] | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; +export interface ConnectionsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ConnectionsListOptionalParams extends OperationOptions { + /** Category of the workspace connection. */ + category?: ConnectionType; + /** Indicates whether to list datastores. Service default: do not list datastores. */ + includeAll?: boolean; + /** Target of the workspace connection. */ + target?: string; } /** Optional parameters. */ -export interface AgentsListMessagesOptionalParams extends OperationOptions { - /** Filter messages by the run ID that generated them. */ - runId?: string; +export interface AgentsListVectorStoreFileBatchFilesOptionalParams + extends OperationOptions { + /** Filter by file status. */ + filter?: VectorStoreFileStatusFilter; /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ limit?: number; /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ @@ -162,71 +114,40 @@ export interface AgentsListMessagesOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface AgentsGetMessageOptionalParams extends OperationOptions {} +export interface AgentsCancelVectorStoreFileBatchOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface AgentsUpdateMessageOptionalParams extends OperationOptions { - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; +export interface AgentsGetVectorStoreFileBatchOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsCreateVectorStoreFileBatchOptionalParams + extends OperationOptions { + /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ + chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; } /** Optional parameters. */ -export interface AgentsCreateRunOptionalParams extends OperationOptions { - /** The overridden model name that the agent should use to run the thread. */ - model?: string | null; - /** The overridden system instructions that the agent should use to run the thread. */ - instructions?: string | null; - /** - * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior - * on a per-run basis without overriding other instructions. - */ - additionalInstructions?: string | null; - /** Adds additional messages to the thread before creating the run. */ - additionalMessages?: ThreadMessage[] | null; - /** The overridden list of enabled tools that the agent should use to run the thread. */ - tools?: ToolDefinitionUnion[] | null; - /** - * If `true`, returns a stream of events that happen during the Run as server-sent events, - * terminating when the Run enters a terminal state with a `data: [DONE]` message. - */ - stream?: boolean; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - * more random, while lower values like 0.2 will make it more focused and deterministic. - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model - * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - * comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP?: number | null; - /** - * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - * the run will end with status `incomplete`. See `incomplete_details` for more info. - */ - maxPromptTokens?: number | null; - /** - * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort - * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of - * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - */ - maxCompletionTokens?: number | null; - /** The strategy to use for dropping messages as the context windows moves forward. */ - truncationStrategy?: TruncationObject | null; - /** Controls whether or not and which tool is called by the model. */ - toolChoice?: AgentsApiToolChoiceOption | null; - /** Specifies the format that the model must output. */ - responseFormat?: AgentsApiResponseFormatOption | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; +export interface AgentsDeleteVectorStoreFileOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsGetVectorStoreFileOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsCreateVectorStoreFileOptionalParams + extends OperationOptions { + /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ + chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; } /** Optional parameters. */ -export interface AgentsListRunsOptionalParams extends OperationOptions { +export interface AgentsListVectorStoreFilesOptionalParams + extends OperationOptions { + /** Filter by file status. */ + filter?: VectorStoreFileStatusFilter; /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ limit?: number; /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ @@ -238,23 +159,85 @@ export interface AgentsListRunsOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface AgentsGetRunOptionalParams extends OperationOptions {} +export interface AgentsDeleteVectorStoreOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface AgentsUpdateRunOptionalParams extends OperationOptions { +export interface AgentsModifyVectorStoreOptionalParams + extends OperationOptions { + /** The name of the vector store. */ + name?: string | null; + /** Details on when this vector store expires */ + expiresAfter?: VectorStoreExpirationPolicy | null; /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ metadata?: Record | null; } /** Optional parameters. */ -export interface AgentsSubmitToolOutputsToRunOptionalParams - extends OperationOptions { - /** If true, returns a stream of events that happen during the Run as server-sent events, terminating when the run enters a terminal state. */ - stream?: boolean | null; +export interface AgentsGetVectorStoreOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsCreateVectorStoreOptionalParams + extends OperationOptions { + /** A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. */ + fileIds?: string[]; + /** The name of the vector store. */ + name?: string; + /** Details on when this vector store expires */ + expiresAfter?: VectorStoreExpirationPolicy; + /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. */ + chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; + /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ + metadata?: Record | null; } /** Optional parameters. */ -export interface AgentsCancelRunOptionalParams extends OperationOptions {} +export interface AgentsListVectorStoresOptionalParams extends OperationOptions { + /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ + limit?: number; + /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ + order?: ListSortOrder; + /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ + after?: string; + /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ + before?: string; +} + +/** Optional parameters. */ +export interface AgentsGetFileContentOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsGetFileOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsDeleteFileOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsUploadFileOptionalParams extends OperationOptions { + /** The name of the file. */ + filename?: string; +} + +/** Optional parameters. */ +export interface AgentsListFilesOptionalParams extends OperationOptions { + /** The purpose of the file. */ + purpose?: FilePurpose; +} + +/** Optional parameters. */ +export interface AgentsListRunStepsOptionalParams extends OperationOptions { + /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ + limit?: number; + /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ + order?: ListSortOrder; + /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ + after?: string; + /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ + before?: string; +} + +/** Optional parameters. */ +export interface AgentsGetRunStepOptionalParams extends OperationOptions {} /** Optional parameters. */ export interface AgentsCreateThreadAndRunOptionalParams @@ -310,45 +293,26 @@ export interface AgentsCreateThreadAndRunOptionalParams } /** Optional parameters. */ -export interface AgentsGetRunStepOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface AgentsListRunStepsOptionalParams extends OperationOptions { - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} +export interface AgentsCancelRunOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AgentsListFilesOptionalParams extends OperationOptions { - /** The purpose of the file. */ - purpose?: FilePurpose; +export interface AgentsSubmitToolOutputsToRunOptionalParams + extends OperationOptions { + /** If true, returns a stream of events that happen during the Run as server-sent events, terminating when the run enters a terminal state. */ + stream?: boolean | null; } /** Optional parameters. */ -export interface AgentsUploadFileOptionalParams extends OperationOptions { - /** The name of the file to upload. */ - contentType?: string; - /** The name of the file. */ - filename?: string; +export interface AgentsUpdateRunOptionalParams extends OperationOptions { + /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ + metadata?: Record | null; } /** Optional parameters. */ -export interface AgentsDeleteFileOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface AgentsGetFileOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface AgentsGetFileContentOptionalParams extends OperationOptions {} +export interface AgentsGetRunOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AgentsListVectorStoresOptionalParams extends OperationOptions { +export interface AgentsListRunsOptionalParams extends OperationOptions { /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ limit?: number; /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ @@ -360,43 +324,73 @@ export interface AgentsListVectorStoresOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface AgentsCreateVectorStoreOptionalParams - extends OperationOptions { - /** A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. */ - fileIds?: string[]; - /** The name of the vector store. */ - name?: string; - /** Details on when this vector store expires */ - expiresAfter?: VectorStoreExpirationPolicy; - /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. */ - chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; +export interface AgentsCreateRunOptionalParams extends OperationOptions { + /** The overridden model name that the agent should use to run the thread. */ + model?: string | null; + /** The overridden system instructions that the agent should use to run the thread. */ + instructions?: string | null; + /** + * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior + * on a per-run basis without overriding other instructions. + */ + additionalInstructions?: string | null; + /** Adds additional messages to the thread before creating the run. */ + additionalMessages?: ThreadMessage[] | null; + /** The overridden list of enabled tools that the agent should use to run the thread. */ + tools?: ToolDefinitionUnion[] | null; + /** + * If `true`, returns a stream of events that happen during the Run as server-sent events, + * terminating when the Run enters a terminal state with a `data: [DONE]` message. + */ + stream?: boolean; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + topP?: number | null; + /** + * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + maxPromptTokens?: number | null; + /** + * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + maxCompletionTokens?: number | null; + /** The strategy to use for dropping messages as the context windows moves forward. */ + truncationStrategy?: TruncationObject | null; + /** Controls whether or not and which tool is called by the model. */ + toolChoice?: AgentsApiToolChoiceOption | null; + /** Specifies the format that the model must output. */ + responseFormat?: AgentsApiResponseFormatOption | null; /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ metadata?: Record | null; } /** Optional parameters. */ -export interface AgentsGetVectorStoreOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface AgentsModifyVectorStoreOptionalParams - extends OperationOptions { - /** The name of the vector store. */ - name?: string | null; - /** Details on when this vector store expires */ - expiresAfter?: VectorStoreExpirationPolicy | null; +export interface AgentsUpdateMessageOptionalParams extends OperationOptions { /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ metadata?: Record | null; } /** Optional parameters. */ -export interface AgentsDeleteVectorStoreOptionalParams - extends OperationOptions {} +export interface AgentsGetMessageOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AgentsListVectorStoreFilesOptionalParams - extends OperationOptions { - /** Filter by file status. */ - filter?: VectorStoreFileStatusFilter; +export interface AgentsListMessagesOptionalParams extends OperationOptions { + /** Filter messages by the run ID that generated them. */ + runId?: string; /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ limit?: number; /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ @@ -408,40 +402,88 @@ export interface AgentsListVectorStoreFilesOptionalParams } /** Optional parameters. */ -export interface AgentsCreateVectorStoreFileOptionalParams - extends OperationOptions { - /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ - chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; +export interface AgentsCreateMessageOptionalParams extends OperationOptions { + /** A list of files attached to the message, and the tools they should be added to. */ + attachments?: MessageAttachment[] | null; + /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ + metadata?: Record | null; } /** Optional parameters. */ -export interface AgentsGetVectorStoreFileOptionalParams - extends OperationOptions {} +export interface AgentsDeleteThreadOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AgentsDeleteVectorStoreFileOptionalParams - extends OperationOptions {} +export interface AgentsUpdateThreadOptionalParams extends OperationOptions { + /** + * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + * a list of vector store IDs + */ + toolResources?: ToolResources | null; + /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ + metadata?: Record | null; +} /** Optional parameters. */ -export interface AgentsCreateVectorStoreFileBatchOptionalParams - extends OperationOptions { - /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ - chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; +export interface AgentsGetThreadOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsCreateThreadOptionalParams extends OperationOptions { + /** The initial messages to associate with the new thread. */ + messages?: ThreadMessageOptions[]; + /** + * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + * a list of vector store IDs. + */ + toolResources?: ToolResources | null; + /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ + metadata?: Record | null; } /** Optional parameters. */ -export interface AgentsGetVectorStoreFileBatchOptionalParams - extends OperationOptions {} +export interface AgentsDeleteAgentOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AgentsCancelVectorStoreFileBatchOptionalParams - extends OperationOptions {} +export interface AgentsUpdateAgentOptionalParams extends OperationOptions { + /** The ID of the model to use. */ + model?: string; + /** The modified name for the agent to use. */ + name?: string | null; + /** The modified description for the agent to use. */ + description?: string | null; + /** The modified system instructions for the new agent to use. */ + instructions?: string | null; + /** The modified collection of tools to enable for the agent. */ + tools?: ToolDefinitionUnion[]; + /** + * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + toolResources?: ToolResources; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + topP?: number | null; + /** The response format of the tool calls used by this agent. */ + responseFormat?: AgentsApiResponseFormatOption | null; + /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ + metadata?: Record | null; +} /** Optional parameters. */ -export interface AgentsListVectorStoreFileBatchFilesOptionalParams - extends OperationOptions { - /** Filter by file status. */ - filter?: VectorStoreFileStatusFilter; +export interface AgentsGetAgentOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsListAgentsOptionalParams extends OperationOptions { /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ limit?: number; /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ @@ -453,80 +495,34 @@ export interface AgentsListVectorStoreFileBatchFilesOptionalParams } /** Optional parameters. */ -export interface ConnectionsListOptionalParams extends OperationOptions { - /** Category of the workspace connection. */ - category?: ConnectionType; - /** Indicates whether to list datastores. Service default: do not list datastores. */ - includeAll?: boolean; - /** Target of the workspace connection. */ - target?: string; -} - -/** Optional parameters. */ -export interface ConnectionsGetOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface ConnectionsListSecretsOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface EvaluationsGetOptionalParams extends OperationOptions { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; -} - -/** Optional parameters. */ -export interface EvaluationsCreateOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface EvaluationsListOptionalParams extends OperationOptions { - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; -} - -/** Optional parameters. */ -export interface EvaluationsUpdateOptionalParams extends OperationOptions { - /** This request has a JSON Merge Patch body. */ - contentType?: string; - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; -} - -/** Optional parameters. */ -export interface EvaluationsGetScheduleOptionalParams extends OperationOptions { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; -} - -/** Optional parameters. */ -export interface EvaluationsCreateOrReplaceScheduleOptionalParams - extends OperationOptions { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; -} - -/** Optional parameters. */ -export interface EvaluationsListScheduleOptionalParams - extends OperationOptions { - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; -} - -/** Optional parameters. */ -export interface EvaluationsDeleteScheduleOptionalParams - extends OperationOptions { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; +export interface AgentsCreateAgentOptionalParams extends OperationOptions { + /** The name of the new agent. */ + name?: string | null; + /** The description of the new agent. */ + description?: string | null; + /** The system instructions for the new agent to use. */ + instructions?: string | null; + /** The collection of tools to enable for the new agent. */ + tools?: ToolDefinitionUnion[]; + /** + * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + toolResources?: ToolResources | null; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + temperature?: number | null; + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + topP?: number | null; + /** The response format of the tool calls used by this agent. */ + responseFormat?: AgentsApiResponseFormatOption | null; + /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ + metadata?: Record | null; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/azureAIClient.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/azureAIClient.ts index 6478f29185..420bb83754 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/azureAIClient.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/azureAIClient.ts @@ -2,17 +2,17 @@ // Licensed under the MIT License. import { - getAgentsOperations, - AgentsOperations, -} from "./classic/agents/index.js"; + getEvaluationsOperations, + EvaluationsOperations, +} from "./classic/evaluations/index.js"; import { getConnectionsOperations, ConnectionsOperations, } from "./classic/connections/index.js"; import { - getEvaluationsOperations, - EvaluationsOperations, -} from "./classic/evaluations/index.js"; + getAgentsOperations, + AgentsOperations, +} from "./classic/agents/index.js"; import { createAzureAI, AzureAIContext, @@ -49,15 +49,15 @@ export class AzureAIClient { { ...options, userAgentOptions: { userAgentPrefix } }, ); this.pipeline = this._client.pipeline; - this.agents = getAgentsOperations(this._client); - this.connections = getConnectionsOperations(this._client); this.evaluations = getEvaluationsOperations(this._client); + this.connections = getConnectionsOperations(this._client); + this.agents = getAgentsOperations(this._client); } - /** The operation groups for Agents */ - public readonly agents: AgentsOperations; - /** The operation groups for Connections */ - public readonly connections: ConnectionsOperations; - /** The operation groups for Evaluations */ + /** The operation groups for evaluations */ public readonly evaluations: EvaluationsOperations; + /** The operation groups for connections */ + public readonly connections: ConnectionsOperations; + /** The operation groups for agents */ + public readonly agents: AgentsOperations; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts index 5608ec07ef..0cc3827383 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts @@ -3,46 +3,46 @@ import { AzureAIContext } from "../../api/azureAIContext.js"; import { - createAgent, - listAgents, - getAgent, - updateAgent, - deleteAgent, - createThread, - getThread, - updateThread, - deleteThread, - createMessage, - listMessages, - getMessage, - updateMessage, - createRun, - listRuns, - getRun, - updateRun, - submitToolOutputsToRun, - cancelRun, - createThreadAndRun, - getRunStep, - listRunSteps, - listFiles, - uploadFile, - deleteFile, - getFile, - getFileContent, - listVectorStores, - createVectorStore, - getVectorStore, - modifyVectorStore, - deleteVectorStore, - listVectorStoreFiles, - createVectorStoreFile, - getVectorStoreFile, - deleteVectorStoreFile, - createVectorStoreFileBatch, - getVectorStoreFileBatch, - cancelVectorStoreFileBatch, listVectorStoreFileBatchFiles, + cancelVectorStoreFileBatch, + getVectorStoreFileBatch, + createVectorStoreFileBatch, + deleteVectorStoreFile, + getVectorStoreFile, + createVectorStoreFile, + listVectorStoreFiles, + deleteVectorStore, + modifyVectorStore, + getVectorStore, + createVectorStore, + listVectorStores, + getFileContent, + getFile, + deleteFile, + uploadFile, + listFiles, + listRunSteps, + getRunStep, + createThreadAndRun, + cancelRun, + submitToolOutputsToRun, + updateRun, + getRun, + listRuns, + createRun, + updateMessage, + getMessage, + listMessages, + createMessage, + deleteThread, + updateThread, + getThread, + createThread, + deleteAgent, + updateAgent, + getAgent, + listAgents, + createAgent, } from "../../api/agents/index.js"; import { Agent, @@ -72,433 +72,433 @@ import { VectorStoreFileBatch, } from "../../models/models.js"; import { - AgentsCreateAgentOptionalParams, - AgentsListAgentsOptionalParams, - AgentsGetAgentOptionalParams, - AgentsUpdateAgentOptionalParams, - AgentsDeleteAgentOptionalParams, - AgentsCreateThreadOptionalParams, - AgentsGetThreadOptionalParams, - AgentsUpdateThreadOptionalParams, - AgentsDeleteThreadOptionalParams, - AgentsCreateMessageOptionalParams, - AgentsListMessagesOptionalParams, - AgentsGetMessageOptionalParams, - AgentsUpdateMessageOptionalParams, - AgentsCreateRunOptionalParams, - AgentsListRunsOptionalParams, - AgentsGetRunOptionalParams, - AgentsUpdateRunOptionalParams, - AgentsSubmitToolOutputsToRunOptionalParams, - AgentsCancelRunOptionalParams, - AgentsCreateThreadAndRunOptionalParams, - AgentsGetRunStepOptionalParams, - AgentsListRunStepsOptionalParams, - AgentsListFilesOptionalParams, - AgentsUploadFileOptionalParams, - AgentsDeleteFileOptionalParams, - AgentsGetFileOptionalParams, - AgentsGetFileContentOptionalParams, - AgentsListVectorStoresOptionalParams, - AgentsCreateVectorStoreOptionalParams, - AgentsGetVectorStoreOptionalParams, - AgentsModifyVectorStoreOptionalParams, - AgentsDeleteVectorStoreOptionalParams, - AgentsListVectorStoreFilesOptionalParams, - AgentsCreateVectorStoreFileOptionalParams, - AgentsGetVectorStoreFileOptionalParams, - AgentsDeleteVectorStoreFileOptionalParams, - AgentsCreateVectorStoreFileBatchOptionalParams, - AgentsGetVectorStoreFileBatchOptionalParams, - AgentsCancelVectorStoreFileBatchOptionalParams, AgentsListVectorStoreFileBatchFilesOptionalParams, + AgentsCancelVectorStoreFileBatchOptionalParams, + AgentsGetVectorStoreFileBatchOptionalParams, + AgentsCreateVectorStoreFileBatchOptionalParams, + AgentsDeleteVectorStoreFileOptionalParams, + AgentsGetVectorStoreFileOptionalParams, + AgentsCreateVectorStoreFileOptionalParams, + AgentsListVectorStoreFilesOptionalParams, + AgentsDeleteVectorStoreOptionalParams, + AgentsModifyVectorStoreOptionalParams, + AgentsGetVectorStoreOptionalParams, + AgentsCreateVectorStoreOptionalParams, + AgentsListVectorStoresOptionalParams, + AgentsGetFileContentOptionalParams, + AgentsGetFileOptionalParams, + AgentsDeleteFileOptionalParams, + AgentsUploadFileOptionalParams, + AgentsListFilesOptionalParams, + AgentsListRunStepsOptionalParams, + AgentsGetRunStepOptionalParams, + AgentsCreateThreadAndRunOptionalParams, + AgentsCancelRunOptionalParams, + AgentsSubmitToolOutputsToRunOptionalParams, + AgentsUpdateRunOptionalParams, + AgentsGetRunOptionalParams, + AgentsListRunsOptionalParams, + AgentsCreateRunOptionalParams, + AgentsUpdateMessageOptionalParams, + AgentsGetMessageOptionalParams, + AgentsListMessagesOptionalParams, + AgentsCreateMessageOptionalParams, + AgentsDeleteThreadOptionalParams, + AgentsUpdateThreadOptionalParams, + AgentsGetThreadOptionalParams, + AgentsCreateThreadOptionalParams, + AgentsDeleteAgentOptionalParams, + AgentsUpdateAgentOptionalParams, + AgentsGetAgentOptionalParams, + AgentsListAgentsOptionalParams, + AgentsCreateAgentOptionalParams, } from "../../api/options.js"; /** Interface representing a Agents operations. */ export interface AgentsOperations { - /** Creates a new agent. */ - createAgent: ( - model: string, - options?: AgentsCreateAgentOptionalParams, - ) => Promise; - /** Gets a list of agents that were previously created. */ - listAgents: ( - options?: AgentsListAgentsOptionalParams, - ) => Promise; - /** Retrieves an existing agent. */ - getAgent: ( - assistantId: string, - options?: AgentsGetAgentOptionalParams, - ) => Promise; - /** Modifies an existing agent. */ - updateAgent: ( - assistantId: string, - options?: AgentsUpdateAgentOptionalParams, - ) => Promise; - /** Deletes an agent. */ - deleteAgent: ( - assistantId: string, - options?: AgentsDeleteAgentOptionalParams, - ) => Promise; - /** Creates a new thread. Threads contain messages and can be run by agents. */ - createThread: ( - options?: AgentsCreateThreadOptionalParams, - ) => Promise; - /** Gets information about an existing thread. */ - getThread: ( - threadId: string, - options?: AgentsGetThreadOptionalParams, - ) => Promise; - /** Modifies an existing thread. */ - updateThread: ( - threadId: string, - options?: AgentsUpdateThreadOptionalParams, - ) => Promise; - /** Deletes an existing thread. */ - deleteThread: ( - threadId: string, - options?: AgentsDeleteThreadOptionalParams, - ) => Promise; - /** Creates a new message on a specified thread. */ - createMessage: ( - threadId: string, - role: MessageRole, - content: string, - options?: AgentsCreateMessageOptionalParams, - ) => Promise; - /** Gets a list of messages that exist on a thread. */ - listMessages: ( - threadId: string, - options?: AgentsListMessagesOptionalParams, - ) => Promise; - /** Gets an existing message from an existing thread. */ - getMessage: ( - threadId: string, - messageId: string, - options?: AgentsGetMessageOptionalParams, - ) => Promise; - /** Modifies an existing message on an existing thread. */ - updateMessage: ( - threadId: string, - messageId: string, - options?: AgentsUpdateMessageOptionalParams, - ) => Promise; - /** Creates a new run for an agent thread. */ - createRun: ( - threadId: string, - assistantId: string, - options?: AgentsCreateRunOptionalParams, - ) => Promise; - /** Gets a list of runs for a specified thread. */ - listRuns: ( - threadId: string, - options?: AgentsListRunsOptionalParams, - ) => Promise; - /** Gets an existing run from an existing thread. */ - getRun: ( - threadId: string, - runId: string, - options?: AgentsGetRunOptionalParams, - ) => Promise; - /** Modifies an existing thread run. */ - updateRun: ( - threadId: string, - runId: string, - options?: AgentsUpdateRunOptionalParams, - ) => Promise; - /** Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. */ - submitToolOutputsToRun: ( - threadId: string, - runId: string, - toolOutputs: ToolOutput[], - options?: AgentsSubmitToolOutputsToRunOptionalParams, - ) => Promise; - /** Cancels a run of an in progress thread. */ - cancelRun: ( - threadId: string, - runId: string, - options?: AgentsCancelRunOptionalParams, - ) => Promise; - /** Creates a new agent thread and immediately starts a run using that new thread. */ - createThreadAndRun: ( - assistantId: string, - options?: AgentsCreateThreadAndRunOptionalParams, - ) => Promise; - /** Gets a single run step from a thread run. */ - getRunStep: ( - threadId: string, - runId: string, - stepId: string, - options?: AgentsGetRunStepOptionalParams, - ) => Promise; - /** Gets a list of run steps from a thread run. */ - listRunSteps: ( - threadId: string, - runId: string, - options?: AgentsListRunStepsOptionalParams, - ) => Promise; - /** Gets a list of previously uploaded files. */ - listFiles: ( - options?: AgentsListFilesOptionalParams, - ) => Promise; - /** Uploads a file for use by other operations. */ - uploadFile: ( - file: Uint8Array, - purpose: FilePurpose, - options?: AgentsUploadFileOptionalParams, - ) => Promise; - /** Delete a previously uploaded file. */ - deleteFile: ( - fileId: string, - options?: AgentsDeleteFileOptionalParams, - ) => Promise; - /** Returns information about a specific file. Does not retrieve file content. */ - getFile: ( - fileId: string, - options?: AgentsGetFileOptionalParams, - ) => Promise; - /** Returns information about a specific file. Does not retrieve file content. */ - getFileContent: ( - fileId: string, - options?: AgentsGetFileContentOptionalParams, - ) => Promise; - /** Returns a list of vector stores. */ - listVectorStores: ( - options?: AgentsListVectorStoresOptionalParams, - ) => Promise; - /** Creates a vector store. */ - createVectorStore: ( - options?: AgentsCreateVectorStoreOptionalParams, - ) => Promise; - /** Returns the vector store object matching the specified ID. */ - getVectorStore: ( + /** Returns a list of vector store files in a batch. */ + listVectorStoreFileBatchFiles: ( vectorStoreId: string, - options?: AgentsGetVectorStoreOptionalParams, - ) => Promise; - /** The ID of the vector store to modify. */ - modifyVectorStore: ( + batchId: string, + options?: AgentsListVectorStoreFileBatchFilesOptionalParams, + ) => Promise; + /** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */ + cancelVectorStoreFileBatch: ( vectorStoreId: string, - options?: AgentsModifyVectorStoreOptionalParams, - ) => Promise; - /** Deletes the vector store object matching the specified ID. */ - deleteVectorStore: ( + batchId: string, + options?: AgentsCancelVectorStoreFileBatchOptionalParams, + ) => Promise; + /** Retrieve a vector store file batch. */ + getVectorStoreFileBatch: ( vectorStoreId: string, - options?: AgentsDeleteVectorStoreOptionalParams, - ) => Promise; - /** Returns a list of vector store files. */ - listVectorStoreFiles: ( + batchId: string, + options?: AgentsGetVectorStoreFileBatchOptionalParams, + ) => Promise; + /** Create a vector store file batch. */ + createVectorStoreFileBatch: ( vectorStoreId: string, - options?: AgentsListVectorStoreFilesOptionalParams, - ) => Promise; - /** Create a vector store file by attaching a file to a vector store. */ - createVectorStoreFile: ( + fileIds: string[], + options?: AgentsCreateVectorStoreFileBatchOptionalParams, + ) => Promise; + /** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + * To delete the file, use the delete file endpoint. + */ + deleteVectorStoreFile: ( vectorStoreId: string, fileId: string, - options?: AgentsCreateVectorStoreFileOptionalParams, - ) => Promise; + options?: AgentsDeleteVectorStoreFileOptionalParams, + ) => Promise; /** Retrieves a vector store file. */ getVectorStoreFile: ( vectorStoreId: string, fileId: string, options?: AgentsGetVectorStoreFileOptionalParams, ) => Promise; - /** - * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. - * To delete the file, use the delete file endpoint. - */ - deleteVectorStoreFile: ( + /** Create a vector store file by attaching a file to a vector store. */ + createVectorStoreFile: ( vectorStoreId: string, fileId: string, - options?: AgentsDeleteVectorStoreFileOptionalParams, - ) => Promise; - /** Create a vector store file batch. */ - createVectorStoreFileBatch: ( + options?: AgentsCreateVectorStoreFileOptionalParams, + ) => Promise; + /** Returns a list of vector store files. */ + listVectorStoreFiles: ( vectorStoreId: string, - fileIds: string[], - options?: AgentsCreateVectorStoreFileBatchOptionalParams, - ) => Promise; - /** Retrieve a vector store file batch. */ - getVectorStoreFileBatch: ( + options?: AgentsListVectorStoreFilesOptionalParams, + ) => Promise; + /** Deletes the vector store object matching the specified ID. */ + deleteVectorStore: ( vectorStoreId: string, - batchId: string, - options?: AgentsGetVectorStoreFileBatchOptionalParams, - ) => Promise; - /** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */ - cancelVectorStoreFileBatch: ( + options?: AgentsDeleteVectorStoreOptionalParams, + ) => Promise; + /** The ID of the vector store to modify. */ + modifyVectorStore: ( vectorStoreId: string, - batchId: string, - options?: AgentsCancelVectorStoreFileBatchOptionalParams, - ) => Promise; - /** Returns a list of vector store files in a batch. */ - listVectorStoreFileBatchFiles: ( + options?: AgentsModifyVectorStoreOptionalParams, + ) => Promise; + /** Returns the vector store object matching the specified ID. */ + getVectorStore: ( vectorStoreId: string, - batchId: string, - options?: AgentsListVectorStoreFileBatchFilesOptionalParams, - ) => Promise; -} - -export function getAgents(context: AzureAIContext) { - return { - createAgent: (model: string, options?: AgentsCreateAgentOptionalParams) => - createAgent(context, model, options), - listAgents: (options?: AgentsListAgentsOptionalParams) => - listAgents(context, options), - getAgent: (assistantId: string, options?: AgentsGetAgentOptionalParams) => - getAgent(context, assistantId, options), - updateAgent: ( - assistantId: string, - options?: AgentsUpdateAgentOptionalParams, - ) => updateAgent(context, assistantId, options), - deleteAgent: ( - assistantId: string, - options?: AgentsDeleteAgentOptionalParams, - ) => deleteAgent(context, assistantId, options), - createThread: (options?: AgentsCreateThreadOptionalParams) => - createThread(context, options), - getThread: (threadId: string, options?: AgentsGetThreadOptionalParams) => - getThread(context, threadId, options), - updateThread: ( - threadId: string, - options?: AgentsUpdateThreadOptionalParams, - ) => updateThread(context, threadId, options), - deleteThread: ( - threadId: string, - options?: AgentsDeleteThreadOptionalParams, - ) => deleteThread(context, threadId, options), - createMessage: ( - threadId: string, - role: MessageRole, - content: string, - options?: AgentsCreateMessageOptionalParams, - ) => createMessage(context, threadId, role, content, options), - listMessages: ( - threadId: string, - options?: AgentsListMessagesOptionalParams, - ) => listMessages(context, threadId, options), - getMessage: ( - threadId: string, - messageId: string, - options?: AgentsGetMessageOptionalParams, - ) => getMessage(context, threadId, messageId, options), - updateMessage: ( - threadId: string, - messageId: string, - options?: AgentsUpdateMessageOptionalParams, - ) => updateMessage(context, threadId, messageId, options), - createRun: ( - threadId: string, - assistantId: string, - options?: AgentsCreateRunOptionalParams, - ) => createRun(context, threadId, assistantId, options), - listRuns: (threadId: string, options?: AgentsListRunsOptionalParams) => - listRuns(context, threadId, options), - getRun: ( - threadId: string, - runId: string, - options?: AgentsGetRunOptionalParams, - ) => getRun(context, threadId, runId, options), - updateRun: ( - threadId: string, - runId: string, - options?: AgentsUpdateRunOptionalParams, - ) => updateRun(context, threadId, runId, options), - submitToolOutputsToRun: ( - threadId: string, - runId: string, - toolOutputs: ToolOutput[], - options?: AgentsSubmitToolOutputsToRunOptionalParams, - ) => submitToolOutputsToRun(context, threadId, runId, toolOutputs, options), - cancelRun: ( - threadId: string, - runId: string, - options?: AgentsCancelRunOptionalParams, - ) => cancelRun(context, threadId, runId, options), - createThreadAndRun: ( - assistantId: string, - options?: AgentsCreateThreadAndRunOptionalParams, - ) => createThreadAndRun(context, assistantId, options), - getRunStep: ( - threadId: string, - runId: string, - stepId: string, - options?: AgentsGetRunStepOptionalParams, - ) => getRunStep(context, threadId, runId, stepId, options), - listRunSteps: ( - threadId: string, - runId: string, - options?: AgentsListRunStepsOptionalParams, - ) => listRunSteps(context, threadId, runId, options), - listFiles: (options?: AgentsListFilesOptionalParams) => - listFiles(context, options), - uploadFile: ( - file: Uint8Array, - purpose: FilePurpose, - options?: AgentsUploadFileOptionalParams, - ) => uploadFile(context, file, purpose, options), - deleteFile: (fileId: string, options?: AgentsDeleteFileOptionalParams) => - deleteFile(context, fileId, options), - getFile: (fileId: string, options?: AgentsGetFileOptionalParams) => - getFile(context, fileId, options), - getFileContent: ( - fileId: string, - options?: AgentsGetFileContentOptionalParams, - ) => getFileContent(context, fileId, options), - listVectorStores: (options?: AgentsListVectorStoresOptionalParams) => - listVectorStores(context, options), - createVectorStore: (options?: AgentsCreateVectorStoreOptionalParams) => - createVectorStore(context, options), - getVectorStore: ( + options?: AgentsGetVectorStoreOptionalParams, + ) => Promise; + /** Creates a vector store. */ + createVectorStore: ( + options?: AgentsCreateVectorStoreOptionalParams, + ) => Promise; + /** Returns a list of vector stores. */ + listVectorStores: ( + options?: AgentsListVectorStoresOptionalParams, + ) => Promise; + /** Returns information about a specific file. Does not retrieve file content. */ + getFileContent: ( + fileId: string, + options?: AgentsGetFileContentOptionalParams, + ) => Promise; + /** Returns information about a specific file. Does not retrieve file content. */ + getFile: ( + fileId: string, + options?: AgentsGetFileOptionalParams, + ) => Promise; + /** Delete a previously uploaded file. */ + deleteFile: ( + fileId: string, + options?: AgentsDeleteFileOptionalParams, + ) => Promise; + /** Uploads a file for use by other operations. */ + uploadFile: ( + file: Uint8Array, + purpose: FilePurpose, + options?: AgentsUploadFileOptionalParams, + ) => Promise; + /** Gets a list of previously uploaded files. */ + listFiles: ( + options?: AgentsListFilesOptionalParams, + ) => Promise; + /** Gets a list of run steps from a thread run. */ + listRunSteps: ( + threadId: string, + runId: string, + options?: AgentsListRunStepsOptionalParams, + ) => Promise; + /** Gets a single run step from a thread run. */ + getRunStep: ( + threadId: string, + runId: string, + stepId: string, + options?: AgentsGetRunStepOptionalParams, + ) => Promise; + /** Creates a new agent thread and immediately starts a run using that new thread. */ + createThreadAndRun: ( + assistantId: string, + options?: AgentsCreateThreadAndRunOptionalParams, + ) => Promise; + /** Cancels a run of an in progress thread. */ + cancelRun: ( + threadId: string, + runId: string, + options?: AgentsCancelRunOptionalParams, + ) => Promise; + /** Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. */ + submitToolOutputsToRun: ( + threadId: string, + runId: string, + toolOutputs: ToolOutput[], + options?: AgentsSubmitToolOutputsToRunOptionalParams, + ) => Promise; + /** Modifies an existing thread run. */ + updateRun: ( + threadId: string, + runId: string, + options?: AgentsUpdateRunOptionalParams, + ) => Promise; + /** Gets an existing run from an existing thread. */ + getRun: ( + threadId: string, + runId: string, + options?: AgentsGetRunOptionalParams, + ) => Promise; + /** Gets a list of runs for a specified thread. */ + listRuns: ( + threadId: string, + options?: AgentsListRunsOptionalParams, + ) => Promise; + /** Creates a new run for an agent thread. */ + createRun: ( + threadId: string, + assistantId: string, + options?: AgentsCreateRunOptionalParams, + ) => Promise; + /** Modifies an existing message on an existing thread. */ + updateMessage: ( + threadId: string, + messageId: string, + options?: AgentsUpdateMessageOptionalParams, + ) => Promise; + /** Gets an existing message from an existing thread. */ + getMessage: ( + threadId: string, + messageId: string, + options?: AgentsGetMessageOptionalParams, + ) => Promise; + /** Gets a list of messages that exist on a thread. */ + listMessages: ( + threadId: string, + options?: AgentsListMessagesOptionalParams, + ) => Promise; + /** Creates a new message on a specified thread. */ + createMessage: ( + threadId: string, + role: MessageRole, + content: string, + options?: AgentsCreateMessageOptionalParams, + ) => Promise; + /** Deletes an existing thread. */ + deleteThread: ( + threadId: string, + options?: AgentsDeleteThreadOptionalParams, + ) => Promise; + /** Modifies an existing thread. */ + updateThread: ( + threadId: string, + options?: AgentsUpdateThreadOptionalParams, + ) => Promise; + /** Gets information about an existing thread. */ + getThread: ( + threadId: string, + options?: AgentsGetThreadOptionalParams, + ) => Promise; + /** Creates a new thread. Threads contain messages and can be run by agents. */ + createThread: ( + options?: AgentsCreateThreadOptionalParams, + ) => Promise; + /** Deletes an agent. */ + deleteAgent: ( + assistantId: string, + options?: AgentsDeleteAgentOptionalParams, + ) => Promise; + /** Modifies an existing agent. */ + updateAgent: ( + assistantId: string, + options?: AgentsUpdateAgentOptionalParams, + ) => Promise; + /** Retrieves an existing agent. */ + getAgent: ( + assistantId: string, + options?: AgentsGetAgentOptionalParams, + ) => Promise; + /** Gets a list of agents that were previously created. */ + listAgents: ( + options?: AgentsListAgentsOptionalParams, + ) => Promise; + /** Creates a new agent. */ + createAgent: ( + model: string, + options?: AgentsCreateAgentOptionalParams, + ) => Promise; +} + +export function getAgents(context: AzureAIContext) { + return { + listVectorStoreFileBatchFiles: ( vectorStoreId: string, - options?: AgentsGetVectorStoreOptionalParams, - ) => getVectorStore(context, vectorStoreId, options), - modifyVectorStore: ( + batchId: string, + options?: AgentsListVectorStoreFileBatchFilesOptionalParams, + ) => + listVectorStoreFileBatchFiles(context, vectorStoreId, batchId, options), + cancelVectorStoreFileBatch: ( vectorStoreId: string, - options?: AgentsModifyVectorStoreOptionalParams, - ) => modifyVectorStore(context, vectorStoreId, options), - deleteVectorStore: ( + batchId: string, + options?: AgentsCancelVectorStoreFileBatchOptionalParams, + ) => cancelVectorStoreFileBatch(context, vectorStoreId, batchId, options), + getVectorStoreFileBatch: ( vectorStoreId: string, - options?: AgentsDeleteVectorStoreOptionalParams, - ) => deleteVectorStore(context, vectorStoreId, options), - listVectorStoreFiles: ( + batchId: string, + options?: AgentsGetVectorStoreFileBatchOptionalParams, + ) => getVectorStoreFileBatch(context, vectorStoreId, batchId, options), + createVectorStoreFileBatch: ( vectorStoreId: string, - options?: AgentsListVectorStoreFilesOptionalParams, - ) => listVectorStoreFiles(context, vectorStoreId, options), - createVectorStoreFile: ( + fileIds: string[], + options?: AgentsCreateVectorStoreFileBatchOptionalParams, + ) => createVectorStoreFileBatch(context, vectorStoreId, fileIds, options), + deleteVectorStoreFile: ( vectorStoreId: string, fileId: string, - options?: AgentsCreateVectorStoreFileOptionalParams, - ) => createVectorStoreFile(context, vectorStoreId, fileId, options), + options?: AgentsDeleteVectorStoreFileOptionalParams, + ) => deleteVectorStoreFile(context, vectorStoreId, fileId, options), getVectorStoreFile: ( vectorStoreId: string, fileId: string, options?: AgentsGetVectorStoreFileOptionalParams, ) => getVectorStoreFile(context, vectorStoreId, fileId, options), - deleteVectorStoreFile: ( + createVectorStoreFile: ( vectorStoreId: string, fileId: string, - options?: AgentsDeleteVectorStoreFileOptionalParams, - ) => deleteVectorStoreFile(context, vectorStoreId, fileId, options), - createVectorStoreFileBatch: ( + options?: AgentsCreateVectorStoreFileOptionalParams, + ) => createVectorStoreFile(context, vectorStoreId, fileId, options), + listVectorStoreFiles: ( vectorStoreId: string, - fileIds: string[], - options?: AgentsCreateVectorStoreFileBatchOptionalParams, - ) => createVectorStoreFileBatch(context, vectorStoreId, fileIds, options), - getVectorStoreFileBatch: ( + options?: AgentsListVectorStoreFilesOptionalParams, + ) => listVectorStoreFiles(context, vectorStoreId, options), + deleteVectorStore: ( vectorStoreId: string, - batchId: string, - options?: AgentsGetVectorStoreFileBatchOptionalParams, - ) => getVectorStoreFileBatch(context, vectorStoreId, batchId, options), - cancelVectorStoreFileBatch: ( + options?: AgentsDeleteVectorStoreOptionalParams, + ) => deleteVectorStore(context, vectorStoreId, options), + modifyVectorStore: ( vectorStoreId: string, - batchId: string, - options?: AgentsCancelVectorStoreFileBatchOptionalParams, - ) => cancelVectorStoreFileBatch(context, vectorStoreId, batchId, options), - listVectorStoreFileBatchFiles: ( + options?: AgentsModifyVectorStoreOptionalParams, + ) => modifyVectorStore(context, vectorStoreId, options), + getVectorStore: ( vectorStoreId: string, - batchId: string, - options?: AgentsListVectorStoreFileBatchFilesOptionalParams, - ) => - listVectorStoreFileBatchFiles(context, vectorStoreId, batchId, options), + options?: AgentsGetVectorStoreOptionalParams, + ) => getVectorStore(context, vectorStoreId, options), + createVectorStore: (options?: AgentsCreateVectorStoreOptionalParams) => + createVectorStore(context, options), + listVectorStores: (options?: AgentsListVectorStoresOptionalParams) => + listVectorStores(context, options), + getFileContent: ( + fileId: string, + options?: AgentsGetFileContentOptionalParams, + ) => getFileContent(context, fileId, options), + getFile: (fileId: string, options?: AgentsGetFileOptionalParams) => + getFile(context, fileId, options), + deleteFile: (fileId: string, options?: AgentsDeleteFileOptionalParams) => + deleteFile(context, fileId, options), + uploadFile: ( + file: Uint8Array, + purpose: FilePurpose, + options?: AgentsUploadFileOptionalParams, + ) => uploadFile(context, file, purpose, options), + listFiles: (options?: AgentsListFilesOptionalParams) => + listFiles(context, options), + listRunSteps: ( + threadId: string, + runId: string, + options?: AgentsListRunStepsOptionalParams, + ) => listRunSteps(context, threadId, runId, options), + getRunStep: ( + threadId: string, + runId: string, + stepId: string, + options?: AgentsGetRunStepOptionalParams, + ) => getRunStep(context, threadId, runId, stepId, options), + createThreadAndRun: ( + assistantId: string, + options?: AgentsCreateThreadAndRunOptionalParams, + ) => createThreadAndRun(context, assistantId, options), + cancelRun: ( + threadId: string, + runId: string, + options?: AgentsCancelRunOptionalParams, + ) => cancelRun(context, threadId, runId, options), + submitToolOutputsToRun: ( + threadId: string, + runId: string, + toolOutputs: ToolOutput[], + options?: AgentsSubmitToolOutputsToRunOptionalParams, + ) => submitToolOutputsToRun(context, threadId, runId, toolOutputs, options), + updateRun: ( + threadId: string, + runId: string, + options?: AgentsUpdateRunOptionalParams, + ) => updateRun(context, threadId, runId, options), + getRun: ( + threadId: string, + runId: string, + options?: AgentsGetRunOptionalParams, + ) => getRun(context, threadId, runId, options), + listRuns: (threadId: string, options?: AgentsListRunsOptionalParams) => + listRuns(context, threadId, options), + createRun: ( + threadId: string, + assistantId: string, + options?: AgentsCreateRunOptionalParams, + ) => createRun(context, threadId, assistantId, options), + updateMessage: ( + threadId: string, + messageId: string, + options?: AgentsUpdateMessageOptionalParams, + ) => updateMessage(context, threadId, messageId, options), + getMessage: ( + threadId: string, + messageId: string, + options?: AgentsGetMessageOptionalParams, + ) => getMessage(context, threadId, messageId, options), + listMessages: ( + threadId: string, + options?: AgentsListMessagesOptionalParams, + ) => listMessages(context, threadId, options), + createMessage: ( + threadId: string, + role: MessageRole, + content: string, + options?: AgentsCreateMessageOptionalParams, + ) => createMessage(context, threadId, role, content, options), + deleteThread: ( + threadId: string, + options?: AgentsDeleteThreadOptionalParams, + ) => deleteThread(context, threadId, options), + updateThread: ( + threadId: string, + options?: AgentsUpdateThreadOptionalParams, + ) => updateThread(context, threadId, options), + getThread: (threadId: string, options?: AgentsGetThreadOptionalParams) => + getThread(context, threadId, options), + createThread: (options?: AgentsCreateThreadOptionalParams) => + createThread(context, options), + deleteAgent: ( + assistantId: string, + options?: AgentsDeleteAgentOptionalParams, + ) => deleteAgent(context, assistantId, options), + updateAgent: ( + assistantId: string, + options?: AgentsUpdateAgentOptionalParams, + ) => updateAgent(context, assistantId, options), + getAgent: (assistantId: string, options?: AgentsGetAgentOptionalParams) => + getAgent(context, assistantId, options), + listAgents: (options?: AgentsListAgentsOptionalParams) => + listAgents(context, options), + createAgent: (model: string, options?: AgentsCreateAgentOptionalParams) => + createAgent(context, model, options), }; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts index fd33f216f9..75ceca3621 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts @@ -2,11 +2,11 @@ // Licensed under the MIT License. import { AzureAIContext } from "../../api/azureAIContext.js"; -import { list, get, listSecrets } from "../../api/connections/index.js"; +import { listSecrets, get, list } from "../../api/connections/index.js"; import { - ConnectionsListOptionalParams, - ConnectionsGetOptionalParams, ConnectionsListSecretsOptionalParams, + ConnectionsGetOptionalParams, + ConnectionsListOptionalParams, } from "../../api/options.js"; import { ConnectionsListResponse, @@ -15,33 +15,33 @@ import { /** Interface representing a Connections operations. */ export interface ConnectionsOperations { - /** List the details of all the connections (not including their credentials) */ - list: ( - options?: ConnectionsListOptionalParams, - ) => Promise; - /** Get the details of a single connection, without credentials. */ - get: ( - connectionName: string, - options?: ConnectionsGetOptionalParams, - ) => Promise; /** Get the details of a single connection, including credentials (if available). */ listSecrets: ( connectionName: string, ignored: string, options?: ConnectionsListSecretsOptionalParams, ) => Promise; + /** Get the details of a single connection, without credentials. */ + get: ( + connectionName: string, + options?: ConnectionsGetOptionalParams, + ) => Promise; + /** List the details of all the connections (not including their credentials) */ + list: ( + options?: ConnectionsListOptionalParams, + ) => Promise; } export function getConnections(context: AzureAIContext) { return { - list: (options?: ConnectionsListOptionalParams) => list(context, options), - get: (connectionName: string, options?: ConnectionsGetOptionalParams) => - get(context, connectionName, options), listSecrets: ( connectionName: string, ignored: string, options?: ConnectionsListSecretsOptionalParams, ) => listSecrets(context, connectionName, ignored, options), + get: (connectionName: string, options?: ConnectionsGetOptionalParams) => + get(context, connectionName, options), + list: (options?: ConnectionsListOptionalParams) => list(context, options), }; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts index 5022e9e570..def0c46ecd 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts @@ -3,99 +3,99 @@ import { AzureAIContext } from "../../api/azureAIContext.js"; import { - get, - create, - list, - update, - getSchedule, - createOrReplaceSchedule, - listSchedule, deleteSchedule, + listSchedule, + createOrReplaceSchedule, + getSchedule, + update, + list, + create, + get, } from "../../api/evaluations/index.js"; import { - EvaluationsGetOptionalParams, - EvaluationsCreateOptionalParams, - EvaluationsListOptionalParams, - EvaluationsUpdateOptionalParams, - EvaluationsGetScheduleOptionalParams, - EvaluationsCreateOrReplaceScheduleOptionalParams, - EvaluationsListScheduleOptionalParams, EvaluationsDeleteScheduleOptionalParams, + EvaluationsListScheduleOptionalParams, + EvaluationsCreateOrReplaceScheduleOptionalParams, + EvaluationsGetScheduleOptionalParams, + EvaluationsUpdateOptionalParams, + EvaluationsListOptionalParams, + EvaluationsCreateOptionalParams, + EvaluationsGetOptionalParams, } from "../../api/options.js"; import { Evaluation, EvaluationSchedule } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; /** Interface representing a Evaluations operations. */ export interface EvaluationsOperations { - /** Resource read operation template. */ - get: ( + /** Resource delete operation template. */ + deleteSchedule: ( id: string, - options?: EvaluationsGetOptionalParams, - ) => Promise; - /** Run the evaluation. */ - create: ( - evaluation: Evaluation, - options?: EvaluationsCreateOptionalParams, - ) => Promise; + options?: EvaluationsDeleteScheduleOptionalParams, + ) => Promise; /** Resource list operation template. */ - list: ( - options?: EvaluationsListOptionalParams, - ) => PagedAsyncIterableIterator; - /** Resource update operation template. */ - update: ( + listSchedule: ( + options?: EvaluationsListScheduleOptionalParams, + ) => PagedAsyncIterableIterator; + /** Create or replace operation template. */ + createOrReplaceSchedule: ( id: string, - resource: Evaluation, - options?: EvaluationsUpdateOptionalParams, - ) => Promise; + resource: EvaluationSchedule, + options?: EvaluationsCreateOrReplaceScheduleOptionalParams, + ) => Promise; /** Resource read operation template. */ getSchedule: ( id: string, options?: EvaluationsGetScheduleOptionalParams, ) => Promise; - /** Create or replace operation template. */ - createOrReplaceSchedule: ( + /** Resource update operation template. */ + update: ( id: string, - resource: EvaluationSchedule, - options?: EvaluationsCreateOrReplaceScheduleOptionalParams, - ) => Promise; + resource: Evaluation, + options?: EvaluationsUpdateOptionalParams, + ) => Promise; /** Resource list operation template. */ - listSchedule: ( - options?: EvaluationsListScheduleOptionalParams, - ) => PagedAsyncIterableIterator; - /** Resource delete operation template. */ - deleteSchedule: ( + list: ( + options?: EvaluationsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Run the evaluation. */ + create: ( + evaluation: Evaluation, + options?: EvaluationsCreateOptionalParams, + ) => Promise; + /** Resource read operation template. */ + get: ( id: string, - options?: EvaluationsDeleteScheduleOptionalParams, - ) => Promise; + options?: EvaluationsGetOptionalParams, + ) => Promise; } export function getEvaluations(context: AzureAIContext) { return { - get: (id: string, options?: EvaluationsGetOptionalParams) => - get(context, id, options), - create: ( - evaluation: Evaluation, - options?: EvaluationsCreateOptionalParams, - ) => create(context, evaluation, options), - list: (options?: EvaluationsListOptionalParams) => list(context, options), - update: ( + deleteSchedule: ( id: string, - resource: Evaluation, - options?: EvaluationsUpdateOptionalParams, - ) => update(context, id, resource, options), - getSchedule: (id: string, options?: EvaluationsGetScheduleOptionalParams) => - getSchedule(context, id, options), + options?: EvaluationsDeleteScheduleOptionalParams, + ) => deleteSchedule(context, id, options), + listSchedule: (options?: EvaluationsListScheduleOptionalParams) => + listSchedule(context, options), createOrReplaceSchedule: ( id: string, resource: EvaluationSchedule, options?: EvaluationsCreateOrReplaceScheduleOptionalParams, ) => createOrReplaceSchedule(context, id, resource, options), - listSchedule: (options?: EvaluationsListScheduleOptionalParams) => - listSchedule(context, options), - deleteSchedule: ( + getSchedule: (id: string, options?: EvaluationsGetScheduleOptionalParams) => + getSchedule(context, id, options), + update: ( id: string, - options?: EvaluationsDeleteScheduleOptionalParams, - ) => deleteSchedule(context, id, options), + resource: Evaluation, + options?: EvaluationsUpdateOptionalParams, + ) => update(context, id, resource, options), + list: (options?: EvaluationsListOptionalParams) => list(context, options), + create: ( + evaluation: Evaluation, + options?: EvaluationsCreateOptionalParams, + ) => create(context, evaluation, options), + get: (id: string, options?: EvaluationsGetOptionalParams) => + get(context, id, options), }; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts index 670a629133..7873ee29db 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts @@ -216,57 +216,57 @@ export { } from "./models/index.js"; export { AzureAIClientOptionalParams, - AgentsCreateAgentOptionalParams, - AgentsListAgentsOptionalParams, - AgentsGetAgentOptionalParams, - AgentsUpdateAgentOptionalParams, - AgentsDeleteAgentOptionalParams, - AgentsCreateThreadOptionalParams, - AgentsGetThreadOptionalParams, - AgentsUpdateThreadOptionalParams, - AgentsDeleteThreadOptionalParams, - AgentsCreateMessageOptionalParams, - AgentsListMessagesOptionalParams, - AgentsGetMessageOptionalParams, - AgentsUpdateMessageOptionalParams, - AgentsCreateRunOptionalParams, - AgentsListRunsOptionalParams, - AgentsGetRunOptionalParams, - AgentsUpdateRunOptionalParams, - AgentsSubmitToolOutputsToRunOptionalParams, - AgentsCancelRunOptionalParams, - AgentsCreateThreadAndRunOptionalParams, - AgentsGetRunStepOptionalParams, - AgentsListRunStepsOptionalParams, - AgentsListFilesOptionalParams, - AgentsUploadFileOptionalParams, - AgentsDeleteFileOptionalParams, - AgentsGetFileOptionalParams, - AgentsGetFileContentOptionalParams, - AgentsListVectorStoresOptionalParams, - AgentsCreateVectorStoreOptionalParams, - AgentsGetVectorStoreOptionalParams, - AgentsModifyVectorStoreOptionalParams, - AgentsDeleteVectorStoreOptionalParams, - AgentsListVectorStoreFilesOptionalParams, - AgentsCreateVectorStoreFileOptionalParams, - AgentsGetVectorStoreFileOptionalParams, - AgentsDeleteVectorStoreFileOptionalParams, - AgentsCreateVectorStoreFileBatchOptionalParams, - AgentsGetVectorStoreFileBatchOptionalParams, - AgentsCancelVectorStoreFileBatchOptionalParams, - AgentsListVectorStoreFileBatchFilesOptionalParams, - ConnectionsListOptionalParams, - ConnectionsGetOptionalParams, - ConnectionsListSecretsOptionalParams, - EvaluationsGetOptionalParams, - EvaluationsCreateOptionalParams, - EvaluationsListOptionalParams, - EvaluationsUpdateOptionalParams, - EvaluationsGetScheduleOptionalParams, - EvaluationsCreateOrReplaceScheduleOptionalParams, - EvaluationsListScheduleOptionalParams, EvaluationsDeleteScheduleOptionalParams, + EvaluationsListScheduleOptionalParams, + EvaluationsCreateOrReplaceScheduleOptionalParams, + EvaluationsGetScheduleOptionalParams, + EvaluationsUpdateOptionalParams, + EvaluationsListOptionalParams, + EvaluationsCreateOptionalParams, + EvaluationsGetOptionalParams, + ConnectionsListSecretsOptionalParams, + ConnectionsGetOptionalParams, + ConnectionsListOptionalParams, + AgentsListVectorStoreFileBatchFilesOptionalParams, + AgentsCancelVectorStoreFileBatchOptionalParams, + AgentsGetVectorStoreFileBatchOptionalParams, + AgentsCreateVectorStoreFileBatchOptionalParams, + AgentsDeleteVectorStoreFileOptionalParams, + AgentsGetVectorStoreFileOptionalParams, + AgentsCreateVectorStoreFileOptionalParams, + AgentsListVectorStoreFilesOptionalParams, + AgentsDeleteVectorStoreOptionalParams, + AgentsModifyVectorStoreOptionalParams, + AgentsGetVectorStoreOptionalParams, + AgentsCreateVectorStoreOptionalParams, + AgentsListVectorStoresOptionalParams, + AgentsGetFileContentOptionalParams, + AgentsGetFileOptionalParams, + AgentsDeleteFileOptionalParams, + AgentsUploadFileOptionalParams, + AgentsListFilesOptionalParams, + AgentsListRunStepsOptionalParams, + AgentsGetRunStepOptionalParams, + AgentsCreateThreadAndRunOptionalParams, + AgentsCancelRunOptionalParams, + AgentsSubmitToolOutputsToRunOptionalParams, + AgentsUpdateRunOptionalParams, + AgentsGetRunOptionalParams, + AgentsListRunsOptionalParams, + AgentsCreateRunOptionalParams, + AgentsUpdateMessageOptionalParams, + AgentsGetMessageOptionalParams, + AgentsListMessagesOptionalParams, + AgentsCreateMessageOptionalParams, + AgentsDeleteThreadOptionalParams, + AgentsUpdateThreadOptionalParams, + AgentsGetThreadOptionalParams, + AgentsCreateThreadOptionalParams, + AgentsDeleteAgentOptionalParams, + AgentsUpdateAgentOptionalParams, + AgentsGetAgentOptionalParams, + AgentsListAgentsOptionalParams, + AgentsCreateAgentOptionalParams, } from "./api/index.js"; export { AgentsOperations, diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts index 857ac0c2a1..3e63658359 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts @@ -1395,12 +1395,14 @@ export function agentDeserializer(item: any): Agent { model: item["model"], instructions: item["instructions"], tools: toolDefinitionUnionArrayDeserializer(item["tools"]), - toolResources: item["tool_resources"], + toolResources: !item["tool_resources"] + ? item["tool_resources"] + : toolResourcesDeserializer(item["tool_resources"]), temperature: item["temperature"], topP: item["top_p"], responseFormat: !item["response_format"] ? item["response_format"] - : (item["response_format"] as any), + : agentsApiResponseFormatOptionDeserializer(item["response_format"]), metadata: item["metadata"], }; } @@ -1485,9 +1487,7 @@ export function threadMessageOptionsSerializer( content: item["content"], attachments: !item["attachments"] ? item["attachments"] - : item["attachments"].map((p: any) => { - return messageAttachmentSerializer(p); - }), + : messageAttachmentArraySerializer(item["attachments"]), metadata: item["metadata"], }; } @@ -1614,7 +1614,9 @@ export function agentThreadDeserializer(item: any): AgentThread { id: item["id"], object: item["object"], createdAt: new Date(item["created_at"] * 1000), - toolResources: item["tool_resources"], + toolResources: !item["tool_resources"] + ? item["tool_resources"] + : toolResourcesDeserializer(item["tool_resources"]), metadata: item["metadata"], }; } @@ -1678,7 +1680,9 @@ export function threadMessageSerializer(item: ThreadMessage): any { created_at: (item["createdAt"].getTime() / 1000) | 0, thread_id: item["threadId"], status: item["status"], - incomplete_details: item["incompleteDetails"], + incomplete_details: !item["incompleteDetails"] + ? item["incompleteDetails"] + : messageIncompleteDetailsSerializer(item["incompleteDetails"]), completed_at: !item["completedAt"] ? item["completedAt"] : (item["completedAt"].getTime() / 1000) | 0, @@ -1691,9 +1695,7 @@ export function threadMessageSerializer(item: ThreadMessage): any { run_id: item["runId"], attachments: !item["attachments"] ? item["attachments"] - : item["attachments"].map((p: any) => { - return messageAttachmentSerializer(p); - }), + : messageAttachmentArraySerializer(item["attachments"]), metadata: item["metadata"], }; } @@ -1705,28 +1707,22 @@ export function threadMessageDeserializer(item: any): ThreadMessage { createdAt: new Date(item["created_at"] * 1000), threadId: item["thread_id"], status: item["status"], - incompleteDetails: item["incomplete_details"], + incompleteDetails: !item["incomplete_details"] + ? item["incomplete_details"] + : messageIncompleteDetailsDeserializer(item["incomplete_details"]), completedAt: !item["completed_at"] ? item["completed_at"] - : !item["completed_at"] - ? item["completed_at"] - : new Date(item["completed_at"] * 1000), + : new Date(item["completed_at"] * 1000), incompleteAt: !item["incomplete_at"] ? item["incomplete_at"] - : !item["incomplete_at"] - ? item["incomplete_at"] - : new Date(item["incomplete_at"] * 1000), + : new Date(item["incomplete_at"] * 1000), role: item["role"], content: messageContentUnionArrayDeserializer(item["content"]), assistantId: item["assistant_id"], runId: item["run_id"], attachments: !item["attachments"] ? item["attachments"] - : !item["attachments"] - ? item["attachments"] - : item["attachments"].map((p: any) => { - return messageAttachmentDeserializer(p); - }), + : messageAttachmentArrayDeserializer(item["attachments"]), metadata: item["metadata"], }; } @@ -2345,52 +2341,52 @@ export function threadRunDeserializer(item: any): ThreadRun { threadId: item["thread_id"], assistantId: item["assistant_id"], status: item["status"], - requiredAction: item["required_action"], - lastError: item["last_error"], + requiredAction: !item["required_action"] + ? item["required_action"] + : requiredActionUnionDeserializer(item["required_action"]), + lastError: !item["last_error"] + ? item["last_error"] + : runErrorDeserializer(item["last_error"]), model: item["model"], instructions: item["instructions"], tools: toolDefinitionUnionArrayDeserializer(item["tools"]), createdAt: new Date(item["created_at"] * 1000), expiresAt: !item["expires_at"] ? item["expires_at"] - : !item["expires_at"] - ? item["expires_at"] - : new Date(item["expires_at"] * 1000), + : new Date(item["expires_at"] * 1000), startedAt: !item["started_at"] ? item["started_at"] - : !item["started_at"] - ? item["started_at"] - : new Date(item["started_at"] * 1000), + : new Date(item["started_at"] * 1000), completedAt: !item["completed_at"] ? item["completed_at"] - : !item["completed_at"] - ? item["completed_at"] - : new Date(item["completed_at"] * 1000), + : new Date(item["completed_at"] * 1000), cancelledAt: !item["cancelled_at"] ? item["cancelled_at"] - : !item["cancelled_at"] - ? item["cancelled_at"] - : new Date(item["cancelled_at"] * 1000), + : new Date(item["cancelled_at"] * 1000), failedAt: !item["failed_at"] ? item["failed_at"] - : !item["failed_at"] - ? item["failed_at"] - : new Date(item["failed_at"] * 1000), + : new Date(item["failed_at"] * 1000), incompleteDetails: item["incomplete_details"], - usage: item["usage"], + usage: !item["usage"] + ? item["usage"] + : runCompletionUsageDeserializer(item["usage"]), temperature: item["temperature"], topP: item["top_p"], maxPromptTokens: item["max_prompt_tokens"], maxCompletionTokens: item["max_completion_tokens"], - truncationStrategy: item["truncation_strategy"], + truncationStrategy: !item["truncation_strategy"] + ? item["truncation_strategy"] + : truncationObjectDeserializer(item["truncation_strategy"]), toolChoice: !item["tool_choice"] ? item["tool_choice"] - : (item["tool_choice"] as any), + : agentsApiToolChoiceOptionDeserializer(item["tool_choice"]), responseFormat: !item["response_format"] ? item["response_format"] - : (item["response_format"] as any), + : agentsApiResponseFormatOptionDeserializer(item["response_format"]), metadata: item["metadata"], - toolResources: item["tool_resources"], + toolResources: !item["tool_resources"] + ? item["tool_resources"] + : updateToolResourcesOptionsDeserializer(item["tool_resources"]), parallelToolCalls: item["parallelToolCalls"], }; } @@ -2791,7 +2787,9 @@ export function agentThreadCreationOptionsSerializer( messages: !item["messages"] ? item["messages"] : threadMessageOptionsArraySerializer(item["messages"]), - tool_resources: item["toolResources"], + tool_resources: !item["toolResources"] + ? item["toolResources"] + : toolResourcesSerializer(item["toolResources"]), metadata: item["metadata"], }; } @@ -2842,29 +2840,25 @@ export function runStepDeserializer(item: any): RunStep { runId: item["run_id"], status: item["status"], stepDetails: runStepDetailsUnionDeserializer(item["step_details"]), - lastError: item["last_error"], + lastError: !item["last_error"] + ? item["last_error"] + : runStepErrorDeserializer(item["last_error"]), createdAt: new Date(item["created_at"] * 1000), expiredAt: !item["expired_at"] ? item["expired_at"] - : !item["expired_at"] - ? item["expired_at"] - : new Date(item["expired_at"] * 1000), + : new Date(item["expired_at"] * 1000), completedAt: !item["completed_at"] ? item["completed_at"] - : !item["completed_at"] - ? item["completed_at"] - : new Date(item["completed_at"] * 1000), + : new Date(item["completed_at"] * 1000), cancelledAt: !item["cancelled_at"] ? item["cancelled_at"] - : !item["cancelled_at"] - ? item["cancelled_at"] - : new Date(item["cancelled_at"] * 1000), + : new Date(item["cancelled_at"] * 1000), failedAt: !item["failed_at"] ? item["failed_at"] - : !item["failed_at"] - ? item["failed_at"] - : new Date(item["failed_at"] * 1000), - usage: item["usage"], + : new Date(item["failed_at"] * 1000), + usage: !item["usage"] + ? item["usage"] + : runStepCompletionUsageDeserializer(item["usage"]), metadata: item["metadata"], }; } @@ -3582,14 +3576,10 @@ export function vectorStoreDeserializer(item: any): VectorStore { : vectorStoreExpirationPolicyDeserializer(item["expires_after"]), expiresAt: !item["expires_at"] ? item["expires_at"] - : !item["expires_at"] - ? item["expires_at"] - : new Date(item["expires_at"] * 1000), + : new Date(item["expires_at"] * 1000), lastActiveAt: !item["last_active_at"] ? item["last_active_at"] - : !item["last_active_at"] - ? item["last_active_at"] - : new Date(item["last_active_at"] * 1000), + : new Date(item["last_active_at"] * 1000), metadata: item["metadata"], }; } @@ -3835,7 +3825,9 @@ export function vectorStoreFileDeserializer(item: any): VectorStoreFile { createdAt: new Date(item["created_at"] * 1000), vectorStoreId: item["vector_store_id"], status: item["status"], - lastError: item["last_error"], + lastError: !item["last_error"] + ? item["last_error"] + : vectorStoreFileErrorDeserializer(item["last_error"]), chunkingStrategy: vectorStoreChunkingStrategyResponseUnionDeserializer( item["chunking_strategy"], ), @@ -4773,5 +4765,5 @@ export type VectorStoreFileStatusFilter = /** Azure AI API versions */ export enum KnownVersions { /** Azure AI API version 2024-07-01-preview. */ - "V2024-07-01-Preview" = "2024-07-01-preview", + "2024-07-01-preview" = "2024-07-01-preview", } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json index a8ae41ceeb..93b4b445e6 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json @@ -13,8 +13,8 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/univariate": "./src/api/univariate/index.ts", - "./api/multivariate": "./src/api/multivariate/index.ts" + "./api/multivariate": "./src/api/multivariate/index.ts", + "./api/univariate": "./src/api/univariate/index.ts" }, "dialects": [ "esm", @@ -142,24 +142,6 @@ "default": "./dist/commonjs/api/index.js" } }, - "./api/univariate": { - "browser": { - "types": "./dist/browser/api/univariate/index.d.ts", - "default": "./dist/browser/api/univariate/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/univariate/index.d.ts", - "default": "./dist/react-native/api/univariate/index.js" - }, - "import": { - "types": "./dist/esm/api/univariate/index.d.ts", - "default": "./dist/esm/api/univariate/index.js" - }, - "require": { - "types": "./dist/commonjs/api/univariate/index.d.ts", - "default": "./dist/commonjs/api/univariate/index.js" - } - }, "./api/multivariate": { "browser": { "types": "./dist/browser/api/multivariate/index.d.ts", @@ -177,6 +159,24 @@ "types": "./dist/commonjs/api/multivariate/index.d.ts", "default": "./dist/commonjs/api/multivariate/index.js" } + }, + "./api/univariate": { + "browser": { + "types": "./dist/browser/api/univariate/index.d.ts", + "default": "./dist/browser/api/univariate/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/univariate/index.d.ts", + "default": "./dist/react-native/api/univariate/index.js" + }, + "import": { + "types": "./dist/esm/api/univariate/index.d.ts", + "default": "./dist/esm/api/univariate/index.js" + }, + "require": { + "types": "./dist/commonjs/api/univariate/index.d.ts", + "default": "./dist/commonjs/api/univariate/index.js" + } } }, "main": "./dist/commonjs/index.js", diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index d094c5c10a..a67df11f8a 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -30,7 +30,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { // (undocumented) - V1_1 = "v1.1" + v1_1 = "v1.1" } // @public diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts index 9796b46486..ae8edb2927 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - getUnivariateOperations, - UnivariateOperations, -} from "./classic/univariate/index.js"; import { getMultivariateOperations, MultivariateOperations, } from "./classic/multivariate/index.js"; +import { + getUnivariateOperations, + UnivariateOperations, +} from "./classic/univariate/index.js"; import { createAnomalyDetector, AnomalyDetectorContext, @@ -56,12 +56,12 @@ export class AnomalyDetectorClient { userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; - this.univariate = getUnivariateOperations(this._client); this.multivariate = getMultivariateOperations(this._client); + this.univariate = getUnivariateOperations(this._client); } - /** The operation groups for Univariate */ - public readonly univariate: UnivariateOperations; - /** The operation groups for Multivariate */ + /** The operation groups for multivariate */ public readonly multivariate: MultivariateOperations; + /** The operation groups for univariate */ + public readonly univariate: UnivariateOperations; } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts index 6ee0ba4e67..88bd23e8a1 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts @@ -24,7 +24,11 @@ import { KeyCredential } from "@azure/core-auth"; * a set of time series. By using anomaly detector service, business customers can * discover incidents and establish a logic flow for root cause analysis. */ -export interface AnomalyDetectorContext extends Client {} +export interface AnomalyDetectorContext extends Client { + /** Api Version */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface AnomalyDetectorClientOptionalParams extends ClientOptions { @@ -77,5 +81,5 @@ export function createAnomalyDetector( }; const clientContext = getClient(endpointUrl, credential, updatedOptions); clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - return clientContext; + return { ...clientContext, apiVersion } as AnomalyDetectorContext; } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts index 113a94ebf7..9161609ded 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts @@ -7,14 +7,14 @@ export { AnomalyDetectorClientOptionalParams, } from "./anomalyDetectorContext.js"; export { - UnivariateDetectUnivariateEntireSeriesOptionalParams, - UnivariateDetectUnivariateLastPointOptionalParams, - UnivariateDetectUnivariateChangePointOptionalParams, - MultivariateGetMultivariateBatchDetectionResultOptionalParams, - MultivariateTrainMultivariateModelOptionalParams, - MultivariateListMultivariateModelsOptionalParams, - MultivariateDeleteMultivariateModelOptionalParams, - MultivariateGetMultivariateModelOptionalParams, - MultivariateDetectMultivariateBatchAnomalyOptionalParams, MultivariateDetectMultivariateLastAnomalyOptionalParams, + MultivariateDetectMultivariateBatchAnomalyOptionalParams, + MultivariateGetMultivariateModelOptionalParams, + MultivariateDeleteMultivariateModelOptionalParams, + MultivariateListMultivariateModelsOptionalParams, + MultivariateTrainMultivariateModelOptionalParams, + MultivariateGetMultivariateBatchDetectionResultOptionalParams, + UnivariateDetectUnivariateChangePointOptionalParams, + UnivariateDetectUnivariateLastPointOptionalParams, + UnivariateDetectUnivariateEntireSeriesOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts index 8ee761c9ca..f513ba5159 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts @@ -38,133 +38,160 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _getMultivariateBatchDetectionResultSend( +export function _detectMultivariateLastAnomalySend( context: Client, - resultId: string, - options: MultivariateGetMultivariateBatchDetectionResultOptionalParams = { + modelId: string, + options: MultivariateMultivariateLastDetectionOptions, + optionalParams: MultivariateDetectMultivariateLastAnomalyOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/multivariate/detect-batch/{resultId}", resultId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/multivariate/models/{modelId}:detect-last", modelId) + .post({ + ...operationOptionsToRequestParameters(optionalParams), + contentType: "application/json", + headers: { + accept: "application/json", + ...optionalParams.requestOptions?.headers, + }, + body: multivariateMultivariateLastDetectionOptionsSerializer(options), + }); } -export async function _getMultivariateBatchDetectionResultDeserialize( +export async function _detectMultivariateLastAnomalyDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return multivariateMultivariateDetectionResultDeserializer(result.body); + return multivariateMultivariateLastDetectionResultDeserializer(result.body); } /** - * For asynchronous inference, get multivariate anomaly detection result based on - * resultId returned by the BatchDetectAnomaly api. + * Submit multivariate anomaly detection task with the modelId of trained model + * and inference data, and the inference data should be put into request body in a + * JSON format. The request will complete synchronously and return the detection + * immediately in the response body. */ -export async function getMultivariateBatchDetectionResult( +export async function detectMultivariateLastAnomaly( context: Client, - resultId: string, - options: MultivariateGetMultivariateBatchDetectionResultOptionalParams = { + modelId: string, + options: MultivariateMultivariateLastDetectionOptions, + optionalParams: MultivariateDetectMultivariateLastAnomalyOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _getMultivariateBatchDetectionResultSend( +): Promise { + const result = await _detectMultivariateLastAnomalySend( context, - resultId, + modelId, options, + optionalParams, ); - return _getMultivariateBatchDetectionResultDeserialize(result); + return _detectMultivariateLastAnomalyDeserialize(result); } -export function _trainMultivariateModelSend( +export function _detectMultivariateBatchAnomalySend( context: Client, - modelInfo: MultivariateModelInfo, - options: MultivariateTrainMultivariateModelOptionalParams = { + modelId: string, + options: MultivariateMultivariateBatchDetectionOptions, + optionalParams: MultivariateDetectMultivariateBatchAnomalyOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/multivariate/models") + .path("/multivariate/models/{modelId}:detect-batch", modelId) .post({ - ...operationOptionsToRequestParameters(options), - body: multivariateModelInfoSerializer(modelInfo), + ...operationOptionsToRequestParameters(optionalParams), + contentType: "application/json", + headers: { + accept: "application/json", + ...optionalParams.requestOptions?.headers, + }, + body: multivariateMultivariateBatchDetectionOptionsSerializer(options), }); } -export async function _trainMultivariateModelDeserialize( +export async function _detectMultivariateBatchAnomalyDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; +): Promise { + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return multivariateAnomalyDetectionModelDeserializer(result.body); + return multivariateMultivariateDetectionResultDeserializer(result.body); } /** - * Create and train a multivariate anomaly detection model. The request must - * include a source parameter to indicate an externally accessible Azure blob - * storage URI.There are two types of data input: An URI pointed to an Azure blob - * storage folder which contains multiple CSV files, and each CSV file contains - * two columns, timestamp and variable. Another type of input is an URI pointed to - * a CSV file in Azure blob storage, which contains all the variables and a - * timestamp column. + * Submit multivariate anomaly detection task with the modelId of trained model + * and inference data, the input schema should be the same with the training + * request. The request will complete asynchronously and return a resultId to + * query the detection result.The request should be a source link to indicate an + * externally accessible Azure storage Uri, either pointed to an Azure blob + * storage folder, or pointed to a CSV file in Azure blob storage. */ -export async function trainMultivariateModel( +export async function detectMultivariateBatchAnomaly( context: Client, - modelInfo: MultivariateModelInfo, - options: MultivariateTrainMultivariateModelOptionalParams = { + modelId: string, + options: MultivariateMultivariateBatchDetectionOptions, + optionalParams: MultivariateDetectMultivariateBatchAnomalyOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _trainMultivariateModelSend(context, modelInfo, options); - return _trainMultivariateModelDeserialize(result); +): Promise { + const result = await _detectMultivariateBatchAnomalySend( + context, + modelId, + options, + optionalParams, + ); + return _detectMultivariateBatchAnomalyDeserialize(result); } -export function _listMultivariateModelsSend( +export function _getMultivariateModelSend( context: Client, - options: MultivariateListMultivariateModelsOptionalParams = { + modelId: string, + options: MultivariateGetMultivariateModelOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/multivariate/models") + .path("/multivariate/models/{modelId}", modelId) .get({ ...operationOptionsToRequestParameters(options), - queryParameters: { skip: options?.skip, top: options?.top }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _listMultivariateModelsDeserialize( +export async function _getMultivariateModelDeserialize( result: PathUncheckedResponse, -): Promise<_MultivariateModelList> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _multivariateModelListDeserializer(result.body); + return multivariateAnomalyDetectionModelDeserializer(result.body); } -/** List models of a resource. */ -export function listMultivariateModels( +/** + * Get detailed information of multivariate model, including the training status + * and variables used in the model. + */ +export async function getMultivariateModel( context: Client, - options: MultivariateListMultivariateModelsOptionalParams = { + modelId: string, + options: MultivariateGetMultivariateModelOptionalParams = { requestOptions: {}, }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listMultivariateModelsSend(context, options), - _listMultivariateModelsDeserialize, - ["200"], - { itemName: "models", nextLinkName: "nextLink" }, - ); +): Promise { + const result = await _getMultivariateModelSend(context, modelId, options); + return _getMultivariateModelDeserialize(result); } export function _deleteMultivariateModelSend( @@ -176,7 +203,13 @@ export function _deleteMultivariateModelSend( ): StreamableMethod { return context .path("/multivariate/models/{modelId}", modelId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _deleteMultivariateModelDeserialize( @@ -202,142 +235,146 @@ export async function deleteMultivariateModel( return _deleteMultivariateModelDeserialize(result); } -export function _getMultivariateModelSend( +export function _listMultivariateModelsSend( context: Client, - modelId: string, - options: MultivariateGetMultivariateModelOptionalParams = { + options: MultivariateListMultivariateModelsOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/multivariate/models/{modelId}", modelId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/multivariate/models") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { skip: options?.skip, top: options?.top }, + }); } -export async function _getMultivariateModelDeserialize( +export async function _listMultivariateModelsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_MultivariateModelList> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return multivariateAnomalyDetectionModelDeserializer(result.body); + return _multivariateModelListDeserializer(result.body); } -/** - * Get detailed information of multivariate model, including the training status - * and variables used in the model. - */ -export async function getMultivariateModel( +/** List models of a resource. */ +export function listMultivariateModels( context: Client, - modelId: string, - options: MultivariateGetMultivariateModelOptionalParams = { + options: MultivariateListMultivariateModelsOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _getMultivariateModelSend(context, modelId, options); - return _getMultivariateModelDeserialize(result); +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listMultivariateModelsSend(context, options), + _listMultivariateModelsDeserialize, + ["200"], + { itemName: "models", nextLinkName: "nextLink" }, + ); } -export function _detectMultivariateBatchAnomalySend( +export function _trainMultivariateModelSend( context: Client, - modelId: string, - options: MultivariateMultivariateBatchDetectionOptions, - optionalParams: MultivariateDetectMultivariateBatchAnomalyOptionalParams = { + modelInfo: MultivariateModelInfo, + options: MultivariateTrainMultivariateModelOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/multivariate/models/{modelId}:detect-batch", modelId) + .path("/multivariate/models") .post({ - ...operationOptionsToRequestParameters(optionalParams), - body: multivariateMultivariateBatchDetectionOptionsSerializer(options), + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: multivariateModelInfoSerializer(modelInfo), }); } -export async function _detectMultivariateBatchAnomalyDeserialize( +export async function _trainMultivariateModelDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202"]; +): Promise { + const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return multivariateMultivariateDetectionResultDeserializer(result.body); + return multivariateAnomalyDetectionModelDeserializer(result.body); } /** - * Submit multivariate anomaly detection task with the modelId of trained model - * and inference data, the input schema should be the same with the training - * request. The request will complete asynchronously and return a resultId to - * query the detection result.The request should be a source link to indicate an - * externally accessible Azure storage Uri, either pointed to an Azure blob - * storage folder, or pointed to a CSV file in Azure blob storage. + * Create and train a multivariate anomaly detection model. The request must + * include a source parameter to indicate an externally accessible Azure blob + * storage URI.There are two types of data input: An URI pointed to an Azure blob + * storage folder which contains multiple CSV files, and each CSV file contains + * two columns, timestamp and variable. Another type of input is an URI pointed to + * a CSV file in Azure blob storage, which contains all the variables and a + * timestamp column. */ -export async function detectMultivariateBatchAnomaly( +export async function trainMultivariateModel( context: Client, - modelId: string, - options: MultivariateMultivariateBatchDetectionOptions, - optionalParams: MultivariateDetectMultivariateBatchAnomalyOptionalParams = { + modelInfo: MultivariateModelInfo, + options: MultivariateTrainMultivariateModelOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _detectMultivariateBatchAnomalySend( - context, - modelId, - options, - optionalParams, - ); - return _detectMultivariateBatchAnomalyDeserialize(result); +): Promise { + const result = await _trainMultivariateModelSend(context, modelInfo, options); + return _trainMultivariateModelDeserialize(result); } -export function _detectMultivariateLastAnomalySend( +export function _getMultivariateBatchDetectionResultSend( context: Client, - modelId: string, - options: MultivariateMultivariateLastDetectionOptions, - optionalParams: MultivariateDetectMultivariateLastAnomalyOptionalParams = { + resultId: string, + options: MultivariateGetMultivariateBatchDetectionResultOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/multivariate/models/{modelId}:detect-last", modelId) - .post({ - ...operationOptionsToRequestParameters(optionalParams), - body: multivariateMultivariateLastDetectionOptionsSerializer(options), + .path("/multivariate/detect-batch/{resultId}", resultId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _detectMultivariateLastAnomalyDeserialize( +export async function _getMultivariateBatchDetectionResultDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return multivariateMultivariateLastDetectionResultDeserializer(result.body); + return multivariateMultivariateDetectionResultDeserializer(result.body); } /** - * Submit multivariate anomaly detection task with the modelId of trained model - * and inference data, and the inference data should be put into request body in a - * JSON format. The request will complete synchronously and return the detection - * immediately in the response body. + * For asynchronous inference, get multivariate anomaly detection result based on + * resultId returned by the BatchDetectAnomaly api. */ -export async function detectMultivariateLastAnomaly( +export async function getMultivariateBatchDetectionResult( context: Client, - modelId: string, - options: MultivariateMultivariateLastDetectionOptions, - optionalParams: MultivariateDetectMultivariateLastAnomalyOptionalParams = { + resultId: string, + options: MultivariateGetMultivariateBatchDetectionResultOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _detectMultivariateLastAnomalySend( +): Promise { + const result = await _getMultivariateBatchDetectionResultSend( context, - modelId, + resultId, options, - optionalParams, ); - return _detectMultivariateLastAnomalyDeserialize(result); + return _getMultivariateBatchDetectionResultDeserialize(result); } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/options.ts index b157684474..b20c56015e 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/options.ts @@ -4,23 +4,19 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface UnivariateDetectUnivariateEntireSeriesOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface UnivariateDetectUnivariateLastPointOptionalParams +export interface MultivariateDetectMultivariateLastAnomalyOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface UnivariateDetectUnivariateChangePointOptionalParams +export interface MultivariateDetectMultivariateBatchAnomalyOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface MultivariateGetMultivariateBatchDetectionResultOptionalParams +export interface MultivariateGetMultivariateModelOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface MultivariateTrainMultivariateModelOptionalParams +export interface MultivariateDeleteMultivariateModelOptionalParams extends OperationOptions {} /** Optional parameters. */ @@ -33,17 +29,21 @@ export interface MultivariateListMultivariateModelsOptionalParams } /** Optional parameters. */ -export interface MultivariateDeleteMultivariateModelOptionalParams +export interface MultivariateTrainMultivariateModelOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface MultivariateGetMultivariateModelOptionalParams +export interface MultivariateGetMultivariateBatchDetectionResultOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface MultivariateDetectMultivariateBatchAnomalyOptionalParams +export interface UnivariateDetectUnivariateChangePointOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface MultivariateDetectMultivariateLastAnomalyOptionalParams +export interface UnivariateDetectUnivariateLastPointOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface UnivariateDetectUnivariateEntireSeriesOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts index 044e0eee1c..a5501a1b74 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts @@ -26,51 +26,53 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _detectUnivariateEntireSeriesSend( +export function _detectUnivariateChangePointSend( context: Client, - options: UnivariateUnivariateDetectionOptions, - optionalParams: UnivariateDetectUnivariateEntireSeriesOptionalParams = { + options: UnivariateUnivariateChangePointDetectionOptions, + optionalParams: UnivariateDetectUnivariateChangePointOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/timeseries/entire/detect") + .path("/timeseries/changepoint/detect") .post({ ...operationOptionsToRequestParameters(optionalParams), - body: univariateUnivariateDetectionOptionsSerializer(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...optionalParams.requestOptions?.headers, + }, + body: univariateUnivariateChangePointDetectionOptionsSerializer(options), }); } -export async function _detectUnivariateEntireSeriesDeserialize( +export async function _detectUnivariateChangePointDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return univariateUnivariateEntireDetectionResultDeserializer(result.body); + return univariateUnivariateChangePointDetectionResultDeserializer( + result.body, + ); } -/** - * This operation generates a model with an entire series, each point is detected - * with the same model. With this method, points before and after a certain point - * are used to determine whether it is an anomaly. The entire detection can give - * user an overall status of the time series. - */ -export async function detectUnivariateEntireSeries( +/** Evaluate change point score of every series point */ +export async function detectUnivariateChangePoint( context: Client, - options: UnivariateUnivariateDetectionOptions, - optionalParams: UnivariateDetectUnivariateEntireSeriesOptionalParams = { + options: UnivariateUnivariateChangePointDetectionOptions, + optionalParams: UnivariateDetectUnivariateChangePointOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _detectUnivariateEntireSeriesSend( +): Promise { + const result = await _detectUnivariateChangePointSend( context, options, optionalParams, ); - return _detectUnivariateEntireSeriesDeserialize(result); + return _detectUnivariateChangePointDeserialize(result); } export function _detectUnivariateLastPointSend( @@ -84,6 +86,11 @@ export function _detectUnivariateLastPointSend( .path("/timeseries/last/detect") .post({ ...operationOptionsToRequestParameters(optionalParams), + contentType: "application/json", + headers: { + accept: "application/json", + ...optionalParams.requestOptions?.headers, + }, body: univariateUnivariateDetectionOptionsSerializer(options), }); } @@ -118,46 +125,54 @@ export async function detectUnivariateLastPoint( return _detectUnivariateLastPointDeserialize(result); } -export function _detectUnivariateChangePointSend( +export function _detectUnivariateEntireSeriesSend( context: Client, - options: UnivariateUnivariateChangePointDetectionOptions, - optionalParams: UnivariateDetectUnivariateChangePointOptionalParams = { + options: UnivariateUnivariateDetectionOptions, + optionalParams: UnivariateDetectUnivariateEntireSeriesOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/timeseries/changepoint/detect") + .path("/timeseries/entire/detect") .post({ ...operationOptionsToRequestParameters(optionalParams), - body: univariateUnivariateChangePointDetectionOptionsSerializer(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...optionalParams.requestOptions?.headers, + }, + body: univariateUnivariateDetectionOptionsSerializer(options), }); } -export async function _detectUnivariateChangePointDeserialize( +export async function _detectUnivariateEntireSeriesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return univariateUnivariateChangePointDetectionResultDeserializer( - result.body, - ); + return univariateUnivariateEntireDetectionResultDeserializer(result.body); } -/** Evaluate change point score of every series point */ -export async function detectUnivariateChangePoint( +/** + * This operation generates a model with an entire series, each point is detected + * with the same model. With this method, points before and after a certain point + * are used to determine whether it is an anomaly. The entire detection can give + * user an overall status of the time series. + */ +export async function detectUnivariateEntireSeries( context: Client, - options: UnivariateUnivariateChangePointDetectionOptions, - optionalParams: UnivariateDetectUnivariateChangePointOptionalParams = { + options: UnivariateUnivariateDetectionOptions, + optionalParams: UnivariateDetectUnivariateEntireSeriesOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _detectUnivariateChangePointSend( +): Promise { + const result = await _detectUnivariateEntireSeriesSend( context, options, optionalParams, ); - return _detectUnivariateChangePointDeserialize(result); + return _detectUnivariateEntireSeriesDeserialize(result); } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts index 62047c82d1..f0fbffcf2e 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts @@ -3,22 +3,22 @@ import { AnomalyDetectorContext } from "../../api/anomalyDetectorContext.js"; import { - getMultivariateBatchDetectionResult, - trainMultivariateModel, - listMultivariateModels, - deleteMultivariateModel, - getMultivariateModel, - detectMultivariateBatchAnomaly, detectMultivariateLastAnomaly, + detectMultivariateBatchAnomaly, + getMultivariateModel, + deleteMultivariateModel, + listMultivariateModels, + trainMultivariateModel, + getMultivariateBatchDetectionResult, } from "../../api/multivariate/index.js"; import { - MultivariateGetMultivariateBatchDetectionResultOptionalParams, - MultivariateTrainMultivariateModelOptionalParams, - MultivariateListMultivariateModelsOptionalParams, - MultivariateDeleteMultivariateModelOptionalParams, - MultivariateGetMultivariateModelOptionalParams, - MultivariateDetectMultivariateBatchAnomalyOptionalParams, MultivariateDetectMultivariateLastAnomalyOptionalParams, + MultivariateDetectMultivariateBatchAnomalyOptionalParams, + MultivariateGetMultivariateModelOptionalParams, + MultivariateDeleteMultivariateModelOptionalParams, + MultivariateListMultivariateModelsOptionalParams, + MultivariateTrainMultivariateModelOptionalParams, + MultivariateGetMultivariateBatchDetectionResultOptionalParams, } from "../../api/options.js"; import { MultivariateMultivariateDetectionResult, @@ -33,43 +33,16 @@ import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.j /** Interface representing a Multivariate operations. */ export interface MultivariateOperations { /** - * For asynchronous inference, get multivariate anomaly detection result based on - * resultId returned by the BatchDetectAnomaly api. - */ - getMultivariateBatchDetectionResult: ( - resultId: string, - options?: MultivariateGetMultivariateBatchDetectionResultOptionalParams, - ) => Promise; - /** - * Create and train a multivariate anomaly detection model. The request must - * include a source parameter to indicate an externally accessible Azure blob - * storage URI.There are two types of data input: An URI pointed to an Azure blob - * storage folder which contains multiple CSV files, and each CSV file contains - * two columns, timestamp and variable. Another type of input is an URI pointed to - * a CSV file in Azure blob storage, which contains all the variables and a - * timestamp column. - */ - trainMultivariateModel: ( - modelInfo: MultivariateModelInfo, - options?: MultivariateTrainMultivariateModelOptionalParams, - ) => Promise; - /** List models of a resource. */ - listMultivariateModels: ( - options?: MultivariateListMultivariateModelsOptionalParams, - ) => PagedAsyncIterableIterator; - /** Delete an existing multivariate model according to the modelId */ - deleteMultivariateModel: ( - modelId: string, - options?: MultivariateDeleteMultivariateModelOptionalParams, - ) => Promise; - /** - * Get detailed information of multivariate model, including the training status - * and variables used in the model. + * Submit multivariate anomaly detection task with the modelId of trained model + * and inference data, and the inference data should be put into request body in a + * JSON format. The request will complete synchronously and return the detection + * immediately in the response body. */ - getMultivariateModel: ( + detectMultivariateLastAnomaly: ( modelId: string, - options?: MultivariateGetMultivariateModelOptionalParams, - ) => Promise; + options: MultivariateMultivariateLastDetectionOptions, + optionalParams?: MultivariateDetectMultivariateLastAnomalyOptionalParams, + ) => Promise; /** * Submit multivariate anomaly detection task with the modelId of trained model * and inference data, the input schema should be the same with the training @@ -84,51 +57,78 @@ export interface MultivariateOperations { optionalParams?: MultivariateDetectMultivariateBatchAnomalyOptionalParams, ) => Promise; /** - * Submit multivariate anomaly detection task with the modelId of trained model - * and inference data, and the inference data should be put into request body in a - * JSON format. The request will complete synchronously and return the detection - * immediately in the response body. + * Get detailed information of multivariate model, including the training status + * and variables used in the model. */ - detectMultivariateLastAnomaly: ( + getMultivariateModel: ( modelId: string, - options: MultivariateMultivariateLastDetectionOptions, - optionalParams?: MultivariateDetectMultivariateLastAnomalyOptionalParams, - ) => Promise; + options?: MultivariateGetMultivariateModelOptionalParams, + ) => Promise; + /** Delete an existing multivariate model according to the modelId */ + deleteMultivariateModel: ( + modelId: string, + options?: MultivariateDeleteMultivariateModelOptionalParams, + ) => Promise; + /** List models of a resource. */ + listMultivariateModels: ( + options?: MultivariateListMultivariateModelsOptionalParams, + ) => PagedAsyncIterableIterator; + /** + * Create and train a multivariate anomaly detection model. The request must + * include a source parameter to indicate an externally accessible Azure blob + * storage URI.There are two types of data input: An URI pointed to an Azure blob + * storage folder which contains multiple CSV files, and each CSV file contains + * two columns, timestamp and variable. Another type of input is an URI pointed to + * a CSV file in Azure blob storage, which contains all the variables and a + * timestamp column. + */ + trainMultivariateModel: ( + modelInfo: MultivariateModelInfo, + options?: MultivariateTrainMultivariateModelOptionalParams, + ) => Promise; + /** + * For asynchronous inference, get multivariate anomaly detection result based on + * resultId returned by the BatchDetectAnomaly api. + */ + getMultivariateBatchDetectionResult: ( + resultId: string, + options?: MultivariateGetMultivariateBatchDetectionResultOptionalParams, + ) => Promise; } export function getMultivariate(context: AnomalyDetectorContext) { return { - getMultivariateBatchDetectionResult: ( - resultId: string, - options?: MultivariateGetMultivariateBatchDetectionResultOptionalParams, - ) => getMultivariateBatchDetectionResult(context, resultId, options), - trainMultivariateModel: ( - modelInfo: MultivariateModelInfo, - options?: MultivariateTrainMultivariateModelOptionalParams, - ) => trainMultivariateModel(context, modelInfo, options), - listMultivariateModels: ( - options?: MultivariateListMultivariateModelsOptionalParams, - ) => listMultivariateModels(context, options), - deleteMultivariateModel: ( - modelId: string, - options?: MultivariateDeleteMultivariateModelOptionalParams, - ) => deleteMultivariateModel(context, modelId, options), - getMultivariateModel: ( + detectMultivariateLastAnomaly: ( modelId: string, - options?: MultivariateGetMultivariateModelOptionalParams, - ) => getMultivariateModel(context, modelId, options), + options: MultivariateMultivariateLastDetectionOptions, + optionalParams?: MultivariateDetectMultivariateLastAnomalyOptionalParams, + ) => + detectMultivariateLastAnomaly(context, modelId, options, optionalParams), detectMultivariateBatchAnomaly: ( modelId: string, options: MultivariateMultivariateBatchDetectionOptions, optionalParams?: MultivariateDetectMultivariateBatchAnomalyOptionalParams, ) => detectMultivariateBatchAnomaly(context, modelId, options, optionalParams), - detectMultivariateLastAnomaly: ( + getMultivariateModel: ( modelId: string, - options: MultivariateMultivariateLastDetectionOptions, - optionalParams?: MultivariateDetectMultivariateLastAnomalyOptionalParams, - ) => - detectMultivariateLastAnomaly(context, modelId, options, optionalParams), + options?: MultivariateGetMultivariateModelOptionalParams, + ) => getMultivariateModel(context, modelId, options), + deleteMultivariateModel: ( + modelId: string, + options?: MultivariateDeleteMultivariateModelOptionalParams, + ) => deleteMultivariateModel(context, modelId, options), + listMultivariateModels: ( + options?: MultivariateListMultivariateModelsOptionalParams, + ) => listMultivariateModels(context, options), + trainMultivariateModel: ( + modelInfo: MultivariateModelInfo, + options?: MultivariateTrainMultivariateModelOptionalParams, + ) => trainMultivariateModel(context, modelInfo, options), + getMultivariateBatchDetectionResult: ( + resultId: string, + options?: MultivariateGetMultivariateBatchDetectionResultOptionalParams, + ) => getMultivariateBatchDetectionResult(context, resultId, options), }; } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts index d8ccd2ab9d..27a096e462 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts @@ -3,14 +3,14 @@ import { AnomalyDetectorContext } from "../../api/anomalyDetectorContext.js"; import { - UnivariateDetectUnivariateEntireSeriesOptionalParams, - UnivariateDetectUnivariateLastPointOptionalParams, UnivariateDetectUnivariateChangePointOptionalParams, + UnivariateDetectUnivariateLastPointOptionalParams, + UnivariateDetectUnivariateEntireSeriesOptionalParams, } from "../../api/options.js"; import { - detectUnivariateEntireSeries, - detectUnivariateLastPoint, detectUnivariateChangePoint, + detectUnivariateLastPoint, + detectUnivariateEntireSeries, } from "../../api/univariate/index.js"; import { UnivariateUnivariateDetectionOptions, @@ -22,6 +22,19 @@ import { /** Interface representing a Univariate operations. */ export interface UnivariateOperations { + /** Evaluate change point score of every series point */ + detectUnivariateChangePoint: ( + options: UnivariateUnivariateChangePointDetectionOptions, + optionalParams?: UnivariateDetectUnivariateChangePointOptionalParams, + ) => Promise; + /** + * This operation generates a model using the points that you sent into the API, + * and based on all data to determine whether the last point is anomalous. + */ + detectUnivariateLastPoint: ( + options: UnivariateUnivariateDetectionOptions, + optionalParams?: UnivariateDetectUnivariateLastPointOptionalParams, + ) => Promise; /** * This operation generates a model with an entire series, each point is detected * with the same model. With this method, points before and after a certain point @@ -32,35 +45,22 @@ export interface UnivariateOperations { options: UnivariateUnivariateDetectionOptions, optionalParams?: UnivariateDetectUnivariateEntireSeriesOptionalParams, ) => Promise; - /** - * This operation generates a model using the points that you sent into the API, - * and based on all data to determine whether the last point is anomalous. - */ - detectUnivariateLastPoint: ( - options: UnivariateUnivariateDetectionOptions, - optionalParams?: UnivariateDetectUnivariateLastPointOptionalParams, - ) => Promise; - /** Evaluate change point score of every series point */ - detectUnivariateChangePoint: ( - options: UnivariateUnivariateChangePointDetectionOptions, - optionalParams?: UnivariateDetectUnivariateChangePointOptionalParams, - ) => Promise; } export function getUnivariate(context: AnomalyDetectorContext) { return { - detectUnivariateEntireSeries: ( - options: UnivariateUnivariateDetectionOptions, - optionalParams?: UnivariateDetectUnivariateEntireSeriesOptionalParams, - ) => detectUnivariateEntireSeries(context, options, optionalParams), - detectUnivariateLastPoint: ( - options: UnivariateUnivariateDetectionOptions, - optionalParams?: UnivariateDetectUnivariateLastPointOptionalParams, - ) => detectUnivariateLastPoint(context, options, optionalParams), detectUnivariateChangePoint: ( options: UnivariateUnivariateChangePointDetectionOptions, optionalParams?: UnivariateDetectUnivariateChangePointOptionalParams, ) => detectUnivariateChangePoint(context, options, optionalParams), + detectUnivariateLastPoint: ( + options: UnivariateUnivariateDetectionOptions, + optionalParams?: UnivariateDetectUnivariateLastPointOptionalParams, + ) => detectUnivariateLastPoint(context, options, optionalParams), + detectUnivariateEntireSeries: ( + options: UnivariateUnivariateDetectionOptions, + optionalParams?: UnivariateDetectUnivariateEntireSeriesOptionalParams, + ) => detectUnivariateEntireSeries(context, options, optionalParams), }; } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts index d0a887e898..24ec34fda5 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts @@ -43,16 +43,16 @@ export { } from "./models/index.js"; export { AnomalyDetectorClientOptionalParams, - UnivariateDetectUnivariateEntireSeriesOptionalParams, - UnivariateDetectUnivariateLastPointOptionalParams, - UnivariateDetectUnivariateChangePointOptionalParams, - MultivariateGetMultivariateBatchDetectionResultOptionalParams, - MultivariateTrainMultivariateModelOptionalParams, - MultivariateListMultivariateModelsOptionalParams, - MultivariateDeleteMultivariateModelOptionalParams, - MultivariateGetMultivariateModelOptionalParams, - MultivariateDetectMultivariateBatchAnomalyOptionalParams, MultivariateDetectMultivariateLastAnomalyOptionalParams, + MultivariateDetectMultivariateBatchAnomalyOptionalParams, + MultivariateGetMultivariateModelOptionalParams, + MultivariateDeleteMultivariateModelOptionalParams, + MultivariateListMultivariateModelsOptionalParams, + MultivariateTrainMultivariateModelOptionalParams, + MultivariateGetMultivariateBatchDetectionResultOptionalParams, + UnivariateDetectUnivariateChangePointOptionalParams, + UnivariateDetectUnivariateLastPointOptionalParams, + UnivariateDetectUnivariateEntireSeriesOptionalParams, } from "./api/index.js"; export { MultivariateOperations, diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index 0cc985b7cd..d6773e2fa2 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -124,8 +124,12 @@ export function multivariateVariableStateSerializer( variable: item["variable"], filledNARatio: item["filledNARatio"], effectiveCount: item["effectiveCount"], - firstTimestamp: item["firstTimestamp"]?.toISOString(), - lastTimestamp: item["lastTimestamp"]?.toISOString(), + firstTimestamp: !item["firstTimestamp"] + ? item["firstTimestamp"] + : item["firstTimestamp"].toISOString(), + lastTimestamp: !item["lastTimestamp"] + ? item["lastTimestamp"] + : item["lastTimestamp"].toISOString(), }; } @@ -783,7 +787,12 @@ export interface UnivariateTimeSeriesPoint { export function univariateTimeSeriesPointSerializer( item: UnivariateTimeSeriesPoint, ): any { - return { timestamp: item["timestamp"]?.toISOString(), value: item["value"] }; + return { + timestamp: !item["timestamp"] + ? item["timestamp"] + : item["timestamp"].toISOString(), + value: item["value"], + }; } /** Type of UnivariateTimeGranularity */ @@ -1042,5 +1051,5 @@ export function univariateUnivariateChangePointDetectionResultDeserializer( /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - V1_1 = "v1.1", + v1_1 = "v1.1", } diff --git a/packages/typespec-test/test/anomalyDetector/spec/multivariate/models.tsp b/packages/typespec-test/test/anomalyDetector/spec/multivariate/models.tsp index 6d22a7532f..2919e947fe 100644 --- a/packages/typespec-test/test/anomalyDetector/spec/multivariate/models.tsp +++ b/packages/typespec-test/test/anomalyDetector/spec/multivariate/models.tsp @@ -341,7 +341,7 @@ model ModelList { maxCount: int32; @doc("The link to fetch more models.") - @Azure.Core.nextLink + @TypeSpec.nextLink nextLink?: string; } diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/authoring/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/batch_modular/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md index 0a87d83125..05bd62b29c 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md @@ -580,7 +580,9 @@ export type CachingType = "none" | "readonly" | "readwrite"; // @public export interface CancelCertificateDeletionOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -648,50 +650,57 @@ export type ContinuablePage = TPage & { // @public export interface CreateCertificateOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface CreateJobOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface CreateJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface CreateNodeUserOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface CreatePoolOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface CreateTaskCollectionOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface CreateTaskOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -712,67 +721,83 @@ export interface DeleteCertificateError { // @public export interface DeleteCertificateOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DeleteJobOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DeleteJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DeleteNodeFileOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; recursive?: boolean; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DeleteNodeUserOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DeletePoolOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DeleteTaskFileOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; recursive?: boolean; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DeleteTaskOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -795,36 +820,42 @@ export type DisableJobOption = "requeue" | "terminate" | "wait"; // @public export interface DisableJobOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DisableJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DisableNodeSchedulingOptionalParams extends OperationOptions { - apiVersion?: string; body?: NodeDisableSchedulingOptions; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface DisablePoolAutoScaleOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -844,38 +875,45 @@ export type ElevationLevel = "nonadmin" | "admin"; // @public export interface EnableJobOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface EnableJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface EnableNodeSchedulingOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface EnablePoolAutoScaleOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -896,8 +934,9 @@ export interface ErrorMessage { // @public export interface EvaluatePoolAutoScaleOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -940,128 +979,158 @@ export interface FileProperties { // @public export interface GetApplicationOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetCertificateOptionalParams extends OperationOptions { - apiVersion?: string; - select?: string[]; + $select?: string[]; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetJobOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; + $expand?: string[]; + $select?: string[]; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; + $expand?: string[]; + $select?: string[]; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetJobTaskCountsOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetNodeExtensionOptionalParams extends OperationOptions { - apiVersion?: string; - select?: string[]; + $select?: string[]; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetNodeFileOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; + ocpDate?: Date; ocpRange?: string; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetNodeFilePropertiesOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetNodeOptionalParams extends OperationOptions { - apiVersion?: string; - select?: string[]; + $select?: string[]; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetNodeRemoteDesktopFileOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetNodeRemoteLoginSettingsOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetPoolOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; + $expand?: string[]; + $select?: string[]; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetTaskFileOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; + ocpDate?: Date; ocpRange?: string; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface GetTaskOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; + $expand?: string[]; + $select?: string[]; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -1245,11 +1314,13 @@ export interface JobScheduleExecutionInformation { // @public export interface JobScheduleExistsOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -1324,7 +1395,7 @@ export interface JobStatistics { // @public export enum KnownVersions { - "V2023-05-01.17.0" = "2023-05-01.17.0" + "2023-05-01.17.0" = "2023-05-01.17.0" } // @public @@ -1336,141 +1407,176 @@ export interface LinuxUserConfiguration { // @public export interface ListApplicationsOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; maxresults?: number; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListCertificatesOptionalParams extends OperationOptions { - apiVersion?: string; - filter?: string; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListJobPreparationAndReleaseTaskStatusOptionalParams extends OperationOptions { - filter?: string; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListJobSchedulesOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; - filter?: string; + $expand?: string[]; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListJobsFromScheduleOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; - filter?: string; + $expand?: string[]; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListJobsOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; - filter?: string; + $expand?: string[]; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListNodeExtensionsOptionalParams extends OperationOptions { + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListNodeFilesOptionalParams extends OperationOptions { - apiVersion?: string; - filter?: string; + $filter?: string; + clientRequestId?: string; maxresults?: number; + ocpDate?: Date; recursive?: boolean; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListNodesOptionalParams extends OperationOptions { - apiVersion?: string; - filter?: string; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListPoolNodeCountsOptionalParams extends OperationOptions { - apiVersion?: string; - filter?: string; + $filter?: string; + clientRequestId?: string; maxresults?: number; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListPoolsOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; - filter?: string; + $expand?: string[]; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { - apiVersion?: string; + $filter?: string; + clientRequestId?: string; endtime?: Date; - filter?: string; maxresults?: number; + ocpDate?: Date; + returnClientRequestId?: boolean; starttime?: Date; timeOutInSeconds?: number; } // @public export interface ListSubTasksOptionalParams extends OperationOptions { - apiVersion?: string; - select?: string[]; + $select?: string[]; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListSupportedImagesOptionalParams extends OperationOptions { - filter?: string; + $filter?: string; + clientRequestId?: string; maxresults?: number; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListTaskFilesOptionalParams extends OperationOptions { - apiVersion?: string; - filter?: string; + $filter?: string; + clientRequestId?: string; maxresults?: number; + ocpDate?: Date; recursive?: boolean; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ListTasksOptionalParams extends OperationOptions { - apiVersion?: string; - expand?: string[]; - filter?: string; + $expand?: string[]; + $filter?: string; + $select?: string[]; + clientRequestId?: string; maxresults?: number; - select?: string[]; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -1664,11 +1770,13 @@ export interface PoolEndpointConfiguration { // @public export interface PoolExistsOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -1746,19 +1854,22 @@ export interface PublicIpAddressConfiguration { // @public export interface ReactivateTaskOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface RebootNodeOptionalParams extends OperationOptions { - apiVersion?: string; body?: NodeRebootOptions; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -1770,67 +1881,74 @@ export interface RecentJob { // @public export interface ReimageNodeOptionalParams extends OperationOptions { - apiVersion?: string; body?: NodeReimageOptions; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface RemoveNodesOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ReplaceJobOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ReplaceJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ReplaceNodeUserOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ReplacePoolPropertiesOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface ReplaceTaskOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -1843,12 +1961,13 @@ export interface ResizeError { // @public export interface ResizePoolOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -1923,11 +2042,13 @@ export type StatusLevelTypes = "Error" | "Info" | "Warning"; // @public export interface StopPoolResizeOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -2089,66 +2210,74 @@ export interface TaskStatistics { // @public export interface TerminateJobOptionalParams extends OperationOptions { - apiVersion?: string; body?: BatchJobTerminateOptions; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface TerminateJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface TerminateTaskOptionalParams extends OperationOptions { - apiVersion?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface UpdateJobOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface UpdateJobScheduleOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } // @public export interface UpdatePoolOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } @@ -2168,8 +2297,9 @@ export interface UploadBatchServiceLogsResult { // @public export interface UploadNodeLogsOptionalParams extends OperationOptions { - apiVersion?: string; - contentType?: string; + clientRequestId?: string; + ocpDate?: Date; + returnClientRequestId?: boolean; timeOutInSeconds?: number; } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/batchContext.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/batchContext.ts index 3d8f800f44..489548bb57 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/batchContext.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/batchContext.ts @@ -7,7 +7,11 @@ import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; /** Azure Batch provides Cloud-scale job scheduling and compute management. */ -export interface BatchContext extends Client {} +export interface BatchContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface BatchClientOptionalParams extends ClientOptions { @@ -22,7 +26,8 @@ export function createBatch( credential: TokenCredential, options: BatchClientOptionalParams = {}, ): BatchContext { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`; + const endpointUrl = + options.endpoint ?? options.baseUrl ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-batch/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions @@ -40,10 +45,21 @@ export function createBatch( }; const clientContext = getClient(endpointUrl, credential, updatedOptions); clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - logger.warning( - "This client does not support client api-version, please change it at the operation level", - ); - } - return clientContext; + const apiVersion = options.apiVersion ?? "2023-05-01.17.0"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { ...clientContext, apiVersion } as BatchContext; } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts index 6ae19d1894..b54875d01d 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts @@ -7,158 +7,158 @@ export { BatchClientOptionalParams, } from "./batchContext.js"; export { - listApplications, - getApplication, - listPoolUsageMetrics, - createPool, - listPools, - deletePool, - poolExists, - getPool, - updatePool, - disablePoolAutoScale, - enablePoolAutoScale, - evaluatePoolAutoScale, - resizePool, - stopPoolResize, - replacePoolProperties, - removeNodes, - listSupportedImages, - listPoolNodeCounts, - deleteJob, - getJob, - updateJob, - replaceJob, - disableJob, - enableJob, - terminateJob, - createJob, - listJobs, - listJobsFromSchedule, - listJobPreparationAndReleaseTaskStatus, - getJobTaskCounts, - createCertificate, - listCertificates, - cancelCertificateDeletion, - deleteCertificate, - getCertificate, - jobScheduleExists, - deleteJobSchedule, - getJobSchedule, - updateJobSchedule, - replaceJobSchedule, - disableJobSchedule, - enableJobSchedule, - terminateJobSchedule, - createJobSchedule, - listJobSchedules, - createTask, - listTasks, - createTaskCollection, - deleteTask, - getTask, - replaceTask, - listSubTasks, - terminateTask, - reactivateTask, - deleteTaskFile, - getTaskFile, - getTaskFileProperties, - listTaskFiles, - createNodeUser, - deleteNodeUser, - replaceNodeUser, - getNode, - rebootNode, - reimageNode, - disableNodeScheduling, - enableNodeScheduling, - getNodeRemoteLoginSettings, - getNodeRemoteDesktopFile, - uploadNodeLogs, - listNodes, - getNodeExtension, - listNodeExtensions, - deleteNodeFile, - getNodeFile, - getNodeFileProperties, listNodeFiles, + getNodeFileProperties, + getNodeFile, + deleteNodeFile, + listNodeExtensions, + getNodeExtension, + listNodes, + uploadNodeLogs, + getNodeRemoteDesktopFile, + getNodeRemoteLoginSettings, + enableNodeScheduling, + disableNodeScheduling, + reimageNode, + rebootNode, + getNode, + replaceNodeUser, + deleteNodeUser, + createNodeUser, + listTaskFiles, + getTaskFileProperties, + getTaskFile, + deleteTaskFile, + reactivateTask, + terminateTask, + listSubTasks, + replaceTask, + getTask, + deleteTask, + createTaskCollection, + listTasks, + createTask, + listJobSchedules, + createJobSchedule, + terminateJobSchedule, + enableJobSchedule, + disableJobSchedule, + replaceJobSchedule, + updateJobSchedule, + getJobSchedule, + deleteJobSchedule, + jobScheduleExists, + getCertificate, + deleteCertificate, + cancelCertificateDeletion, + listCertificates, + createCertificate, + getJobTaskCounts, + listJobPreparationAndReleaseTaskStatus, + listJobsFromSchedule, + listJobs, + createJob, + terminateJob, + enableJob, + disableJob, + replaceJob, + updateJob, + getJob, + deleteJob, + listPoolNodeCounts, + listSupportedImages, + removeNodes, + replacePoolProperties, + stopPoolResize, + resizePool, + evaluatePoolAutoScale, + enablePoolAutoScale, + disablePoolAutoScale, + updatePool, + getPool, + poolExists, + deletePool, + listPools, + createPool, + listPoolUsageMetrics, + getApplication, + listApplications, } from "./operations.js"; export { - ListApplicationsOptionalParams, - GetApplicationOptionalParams, - ListPoolUsageMetricsOptionalParams, - CreatePoolOptionalParams, - ListPoolsOptionalParams, - DeletePoolOptionalParams, - PoolExistsOptionalParams, - GetPoolOptionalParams, - UpdatePoolOptionalParams, - DisablePoolAutoScaleOptionalParams, - EnablePoolAutoScaleOptionalParams, - EvaluatePoolAutoScaleOptionalParams, - ResizePoolOptionalParams, - StopPoolResizeOptionalParams, - ReplacePoolPropertiesOptionalParams, - RemoveNodesOptionalParams, - ListSupportedImagesOptionalParams, - ListPoolNodeCountsOptionalParams, - DeleteJobOptionalParams, - GetJobOptionalParams, - UpdateJobOptionalParams, - ReplaceJobOptionalParams, - DisableJobOptionalParams, - EnableJobOptionalParams, - TerminateJobOptionalParams, - CreateJobOptionalParams, - ListJobsOptionalParams, - ListJobsFromScheduleOptionalParams, - ListJobPreparationAndReleaseTaskStatusOptionalParams, - GetJobTaskCountsOptionalParams, - CreateCertificateOptionalParams, - ListCertificatesOptionalParams, - CancelCertificateDeletionOptionalParams, - DeleteCertificateOptionalParams, - GetCertificateOptionalParams, - JobScheduleExistsOptionalParams, - DeleteJobScheduleOptionalParams, - GetJobScheduleOptionalParams, - UpdateJobScheduleOptionalParams, - ReplaceJobScheduleOptionalParams, - DisableJobScheduleOptionalParams, - EnableJobScheduleOptionalParams, - TerminateJobScheduleOptionalParams, - CreateJobScheduleOptionalParams, - ListJobSchedulesOptionalParams, - CreateTaskOptionalParams, - ListTasksOptionalParams, - CreateTaskCollectionOptionalParams, - DeleteTaskOptionalParams, - GetTaskOptionalParams, - ReplaceTaskOptionalParams, - ListSubTasksOptionalParams, - TerminateTaskOptionalParams, - ReactivateTaskOptionalParams, - DeleteTaskFileOptionalParams, - GetTaskFileOptionalParams, - GetTaskFilePropertiesOptionalParams, - ListTaskFilesOptionalParams, - CreateNodeUserOptionalParams, - DeleteNodeUserOptionalParams, - ReplaceNodeUserOptionalParams, - GetNodeOptionalParams, - RebootNodeOptionalParams, - ReimageNodeOptionalParams, - DisableNodeSchedulingOptionalParams, - EnableNodeSchedulingOptionalParams, - GetNodeRemoteLoginSettingsOptionalParams, - GetNodeRemoteDesktopFileOptionalParams, - UploadNodeLogsOptionalParams, - ListNodesOptionalParams, - GetNodeExtensionOptionalParams, - ListNodeExtensionsOptionalParams, - DeleteNodeFileOptionalParams, - GetNodeFileOptionalParams, - GetNodeFilePropertiesOptionalParams, ListNodeFilesOptionalParams, + GetNodeFilePropertiesOptionalParams, + GetNodeFileOptionalParams, + DeleteNodeFileOptionalParams, + ListNodeExtensionsOptionalParams, + GetNodeExtensionOptionalParams, + ListNodesOptionalParams, + UploadNodeLogsOptionalParams, + GetNodeRemoteDesktopFileOptionalParams, + GetNodeRemoteLoginSettingsOptionalParams, + EnableNodeSchedulingOptionalParams, + DisableNodeSchedulingOptionalParams, + ReimageNodeOptionalParams, + RebootNodeOptionalParams, + GetNodeOptionalParams, + ReplaceNodeUserOptionalParams, + DeleteNodeUserOptionalParams, + CreateNodeUserOptionalParams, + ListTaskFilesOptionalParams, + GetTaskFilePropertiesOptionalParams, + GetTaskFileOptionalParams, + DeleteTaskFileOptionalParams, + ReactivateTaskOptionalParams, + TerminateTaskOptionalParams, + ListSubTasksOptionalParams, + ReplaceTaskOptionalParams, + GetTaskOptionalParams, + DeleteTaskOptionalParams, + CreateTaskCollectionOptionalParams, + ListTasksOptionalParams, + CreateTaskOptionalParams, + ListJobSchedulesOptionalParams, + CreateJobScheduleOptionalParams, + TerminateJobScheduleOptionalParams, + EnableJobScheduleOptionalParams, + DisableJobScheduleOptionalParams, + ReplaceJobScheduleOptionalParams, + UpdateJobScheduleOptionalParams, + GetJobScheduleOptionalParams, + DeleteJobScheduleOptionalParams, + JobScheduleExistsOptionalParams, + GetCertificateOptionalParams, + DeleteCertificateOptionalParams, + CancelCertificateDeletionOptionalParams, + ListCertificatesOptionalParams, + CreateCertificateOptionalParams, + GetJobTaskCountsOptionalParams, + ListJobPreparationAndReleaseTaskStatusOptionalParams, + ListJobsFromScheduleOptionalParams, + ListJobsOptionalParams, + CreateJobOptionalParams, + TerminateJobOptionalParams, + EnableJobOptionalParams, + DisableJobOptionalParams, + ReplaceJobOptionalParams, + UpdateJobOptionalParams, + GetJobOptionalParams, + DeleteJobOptionalParams, + ListPoolNodeCountsOptionalParams, + ListSupportedImagesOptionalParams, + RemoveNodesOptionalParams, + ReplacePoolPropertiesOptionalParams, + StopPoolResizeOptionalParams, + ResizePoolOptionalParams, + EvaluatePoolAutoScaleOptionalParams, + EnablePoolAutoScaleOptionalParams, + DisablePoolAutoScaleOptionalParams, + UpdatePoolOptionalParams, + GetPoolOptionalParams, + PoolExistsOptionalParams, + DeletePoolOptionalParams, + ListPoolsOptionalParams, + CreatePoolOptionalParams, + ListPoolUsageMetricsOptionalParams, + GetApplicationOptionalParams, + ListApplicationsOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts index 60ec0b4d0c..f9bfb9bd4b 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts @@ -195,171 +195,286 @@ import { } from "@azure-rest/core-client"; import { stringToUint8Array } from "@azure/core-util"; -export function _listApplicationsSend( +export function _listNodeFilesSend( context: Client, - options: ListApplicationsOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + options: ListNodeFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/applications") + .path("/pools/{poolId}/nodes/{nodeId}/files", poolId, nodeId) .get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, + $filter: options?.$filter, + recursive: options?.recursive, }, }); } -export async function _listApplicationsDeserialize( +export async function _listNodeFilesDeserialize( result: PathUncheckedResponse, -): Promise<_ApplicationListResult> { +): Promise<_NodeFileListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _applicationListResultDeserializer(result.body); + return _nodeFileListResultDeserializer(result.body); } -/** - * This operation returns only Applications and versions that are available for - * use on Compute Nodes; that is, that can be used in an Package reference. For - * administrator information about applications and versions that are not yet - * available to Compute Nodes, use the Azure portal or the Azure Resource Manager - * API. - */ -export function listApplications( +/** Lists all of the files in Task directories on the specified Compute Node. */ +export function listNodeFiles( context: Client, - options: ListApplicationsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + poolId: string, + nodeId: string, + options: ListNodeFilesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listApplicationsSend(context, options), - _listApplicationsDeserialize, + () => _listNodeFilesSend(context, poolId, nodeId, options), + _listNodeFilesDeserialize, ["200"], { itemName: "value", nextLinkName: "odata.nextLink" }, ); } -export function _getApplicationSend( +export function _getNodeFilePropertiesSend( context: Client, - applicationId: string, - options: GetApplicationOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + filePath: string, + options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/applications/{applicationId}", applicationId) - .get({ + .path( + "/pools/{poolId}/nodes/{nodeId}/files/{filePath}", + poolId, + nodeId, + filePath, + ) + .head({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _getApplicationDeserialize( +export async function _getNodeFilePropertiesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return batchApplicationDeserializer(result.body); + return; } -/** - * This operation returns only Applications and versions that are available for - * use on Compute Nodes; that is, that can be used in an Package reference. For - * administrator information about Applications and versions that are not yet - * available to Compute Nodes, use the Azure portal or the Azure Resource Manager - * API. - */ -export async function getApplication( +/** Gets the properties of the specified Compute Node file. */ +export async function getNodeFileProperties( context: Client, - applicationId: string, - options: GetApplicationOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getApplicationSend(context, applicationId, options); - return _getApplicationDeserialize(result); + poolId: string, + nodeId: string, + filePath: string, + options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getNodeFilePropertiesSend( + context, + poolId, + nodeId, + filePath, + options, + ); + return _getNodeFilePropertiesDeserialize(result); } -export function _listPoolUsageMetricsSend( +export function _getNodeFileSend( context: Client, - options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + filePath: string, + options: GetNodeFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/poolusagemetrics") + .path( + "/pools/{poolId}/nodes/{nodeId}/files/{filePath}", + poolId, + nodeId, + filePath, + ) .get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + ...(options?.ocpRange !== undefined + ? { "ocp-range": options?.ocpRange } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - maxresults: options?.maxresults, + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - starttime: options?.starttime?.toISOString(), - endtime: options?.endtime?.toISOString(), - $filter: options?.filter, }, }); } -export async function _listPoolUsageMetricsDeserialize( +export async function _getNodeFileDeserialize( result: PathUncheckedResponse, -): Promise<_PoolListUsageMetricsResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _poolListUsageMetricsResultDeserializer(result.body); + return typeof result.body === "string" + ? stringToUint8Array(result.body, "base64") + : result.body; } -/** - * If you do not specify a $filter clause including a poolId, the response - * includes all Pools that existed in the Account in the time range of the - * returned aggregation intervals. If you do not specify a $filter clause - * including a startTime or endTime these filters default to the start and end - * times of the last aggregation interval currently available; that is, only the - * last aggregation interval is returned. - */ -export function listPoolUsageMetrics( +/** Returns the content of the specified Compute Node file. */ +export async function getNodeFile( context: Client, - options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( + poolId: string, + nodeId: string, + filePath: string, + options: GetNodeFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getNodeFileSend( context, - () => _listPoolUsageMetricsSend(context, options), - _listPoolUsageMetricsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, + poolId, + nodeId, + filePath, + options, ); + return _getNodeFileDeserialize(result); } -export function _createPoolSend( +export function _deleteNodeFileSend( context: Client, - body: BatchPoolCreateOptions, - options: CreatePoolOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + filePath: string, + options: DeleteNodeFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools") - .post({ + .path( + "/pools/{poolId}/nodes/{nodeId}/files/{filePath}", + poolId, + nodeId, + filePath, + ) + .delete({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, + recursive: options?.recursive, }, - body: batchPoolCreateOptionsSerializer(body), }); } -export async function _createPoolDeserialize( +export async function _deleteNodeFileDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["201"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -367,545 +482,545 @@ export async function _createPoolDeserialize( return; } -/** - * When naming Pools, avoid including sensitive information such as user names or - * secret project names. This information may appear in telemetry logs accessible - * to Microsoft Support engineers. - */ -export async function createPool( +/** Deletes the specified file from the Compute Node. */ +export async function deleteNodeFile( context: Client, - body: BatchPoolCreateOptions, - options: CreatePoolOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + filePath: string, + options: DeleteNodeFileOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createPoolSend(context, body, options); - return _createPoolDeserialize(result); + const result = await _deleteNodeFileSend( + context, + poolId, + nodeId, + filePath, + options, + ); + return _deleteNodeFileDeserialize(result); } -export function _listPoolsSend( +export function _listNodeExtensionsSend( context: Client, - options: ListPoolsOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context.path("/pools").get({ - ...operationOptionsToRequestParameters(options), - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - maxresults: options?.maxresults, - timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { - return p; - }), - }, - }); -} - -export async function _listPoolsDeserialize( - result: PathUncheckedResponse, -): Promise<_BatchPoolListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return _batchPoolListResultDeserializer(result.body); -} - -/** Lists all of the Pools in the specified Account. */ -export function listPools( - context: Client, - options: ListPoolsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listPoolsSend(context, options), - _listPoolsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, - ); -} - -export function _deletePoolSend( - context: Client, - poolId: string, - options: DeletePoolOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path("/pools/{poolId}", poolId) - .delete({ + .path("/pools/{poolId}/nodes/{nodeId}/extensions", poolId, nodeId) + .get({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), - ...(options?.ifUnmodifiedSince !== undefined - ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), - } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), }, }); } -export async function _deletePoolDeserialize( +export async function _listNodeExtensionsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202"]; +): Promise<_NodeVMExtensionList> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _nodeVMExtensionListDeserializer(result.body); } -/** - * When you request that a Pool be deleted, the following actions occur: the Pool - * state is set to deleting; any ongoing resize operation on the Pool are stopped; - * the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks - * running on existing Compute Nodes are terminated and requeued (as if a resize - * Pool operation had been requested with the default requeue option); finally, - * the Pool is removed from the system. Because running Tasks are requeued, the - * user can rerun these Tasks by updating their Job to target a different Pool. - * The Tasks can then run on the new Pool. If you want to override the requeue - * behavior, then you should call resize Pool explicitly to shrink the Pool to - * zero size before deleting the Pool. If you call an Update, Patch or Delete API - * on a Pool in the deleting state, it will fail with HTTP status code 409 with - * error code PoolBeingDeleted. - */ -export async function deletePool( +/** Lists the Compute Nodes Extensions in the specified Pool. */ +export function listNodeExtensions( context: Client, poolId: string, - options: DeletePoolOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deletePoolSend(context, poolId, options); - return _deletePoolDeserialize(result); + nodeId: string, + options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listNodeExtensionsSend(context, poolId, nodeId, options), + _listNodeExtensionsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, + ); } -export function _poolExistsSend( +export function _getNodeExtensionSend( context: Client, poolId: string, - options: PoolExistsOptionalParams = { requestOptions: {} }, + nodeId: string, + extensionName: string, + options: GetNodeExtensionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}", poolId) - .head({ + .path( + "/pools/{poolId}/nodes/{nodeId}/extensions/{extensionName}", + poolId, + nodeId, + extensionName, + ) + .get({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), }, }); } -export async function _poolExistsDeserialize( +export async function _getNodeExtensionDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "404"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return nodeVMExtensionDeserializer(result.body); } -/** Gets basic properties of a Pool. */ -export async function poolExists( +/** Gets information about the specified Compute Node Extension. */ +export async function getNodeExtension( context: Client, poolId: string, - options: PoolExistsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _poolExistsSend(context, poolId, options); - return _poolExistsDeserialize(result); + nodeId: string, + extensionName: string, + options: GetNodeExtensionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getNodeExtensionSend( + context, + poolId, + nodeId, + extensionName, + options, + ); + return _getNodeExtensionDeserialize(result); } -export function _getPoolSend( +export function _listNodesSend( context: Client, poolId: string, - options: GetPoolOptionalParams = { requestOptions: {} }, + options: ListNodesOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/pools/{poolId}", poolId).get({ + return context.path("/pools/{poolId}/nodes", poolId).get({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), - ...(options?.ifUnmodifiedSince !== undefined - ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), - } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, + maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { return p; }), }, }); } -export async function _getPoolDeserialize( +export async function _listNodesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_BatchNodeListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return batchPoolDeserializer(result.body); + return _batchNodeListResultDeserializer(result.body); } -/** Gets information about the specified Pool. */ -export async function getPool( +/** Lists the Compute Nodes in the specified Pool. */ +export function listNodes( context: Client, poolId: string, - options: GetPoolOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getPoolSend(context, poolId, options); - return _getPoolDeserialize(result); + options: ListNodesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listNodesSend(context, poolId, options), + _listNodesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, + ); } -export function _updatePoolSend( +export function _uploadNodeLogsSend( context: Client, poolId: string, - body: BatchPoolUpdateOptions, - options: UpdatePoolOptionalParams = { requestOptions: {} }, + nodeId: string, + body: UploadBatchServiceLogsOptions, + options: UploadNodeLogsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}", poolId) - .patch({ + .path( + "/pools/{poolId}/nodes/{nodeId}/uploadbatchservicelogs", + poolId, + nodeId, + ) + .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchPoolUpdateOptionsSerializer(body), + body: uploadBatchServiceLogsOptionsSerializer(body), }); } -export async function _updatePoolDeserialize( +export async function _uploadNodeLogsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return uploadBatchServiceLogsResultDeserializer(result.body); } /** - * This only replaces the Pool properties specified in the request. For example, - * if the Pool has a StartTask associated with it, and a request does not specify - * a StartTask element, then the Pool keeps the existing StartTask. + * This is for gathering Azure Batch service log files in an automated fashion + * from Compute Nodes if you are experiencing an error and wish to escalate to + * Azure support. The Azure Batch service log files should be shared with Azure + * support to aid in debugging issues with the Batch service. */ -export async function updatePool( +export async function uploadNodeLogs( context: Client, poolId: string, - body: BatchPoolUpdateOptions, - options: UpdatePoolOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updatePoolSend(context, poolId, body, options); - return _updatePoolDeserialize(result); + nodeId: string, + body: UploadBatchServiceLogsOptions, + options: UploadNodeLogsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _uploadNodeLogsSend( + context, + poolId, + nodeId, + body, + options, + ); + return _uploadNodeLogsDeserialize(result); } -export function _disablePoolAutoScaleSend( +export function _getNodeRemoteDesktopFileSend( context: Client, poolId: string, - options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, + nodeId: string, + options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/disableautoscale", poolId) - .post({ + .path("/pools/{poolId}/nodes/{nodeId}/rdp", poolId, nodeId) + .get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _disablePoolAutoScaleDeserialize( +export async function _getNodeRemoteDesktopFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return typeof result.body === "string" + ? stringToUint8Array(result.body, "base64") + : result.body; } -/** Disables automatic scaling for a Pool. */ -export async function disablePoolAutoScale( +/** + * Before you can access a Compute Node by using the RDP file, you must create a + * user Account on the Compute Node. This API can only be invoked on Pools created + * with a cloud service configuration. For Pools created with a virtual machine + * configuration, see the GetRemoteLoginSettings API. + */ +export async function getNodeRemoteDesktopFile( context: Client, poolId: string, - options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _disablePoolAutoScaleSend(context, poolId, options); - return _disablePoolAutoScaleDeserialize(result); + nodeId: string, + options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getNodeRemoteDesktopFileSend( + context, + poolId, + nodeId, + options, + ); + return _getNodeRemoteDesktopFileDeserialize(result); } -export function _enablePoolAutoScaleSend( +export function _getNodeRemoteLoginSettingsSend( context: Client, poolId: string, - body: BatchPoolEnableAutoScaleOptions, - options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, + nodeId: string, + options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/enableautoscale", poolId) - .post({ + .path("/pools/{poolId}/nodes/{nodeId}/remoteloginsettings", poolId, nodeId) + .get({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchPoolEnableAutoScaleOptionsSerializer(body), }); } -export async function _enablePoolAutoScaleDeserialize( +export async function _getNodeRemoteLoginSettingsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return batchNodeRemoteLoginSettingsResultDeserializer(result.body); } /** - * You cannot enable automatic scaling on a Pool if a resize operation is in - * progress on the Pool. If automatic scaling of the Pool is currently disabled, - * you must specify a valid autoscale formula as part of the request. If automatic - * scaling of the Pool is already enabled, you may specify a new autoscale formula - * and/or a new evaluation interval. You cannot call this API for the same Pool - * more than once every 30 seconds. + * Before you can remotely login to a Compute Node using the remote login + * settings, you must create a user Account on the Compute Node. This API can be + * invoked only on Pools created with the virtual machine configuration property. + * For Pools created with a cloud service configuration, see the GetRemoteDesktop + * API. */ -export async function enablePoolAutoScale( +export async function getNodeRemoteLoginSettings( context: Client, poolId: string, - body: BatchPoolEnableAutoScaleOptions, - options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _enablePoolAutoScaleSend(context, poolId, body, options); - return _enablePoolAutoScaleDeserialize(result); + nodeId: string, + options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getNodeRemoteLoginSettingsSend( + context, + poolId, + nodeId, + options, + ); + return _getNodeRemoteLoginSettingsDeserialize(result); } -export function _evaluatePoolAutoScaleSend( +export function _enableNodeSchedulingSend( context: Client, poolId: string, - body: BatchPoolEvaluateAutoScaleOptions, - options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, + nodeId: string, + options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/evaluateautoscale", poolId) + .path("/pools/{poolId}/nodes/{nodeId}/enablescheduling", poolId, nodeId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchPoolEvaluateAutoScaleOptionsSerializer(body), }); } -export async function _evaluatePoolAutoScaleDeserialize( +export async function _enableNodeSchedulingDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return autoScaleRunDeserializer(result.body); + return; } /** - * This API is primarily for validating an autoscale formula, as it simply returns - * the result without applying the formula to the Pool. The Pool must have auto - * scaling enabled in order to evaluate a formula. + * You can enable Task scheduling on a Compute Node only if its current scheduling + * state is disabled */ -export async function evaluatePoolAutoScale( +export async function enableNodeScheduling( context: Client, poolId: string, - body: BatchPoolEvaluateAutoScaleOptions, - options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _evaluatePoolAutoScaleSend( + nodeId: string, + options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _enableNodeSchedulingSend( context, poolId, - body, + nodeId, options, ); - return _evaluatePoolAutoScaleDeserialize(result); + return _enableNodeSchedulingDeserialize(result); } -export function _resizePoolSend( +export function _disableNodeSchedulingSend( context: Client, poolId: string, - body: BatchPoolResizeOptions, - options: ResizePoolOptionalParams = { requestOptions: {} }, + nodeId: string, + options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/resize", poolId) + .path("/pools/{poolId}/nodes/{nodeId}/disablescheduling", poolId, nodeId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchPoolResizeOptionsSerializer(body), + body: !options["body"] + ? options["body"] + : nodeDisableSchedulingOptionsSerializer(options["body"]), }); } -export async function _resizePoolDeserialize( +export async function _disableNodeSchedulingDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -914,63 +1029,63 @@ export async function _resizePoolDeserialize( } /** - * You can only resize a Pool when its allocation state is steady. If the Pool is - * already resizing, the request fails with status code 409. When you resize a - * Pool, the Pool's allocation state changes from steady to resizing. You cannot - * resize Pools which are configured for automatic scaling. If you try to do this, - * the Batch service returns an error 409. If you resize a Pool downwards, the - * Batch service chooses which Compute Nodes to remove. To remove specific Compute - * Nodes, use the Pool remove Compute Nodes API instead. + * You can disable Task scheduling on a Compute Node only if its current + * scheduling state is enabled. */ -export async function resizePool( +export async function disableNodeScheduling( context: Client, poolId: string, - body: BatchPoolResizeOptions, - options: ResizePoolOptionalParams = { requestOptions: {} }, + nodeId: string, + options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _resizePoolSend(context, poolId, body, options); - return _resizePoolDeserialize(result); + const result = await _disableNodeSchedulingSend( + context, + poolId, + nodeId, + options, + ); + return _disableNodeSchedulingDeserialize(result); } -export function _stopPoolResizeSend( +export function _reimageNodeSend( context: Client, poolId: string, - options: StopPoolResizeOptionalParams = { requestOptions: {} }, + nodeId: string, + options: ReimageNodeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/stopresize", poolId) + .path("/pools/{poolId}/nodes/{nodeId}/reimage", poolId, nodeId) .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: !options["body"] + ? options["body"] + : nodeReimageOptionsSerializer(options["body"]), }); } -export async function _stopPoolResizeDeserialize( +export async function _reimageNodeDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["202"]; @@ -982,119 +1097,59 @@ export async function _stopPoolResizeDeserialize( } /** - * This does not restore the Pool to its previous state before the resize - * operation: it only stops any further changes being made, and the Pool maintains - * its current state. After stopping, the Pool stabilizes at the number of Compute - * Nodes it was at when the stop operation was done. During the stop operation, - * the Pool allocation state changes first to stopping and then to steady. A - * resize operation need not be an explicit resize Pool request; this API can also - * be used to halt the initial sizing of the Pool when it is created. - */ -export async function stopPoolResize( - context: Client, - poolId: string, - options: StopPoolResizeOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _stopPoolResizeSend(context, poolId, options); - return _stopPoolResizeDeserialize(result); -} - -export function _replacePoolPropertiesSend( - context: Client, - poolId: string, - body: BatchPoolReplaceOptions, - options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/pools/{poolId}/updateproperties", poolId) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - }, - body: batchPoolReplaceOptionsSerializer(body), - }); -} - -export async function _replacePoolPropertiesDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return; -} - -/** - * This fully replaces all the updatable properties of the Pool. For example, if - * the Pool has a StartTask associated with it and if StartTask is not specified - * with this request, then the Batch service will remove the existing StartTask. + * You can reinstall the operating system on a Compute Node only if it is in an + * idle or running state. This API can be invoked only on Pools created with the + * cloud service configuration property. */ -export async function replacePoolProperties( +export async function reimageNode( context: Client, poolId: string, - body: BatchPoolReplaceOptions, - options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, + nodeId: string, + options: ReimageNodeOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _replacePoolPropertiesSend( - context, - poolId, - body, - options, - ); - return _replacePoolPropertiesDeserialize(result); + const result = await _reimageNodeSend(context, poolId, nodeId, options); + return _reimageNodeDeserialize(result); } -export function _removeNodesSend( +export function _rebootNodeSend( context: Client, poolId: string, - body: NodeRemoveOptions, - options: RemoveNodesOptionalParams = { requestOptions: {} }, + nodeId: string, + options: RebootNodeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/removenodes", poolId) + .path("/pools/{poolId}/nodes/{nodeId}/reboot", poolId, nodeId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: nodeRemoveOptionsSerializer(body), + body: !options["body"] + ? options["body"] + : nodeRebootOptionsSerializer(options["body"]), }); } -export async function _removeNodesDeserialize( +export async function _rebootNodeDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["202"]; @@ -1105,150 +1160,199 @@ export async function _removeNodesDeserialize( return; } -/** - * This operation can only run when the allocation state of the Pool is steady. - * When this operation runs, the allocation state changes from steady to resizing. - * Each request may remove up to 100 nodes. - */ -export async function removeNodes( +/** You can restart a Compute Node only if it is in an idle or running state. */ +export async function rebootNode( context: Client, poolId: string, - body: NodeRemoveOptions, - options: RemoveNodesOptionalParams = { requestOptions: {} }, + nodeId: string, + options: RebootNodeOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _removeNodesSend(context, poolId, body, options); - return _removeNodesDeserialize(result); + const result = await _rebootNodeSend(context, poolId, nodeId, options); + return _rebootNodeDeserialize(result); } -export function _listSupportedImagesSend( +export function _getNodeSend( context: Client, - options: ListSupportedImagesOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + options: GetNodeOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context - .path("/supportedimages") - .get({ - ...operationOptionsToRequestParameters(options), - queryParameters: { - maxresults: options?.maxresults, - timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - }, - }); + return context.path("/pools/{poolId}/nodes/{nodeId}", poolId, nodeId).get({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + }, + }); } -export async function _listSupportedImagesDeserialize( +export async function _getNodeDeserialize( result: PathUncheckedResponse, -): Promise<_AccountListSupportedImagesResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _accountListSupportedImagesResultDeserializer(result.body); + return batchNodeDeserializer(result.body); } -/** Lists all Virtual Machine Images supported by the Azure Batch service. */ -export function listSupportedImages( +/** Gets information about the specified Compute Node. */ +export async function getNode( context: Client, - options: ListSupportedImagesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listSupportedImagesSend(context, options), - _listSupportedImagesDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, - ); + poolId: string, + nodeId: string, + options: GetNodeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getNodeSend(context, poolId, nodeId, options); + return _getNodeDeserialize(result); } -export function _listPoolNodeCountsSend( +export function _replaceNodeUserSend( context: Client, - options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + userName: string, + body: BatchNodeUserUpdateOptions, + options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/nodecounts") - .get({ + .path( + "/pools/{poolId}/nodes/{nodeId}/users/{userName}", + poolId, + nodeId, + userName, + ) + .put({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - maxresults: options?.maxresults, + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, }, + body: batchNodeUserUpdateOptionsSerializer(body), }); } -export async function _listPoolNodeCountsDeserialize( +export async function _replaceNodeUserDeserialize( result: PathUncheckedResponse, -): Promise<_PoolNodeCountsListResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _poolNodeCountsListResultDeserializer(result.body); + return; } /** - * Gets the number of Compute Nodes in each state, grouped by Pool. Note that the - * numbers returned may not always be up to date. If you need exact node counts, - * use a list query. + * This operation replaces of all the updatable properties of the Account. For + * example, if the expiryTime element is not specified, the current value is + * replaced with the default value, not left unmodified. You can update a user + * Account on a Compute Node only when it is in the idle or running state. */ -export function listPoolNodeCounts( +export async function replaceNodeUser( context: Client, - options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( + poolId: string, + nodeId: string, + userName: string, + body: BatchNodeUserUpdateOptions, + options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _replaceNodeUserSend( context, - () => _listPoolNodeCountsSend(context, options), - _listPoolNodeCountsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, + poolId, + nodeId, + userName, + body, + options, ); + return _replaceNodeUserDeserialize(result); } -export function _deleteJobSend( +export function _deleteNodeUserSend( context: Client, - jobId: string, - options: DeleteJobOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + userName: string, + options: DeleteNodeUserOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}", jobId) + .path( + "/pools/{poolId}/nodes/{nodeId}/users/{userName}", + poolId, + nodeId, + userName, + ) .delete({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _deleteJobDeserialize( +export async function _deleteNodeUserDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -1257,179 +1361,188 @@ export async function _deleteJobDeserialize( } /** - * Deleting a Job also deletes all Tasks that are part of that Job, and all Job - * statistics. This also overrides the retention period for Task data; that is, if - * the Job contains Tasks which are still retained on Compute Nodes, the Batch - * services deletes those Tasks' working directories and all their contents. When - * a Delete Job request is received, the Batch service sets the Job to the - * deleting state. All update operations on a Job that is in deleting state will - * fail with status code 409 (Conflict), with additional information indicating - * that the Job is being deleted. + * You can delete a user Account to a Compute Node only when it is in the idle or + * running state. */ -export async function deleteJob( +export async function deleteNodeUser( context: Client, - jobId: string, - options: DeleteJobOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + userName: string, + options: DeleteNodeUserOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteJobSend(context, jobId, options); - return _deleteJobDeserialize(result); + const result = await _deleteNodeUserSend( + context, + poolId, + nodeId, + userName, + options, + ); + return _deleteNodeUserDeserialize(result); } -export function _getJobSend( +export function _createNodeUserSend( context: Client, - jobId: string, - options: GetJobOptionalParams = { requestOptions: {} }, + poolId: string, + nodeId: string, + body: BatchNodeUserCreateOptions, + options: CreateNodeUserOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/jobs/{jobId}", jobId).get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } - : {}), - ...(options?.ifUnmodifiedSince !== undefined - ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), - } - : {}), - }, - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { - return p; - }), - }, - }); + return context + .path("/pools/{poolId}/nodes/{nodeId}/users", poolId, nodeId) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + }, + body: batchNodeUserCreateOptionsSerializer(body), + }); } -export async function _getJobDeserialize( +export async function _createNodeUserDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return batchJobDeserializer(result.body); + return; } -/** Gets information about the specified Job. */ -export async function getJob( +/** + * You can add a user Account to a Compute Node only when it is in the idle or + * running state. + */ +export async function createNodeUser( context: Client, - jobId: string, - options: GetJobOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getJobSend(context, jobId, options); - return _getJobDeserialize(result); + poolId: string, + nodeId: string, + body: BatchNodeUserCreateOptions, + options: CreateNodeUserOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createNodeUserSend( + context, + poolId, + nodeId, + body, + options, + ); + return _createNodeUserDeserialize(result); } -export function _updateJobSend( +export function _listTaskFilesSend( context: Client, jobId: string, - body: BatchJobUpdateOptions, - options: UpdateJobOptionalParams = { requestOptions: {} }, + taskId: string, + options: ListTaskFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}", jobId) - .patch({ + .path("/jobs/{jobId}/tasks/{taskId}/files", jobId, taskId) + .get({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), - ...(options?.ifUnmodifiedSince !== undefined - ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), - } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, + maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, + $filter: options?.$filter, + recursive: options?.recursive, }, - body: batchJobUpdateOptionsSerializer(body), }); } -export async function _updateJobDeserialize( +export async function _listTaskFilesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_NodeFileListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _nodeFileListResultDeserializer(result.body); } -/** - * This replaces only the Job properties specified in the request. For example, if - * the Job has constraints, and a request does not specify the constraints - * element, then the Job keeps the existing constraints. - */ -export async function updateJob( +/** Lists the files in a Task's directory on its Compute Node. */ +export function listTaskFiles( context: Client, jobId: string, - body: BatchJobUpdateOptions, - options: UpdateJobOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updateJobSend(context, jobId, body, options); - return _updateJobDeserialize(result); + taskId: string, + options: ListTaskFilesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listTaskFilesSend(context, jobId, taskId, options), + _listTaskFilesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, + ); } -export function _replaceJobSend( +export function _getTaskFilePropertiesSend( context: Client, jobId: string, - body: BatchJob, - options: ReplaceJobOptionalParams = { requestOptions: {} }, + taskId: string, + filePath: string, + options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}", jobId) - .put({ + .path( + "/jobs/{jobId}/tasks/{taskId}/files/{filePath}", + jobId, + taskId, + filePath, + ) + .head({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } : {}), ...(options?.ifModifiedSince !== undefined ? { @@ -1445,16 +1558,17 @@ export function _replaceJobSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchJobSerializer(body), }); } -export async function _replaceJobDeserialize( +export async function _getTaskFilePropertiesDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1465,40 +1579,53 @@ export async function _replaceJobDeserialize( return; } -/** - * This fully replaces all the updatable properties of the Job. For example, if - * the Job has constraints associated with it and if constraints is not specified - * with this request, then the Batch service will remove the existing constraints. - */ -export async function replaceJob( +/** Gets the properties of the specified Task file. */ +export async function getTaskFileProperties( context: Client, jobId: string, - body: BatchJob, - options: ReplaceJobOptionalParams = { requestOptions: {} }, + taskId: string, + filePath: string, + options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _replaceJobSend(context, jobId, body, options); - return _replaceJobDeserialize(result); + const result = await _getTaskFilePropertiesSend( + context, + jobId, + taskId, + filePath, + options, + ); + return _getTaskFilePropertiesDeserialize(result); } -export function _disableJobSend( +export function _getTaskFileSend( context: Client, jobId: string, - body: BatchJobDisableOptions, - options: DisableJobOptionalParams = { requestOptions: {} }, + taskId: string, + filePath: string, + options: GetTaskFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/disable", jobId) - .post({ + .path( + "/jobs/{jobId}/tasks/{taskId}/files/{filePath}", + jobId, + taskId, + filePath, + ) + .get({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } : {}), ...(options?.ifModifiedSince !== undefined ? { @@ -1514,88 +1641,93 @@ export function _disableJobSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + ...(options?.ocpRange !== undefined + ? { "ocp-range": options?.ocpRange } + : {}), + accept: "application/octet-stream", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchJobDisableOptionsSerializer(body), }); } -export async function _disableJobDeserialize( +export async function _getTaskFileDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return result.body; } -/** - * The Batch Service immediately moves the Job to the disabling state. Batch then - * uses the disableTasks parameter to determine what to do with the currently - * running Tasks of the Job. The Job remains in the disabling state until the - * disable operation is completed and all Tasks have been dealt with according to - * the disableTasks option; the Job then moves to the disabled state. No new Tasks - * are started under the Job until it moves back to active state. If you try to - * disable a Job that is in any state other than active, disabling, or disabled, - * the request fails with status code 409. - */ -export async function disableJob( +/** Returns the content of the specified Task file. */ +export async function getTaskFile( context: Client, jobId: string, - body: BatchJobDisableOptions, - options: DisableJobOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _disableJobSend(context, jobId, body, options); - return _disableJobDeserialize(result); + taskId: string, + filePath: string, + options: GetTaskFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTaskFileSend( + context, + jobId, + taskId, + filePath, + options, + ); + return _getTaskFileDeserialize(result); } -export function _enableJobSend( +export function _deleteTaskFileSend( context: Client, jobId: string, - options: EnableJobOptionalParams = { requestOptions: {} }, + taskId: string, + filePath: string, + options: DeleteTaskFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/enable", jobId) - .post({ + .path( + "/jobs/{jobId}/tasks/{taskId}/files/{filePath}", + jobId, + taskId, + filePath, + ) + .delete({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, + recursive: options?.recursive, }, }); } -export async function _enableJobDeserialize( +export async function _deleteTaskFileDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -1603,36 +1735,48 @@ export async function _enableJobDeserialize( return; } -/** - * When you call this API, the Batch service sets a disabled Job to the enabling - * state. After the this operation is completed, the Job moves to the active - * state, and scheduling of new Tasks under the Job resumes. The Batch service - * does not allow a Task to remain in the active state for more than 180 days. - * Therefore, if you enable a Job containing active Tasks which were added more - * than 180 days ago, those Tasks will not run. - */ -export async function enableJob( +/** Deletes the specified Task file from the Compute Node where the Task ran. */ +export async function deleteTaskFile( context: Client, jobId: string, - options: EnableJobOptionalParams = { requestOptions: {} }, + taskId: string, + filePath: string, + options: DeleteTaskFileOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _enableJobSend(context, jobId, options); - return _enableJobDeserialize(result); + const result = await _deleteTaskFileSend( + context, + jobId, + taskId, + filePath, + options, + ); + return _deleteTaskFileDeserialize(result); } -export function _terminateJobSend( +export function _reactivateTaskSend( context: Client, jobId: string, - options: TerminateJobOptionalParams = { requestOptions: {} }, + taskId: string, + options: ReactivateTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/terminate", jobId) + .path("/jobs/{jobId}/tasks/{taskId}/reactivate", jobId, taskId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -1653,21 +1797,20 @@ export function _terminateJobSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: !options["body"] - ? options["body"] - : batchJobTerminateOptionsSerializer(options["body"]), }); } -export async function _terminateJobDeserialize( +export async function _reactivateTaskDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -1676,46 +1819,82 @@ export async function _terminateJobDeserialize( } /** - * When a Terminate Job request is received, the Batch service sets the Job to the - * terminating state. The Batch service then terminates any running Tasks - * associated with the Job and runs any required Job release Tasks. Then the Job - * moves into the completed state. If there are any Tasks in the Job in the active - * state, they will remain in the active state. Once a Job is terminated, new - * Tasks cannot be added and any remaining active Tasks will not be scheduled. + * Reactivation makes a Task eligible to be retried again up to its maximum retry + * count. The Task's state is changed to active. As the Task is no longer in the + * completed state, any previous exit code or failure information is no longer + * available after reactivation. Each time a Task is reactivated, its retry count + * is reset to 0. Reactivation will fail for Tasks that are not completed or that + * previously completed successfully (with an exit code of 0). Additionally, it + * will fail if the Job has completed (or is terminating or deleting). */ -export async function terminateJob( +export async function reactivateTask( context: Client, jobId: string, - options: TerminateJobOptionalParams = { requestOptions: {} }, + taskId: string, + options: ReactivateTaskOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _terminateJobSend(context, jobId, options); - return _terminateJobDeserialize(result); + const result = await _reactivateTaskSend(context, jobId, taskId, options); + return _reactivateTaskDeserialize(result); } -export function _createJobSend( +export function _terminateTaskSend( context: Client, - body: BatchJobCreateOptions, - options: CreateJobOptionalParams = { requestOptions: {} }, + jobId: string, + taskId: string, + options: TerminateTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs") + .path("/jobs/{jobId}/tasks/{taskId}/terminate", jobId, taskId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchJobCreateOptionsSerializer(body), }); } -export async function _createJobDeserialize( +export async function _terminateTaskDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["201"]; + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -1724,251 +1903,519 @@ export async function _createJobDeserialize( } /** - * The Batch service supports two ways to control the work done as part of a Job. - * In the first approach, the user specifies a Job Manager Task. The Batch service - * launches this Task when it is ready to start the Job. The Job Manager Task - * controls all other Tasks that run under this Job, by using the Task APIs. In - * the second approach, the user directly controls the execution of Tasks under an - * active Job, by using the Task APIs. Also note: when naming Jobs, avoid - * including sensitive information such as user names or secret project names. - * This information may appear in telemetry logs accessible to Microsoft Support - * engineers. + * When the Task has been terminated, it moves to the completed state. For + * multi-instance Tasks, the terminate Task operation applies synchronously to the + * primary task; subtasks are then terminated asynchronously in the background. */ -export async function createJob( +export async function terminateTask( context: Client, - body: BatchJobCreateOptions, - options: CreateJobOptionalParams = { requestOptions: {} }, + jobId: string, + taskId: string, + options: TerminateTaskOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createJobSend(context, body, options); - return _createJobDeserialize(result); + const result = await _terminateTaskSend(context, jobId, taskId, options); + return _terminateTaskDeserialize(result); } -export function _listJobsSend( +export function _listSubTasksSend( context: Client, - options: ListJobsOptionalParams = { requestOptions: {} }, + jobId: string, + taskId: string, + options: ListSubTasksOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/jobs").get({ - ...operationOptionsToRequestParameters(options), - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - maxresults: options?.maxresults, - timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { - return p; - }), - }, - }); + return context + .path("/jobs/{jobId}/tasks/{taskId}/subtasksinfo", jobId, taskId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + }, + }); } -export async function _listJobsDeserialize( +export async function _listSubTasksDeserialize( result: PathUncheckedResponse, -): Promise<_BatchJobListResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _batchJobListResultDeserializer(result.body); + return batchTaskListSubtasksResultDeserializer(result.body); } -/** Lists all of the Jobs in the specified Account. */ -export function listJobs( +/** If the Task is not a multi-instance Task then this returns an empty collection. */ +export async function listSubTasks( context: Client, - options: ListJobsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listJobsSend(context, options), - _listJobsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, - ); + jobId: string, + taskId: string, + options: ListSubTasksOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSubTasksSend(context, jobId, taskId, options); + return _listSubTasksDeserialize(result); } -export function _listJobsFromScheduleSend( +export function _replaceTaskSend( context: Client, - jobScheduleId: string, - options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, + jobId: string, + taskId: string, + body: BatchTask, + options: ReplaceTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/jobschedules/{jobScheduleId}/jobs", jobScheduleId).get({ + return context + .path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + }, + body: batchTaskSerializer(body), + }); +} + +export async function _replaceTaskDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Updates the properties of the specified Task. */ +export async function replaceTask( + context: Client, + jobId: string, + taskId: string, + body: BatchTask, + options: ReplaceTaskOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _replaceTaskSend(context, jobId, taskId, body, options); + return _replaceTaskDeserialize(result); +} + +export function _getTaskSend( + context: Client, + jobId: string, + taskId: string, + options: GetTaskOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context.path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId).get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - maxresults: options?.maxresults, + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { return p; }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { return p; }), }, }); } -export async function _listJobsFromScheduleDeserialize( +export async function _getTaskDeserialize( result: PathUncheckedResponse, -): Promise<_BatchJobListResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _batchJobListResultDeserializer(result.body); + return batchTaskDeserializer(result.body); } -/** Lists the Jobs that have been created under the specified Job Schedule. */ -export function listJobsFromSchedule( +/** + * For multi-instance Tasks, information such as affinityId, executionInfo and + * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve + * information about subtasks. + */ +export async function getTask( context: Client, - jobScheduleId: string, - options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listJobsFromScheduleSend(context, jobScheduleId, options), - _listJobsFromScheduleDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, - ); + jobId: string, + taskId: string, + options: GetTaskOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTaskSend(context, jobId, taskId, options); + return _getTaskDeserialize(result); } -export function _listJobPreparationAndReleaseTaskStatusSend( +export function _deleteTaskSend( context: Client, jobId: string, - options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { - requestOptions: {}, - }, + taskId: string, + options: DeleteTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/jobpreparationandreleasetaskstatus", jobId) - .get({ + .path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId) + .delete({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - maxresults: options?.maxresults, + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), }, }); } -export async function _listJobPreparationAndReleaseTaskStatusDeserialize( +export async function _deleteTaskDeserialize( result: PathUncheckedResponse, -): Promise<_BatchJobListPreparationAndReleaseTaskStatusResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _batchJobListPreparationAndReleaseTaskStatusResultDeserializer( - result.body, - ); + return; } /** - * This API returns the Job Preparation and Job Release Task status on all Compute - * Nodes that have run the Job Preparation or Job Release Task. This includes - * Compute Nodes which have since been removed from the Pool. If this API is - * invoked on a Job which has no Job Preparation or Job Release Task, the Batch - * service returns HTTP status code 409 (Conflict) with an error code of - * JobPreparationTaskNotSpecified. + * When a Task is deleted, all of the files in its directory on the Compute Node + * where it ran are also deleted (regardless of the retention time). For + * multi-instance Tasks, the delete Task operation applies synchronously to the + * primary task; subtasks and their files are then deleted asynchronously in the + * background. */ -export function listJobPreparationAndReleaseTaskStatus( +export async function deleteTask( context: Client, jobId: string, - options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listJobPreparationAndReleaseTaskStatusSend(context, jobId, options), - _listJobPreparationAndReleaseTaskStatusDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, - ); + taskId: string, + options: DeleteTaskOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteTaskSend(context, jobId, taskId, options); + return _deleteTaskDeserialize(result); } -export function _getJobTaskCountsSend( +export function _createTaskCollectionSend( context: Client, jobId: string, - options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, + collection: BatchTaskCollection, + options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/taskcounts", jobId) - .get({ + .path("/jobs/{jobId}/addtaskcollection", jobId) + .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchTaskCollectionSerializer(collection), }); } -export async function _getJobTaskCountsDeserialize( +export async function _createTaskCollectionDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return taskCountsResultDeserializer(result.body); + return taskAddCollectionResultDeserializer(result.body); } /** - * Task counts provide a count of the Tasks by active, running or completed Task - * state, and a count of Tasks which succeeded or failed. Tasks in the preparing - * state are counted as running. Note that the numbers returned may not always be - * up to date. If you need exact task counts, use a list query. + * Note that each Task must have a unique ID. The Batch service may not return the + * results for each Task in the same order the Tasks were submitted in this + * request. If the server times out or the connection is closed during the + * request, the request may have been partially or fully processed, or not at all. + * In such cases, the user should re-issue the request. Note that it is up to the + * user to correctly handle failures when re-issuing a request. For example, you + * should use the same Task IDs during a retry so that if the prior operation + * succeeded, the retry will not create extra Tasks unexpectedly. If the response + * contains any Tasks which failed to add, a client can retry the request. In a + * retry, it is most efficient to resubmit only Tasks that failed to add, and to + * omit Tasks that were successfully added on the first attempt. The maximum + * lifetime of a Task from addition to completion is 180 days. If a Task has not + * completed within 180 days of being added it will be terminated by the Batch + * service and left in whatever state it was in at that time. */ -export async function getJobTaskCounts( +export async function createTaskCollection( context: Client, jobId: string, - options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getJobTaskCountsSend(context, jobId, options); - return _getJobTaskCountsDeserialize(result); + collection: BatchTaskCollection, + options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createTaskCollectionSend( + context, + jobId, + collection, + options, + ); + return _createTaskCollectionDeserialize(result); } -export function _createCertificateSend( +export function _listTasksSend( context: Client, - body: BatchCertificate, - options: CreateCertificateOptionalParams = { requestOptions: {} }, + jobId: string, + options: ListTasksOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context.path("/jobs/{jobId}/tasks", jobId).get({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + maxresults: options?.maxresults, + timeOut: options?.timeOutInSeconds, + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { + return p; + }), + }, + }); +} + +export async function _listTasksDeserialize( + result: PathUncheckedResponse, +): Promise<_BatchTaskListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _batchTaskListResultDeserializer(result.body); +} + +/** + * For multi-instance Tasks, information such as affinityId, executionInfo and + * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve + * information about subtasks. + */ +export function listTasks( + context: Client, + jobId: string, + options: ListTasksOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listTasksSend(context, jobId, options), + _listTasksDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, + ); +} + +export function _createTaskSend( + context: Client, + jobId: string, + body: BatchTaskCreateOptions, + options: CreateTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/certificates") + .path("/jobs/{jobId}/tasks", jobId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchCertificateSerializer(body), + body: batchTaskCreateOptionsSerializer(body), }); } -export async function _createCertificateDeserialize( +export async function _createTaskDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["201"]; @@ -1979,86 +2426,201 @@ export async function _createCertificateDeserialize( return; } -/** Creates a Certificate to the specified Account. */ -export async function createCertificate( +/** + * The maximum lifetime of a Task from addition to completion is 180 days. If a + * Task has not completed within 180 days of being added it will be terminated by + * the Batch service and left in whatever state it was in at that time. + */ +export async function createTask( context: Client, - body: BatchCertificate, - options: CreateCertificateOptionalParams = { requestOptions: {} }, + jobId: string, + body: BatchTaskCreateOptions, + options: CreateTaskOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createCertificateSend(context, body, options); - return _createCertificateDeserialize(result); + const result = await _createTaskSend(context, jobId, body, options); + return _createTaskDeserialize(result); } -export function _listCertificatesSend( +export function _listJobSchedulesSend( context: Client, - options: ListCertificatesOptionalParams = { requestOptions: {} }, + options: ListJobSchedulesOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/certificates").get({ + return context.path("/jobschedules").get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { return p; }), }, }); } -export async function _listCertificatesDeserialize( +export async function _listJobSchedulesDeserialize( result: PathUncheckedResponse, -): Promise<_CertificateListResult> { +): Promise<_BatchJobScheduleListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _certificateListResultDeserializer(result.body); + return _batchJobScheduleListResultDeserializer(result.body); } -/** Lists all of the Certificates that have been added to the specified Account. */ -export function listCertificates( +/** Lists all of the Job Schedules in the specified Account. */ +export function listJobSchedules( context: Client, - options: ListCertificatesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + options: ListJobSchedulesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listCertificatesSend(context, options), - _listCertificatesDeserialize, + () => _listJobSchedulesSend(context, options), + _listJobSchedulesDeserialize, ["200"], { itemName: "value", nextLinkName: "odata.nextLink" }, ); } -export function _cancelCertificateDeletionSend( +export function _createJobScheduleSend( + context: Client, + body: BatchJobScheduleCreateOptions, + options: CreateJobScheduleOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/jobschedules") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + }, + body: batchJobScheduleCreateOptionsSerializer(body), + }); +} + +export async function _createJobScheduleDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Creates a Job Schedule to the specified Account. */ +export async function createJobSchedule( + context: Client, + body: BatchJobScheduleCreateOptions, + options: CreateJobScheduleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createJobScheduleSend(context, body, options); + return _createJobScheduleDeserialize(result); +} + +export function _terminateJobScheduleSend( context: Client, - thumbprintAlgorithm: string, - thumbprint: string, - options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, + jobScheduleId: string, + options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})/canceldelete", - thumbprintAlgorithm, - thumbprint, - ) + .path("/jobschedules/{jobScheduleId}/terminate", jobScheduleId) .post({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _cancelCertificateDeletionDeserialize( +export async function _terminateJobScheduleDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["204"]; + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -2066,55 +2628,77 @@ export async function _cancelCertificateDeletionDeserialize( return; } -/** - * If you try to delete a Certificate that is being used by a Pool or Compute - * Node, the status of the Certificate changes to deleteFailed. If you decide that - * you want to continue using the Certificate, you can use this operation to set - * the status of the Certificate back to active. If you intend to delete the - * Certificate, you do not need to run this operation after the deletion failed. - * You must make sure that the Certificate is not being used by any resources, and - * then you can try again to delete the Certificate. - */ -export async function cancelCertificateDeletion( +/** Terminates a Job Schedule. */ +export async function terminateJobSchedule( context: Client, - thumbprintAlgorithm: string, - thumbprint: string, - options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, + jobScheduleId: string, + options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _cancelCertificateDeletionSend( + const result = await _terminateJobScheduleSend( context, - thumbprintAlgorithm, - thumbprint, + jobScheduleId, options, ); - return _cancelCertificateDeletionDeserialize(result); + return _terminateJobScheduleDeserialize(result); } -export function _deleteCertificateSend( +export function _enableJobScheduleSend( context: Client, - thumbprintAlgorithm: string, - thumbprint: string, - options: DeleteCertificateOptionalParams = { requestOptions: {} }, + jobScheduleId: string, + options: EnableJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})", - thumbprintAlgorithm, - thumbprint, - ) - .delete({ + .path("/jobschedules/{jobScheduleId}/enable", jobScheduleId) + .post({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _deleteCertificateDeserialize( +export async function _enableJobScheduleDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -2122,95 +2706,115 @@ export async function _deleteCertificateDeserialize( return; } -/** - * You cannot delete a Certificate if a resource (Pool or Compute Node) is using - * it. Before you can delete a Certificate, you must therefore make sure that the - * Certificate is not associated with any existing Pools, the Certificate is not - * installed on any Nodes (even if you remove a Certificate from a Pool, it is not - * removed from existing Compute Nodes in that Pool until they restart), and no - * running Tasks depend on the Certificate. If you try to delete a Certificate - * that is in use, the deletion fails. The Certificate status changes to - * deleteFailed. You can use Cancel Delete Certificate to set the status back to - * active if you decide that you want to continue using the Certificate. - */ -export async function deleteCertificate( +/** Enables a Job Schedule. */ +export async function enableJobSchedule( context: Client, - thumbprintAlgorithm: string, - thumbprint: string, - options: DeleteCertificateOptionalParams = { requestOptions: {} }, + jobScheduleId: string, + options: EnableJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteCertificateSend( - context, - thumbprintAlgorithm, - thumbprint, - options, - ); - return _deleteCertificateDeserialize(result); + const result = await _enableJobScheduleSend(context, jobScheduleId, options); + return _enableJobScheduleDeserialize(result); } -export function _getCertificateSend( +export function _disableJobScheduleSend( context: Client, - thumbprintAlgorithm: string, - thumbprint: string, - options: GetCertificateOptionalParams = { requestOptions: {} }, + jobScheduleId: string, + options: DisableJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})", - thumbprintAlgorithm, - thumbprint, - ) - .get({ + .path("/jobschedules/{jobScheduleId}/disable", jobScheduleId) + .post({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), }, }); } -export async function _getCertificateDeserialize( +export async function _disableJobScheduleDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return batchCertificateDeserializer(result.body); + return; } -/** Gets information about the specified Certificate. */ -export async function getCertificate( +/** No new Jobs will be created until the Job Schedule is enabled again. */ +export async function disableJobSchedule( context: Client, - thumbprintAlgorithm: string, - thumbprint: string, - options: GetCertificateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getCertificateSend( - context, - thumbprintAlgorithm, - thumbprint, - options, - ); - return _getCertificateDeserialize(result); + jobScheduleId: string, + options: DisableJobScheduleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _disableJobScheduleSend(context, jobScheduleId, options); + return _disableJobScheduleDeserialize(result); } -export function _jobScheduleExistsSend( +export function _replaceJobScheduleSend( context: Client, jobScheduleId: string, - options: JobScheduleExistsOptionalParams = { requestOptions: {} }, + body: BatchJobSchedule, + options: ReplaceJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobschedules/{jobScheduleId}", jobScheduleId) - .head({ + .put({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -2231,18 +2835,21 @@ export function _jobScheduleExistsSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchJobScheduleSerializer(body), }); } -export async function _jobScheduleExistsDeserialize( +export async function _replaceJobScheduleDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200", "404"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -2250,26 +2857,53 @@ export async function _jobScheduleExistsDeserialize( return; } -/** Checks the specified Job Schedule exists. */ -export async function jobScheduleExists( +/** + * This fully replaces all the updatable properties of the Job Schedule. For + * example, if the schedule property is not specified with this request, then the + * Batch service will remove the existing schedule. Changes to a Job Schedule only + * impact Jobs created by the schedule after the update has taken place; currently + * running Jobs are unaffected. + */ +export async function replaceJobSchedule( context: Client, jobScheduleId: string, - options: JobScheduleExistsOptionalParams = { requestOptions: {} }, + body: BatchJobSchedule, + options: ReplaceJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _jobScheduleExistsSend(context, jobScheduleId, options); - return _jobScheduleExistsDeserialize(result); + const result = await _replaceJobScheduleSend( + context, + jobScheduleId, + body, + options, + ); + return _replaceJobScheduleDeserialize(result); } -export function _deleteJobScheduleSend( +export function _updateJobScheduleSend( context: Client, jobScheduleId: string, - options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, + body: BatchJobScheduleUpdateOptions, + options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobschedules/{jobScheduleId}", jobScheduleId) - .delete({ + .patch({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -2290,18 +2924,21 @@ export function _deleteJobScheduleSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchJobScheduleUpdateOptionsSerializer(body), }); } -export async function _deleteJobScheduleDeserialize( +export async function _updateJobScheduleDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -2310,19 +2947,25 @@ export async function _deleteJobScheduleDeserialize( } /** - * When you delete a Job Schedule, this also deletes all Jobs and Tasks under that - * schedule. When Tasks are deleted, all the files in their working directories on - * the Compute Nodes are also deleted (the retention period is ignored). The Job - * Schedule statistics are no longer accessible once the Job Schedule is deleted, - * though they are still counted towards Account lifetime statistics. + * This replaces only the Job Schedule properties specified in the request. For + * example, if the schedule property is not specified with this request, then the + * Batch service will keep the existing schedule. Changes to a Job Schedule only + * impact Jobs created by the schedule after the update has taken place; currently + * running Jobs are unaffected. */ -export async function deleteJobSchedule( +export async function updateJobSchedule( context: Client, jobScheduleId: string, - options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, + body: BatchJobScheduleUpdateOptions, + options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteJobScheduleSend(context, jobScheduleId, options); - return _deleteJobScheduleDeserialize(result); + const result = await _updateJobScheduleSend( + context, + jobScheduleId, + body, + options, + ); + return _updateJobScheduleDeserialize(result); } export function _getJobScheduleSend( @@ -2333,6 +2976,19 @@ export function _getJobScheduleSend( return context.path("/jobschedules/{jobScheduleId}", jobScheduleId).get({ ...operationOptionsToRequestParameters(options), headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -2353,18 +3009,20 @@ export function _getJobScheduleSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { return p; }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { return p; }), }, @@ -2392,20 +3050,29 @@ export async function getJobSchedule( return _getJobScheduleDeserialize(result); } -export function _updateJobScheduleSend( +export function _deleteJobScheduleSend( context: Client, jobScheduleId: string, - body: BatchJobScheduleUpdateOptions, - options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, + options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobschedules/{jobScheduleId}", jobScheduleId) - .patch({ + .delete({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -2426,19 +3093,20 @@ export function _updateJobScheduleSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchJobScheduleUpdateOptionsSerializer(body), }); } -export async function _updateJobScheduleDeserialize( +export async function _deleteJobScheduleDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -2447,41 +3115,44 @@ export async function _updateJobScheduleDeserialize( } /** - * This replaces only the Job Schedule properties specified in the request. For - * example, if the schedule property is not specified with this request, then the - * Batch service will keep the existing schedule. Changes to a Job Schedule only - * impact Jobs created by the schedule after the update has taken place; currently - * running Jobs are unaffected. + * When you delete a Job Schedule, this also deletes all Jobs and Tasks under that + * schedule. When Tasks are deleted, all the files in their working directories on + * the Compute Nodes are also deleted (the retention period is ignored). The Job + * Schedule statistics are no longer accessible once the Job Schedule is deleted, + * though they are still counted towards Account lifetime statistics. */ -export async function updateJobSchedule( +export async function deleteJobSchedule( context: Client, jobScheduleId: string, - body: BatchJobScheduleUpdateOptions, - options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, + options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _updateJobScheduleSend( - context, - jobScheduleId, - body, - options, - ); - return _updateJobScheduleDeserialize(result); + const result = await _deleteJobScheduleSend(context, jobScheduleId, options); + return _deleteJobScheduleDeserialize(result); } -export function _replaceJobScheduleSend( +export function _jobScheduleExistsSend( context: Client, jobScheduleId: string, - body: BatchJobSchedule, - options: ReplaceJobScheduleOptionalParams = { requestOptions: {} }, + options: JobScheduleExistsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobschedules/{jobScheduleId}", jobScheduleId) - .put({ + .head({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -2502,19 +3173,20 @@ export function _replaceJobScheduleSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchJobScheduleSerializer(body), }); } -export async function _replaceJobScheduleDeserialize( +export async function _jobScheduleExistsDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["200", "404"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -2522,67 +3194,200 @@ export async function _replaceJobScheduleDeserialize( return; } -/** - * This fully replaces all the updatable properties of the Job Schedule. For - * example, if the schedule property is not specified with this request, then the - * Batch service will remove the existing schedule. Changes to a Job Schedule only - * impact Jobs created by the schedule after the update has taken place; currently - * running Jobs are unaffected. - */ -export async function replaceJobSchedule( +/** Checks the specified Job Schedule exists. */ +export async function jobScheduleExists( context: Client, jobScheduleId: string, - body: BatchJobSchedule, - options: ReplaceJobScheduleOptionalParams = { requestOptions: {} }, + options: JobScheduleExistsOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _replaceJobScheduleSend( + const result = await _jobScheduleExistsSend(context, jobScheduleId, options); + return _jobScheduleExistsDeserialize(result); +} + +export function _getCertificateSend( + context: Client, + thumbprintAlgorithm: string, + thumbprint: string, + options: GetCertificateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})", + thumbprintAlgorithm, + thumbprint, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + }, + }); +} + +export async function _getCertificateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return batchCertificateDeserializer(result.body); +} + +/** Gets information about the specified Certificate. */ +export async function getCertificate( + context: Client, + thumbprintAlgorithm: string, + thumbprint: string, + options: GetCertificateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getCertificateSend( context, - jobScheduleId, - body, + thumbprintAlgorithm, + thumbprint, options, ); - return _replaceJobScheduleDeserialize(result); + return _getCertificateDeserialize(result); } -export function _disableJobScheduleSend( +export function _deleteCertificateSend( context: Client, - jobScheduleId: string, - options: DisableJobScheduleOptionalParams = { requestOptions: {} }, + thumbprintAlgorithm: string, + thumbprint: string, + options: DeleteCertificateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobschedules/{jobScheduleId}/disable", jobScheduleId) - .post({ + .path( + "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})", + thumbprintAlgorithm, + thumbprint, + ) + .delete({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifModifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), - ...(options?.ifUnmodifiedSince !== undefined + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + }, + }); +} + +export async function _deleteCertificateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** + * You cannot delete a Certificate if a resource (Pool or Compute Node) is using + * it. Before you can delete a Certificate, you must therefore make sure that the + * Certificate is not associated with any existing Pools, the Certificate is not + * installed on any Nodes (even if you remove a Certificate from a Pool, it is not + * removed from existing Compute Nodes in that Pool until they restart), and no + * running Tasks depend on the Certificate. If you try to delete a Certificate + * that is in use, the deletion fails. The Certificate status changes to + * deleteFailed. You can use Cancel Delete Certificate to set the status back to + * active if you decide that you want to continue using the Certificate. + */ +export async function deleteCertificate( + context: Client, + thumbprintAlgorithm: string, + thumbprint: string, + options: DeleteCertificateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteCertificateSend( + context, + thumbprintAlgorithm, + thumbprint, + options, + ); + return _deleteCertificateDeserialize(result); +} + +export function _cancelCertificateDeletionSend( + context: Client, + thumbprintAlgorithm: string, + thumbprint: string, + options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})/canceldelete", + thumbprintAlgorithm, + thumbprint, + ) + .post({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _disableJobScheduleDeserialize( +export async function _cancelCertificateDeletionDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -2593,58 +3398,131 @@ export async function _disableJobScheduleDeserialize( return; } -/** No new Jobs will be created until the Job Schedule is enabled again. */ -export async function disableJobSchedule( +/** + * If you try to delete a Certificate that is being used by a Pool or Compute + * Node, the status of the Certificate changes to deleteFailed. If you decide that + * you want to continue using the Certificate, you can use this operation to set + * the status of the Certificate back to active. If you intend to delete the + * Certificate, you do not need to run this operation after the deletion failed. + * You must make sure that the Certificate is not being used by any resources, and + * then you can try again to delete the Certificate. + */ +export async function cancelCertificateDeletion( context: Client, - jobScheduleId: string, - options: DisableJobScheduleOptionalParams = { requestOptions: {} }, + thumbprintAlgorithm: string, + thumbprint: string, + options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _disableJobScheduleSend(context, jobScheduleId, options); - return _disableJobScheduleDeserialize(result); + const result = await _cancelCertificateDeletionSend( + context, + thumbprintAlgorithm, + thumbprint, + options, + ); + return _cancelCertificateDeletionDeserialize(result); } -export function _enableJobScheduleSend( +export function _listCertificatesSend( context: Client, - jobScheduleId: string, - options: EnableJobScheduleOptionalParams = { requestOptions: {} }, + options: ListCertificatesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context.path("/certificates").get({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + maxresults: options?.maxresults, + timeOut: options?.timeOutInSeconds, + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + }, + }); +} + +export async function _listCertificatesDeserialize( + result: PathUncheckedResponse, +): Promise<_CertificateListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _certificateListResultDeserializer(result.body); +} + +/** Lists all of the Certificates that have been added to the specified Account. */ +export function listCertificates( + context: Client, + options: ListCertificatesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listCertificatesSend(context, options), + _listCertificatesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, + ); +} + +export function _createCertificateSend( + context: Client, + body: BatchCertificate, + options: CreateCertificateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobschedules/{jobScheduleId}/enable", jobScheduleId) + .path("/certificates") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchCertificateSerializer(body), }); } -export async function _enableJobScheduleDeserialize( +export async function _createCertificateDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["204"]; + const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -2652,347 +3530,380 @@ export async function _enableJobScheduleDeserialize( return; } -/** Enables a Job Schedule. */ -export async function enableJobSchedule( +/** Creates a Certificate to the specified Account. */ +export async function createCertificate( context: Client, - jobScheduleId: string, - options: EnableJobScheduleOptionalParams = { requestOptions: {} }, + body: BatchCertificate, + options: CreateCertificateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _enableJobScheduleSend(context, jobScheduleId, options); - return _enableJobScheduleDeserialize(result); + const result = await _createCertificateSend(context, body, options); + return _createCertificateDeserialize(result); } -export function _terminateJobScheduleSend( +export function _getJobTaskCountsSend( context: Client, - jobScheduleId: string, - options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, + jobId: string, + options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobschedules/{jobScheduleId}/terminate", jobScheduleId) - .post({ + .path("/jobs/{jobId}/taskcounts", jobId) + .get({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _terminateJobScheduleDeserialize( +export async function _getJobTaskCountsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return taskCountsResultDeserializer(result.body); } -/** Terminates a Job Schedule. */ -export async function terminateJobSchedule( +/** + * Task counts provide a count of the Tasks by active, running or completed Task + * state, and a count of Tasks which succeeded or failed. Tasks in the preparing + * state are counted as running. Note that the numbers returned may not always be + * up to date. If you need exact task counts, use a list query. + */ +export async function getJobTaskCounts( context: Client, - jobScheduleId: string, - options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _terminateJobScheduleSend( - context, - jobScheduleId, - options, - ); - return _terminateJobScheduleDeserialize(result); + jobId: string, + options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getJobTaskCountsSend(context, jobId, options); + return _getJobTaskCountsDeserialize(result); } -export function _createJobScheduleSend( +export function _listJobPreparationAndReleaseTaskStatusSend( context: Client, - body: BatchJobScheduleCreateOptions, - options: CreateJobScheduleOptionalParams = { requestOptions: {} }, + jobId: string, + options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path("/jobschedules") - .post({ + .path("/jobs/{jobId}/jobpreparationandreleasetaskstatus", jobId) + .get({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), }, - body: batchJobScheduleCreateOptionsSerializer(body), }); } -export async function _createJobScheduleDeserialize( +export async function _listJobPreparationAndReleaseTaskStatusDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; +): Promise<_BatchJobListPreparationAndReleaseTaskStatusResult> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _batchJobListPreparationAndReleaseTaskStatusResultDeserializer( + result.body, + ); } -/** Creates a Job Schedule to the specified Account. */ -export async function createJobSchedule( +/** + * This API returns the Job Preparation and Job Release Task status on all Compute + * Nodes that have run the Job Preparation or Job Release Task. This includes + * Compute Nodes which have since been removed from the Pool. If this API is + * invoked on a Job which has no Job Preparation or Job Release Task, the Batch + * service returns HTTP status code 409 (Conflict) with an error code of + * JobPreparationTaskNotSpecified. + */ +export function listJobPreparationAndReleaseTaskStatus( context: Client, - body: BatchJobScheduleCreateOptions, - options: CreateJobScheduleOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createJobScheduleSend(context, body, options); - return _createJobScheduleDeserialize(result); + jobId: string, + options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listJobPreparationAndReleaseTaskStatusSend(context, jobId, options), + _listJobPreparationAndReleaseTaskStatusDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, + ); } -export function _listJobSchedulesSend( +export function _listJobsFromScheduleSend( context: Client, - options: ListJobSchedulesOptionalParams = { requestOptions: {} }, + jobScheduleId: string, + options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/jobschedules").get({ + return context.path("/jobschedules/{jobScheduleId}/jobs", jobScheduleId).get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { return p; }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { return p; }), }, }); } -export async function _listJobSchedulesDeserialize( +export async function _listJobsFromScheduleDeserialize( result: PathUncheckedResponse, -): Promise<_BatchJobScheduleListResult> { +): Promise<_BatchJobListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _batchJobScheduleListResultDeserializer(result.body); + return _batchJobListResultDeserializer(result.body); } -/** Lists all of the Job Schedules in the specified Account. */ -export function listJobSchedules( +/** Lists the Jobs that have been created under the specified Job Schedule. */ +export function listJobsFromSchedule( context: Client, - options: ListJobSchedulesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + jobScheduleId: string, + options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listJobSchedulesSend(context, options), - _listJobSchedulesDeserialize, + () => _listJobsFromScheduleSend(context, jobScheduleId, options), + _listJobsFromScheduleDeserialize, ["200"], { itemName: "value", nextLinkName: "odata.nextLink" }, ); } -export function _createTaskSend( - context: Client, - jobId: string, - body: BatchTaskCreateOptions, - options: CreateTaskOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/jobs/{jobId}/tasks", jobId) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - }, - body: batchTaskCreateOptionsSerializer(body), - }); -} - -export async function _createTaskDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return; -} - -/** - * The maximum lifetime of a Task from addition to completion is 180 days. If a - * Task has not completed within 180 days of being added it will be terminated by - * the Batch service and left in whatever state it was in at that time. - */ -export async function createTask( - context: Client, - jobId: string, - body: BatchTaskCreateOptions, - options: CreateTaskOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createTaskSend(context, jobId, body, options); - return _createTaskDeserialize(result); -} - -export function _listTasksSend( +export function _listJobsSend( context: Client, - jobId: string, - options: ListTasksOptionalParams = { requestOptions: {} }, + options: ListJobsOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/jobs/{jobId}/tasks", jobId).get({ + return context.path("/jobs").get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { return p; }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { return p; }), }, }); } -export async function _listTasksDeserialize( +export async function _listJobsDeserialize( result: PathUncheckedResponse, -): Promise<_BatchTaskListResult> { +): Promise<_BatchJobListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _batchTaskListResultDeserializer(result.body); + return _batchJobListResultDeserializer(result.body); } -/** - * For multi-instance Tasks, information such as affinityId, executionInfo and - * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve - * information about subtasks. - */ -export function listTasks( +/** Lists all of the Jobs in the specified Account. */ +export function listJobs( context: Client, - jobId: string, - options: ListTasksOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + options: ListJobsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listTasksSend(context, jobId, options), - _listTasksDeserialize, + () => _listJobsSend(context, options), + _listJobsDeserialize, ["200"], { itemName: "value", nextLinkName: "odata.nextLink" }, ); } -export function _createTaskCollectionSend( +export function _createJobSend( context: Client, - jobId: string, - collection: BatchTaskCollection, - options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, + body: BatchJobCreateOptions, + options: CreateJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/addtaskcollection", jobId) + .path("/jobs") .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchTaskCollectionSerializer(collection), + body: batchJobCreateOptionsSerializer(body), }); } -export async function _createTaskCollectionDeserialize( +export async function _createJobDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return taskAddCollectionResultDeserializer(result.body); + return; } /** - * Note that each Task must have a unique ID. The Batch service may not return the - * results for each Task in the same order the Tasks were submitted in this - * request. If the server times out or the connection is closed during the - * request, the request may have been partially or fully processed, or not at all. - * In such cases, the user should re-issue the request. Note that it is up to the - * user to correctly handle failures when re-issuing a request. For example, you - * should use the same Task IDs during a retry so that if the prior operation - * succeeded, the retry will not create extra Tasks unexpectedly. If the response - * contains any Tasks which failed to add, a client can retry the request. In a - * retry, it is most efficient to resubmit only Tasks that failed to add, and to - * omit Tasks that were successfully added on the first attempt. The maximum - * lifetime of a Task from addition to completion is 180 days. If a Task has not - * completed within 180 days of being added it will be terminated by the Batch - * service and left in whatever state it was in at that time. + * The Batch service supports two ways to control the work done as part of a Job. + * In the first approach, the user specifies a Job Manager Task. The Batch service + * launches this Task when it is ready to start the Job. The Job Manager Task + * controls all other Tasks that run under this Job, by using the Task APIs. In + * the second approach, the user directly controls the execution of Tasks under an + * active Job, by using the Task APIs. Also note: when naming Jobs, avoid + * including sensitive information such as user names or secret project names. + * This information may appear in telemetry logs accessible to Microsoft Support + * engineers. */ -export async function createTaskCollection( +export async function createJob( context: Client, - jobId: string, - collection: BatchTaskCollection, - options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createTaskCollectionSend( - context, - jobId, - collection, - options, - ); - return _createTaskCollectionDeserialize(result); + body: BatchJobCreateOptions, + options: CreateJobOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createJobSend(context, body, options); + return _createJobDeserialize(result); } -export function _deleteTaskSend( +export function _terminateJobSend( context: Client, jobId: string, - taskId: string, - options: DeleteTaskOptionalParams = { requestOptions: {} }, + options: TerminateJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId) - .delete({ + .path("/jobs/{jobId}/terminate", jobId) + .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -3013,18 +3924,23 @@ export function _deleteTaskSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: !options["body"] + ? options["body"] + : batchJobTerminateOptionsSerializer(options["body"]), }); } -export async function _deleteTaskDeserialize( +export async function _terminateJobDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3033,110 +3949,45 @@ export async function _deleteTaskDeserialize( } /** - * When a Task is deleted, all of the files in its directory on the Compute Node - * where it ran are also deleted (regardless of the retention time). For - * multi-instance Tasks, the delete Task operation applies synchronously to the - * primary task; subtasks and their files are then deleted asynchronously in the - * background. - */ -export async function deleteTask( - context: Client, - jobId: string, - taskId: string, - options: DeleteTaskOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteTaskSend(context, jobId, taskId, options); - return _deleteTaskDeserialize(result); -} - -export function _getTaskSend( - context: Client, - jobId: string, - taskId: string, - options: GetTaskOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context.path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId).get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.ifMatch !== undefined - ? { "if-match": options?.ifMatch } - : {}), - ...(options?.ifNoneMatch !== undefined - ? { "if-none-match": options?.ifNoneMatch } - : {}), - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } - : {}), - ...(options?.ifUnmodifiedSince !== undefined - ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), - } - : {}), - }, - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), - $expand: !options?.expand - ? options?.expand - : options?.expand.map((p: any) => { - return p; - }), - }, - }); -} - -export async function _getTaskDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return batchTaskDeserializer(result.body); -} - -/** - * For multi-instance Tasks, information such as affinityId, executionInfo and - * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve - * information about subtasks. + * When a Terminate Job request is received, the Batch service sets the Job to the + * terminating state. The Batch service then terminates any running Tasks + * associated with the Job and runs any required Job release Tasks. Then the Job + * moves into the completed state. If there are any Tasks in the Job in the active + * state, they will remain in the active state. Once a Job is terminated, new + * Tasks cannot be added and any remaining active Tasks will not be scheduled. */ -export async function getTask( +export async function terminateJob( context: Client, jobId: string, - taskId: string, - options: GetTaskOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getTaskSend(context, jobId, taskId, options); - return _getTaskDeserialize(result); + options: TerminateJobOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _terminateJobSend(context, jobId, options); + return _terminateJobDeserialize(result); } -export function _replaceTaskSend( +export function _enableJobSend( context: Client, jobId: string, - taskId: string, - body: BatchTask, - options: ReplaceTaskOptionalParams = { requestOptions: {} }, + options: EnableJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId) - .put({ + .path("/jobs/{jobId}/enable", jobId) + .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -3157,19 +4008,20 @@ export function _replaceTaskSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchTaskSerializer(body), }); } -export async function _replaceTaskDeserialize( +export async function _enableJobDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3177,73 +4029,135 @@ export async function _replaceTaskDeserialize( return; } -/** Updates the properties of the specified Task. */ -export async function replaceTask( +/** + * When you call this API, the Batch service sets a disabled Job to the enabling + * state. After the this operation is completed, the Job moves to the active + * state, and scheduling of new Tasks under the Job resumes. The Batch service + * does not allow a Task to remain in the active state for more than 180 days. + * Therefore, if you enable a Job containing active Tasks which were added more + * than 180 days ago, those Tasks will not run. + */ +export async function enableJob( context: Client, jobId: string, - taskId: string, - body: BatchTask, - options: ReplaceTaskOptionalParams = { requestOptions: {} }, + options: EnableJobOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _replaceTaskSend(context, jobId, taskId, body, options); - return _replaceTaskDeserialize(result); + const result = await _enableJobSend(context, jobId, options); + return _enableJobDeserialize(result); } -export function _listSubTasksSend( +export function _disableJobSend( context: Client, jobId: string, - taskId: string, - options: ListSubTasksOptionalParams = { requestOptions: {} }, + body: BatchJobDisableOptions, + options: DisableJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/tasks/{taskId}/subtasksinfo", jobId, taskId) - .get({ + .path("/jobs/{jobId}/disable", jobId) + .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), }, + body: batchJobDisableOptionsSerializer(body), }); } -export async function _listSubTasksDeserialize( +export async function _disableJobDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return batchTaskListSubtasksResultDeserializer(result.body); + return; } -/** If the Task is not a multi-instance Task then this returns an empty collection. */ -export async function listSubTasks( +/** + * The Batch Service immediately moves the Job to the disabling state. Batch then + * uses the disableTasks parameter to determine what to do with the currently + * running Tasks of the Job. The Job remains in the disabling state until the + * disable operation is completed and all Tasks have been dealt with according to + * the disableTasks option; the Job then moves to the disabled state. No new Tasks + * are started under the Job until it moves back to active state. If you try to + * disable a Job that is in any state other than active, disabling, or disabled, + * the request fails with status code 409. + */ +export async function disableJob( context: Client, jobId: string, - taskId: string, - options: ListSubTasksOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSubTasksSend(context, jobId, taskId, options); - return _listSubTasksDeserialize(result); + body: BatchJobDisableOptions, + options: DisableJobOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _disableJobSend(context, jobId, body, options); + return _disableJobDeserialize(result); } -export function _terminateTaskSend( +export function _replaceJobSend( context: Client, jobId: string, - taskId: string, - options: TerminateTaskOptionalParams = { requestOptions: {} }, + body: BatchJob, + options: ReplaceJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/tasks/{taskId}/terminate", jobId, taskId) - .post({ + .path("/jobs/{jobId}", jobId) + .put({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -3264,18 +4178,21 @@ export function _terminateTaskSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchJobSerializer(body), }); } -export async function _terminateTaskDeserialize( +export async function _replaceJobDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["204"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3284,31 +4201,45 @@ export async function _terminateTaskDeserialize( } /** - * When the Task has been terminated, it moves to the completed state. For - * multi-instance Tasks, the terminate Task operation applies synchronously to the - * primary task; subtasks are then terminated asynchronously in the background. + * This fully replaces all the updatable properties of the Job. For example, if + * the Job has constraints associated with it and if constraints is not specified + * with this request, then the Batch service will remove the existing constraints. */ -export async function terminateTask( +export async function replaceJob( context: Client, jobId: string, - taskId: string, - options: TerminateTaskOptionalParams = { requestOptions: {} }, + body: BatchJob, + options: ReplaceJobOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _terminateTaskSend(context, jobId, taskId, options); - return _terminateTaskDeserialize(result); + const result = await _replaceJobSend(context, jobId, body, options); + return _replaceJobDeserialize(result); } -export function _reactivateTaskSend( +export function _updateJobSend( context: Client, jobId: string, - taskId: string, - options: ReactivateTaskOptionalParams = { requestOptions: {} }, + body: BatchJobUpdateOptions, + options: UpdateJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/tasks/{taskId}/reactivate", jobId, taskId) - .post({ + .path("/jobs/{jobId}", jobId) + .patch({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), @@ -3329,18 +4260,21 @@ export function _reactivateTaskSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchJobUpdateOptionsSerializer(body), }); } -export async function _reactivateTaskDeserialize( +export async function _updateJobDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["204"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3349,165 +4283,131 @@ export async function _reactivateTaskDeserialize( } /** - * Reactivation makes a Task eligible to be retried again up to its maximum retry - * count. The Task's state is changed to active. As the Task is no longer in the - * completed state, any previous exit code or failure information is no longer - * available after reactivation. Each time a Task is reactivated, its retry count - * is reset to 0. Reactivation will fail for Tasks that are not completed or that - * previously completed successfully (with an exit code of 0). Additionally, it - * will fail if the Job has completed (or is terminating or deleting). + * This replaces only the Job properties specified in the request. For example, if + * the Job has constraints, and a request does not specify the constraints + * element, then the Job keeps the existing constraints. */ -export async function reactivateTask( +export async function updateJob( context: Client, jobId: string, - taskId: string, - options: ReactivateTaskOptionalParams = { requestOptions: {} }, + body: BatchJobUpdateOptions, + options: UpdateJobOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _reactivateTaskSend(context, jobId, taskId, options); - return _reactivateTaskDeserialize(result); + const result = await _updateJobSend(context, jobId, body, options); + return _updateJobDeserialize(result); } -export function _deleteTaskFileSend( +export function _getJobSend( context: Client, jobId: string, - taskId: string, - filePath: string, - options: DeleteTaskFileOptionalParams = { requestOptions: {} }, + options: GetJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context - .path( - "/jobs/{jobId}/tasks/{taskId}/files/{filePath}", - jobId, - taskId, - filePath, - ) - .delete({ - ...operationOptionsToRequestParameters(options), - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - recursive: options?.recursive, - }, - }); + return context.path("/jobs/{jobId}", jobId).get({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + timeOut: options?.timeOutInSeconds, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { + return p; + }), + }, + }); } -export async function _deleteTaskFileDeserialize( +export async function _getJobDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return batchJobDeserializer(result.body); } -/** Deletes the specified Task file from the Compute Node where the Task ran. */ -export async function deleteTaskFile( +/** Gets information about the specified Job. */ +export async function getJob( context: Client, jobId: string, - taskId: string, - filePath: string, - options: DeleteTaskFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteTaskFileSend( - context, - jobId, - taskId, - filePath, - options, - ); - return _deleteTaskFileDeserialize(result); + options: GetJobOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getJobSend(context, jobId, options); + return _getJobDeserialize(result); } -export function _getTaskFileSend( +export function _deleteJobSend( context: Client, jobId: string, - taskId: string, - filePath: string, - options: GetTaskFileOptionalParams = { requestOptions: {} }, + options: DeleteJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/jobs/{jobId}/tasks/{taskId}/files/{filePath}", - jobId, - taskId, - filePath, - ) - .get({ + .path("/jobs/{jobId}", jobId) + .delete({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), - ...(options?.ocpRange !== undefined - ? { "ocp-range": options?.ocpRange } + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } : {}), - }, - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - }, - }); -} - -export async function _getTaskFileDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return result.body; -} - -/** Returns the content of the specified Task file. */ -export async function getTaskFile( - context: Client, - jobId: string, - taskId: string, - filePath: string, - options: GetTaskFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getTaskFileSend( - context, - jobId, - taskId, - filePath, - options, - ); - return _getTaskFileDeserialize(result); -} - -export function _getTaskFilePropertiesSend( - context: Client, - jobId: string, - taskId: string, - filePath: string, - options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/jobs/{jobId}/tasks/{taskId}/files/{filePath}", - jobId, - taskId, - filePath, - ) - .head({ - ...operationOptionsToRequestParameters(options), - headers: { ...(options?.ifModifiedSince !== undefined ? { "if-modified-since": !options?.ifModifiedSince @@ -3522,18 +4422,20 @@ export function _getTaskFilePropertiesSend( : options?.ifUnmodifiedSince.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _getTaskFilePropertiesDeserialize( +export async function _deleteJobDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3541,212 +4443,207 @@ export async function _getTaskFilePropertiesDeserialize( return; } -/** Gets the properties of the specified Task file. */ -export async function getTaskFileProperties( +/** + * Deleting a Job also deletes all Tasks that are part of that Job, and all Job + * statistics. This also overrides the retention period for Task data; that is, if + * the Job contains Tasks which are still retained on Compute Nodes, the Batch + * services deletes those Tasks' working directories and all their contents. When + * a Delete Job request is received, the Batch service sets the Job to the + * deleting state. All update operations on a Job that is in deleting state will + * fail with status code 409 (Conflict), with additional information indicating + * that the Job is being deleted. + */ +export async function deleteJob( context: Client, jobId: string, - taskId: string, - filePath: string, - options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, + options: DeleteJobOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getTaskFilePropertiesSend( - context, - jobId, - taskId, - filePath, - options, - ); - return _getTaskFilePropertiesDeserialize(result); + const result = await _deleteJobSend(context, jobId, options); + return _deleteJobDeserialize(result); } -export function _listTaskFilesSend( +export function _listPoolNodeCountsSend( context: Client, - jobId: string, - taskId: string, - options: ListTaskFilesOptionalParams = { requestOptions: {} }, + options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/jobs/{jobId}/tasks/{taskId}/files", jobId, taskId) + .path("/nodecounts") .get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - recursive: options?.recursive, + $filter: options?.$filter, }, }); } -export async function _listTaskFilesDeserialize( +export async function _listPoolNodeCountsDeserialize( result: PathUncheckedResponse, -): Promise<_NodeFileListResult> { +): Promise<_PoolNodeCountsListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _nodeFileListResultDeserializer(result.body); + return _poolNodeCountsListResultDeserializer(result.body); } -/** Lists the files in a Task's directory on its Compute Node. */ -export function listTaskFiles( +/** + * Gets the number of Compute Nodes in each state, grouped by Pool. Note that the + * numbers returned may not always be up to date. If you need exact node counts, + * use a list query. + */ +export function listPoolNodeCounts( context: Client, - jobId: string, - taskId: string, - options: ListTaskFilesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listTaskFilesSend(context, jobId, taskId, options), - _listTaskFilesDeserialize, + () => _listPoolNodeCountsSend(context, options), + _listPoolNodeCountsDeserialize, ["200"], { itemName: "value", nextLinkName: "odata.nextLink" }, ); } -export function _createNodeUserSend( - context: Client, - poolId: string, - nodeId: string, - body: BatchNodeUserCreateOptions, - options: CreateNodeUserOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/pools/{poolId}/nodes/{nodeId}/users", poolId, nodeId) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - }, - body: batchNodeUserCreateOptionsSerializer(body), - }); -} - -export async function _createNodeUserDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return; -} - -/** - * You can add a user Account to a Compute Node only when it is in the idle or - * running state. - */ -export async function createNodeUser( - context: Client, - poolId: string, - nodeId: string, - body: BatchNodeUserCreateOptions, - options: CreateNodeUserOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createNodeUserSend( - context, - poolId, - nodeId, - body, - options, - ); - return _createNodeUserDeserialize(result); -} - -export function _deleteNodeUserSend( +export function _listSupportedImagesSend( context: Client, - poolId: string, - nodeId: string, - userName: string, - options: DeleteNodeUserOptionalParams = { requestOptions: {} }, + options: ListSupportedImagesOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path( - "/pools/{poolId}/nodes/{nodeId}/users/{userName}", - poolId, - nodeId, - userName, - ) - .delete({ + .path("/supportedimages") + .get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, + $filter: options?.$filter, }, }); } -export async function _deleteNodeUserDeserialize( +export async function _listSupportedImagesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_AccountListSupportedImagesResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _accountListSupportedImagesResultDeserializer(result.body); } -/** - * You can delete a user Account to a Compute Node only when it is in the idle or - * running state. - */ -export async function deleteNodeUser( +/** Lists all Virtual Machine Images supported by the Azure Batch service. */ +export function listSupportedImages( context: Client, - poolId: string, - nodeId: string, - userName: string, - options: DeleteNodeUserOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteNodeUserSend( + options: ListSupportedImagesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - poolId, - nodeId, - userName, - options, + () => _listSupportedImagesSend(context, options), + _listSupportedImagesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, ); - return _deleteNodeUserDeserialize(result); } -export function _replaceNodeUserSend( +export function _removeNodesSend( context: Client, poolId: string, - nodeId: string, - userName: string, - body: BatchNodeUserUpdateOptions, - options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, + body: NodeRemoveOptions, + options: RemoveNodesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/pools/{poolId}/nodes/{nodeId}/users/{userName}", - poolId, - nodeId, - userName, - ) - .put({ + .path("/pools/{poolId}/removenodes", poolId) + .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: batchNodeUserUpdateOptionsSerializer(body), + body: nodeRemoveOptionsSerializer(body), }); } -export async function _replaceNodeUserDeserialize( +export async function _removeNodesDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3755,99 +4652,60 @@ export async function _replaceNodeUserDeserialize( } /** - * This operation replaces of all the updatable properties of the Account. For - * example, if the expiryTime element is not specified, the current value is - * replaced with the default value, not left unmodified. You can update a user - * Account on a Compute Node only when it is in the idle or running state. + * This operation can only run when the allocation state of the Pool is steady. + * When this operation runs, the allocation state changes from steady to resizing. + * Each request may remove up to 100 nodes. */ -export async function replaceNodeUser( +export async function removeNodes( context: Client, poolId: string, - nodeId: string, - userName: string, - body: BatchNodeUserUpdateOptions, - options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, + body: NodeRemoveOptions, + options: RemoveNodesOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _replaceNodeUserSend( - context, - poolId, - nodeId, - userName, - body, - options, - ); - return _replaceNodeUserDeserialize(result); -} - -export function _getNodeSend( - context: Client, - poolId: string, - nodeId: string, - options: GetNodeOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context.path("/pools/{poolId}/nodes/{nodeId}", poolId, nodeId).get({ - ...operationOptionsToRequestParameters(options), - queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), - }, - }); -} - -export async function _getNodeDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return batchNodeDeserializer(result.body); -} - -/** Gets information about the specified Compute Node. */ -export async function getNode( - context: Client, - poolId: string, - nodeId: string, - options: GetNodeOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getNodeSend(context, poolId, nodeId, options); - return _getNodeDeserialize(result); + const result = await _removeNodesSend(context, poolId, body, options); + return _removeNodesDeserialize(result); } -export function _rebootNodeSend( +export function _replacePoolPropertiesSend( context: Client, poolId: string, - nodeId: string, - options: RebootNodeOptionalParams = { requestOptions: {} }, + body: BatchPoolReplaceOptions, + options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/reboot", poolId, nodeId) + .path("/pools/{poolId}/updateproperties", poolId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: !options["body"] - ? options["body"] - : nodeRebootOptionsSerializer(options["body"]), + body: batchPoolReplaceOptionsSerializer(body), }); } -export async function _rebootNodeDeserialize( +export async function _replacePoolPropertiesDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3855,41 +4713,80 @@ export async function _rebootNodeDeserialize( return; } -/** You can restart a Compute Node only if it is in an idle or running state. */ -export async function rebootNode( +/** + * This fully replaces all the updatable properties of the Pool. For example, if + * the Pool has a StartTask associated with it and if StartTask is not specified + * with this request, then the Batch service will remove the existing StartTask. + */ +export async function replacePoolProperties( context: Client, poolId: string, - nodeId: string, - options: RebootNodeOptionalParams = { requestOptions: {} }, + body: BatchPoolReplaceOptions, + options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _rebootNodeSend(context, poolId, nodeId, options); - return _rebootNodeDeserialize(result); + const result = await _replacePoolPropertiesSend( + context, + poolId, + body, + options, + ); + return _replacePoolPropertiesDeserialize(result); } -export function _reimageNodeSend( +export function _stopPoolResizeSend( context: Client, poolId: string, - nodeId: string, - options: ReimageNodeOptionalParams = { requestOptions: {} }, + options: StopPoolResizeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/reimage", poolId, nodeId) + .path("/pools/{poolId}/stopresize", poolId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: !options["body"] - ? options["body"] - : nodeReimageOptionsSerializer(options["body"]), }); } -export async function _reimageNodeDeserialize( +export async function _stopPoolResizeDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["202"]; @@ -3901,47 +4798,83 @@ export async function _reimageNodeDeserialize( } /** - * You can reinstall the operating system on a Compute Node only if it is in an - * idle or running state. This API can be invoked only on Pools created with the - * cloud service configuration property. + * This does not restore the Pool to its previous state before the resize + * operation: it only stops any further changes being made, and the Pool maintains + * its current state. After stopping, the Pool stabilizes at the number of Compute + * Nodes it was at when the stop operation was done. During the stop operation, + * the Pool allocation state changes first to stopping and then to steady. A + * resize operation need not be an explicit resize Pool request; this API can also + * be used to halt the initial sizing of the Pool when it is created. */ -export async function reimageNode( +export async function stopPoolResize( context: Client, poolId: string, - nodeId: string, - options: ReimageNodeOptionalParams = { requestOptions: {} }, + options: StopPoolResizeOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _reimageNodeSend(context, poolId, nodeId, options); - return _reimageNodeDeserialize(result); + const result = await _stopPoolResizeSend(context, poolId, options); + return _stopPoolResizeDeserialize(result); } -export function _disableNodeSchedulingSend( +export function _resizePoolSend( context: Client, poolId: string, - nodeId: string, - options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, + body: BatchPoolResizeOptions, + options: ResizePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/disablescheduling", poolId, nodeId) + .path("/pools/{poolId}/resize", poolId) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: !options["body"] - ? options["body"] - : nodeDisableSchedulingOptionsSerializer(options["body"]), + body: batchPoolResizeOptionsSerializer(body), }); } -export async function _disableNodeSchedulingDeserialize( +export async function _resizePoolDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["202"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -3950,413 +4883,661 @@ export async function _disableNodeSchedulingDeserialize( } /** - * You can disable Task scheduling on a Compute Node only if its current - * scheduling state is enabled. + * You can only resize a Pool when its allocation state is steady. If the Pool is + * already resizing, the request fails with status code 409. When you resize a + * Pool, the Pool's allocation state changes from steady to resizing. You cannot + * resize Pools which are configured for automatic scaling. If you try to do this, + * the Batch service returns an error 409. If you resize a Pool downwards, the + * Batch service chooses which Compute Nodes to remove. To remove specific Compute + * Nodes, use the Pool remove Compute Nodes API instead. */ -export async function disableNodeScheduling( +export async function resizePool( context: Client, poolId: string, - nodeId: string, - options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, + body: BatchPoolResizeOptions, + options: ResizePoolOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _disableNodeSchedulingSend( - context, - poolId, - nodeId, - options, - ); - return _disableNodeSchedulingDeserialize(result); + const result = await _resizePoolSend(context, poolId, body, options); + return _resizePoolDeserialize(result); } -export function _enableNodeSchedulingSend( +export function _evaluatePoolAutoScaleSend( context: Client, poolId: string, - nodeId: string, - options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, + body: BatchPoolEvaluateAutoScaleOptions, + options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/enablescheduling", poolId, nodeId) + .path("/pools/{poolId}/evaluateautoscale", poolId) .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchPoolEvaluateAutoScaleOptionsSerializer(body), }); } -export async function _enableNodeSchedulingDeserialize( +export async function _evaluatePoolAutoScaleDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return autoScaleRunDeserializer(result.body); } /** - * You can enable Task scheduling on a Compute Node only if its current scheduling - * state is disabled + * This API is primarily for validating an autoscale formula, as it simply returns + * the result without applying the formula to the Pool. The Pool must have auto + * scaling enabled in order to evaluate a formula. */ -export async function enableNodeScheduling( +export async function evaluatePoolAutoScale( context: Client, poolId: string, - nodeId: string, - options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _enableNodeSchedulingSend( + body: BatchPoolEvaluateAutoScaleOptions, + options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _evaluatePoolAutoScaleSend( context, poolId, - nodeId, + body, options, ); - return _enableNodeSchedulingDeserialize(result); + return _evaluatePoolAutoScaleDeserialize(result); } -export function _getNodeRemoteLoginSettingsSend( +export function _enablePoolAutoScaleSend( context: Client, poolId: string, - nodeId: string, - options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, + body: BatchPoolEnableAutoScaleOptions, + options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/remoteloginsettings", poolId, nodeId) - .get({ + .path("/pools/{poolId}/enableautoscale", poolId) + .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, + body: batchPoolEnableAutoScaleOptionsSerializer(body), }); } -export async function _getNodeRemoteLoginSettingsDeserialize( +export async function _enablePoolAutoScaleDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return batchNodeRemoteLoginSettingsResultDeserializer(result.body); + return; } /** - * Before you can remotely login to a Compute Node using the remote login - * settings, you must create a user Account on the Compute Node. This API can be - * invoked only on Pools created with the virtual machine configuration property. - * For Pools created with a cloud service configuration, see the GetRemoteDesktop - * API. + * You cannot enable automatic scaling on a Pool if a resize operation is in + * progress on the Pool. If automatic scaling of the Pool is currently disabled, + * you must specify a valid autoscale formula as part of the request. If automatic + * scaling of the Pool is already enabled, you may specify a new autoscale formula + * and/or a new evaluation interval. You cannot call this API for the same Pool + * more than once every 30 seconds. */ -export async function getNodeRemoteLoginSettings( +export async function enablePoolAutoScale( context: Client, poolId: string, - nodeId: string, - options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getNodeRemoteLoginSettingsSend( - context, - poolId, - nodeId, - options, - ); - return _getNodeRemoteLoginSettingsDeserialize(result); + body: BatchPoolEnableAutoScaleOptions, + options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _enablePoolAutoScaleSend(context, poolId, body, options); + return _enablePoolAutoScaleDeserialize(result); } -export function _getNodeRemoteDesktopFileSend( +export function _disablePoolAutoScaleSend( context: Client, poolId: string, - nodeId: string, - options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, + options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/rdp", poolId, nodeId) - .get({ + .path("/pools/{poolId}/disableautoscale", poolId) + .post({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _getNodeRemoteDesktopFileDeserialize( +export async function _disablePoolAutoScaleDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return typeof result.body === "string" - ? stringToUint8Array(result.body, "base64") - : result.body; + return; } -/** - * Before you can access a Compute Node by using the RDP file, you must create a - * user Account on the Compute Node. This API can only be invoked on Pools created - * with a cloud service configuration. For Pools created with a virtual machine - * configuration, see the GetRemoteLoginSettings API. - */ -export async function getNodeRemoteDesktopFile( +/** Disables automatic scaling for a Pool. */ +export async function disablePoolAutoScale( context: Client, poolId: string, - nodeId: string, - options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getNodeRemoteDesktopFileSend( - context, - poolId, - nodeId, - options, - ); - return _getNodeRemoteDesktopFileDeserialize(result); + options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _disablePoolAutoScaleSend(context, poolId, options); + return _disablePoolAutoScaleDeserialize(result); } -export function _uploadNodeLogsSend( +export function _updatePoolSend( context: Client, poolId: string, - nodeId: string, - body: UploadBatchServiceLogsOptions, - options: UploadNodeLogsOptionalParams = { requestOptions: {} }, + body: BatchPoolUpdateOptions, + options: UpdatePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/pools/{poolId}/nodes/{nodeId}/uploadbatchservicelogs", - poolId, - nodeId, - ) - .post({ + .path("/pools/{poolId}", poolId) + .patch({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/json; odata=minimalmetadata", + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, - body: uploadBatchServiceLogsOptionsSerializer(body), + body: batchPoolUpdateOptionsSerializer(body), }); } -export async function _uploadNodeLogsDeserialize( +export async function _updatePoolDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return uploadBatchServiceLogsResultDeserializer(result.body); + return; } /** - * This is for gathering Azure Batch service log files in an automated fashion - * from Compute Nodes if you are experiencing an error and wish to escalate to - * Azure support. The Azure Batch service log files should be shared with Azure - * support to aid in debugging issues with the Batch service. + * This only replaces the Pool properties specified in the request. For example, + * if the Pool has a StartTask associated with it, and a request does not specify + * a StartTask element, then the Pool keeps the existing StartTask. */ -export async function uploadNodeLogs( +export async function updatePool( context: Client, poolId: string, - nodeId: string, - body: UploadBatchServiceLogsOptions, - options: UploadNodeLogsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _uploadNodeLogsSend( - context, - poolId, - nodeId, - body, - options, - ); - return _uploadNodeLogsDeserialize(result); + body: BatchPoolUpdateOptions, + options: UpdatePoolOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updatePoolSend(context, poolId, body, options); + return _updatePoolDeserialize(result); } -export function _listNodesSend( +export function _getPoolSend( context: Client, poolId: string, - options: ListNodesOptionalParams = { requestOptions: {} }, + options: GetPoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/pools/{poolId}/nodes", poolId).get({ + return context.path("/pools/{poolId}", poolId).get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", - maxresults: options?.maxresults, + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { return p; }), }, }); } -export async function _listNodesDeserialize( +export async function _getPoolDeserialize( result: PathUncheckedResponse, -): Promise<_BatchNodeListResult> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _batchNodeListResultDeserializer(result.body); + return batchPoolDeserializer(result.body); } -/** Lists the Compute Nodes in the specified Pool. */ -export function listNodes( +/** Gets information about the specified Pool. */ +export async function getPool( context: Client, poolId: string, - options: ListNodesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listNodesSend(context, poolId, options), - _listNodesDeserialize, - ["200"], - { itemName: "value", nextLinkName: "odata.nextLink" }, - ); + options: GetPoolOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getPoolSend(context, poolId, options); + return _getPoolDeserialize(result); } -export function _getNodeExtensionSend( +export function _poolExistsSend( context: Client, poolId: string, - nodeId: string, - extensionName: string, - options: GetNodeExtensionOptionalParams = { requestOptions: {} }, + options: PoolExistsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/pools/{poolId}/nodes/{nodeId}/extensions/{extensionName}", - poolId, - nodeId, - extensionName, - ) - .get({ + .path("/pools/{poolId}", poolId) + .head({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), }, }); } -export async function _getNodeExtensionDeserialize( +export async function _poolExistsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["404", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return nodeVMExtensionDeserializer(result.body); + return; } -/** Gets information about the specified Compute Node Extension. */ -export async function getNodeExtension( +/** Gets basic properties of a Pool. */ +export async function poolExists( context: Client, poolId: string, - nodeId: string, - extensionName: string, - options: GetNodeExtensionOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getNodeExtensionSend( - context, - poolId, - nodeId, - extensionName, - options, - ); - return _getNodeExtensionDeserialize(result); + options: PoolExistsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _poolExistsSend(context, poolId, options); + return _poolExistsDeserialize(result); } -export function _listNodeExtensionsSend( +export function _deletePoolSend( context: Client, poolId: string, - nodeId: string, - options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, + options: DeletePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/extensions", poolId, nodeId) - .get({ + .path("/pools/{poolId}", poolId) + .delete({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.ifMatch !== undefined + ? { "if-match": options?.ifMatch } + : {}), + ...(options?.ifNoneMatch !== undefined + ? { "if-none-match": options?.ifNoneMatch } + : {}), + ...(options?.ifModifiedSince !== undefined + ? { + "if-modified-since": !options?.ifModifiedSince + ? options?.ifModifiedSince + : options?.ifModifiedSince.toUTCString(), + } + : {}), + ...(options?.ifUnmodifiedSince !== undefined + ? { + "if-unmodified-since": !options?.ifUnmodifiedSince + ? options?.ifUnmodifiedSince + : options?.ifUnmodifiedSince.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - maxresults: options?.maxresults, + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.select - ? options?.select - : options?.select.map((p: any) => { - return p; - }), }, }); } -export async function _listNodeExtensionsDeserialize( +export async function _deletePoolDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** + * When you request that a Pool be deleted, the following actions occur: the Pool + * state is set to deleting; any ongoing resize operation on the Pool are stopped; + * the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks + * running on existing Compute Nodes are terminated and requeued (as if a resize + * Pool operation had been requested with the default requeue option); finally, + * the Pool is removed from the system. Because running Tasks are requeued, the + * user can rerun these Tasks by updating their Job to target a different Pool. + * The Tasks can then run on the new Pool. If you want to override the requeue + * behavior, then you should call resize Pool explicitly to shrink the Pool to + * zero size before deleting the Pool. If you call an Update, Patch or Delete API + * on a Pool in the deleting state, it will fail with HTTP status code 409 with + * error code PoolBeingDeleted. + */ +export async function deletePool( + context: Client, + poolId: string, + options: DeletePoolOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deletePoolSend(context, poolId, options); + return _deletePoolDeserialize(result); +} + +export function _listPoolsSend( + context: Client, + options: ListPoolsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context.path("/pools").get({ + ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + maxresults: options?.maxresults, + timeOut: options?.timeOutInSeconds, + $filter: options?.$filter, + $select: !options?.$select + ? options?.$select + : options?.$select.map((p: any) => { + return p; + }), + $expand: !options?.$expand + ? options?.$expand + : options?.$expand.map((p: any) => { + return p; + }), + }, + }); +} + +export async function _listPoolsDeserialize( result: PathUncheckedResponse, -): Promise<_NodeVMExtensionList> { +): Promise<_BatchPoolListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _nodeVMExtensionListDeserializer(result.body); + return _batchPoolListResultDeserializer(result.body); } -/** Lists the Compute Nodes Extensions in the specified Pool. */ -export function listNodeExtensions( +/** Lists all of the Pools in the specified Account. */ +export function listPools( context: Client, - poolId: string, - nodeId: string, - options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + options: ListPoolsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listNodeExtensionsSend(context, poolId, nodeId, options), - _listNodeExtensionsDeserialize, + () => _listPoolsSend(context, options), + _listPoolsDeserialize, ["200"], { itemName: "value", nextLinkName: "odata.nextLink" }, ); } -export function _deleteNodeFileSend( +export function _createPoolSend( context: Client, - poolId: string, - nodeId: string, - filePath: string, - options: DeleteNodeFileOptionalParams = { requestOptions: {} }, + body: BatchPoolCreateOptions, + options: CreatePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/pools/{poolId}/nodes/{nodeId}/files/{filePath}", - poolId, - nodeId, - filePath, - ) - .delete({ + .path("/pools") + .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json; odata=minimalmetadata", + headers: { + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - recursive: options?.recursive, }, + body: batchPoolCreateOptionsSerializer(body), }); } -export async function _deleteNodeFileDeserialize( +export async function _createPoolDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -4364,207 +5545,211 @@ export async function _deleteNodeFileDeserialize( return; } -/** Deletes the specified file from the Compute Node. */ -export async function deleteNodeFile( +/** + * When naming Pools, avoid including sensitive information such as user names or + * secret project names. This information may appear in telemetry logs accessible + * to Microsoft Support engineers. + */ +export async function createPool( context: Client, - poolId: string, - nodeId: string, - filePath: string, - options: DeleteNodeFileOptionalParams = { requestOptions: {} }, + body: BatchPoolCreateOptions, + options: CreatePoolOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteNodeFileSend( - context, - poolId, - nodeId, - filePath, - options, - ); - return _deleteNodeFileDeserialize(result); + const result = await _createPoolSend(context, body, options); + return _createPoolDeserialize(result); } -export function _getNodeFileSend( +export function _listPoolUsageMetricsSend( context: Client, - poolId: string, - nodeId: string, - filePath: string, - options: GetNodeFileOptionalParams = { requestOptions: {} }, + options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/pools/{poolId}/nodes/{nodeId}/files/{filePath}", - poolId, - nodeId, - filePath, - ) + .path("/poolusagemetrics") .get({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifModifiedSince !== undefined + ...(options?.ocpDate !== undefined ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), - ...(options?.ifUnmodifiedSince !== undefined - ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), - } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ocpRange !== undefined - ? { "ocp-range": options?.ocpRange } + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, + maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, + starttime: !options?.starttime + ? options?.starttime + : options?.starttime.toISOString(), + endtime: !options?.endtime + ? options?.endtime + : options?.endtime.toISOString(), + $filter: options?.$filter, }, }); } -export async function _getNodeFileDeserialize( +export async function _listPoolUsageMetricsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_PoolListUsageMetricsResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return typeof result.body === "string" - ? stringToUint8Array(result.body, "base64") - : result.body; + return _poolListUsageMetricsResultDeserializer(result.body); } -/** Returns the content of the specified Compute Node file. */ -export async function getNodeFile( +/** + * If you do not specify a $filter clause including a poolId, the response + * includes all Pools that existed in the Account in the time range of the + * returned aggregation intervals. If you do not specify a $filter clause + * including a startTime or endTime these filters default to the start and end + * times of the last aggregation interval currently available; that is, only the + * last aggregation interval is returned. + */ +export function listPoolUsageMetrics( context: Client, - poolId: string, - nodeId: string, - filePath: string, - options: GetNodeFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getNodeFileSend( + options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - poolId, - nodeId, - filePath, - options, + () => _listPoolUsageMetricsSend(context, options), + _listPoolUsageMetricsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "odata.nextLink" }, ); - return _getNodeFileDeserialize(result); } -export function _getNodeFilePropertiesSend( +export function _getApplicationSend( context: Client, - poolId: string, - nodeId: string, - filePath: string, - options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, + applicationId: string, + options: GetApplicationOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/pools/{poolId}/nodes/{nodeId}/files/{filePath}", - poolId, - nodeId, - filePath, - ) - .head({ + .path("/applications/{applicationId}", applicationId) + .get({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.ifModifiedSince !== undefined - ? { - "if-modified-since": !options?.ifModifiedSince - ? options?.ifModifiedSince - : options?.ifModifiedSince.toUTCString(), - } + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } : {}), - ...(options?.ifUnmodifiedSince !== undefined + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + ...(options?.ocpDate !== undefined ? { - "if-unmodified-since": !options?.ifUnmodifiedSince - ? options?.ifUnmodifiedSince - : options?.ifUnmodifiedSince.toUTCString(), + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), } : {}), + accept: "application/json", + ...options.requestOptions?.headers, }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, }, }); } -export async function _getNodeFilePropertiesDeserialize( +export async function _getApplicationDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return batchApplicationDeserializer(result.body); } -/** Gets the properties of the specified Compute Node file. */ -export async function getNodeFileProperties( +/** + * This operation returns only Applications and versions that are available for + * use on Compute Nodes; that is, that can be used in an Package reference. For + * administrator information about Applications and versions that are not yet + * available to Compute Nodes, use the Azure portal or the Azure Resource Manager + * API. + */ +export async function getApplication( context: Client, - poolId: string, - nodeId: string, - filePath: string, - options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getNodeFilePropertiesSend( - context, - poolId, - nodeId, - filePath, - options, - ); - return _getNodeFilePropertiesDeserialize(result); + applicationId: string, + options: GetApplicationOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getApplicationSend(context, applicationId, options); + return _getApplicationDeserialize(result); } -export function _listNodeFilesSend( +export function _listApplicationsSend( context: Client, - poolId: string, - nodeId: string, - options: ListNodeFilesOptionalParams = { requestOptions: {} }, + options: ListApplicationsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/pools/{poolId}/nodes/{nodeId}/files", poolId, nodeId) + .path("/applications") .get({ ...operationOptionsToRequestParameters(options), + headers: { + ...(options?.ocpDate !== undefined + ? { + "ocp-date": !options?.ocpDate + ? options?.ocpDate + : options?.ocpDate.toUTCString(), + } + : {}), + ...(options?.clientRequestId !== undefined + ? { "client-request-id": options?.clientRequestId } + : {}), + ...(options?.returnClientRequestId !== undefined + ? { "return-client-request-id": options?.returnClientRequestId } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { - "api-version": options?.apiVersion ?? "2023-05-01.17.0", + "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.filter, - recursive: options?.recursive, }, }); } -export async function _listNodeFilesDeserialize( +export async function _listApplicationsDeserialize( result: PathUncheckedResponse, -): Promise<_NodeFileListResult> { +): Promise<_ApplicationListResult> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _nodeFileListResultDeserializer(result.body); + return _applicationListResultDeserializer(result.body); } -/** Lists all of the files in Task directories on the specified Compute Node. */ -export function listNodeFiles( +/** + * This operation returns only Applications and versions that are available for + * use on Compute Nodes; that is, that can be used in an Package reference. For + * administrator information about applications and versions that are not yet + * available to Compute Nodes, use the Azure portal or the Azure Resource Manager + * API. + */ +export function listApplications( context: Client, - poolId: string, - nodeId: string, - options: ListNodeFilesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { + options: ListApplicationsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listNodeFilesSend(context, poolId, nodeId, options), - _listNodeFilesDeserialize, + () => _listApplicationsSend(context, options), + _listApplicationsDeserialize, ["200"], { itemName: "value", nextLinkName: "odata.nextLink" }, ); diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts index c476c2761c..e3272f4698 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts @@ -1,133 +1,546 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OperationOptions } from "@azure-rest/core-client"; import { NodeRebootOptions, NodeReimageOptions, NodeDisableSchedulingOptions, BatchJobTerminateOptions, } from "../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface ListApplicationsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListNodeFilesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * An OData $filter clause. For more information on constructing this filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. + */ + $filter?: string; + /** Whether to list children of a directory. */ + recursive?: boolean; } /** Optional parameters. */ -export interface GetApplicationOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetNodeFilePropertiesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time. + */ + ifModifiedSince?: Date; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time. + */ + ifUnmodifiedSince?: Date; } /** Optional parameters. */ -export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetNodeFileOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ - maxresults?: number; + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time. + */ + ifModifiedSince?: Date; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time. + */ + ifUnmodifiedSince?: Date; + /** + * The byte range to be retrieved. The default is to retrieve the entire file. The + * format is bytes=startRange-endRange. + */ + ocpRange?: string; +} + +/** Optional parameters. */ +export interface DeleteNodeFileOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * The earliest time from which to include metrics. This must be at least two and - * a half hours before the current time. If not specified this defaults to the - * start time of the last aggregation interval currently available. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - starttime?: Date; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * The latest time from which to include metrics. This must be at least two hours - * before the current time. If not specified this defaults to the end time of the - * last aggregation interval currently available. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - endtime?: Date; + ocpDate?: Date; /** - * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. + * Whether to delete children of a directory. If the filePath parameter represents + * a directory instead of a file, you can set recursive to true to delete the + * directory and all of the files and subdirectories in it. If recursive is false + * then the directory must be empty or deletion will fail. */ - filter?: string; + recursive?: boolean; } /** Optional parameters. */ -export interface CreatePoolOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListNodeExtensionsOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** An OData $select clause. */ + $select?: string[]; } /** Optional parameters. */ -export interface ListPoolsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetNodeExtensionOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** An OData $select clause. */ + $select?: string[]; +} + +/** Optional parameters. */ +export interface ListNodesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. */ - filter?: string; + $filter?: string; /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; + $select?: string[]; } /** Optional parameters. */ -export interface DeletePoolOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface UploadNodeLogsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service exactly matches the value specified by the client. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface GetNodeRemoteDesktopFileOptionalParams + extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface GetNodeRemoteLoginSettingsOptionalParams + extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface EnableNodeSchedulingOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface DisableNodeSchedulingOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** The options to use for disabling scheduling on the Compute Node. */ + body?: NodeDisableSchedulingOptions; +} + +/** Optional parameters. */ +export interface ReimageNodeOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** The options to use for reimaging the Compute Node. */ + body?: NodeReimageOptions; +} + +/** Optional parameters. */ +export interface RebootNodeOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** The options to use for rebooting the Compute Node. */ + body?: NodeRebootOptions; +} + +/** Optional parameters. */ +export interface GetNodeOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** An OData $select clause. */ + $select?: string[]; +} + +/** Optional parameters. */ +export interface ReplaceNodeUserOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface DeleteNodeUserOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface CreateNodeUserOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface ListTaskFilesOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * An OData $filter clause. For more information on constructing this filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. + */ + $filter?: string; + /** + * Whether to list children of the Task directory. This parameter can be used in + * combination with the filter parameter to list specific type of files. + */ + recursive?: boolean; +} + +/** Optional parameters. */ +export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - ifMatch?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service does not match the value specified by the client. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - ifNoneMatch?: string; + ocpDate?: Date; /** * A timestamp indicating the last modified time of the resource known to the * client. The operation will be performed only if the resource on the service has @@ -143,26 +556,25 @@ export interface DeletePoolOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface PoolExistsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetTaskFileOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service exactly matches the value specified by the client. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - ifMatch?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service does not match the value specified by the client. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - ifNoneMatch?: string; + ocpDate?: Date; /** * A timestamp indicating the last modified time of the resource known to the * client. The operation will be performed only if the resource on the service has @@ -175,17 +587,62 @@ export interface PoolExistsOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; + /** + * The byte range to be retrieved. The default is to retrieve the entire file. The + * format is bytes=startRange-endRange. + */ + ocpRange?: string; } /** Optional parameters. */ -export interface GetPoolOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface DeleteTaskFileOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** + * Whether to delete children of a directory. If the filePath parameter represents + * a directory instead of a file, you can set recursive to true to delete the + * directory and all of the files and subdirectories in it. If recursive is false + * then the directory must be empty or deletion will fail. + */ + recursive?: boolean; +} + +/** Optional parameters. */ +export interface ReactivateTaskOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -210,21 +667,28 @@ export interface GetPoolOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; } /** Optional parameters. */ -export interface UpdatePoolOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface TerminateTaskOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -249,30 +713,52 @@ export interface UpdatePoolOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; } /** Optional parameters. */ -export interface DisablePoolAutoScaleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListSubTasksOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** An OData $select clause. */ + $select?: string[]; } /** Optional parameters. */ -export interface EnablePoolAutoScaleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ReplaceTaskOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -297,32 +783,28 @@ export interface EnablePoolAutoScaleOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; } /** Optional parameters. */ -export interface EvaluatePoolAutoScaleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetTaskOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; -} - -/** Optional parameters. */ -export interface ResizePoolOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - timeOutInSeconds?: number; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -347,19 +829,32 @@ export interface ResizePoolOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface StopPoolResizeOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface DeleteTaskOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -387,104 +882,209 @@ export interface StopPoolResizeOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface ReplacePoolPropertiesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface CreateTaskCollectionOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; } /** Optional parameters. */ -export interface RemoveNodesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListTasksOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service exactly matches the value specified by the client. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - ifMatch?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service does not match the value specified by the client. + * An OData $filter clause. For more information on constructing this filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. */ - ifNoneMatch?: string; + $filter?: string; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; +} + +/** Optional parameters. */ +export interface CreateTaskOptionalParams extends OperationOptions { /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time. + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. */ - ifModifiedSince?: Date; + timeOutInSeconds?: number; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; } /** Optional parameters. */ -export interface ListSupportedImagesOptionalParams extends OperationOptions { +export interface ListJobSchedulesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. */ - filter?: string; + $filter?: string; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface ListPoolNodeCountsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface CreateJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ - maxresults?: number; + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface TerminateJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service exactly matches the value specified by the client. + */ + ifMatch?: string; + /** + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service does not match the value specified by the client. + */ + ifNoneMatch?: string; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time. + */ + ifModifiedSince?: Date; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time. */ - filter?: string; + ifUnmodifiedSince?: Date; } /** Optional parameters. */ -export interface DeleteJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface EnableJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -512,14 +1112,25 @@ export interface DeleteJobOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface GetJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface DisableJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -544,21 +1155,28 @@ export interface GetJobOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; } /** Optional parameters. */ -export interface UpdateJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ReplaceJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -583,19 +1201,28 @@ export interface UpdateJobOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; } /** Optional parameters. */ -export interface ReplaceJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface UpdateJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -620,19 +1247,28 @@ export interface ReplaceJobOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; } /** Optional parameters. */ -export interface DisableJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -657,19 +1293,32 @@ export interface DisableJobOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface EnableJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface DeleteJobScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -697,14 +1346,25 @@ export interface EnableJobOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface TerminateJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface JobScheduleExistsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -729,73 +1389,153 @@ export interface TerminateJobOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; - /** The options to use for terminating the Job. */ - body?: BatchJobTerminateOptions; } /** Optional parameters. */ -export interface CreateJobOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetCertificateOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; + /** An OData $select clause. */ + $select?: string[]; +} + +/** Optional parameters. */ +export interface DeleteCertificateOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface CancelCertificateDeletionOptionalParams + extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; } /** Optional parameters. */ -export interface ListJobsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListCertificatesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. */ - filter?: string; + $filter?: string; /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; + $select?: string[]; } /** Optional parameters. */ -export interface ListJobsFromScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface CreateCertificateOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ - maxresults?: number; + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface GetJobTaskCountsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - filter?: string; - /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; } /** Optional parameters. */ @@ -806,112 +1546,147 @@ export interface ListJobPreparationAndReleaseTaskStatusOptionalParams * applications can be returned. */ maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-preparation-and-release-status. */ - filter?: string; + $filter?: string; /** An OData $select clause. */ - select?: string[]; + $select?: string[]; } /** Optional parameters. */ -export interface GetJobTaskCountsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListJobsFromScheduleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ - timeOutInSeconds?: number; -} - -/** Optional parameters. */ -export interface CreateCertificateOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * An OData $filter clause. For more information on constructing this filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. + */ + $filter?: string; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface ListCertificatesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListJobsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. */ - filter?: string; + $filter?: string; /** An OData $select clause. */ - select?: string[]; + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface CancelCertificateDeletionOptionalParams - extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface CreateJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; -} - -/** Optional parameters. */ -export interface DeleteCertificateOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - timeOutInSeconds?: number; -} - -/** Optional parameters. */ -export interface GetCertificateOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - timeOutInSeconds?: number; - /** An OData $select clause. */ - select?: string[]; + ocpDate?: Date; } /** Optional parameters. */ -export interface JobScheduleExistsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface TerminateJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -936,17 +1711,30 @@ export interface JobScheduleExistsOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; + /** The options to use for terminating the Job. */ + body?: BatchJobTerminateOptions; } /** Optional parameters. */ -export interface DeleteJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface EnableJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -974,14 +1762,25 @@ export interface DeleteJobScheduleOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface GetJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface DisableJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1006,21 +1805,28 @@ export interface GetJobScheduleOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; } /** Optional parameters. */ -export interface UpdateJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ReplaceJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1045,19 +1851,28 @@ export interface UpdateJobScheduleOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; } /** Optional parameters. */ -export interface ReplaceJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface UpdateJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1082,19 +1897,28 @@ export interface ReplaceJobScheduleOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; } /** Optional parameters. */ -export interface DisableJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1119,17 +1943,32 @@ export interface DisableJobScheduleOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface EnableJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface DeleteJobOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1157,138 +1996,157 @@ export interface EnableJobScheduleOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface TerminateJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListPoolNodeCountsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ - timeOutInSeconds?: number; + maxresults?: number; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service exactly matches the value specified by the client. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - ifMatch?: string; + ocpDate?: Date; /** - * An ETag value associated with the version of the resource known to the client. - * The operation will be performed only if the resource's current ETag on the - * service does not match the value specified by the client. + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. */ - ifNoneMatch?: string; + timeOutInSeconds?: number; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - ifModifiedSince?: Date; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time. + * An OData $filter clause. For more information on constructing this filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. */ - ifUnmodifiedSince?: Date; + $filter?: string; } /** Optional parameters. */ -export interface CreateJobScheduleOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListSupportedImagesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ - timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; -} - -/** Optional parameters. */ -export interface ListJobSchedulesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + maxresults?: number; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - maxresults?: number; + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. */ - filter?: string; - /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; + $filter?: string; } /** Optional parameters. */ -export interface CreateTaskOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface RemoveNodesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; -} - -/** Optional parameters. */ -export interface ListTasksOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - maxresults?: number; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - timeOutInSeconds?: number; + ocpDate?: Date; /** - * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service exactly matches the value specified by the client. */ - filter?: string; - /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; + ifMatch?: string; + /** + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service does not match the value specified by the client. + */ + ifNoneMatch?: string; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time. + */ + ifModifiedSince?: Date; + /** + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time. + */ + ifUnmodifiedSince?: Date; } /** Optional parameters. */ -export interface CreateTaskCollectionOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ReplacePoolPropertiesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; } /** Optional parameters. */ -export interface DeleteTaskOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface StopPoolResizeOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1316,14 +2174,25 @@ export interface DeleteTaskOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface GetTaskOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ResizePoolOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1348,21 +2217,50 @@ export interface GetTaskOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** An OData $select clause. */ - select?: string[]; - /** An OData $expand clause. */ - expand?: string[]; } /** Optional parameters. */ -export interface ReplaceTaskOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface EvaluatePoolAutoScaleOptionalParams extends OperationOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; +} + +/** Optional parameters. */ +export interface EnablePoolAutoScaleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1387,32 +2285,50 @@ export interface ReplaceTaskOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; - /** Type of content */ - contentType?: string; } /** Optional parameters. */ -export interface ListSubTasksOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface DisablePoolAutoScaleOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; - /** An OData $select clause. */ - select?: string[]; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; } /** Optional parameters. */ -export interface TerminateTaskOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface UpdatePoolOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1440,14 +2356,25 @@ export interface TerminateTaskOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface ReactivateTaskOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetPoolOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; + /** + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * An ETag value associated with the version of the resource known to the client. * The operation will be performed only if the resource's current ETag on the @@ -1472,63 +2399,44 @@ export interface ReactivateTaskOptionalParams extends OperationOptions { * not been modified since the specified time. */ ifUnmodifiedSince?: Date; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface DeleteTaskFileOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; - /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. - */ - timeOutInSeconds?: number; - /** - * Whether to delete children of a directory. If the filePath parameter represents - * a directory instead of a file, you can set recursive to true to delete the - * directory and all of the files and subdirectories in it. If recursive is false - * then the directory must be empty or deletion will fail. - */ - recursive?: boolean; -} - -/** Optional parameters. */ -export interface GetTaskFileOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface PoolExistsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - ifModifiedSince?: Date; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - ifUnmodifiedSince?: Date; + ocpDate?: Date; /** - * The byte range to be retrieved. The default is to retrieve the entire file. The - * format is bytes=startRange-endRange. + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service exactly matches the value specified by the client. */ - ocpRange?: string; -} - -/** Optional parameters. */ -export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + ifMatch?: string; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service does not match the value specified by the client. */ - timeOutInSeconds?: number; + ifNoneMatch?: string; /** * A timestamp indicating the last modified time of the resource known to the * client. The operation will be performed only if the resource on the service has @@ -1544,314 +2452,198 @@ export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface ListTaskFilesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; - /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. - */ - maxresults?: number; +export interface DeletePoolOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. - */ - filter?: string; - /** - * Whether to list children of the Task directory. This parameter can be used in - * combination with the filter parameter to list specific type of files. - */ - recursive?: boolean; -} - -/** Optional parameters. */ -export interface CreateNodeUserOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; - /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; -} - -/** Optional parameters. */ -export interface DeleteNodeUserOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - timeOutInSeconds?: number; -} - -/** Optional parameters. */ -export interface ReplaceNodeUserOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + ocpDate?: Date; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service exactly matches the value specified by the client. */ - timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; -} - -/** Optional parameters. */ -export interface GetNodeOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + ifMatch?: string; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * An ETag value associated with the version of the resource known to the client. + * The operation will be performed only if the resource's current ETag on the + * service does not match the value specified by the client. */ - timeOutInSeconds?: number; - /** An OData $select clause. */ - select?: string[]; -} - -/** Optional parameters. */ -export interface RebootNodeOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + ifNoneMatch?: string; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time. */ - timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; - /** The options to use for rebooting the Compute Node. */ - body?: NodeRebootOptions; -} - -/** Optional parameters. */ -export interface ReimageNodeOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + ifModifiedSince?: Date; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time. */ - timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; - /** The options to use for reimaging the Compute Node. */ - body?: NodeReimageOptions; + ifUnmodifiedSince?: Date; } /** Optional parameters. */ -export interface DisableNodeSchedulingOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListPoolsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ - timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; - /** The options to use for disabling scheduling on the Compute Node. */ - body?: NodeDisableSchedulingOptions; -} - -/** Optional parameters. */ -export interface EnableNodeSchedulingOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + maxresults?: number; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - timeOutInSeconds?: number; -} - -/** Optional parameters. */ -export interface GetNodeRemoteLoginSettingsOptionalParams - extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; -} - -/** Optional parameters. */ -export interface GetNodeRemoteDesktopFileOptionalParams - extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - timeOutInSeconds?: number; -} - -/** Optional parameters. */ -export interface UploadNodeLogsOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * An OData $filter clause. For more information on constructing this filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. */ - timeOutInSeconds?: number; - /** Type of content */ - contentType?: string; + $filter?: string; + /** An OData $select clause. */ + $select?: string[]; + /** An OData $expand clause. */ + $expand?: string[]; } /** Optional parameters. */ -export interface ListNodesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; - /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. - */ - maxresults?: number; +export interface CreatePoolOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - filter?: string; - /** An OData $select clause. */ - select?: string[]; -} - -/** Optional parameters. */ -export interface GetNodeExtensionOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - timeOutInSeconds?: number; - /** An OData $select clause. */ - select?: string[]; + ocpDate?: Date; } /** Optional parameters. */ -export interface ListNodeExtensionsOptionalParams extends OperationOptions { +export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ maxresults?: number; /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - timeOutInSeconds?: number; - /** An OData $select clause. */ - select?: string[]; -} - -/** Optional parameters. */ -export interface DeleteNodeFileOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * Whether to delete children of a directory. If the filePath parameter represents - * a directory instead of a file, you can set recursive to true to delete the - * directory and all of the files and subdirectories in it. If recursive is false - * then the directory must be empty or deletion will fail. - */ - recursive?: boolean; -} - -/** Optional parameters. */ -export interface GetNodeFileOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; - /** - * The maximum number of items to return in the response. A maximum of 1000 - * applications can be returned. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - timeOutInSeconds?: number; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time. + * The earliest time from which to include metrics. This must be at least two and + * a half hours before the current time. If not specified this defaults to the + * start time of the last aggregation interval currently available. */ - ifModifiedSince?: Date; + starttime?: Date; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time. + * The latest time from which to include metrics. This must be at least two hours + * before the current time. If not specified this defaults to the end time of the + * last aggregation interval currently available. */ - ifUnmodifiedSince?: Date; + endtime?: Date; /** - * The byte range to be retrieved. The default is to retrieve the entire file. The - * format is bytes=startRange-endRange. + * An OData $filter clause. For more information on constructing this filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. */ - ocpRange?: string; + $filter?: string; } /** Optional parameters. */ -export interface GetNodeFilePropertiesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface GetApplicationOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - ifModifiedSince?: Date; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; /** - * A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time. + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. */ - ifUnmodifiedSince?: Date; + ocpDate?: Date; } /** Optional parameters. */ -export interface ListNodeFilesOptionalParams extends OperationOptions { - /** The API version to use for this operation. */ - apiVersion?: string; +export interface ListApplicationsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ maxresults?: number; + /** + * The time the request was issued. Client libraries typically set this to the + * current system clock time; set it explicitly if you are calling the REST API + * directly. + */ + ocpDate?: Date; /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. */ timeOutInSeconds?: number; /** - * An OData $filter clause. For more information on constructing this filter, see - * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. + * The caller-generated request identity, in the form of a GUID with no decoration + * such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. */ - filter?: string; - /** Whether to list children of a directory. */ - recursive?: boolean; + clientRequestId?: string; + /** Whether the server should return the client-request-id in the response. */ + returnClientRequestId?: boolean; } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts index 33926738c5..fafb808c75 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts @@ -5,158 +5,158 @@ import { createBatch, BatchContext, BatchClientOptionalParams, - listApplications, - getApplication, - listPoolUsageMetrics, - createPool, - listPools, - deletePool, - poolExists, - getPool, - updatePool, - disablePoolAutoScale, - enablePoolAutoScale, - evaluatePoolAutoScale, - resizePool, - stopPoolResize, - replacePoolProperties, - removeNodes, - listSupportedImages, - listPoolNodeCounts, - deleteJob, - getJob, - updateJob, - replaceJob, - disableJob, - enableJob, - terminateJob, - createJob, - listJobs, - listJobsFromSchedule, - listJobPreparationAndReleaseTaskStatus, - getJobTaskCounts, - createCertificate, - listCertificates, - cancelCertificateDeletion, - deleteCertificate, - getCertificate, - jobScheduleExists, - deleteJobSchedule, - getJobSchedule, - updateJobSchedule, - replaceJobSchedule, - disableJobSchedule, - enableJobSchedule, - terminateJobSchedule, - createJobSchedule, - listJobSchedules, - createTask, - listTasks, - createTaskCollection, - deleteTask, - getTask, - replaceTask, - listSubTasks, - terminateTask, - reactivateTask, - deleteTaskFile, - getTaskFile, - getTaskFileProperties, - listTaskFiles, - createNodeUser, - deleteNodeUser, - replaceNodeUser, - getNode, - rebootNode, - reimageNode, - disableNodeScheduling, - enableNodeScheduling, - getNodeRemoteLoginSettings, - getNodeRemoteDesktopFile, - uploadNodeLogs, - listNodes, - getNodeExtension, - listNodeExtensions, - deleteNodeFile, - getNodeFile, - getNodeFileProperties, listNodeFiles, - ListApplicationsOptionalParams, - GetApplicationOptionalParams, - ListPoolUsageMetricsOptionalParams, - CreatePoolOptionalParams, - ListPoolsOptionalParams, - DeletePoolOptionalParams, - PoolExistsOptionalParams, - GetPoolOptionalParams, - UpdatePoolOptionalParams, - DisablePoolAutoScaleOptionalParams, - EnablePoolAutoScaleOptionalParams, - EvaluatePoolAutoScaleOptionalParams, - ResizePoolOptionalParams, - StopPoolResizeOptionalParams, - ReplacePoolPropertiesOptionalParams, - RemoveNodesOptionalParams, - ListSupportedImagesOptionalParams, - ListPoolNodeCountsOptionalParams, - DeleteJobOptionalParams, - GetJobOptionalParams, - UpdateJobOptionalParams, - ReplaceJobOptionalParams, - DisableJobOptionalParams, - EnableJobOptionalParams, - TerminateJobOptionalParams, - CreateJobOptionalParams, - ListJobsOptionalParams, - ListJobsFromScheduleOptionalParams, - ListJobPreparationAndReleaseTaskStatusOptionalParams, - GetJobTaskCountsOptionalParams, - CreateCertificateOptionalParams, - ListCertificatesOptionalParams, - CancelCertificateDeletionOptionalParams, - DeleteCertificateOptionalParams, - GetCertificateOptionalParams, - JobScheduleExistsOptionalParams, - DeleteJobScheduleOptionalParams, - GetJobScheduleOptionalParams, - UpdateJobScheduleOptionalParams, - ReplaceJobScheduleOptionalParams, - DisableJobScheduleOptionalParams, - EnableJobScheduleOptionalParams, - TerminateJobScheduleOptionalParams, - CreateJobScheduleOptionalParams, - ListJobSchedulesOptionalParams, - CreateTaskOptionalParams, - ListTasksOptionalParams, - CreateTaskCollectionOptionalParams, - DeleteTaskOptionalParams, - GetTaskOptionalParams, - ReplaceTaskOptionalParams, - ListSubTasksOptionalParams, - TerminateTaskOptionalParams, - ReactivateTaskOptionalParams, - DeleteTaskFileOptionalParams, - GetTaskFileOptionalParams, - GetTaskFilePropertiesOptionalParams, - ListTaskFilesOptionalParams, - CreateNodeUserOptionalParams, - DeleteNodeUserOptionalParams, - ReplaceNodeUserOptionalParams, - GetNodeOptionalParams, - RebootNodeOptionalParams, - ReimageNodeOptionalParams, - DisableNodeSchedulingOptionalParams, - EnableNodeSchedulingOptionalParams, - GetNodeRemoteLoginSettingsOptionalParams, - GetNodeRemoteDesktopFileOptionalParams, - UploadNodeLogsOptionalParams, - ListNodesOptionalParams, - GetNodeExtensionOptionalParams, - ListNodeExtensionsOptionalParams, - DeleteNodeFileOptionalParams, - GetNodeFileOptionalParams, - GetNodeFilePropertiesOptionalParams, + getNodeFileProperties, + getNodeFile, + deleteNodeFile, + listNodeExtensions, + getNodeExtension, + listNodes, + uploadNodeLogs, + getNodeRemoteDesktopFile, + getNodeRemoteLoginSettings, + enableNodeScheduling, + disableNodeScheduling, + reimageNode, + rebootNode, + getNode, + replaceNodeUser, + deleteNodeUser, + createNodeUser, + listTaskFiles, + getTaskFileProperties, + getTaskFile, + deleteTaskFile, + reactivateTask, + terminateTask, + listSubTasks, + replaceTask, + getTask, + deleteTask, + createTaskCollection, + listTasks, + createTask, + listJobSchedules, + createJobSchedule, + terminateJobSchedule, + enableJobSchedule, + disableJobSchedule, + replaceJobSchedule, + updateJobSchedule, + getJobSchedule, + deleteJobSchedule, + jobScheduleExists, + getCertificate, + deleteCertificate, + cancelCertificateDeletion, + listCertificates, + createCertificate, + getJobTaskCounts, + listJobPreparationAndReleaseTaskStatus, + listJobsFromSchedule, + listJobs, + createJob, + terminateJob, + enableJob, + disableJob, + replaceJob, + updateJob, + getJob, + deleteJob, + listPoolNodeCounts, + listSupportedImages, + removeNodes, + replacePoolProperties, + stopPoolResize, + resizePool, + evaluatePoolAutoScale, + enablePoolAutoScale, + disablePoolAutoScale, + updatePool, + getPool, + poolExists, + deletePool, + listPools, + createPool, + listPoolUsageMetrics, + getApplication, + listApplications, ListNodeFilesOptionalParams, + GetNodeFilePropertiesOptionalParams, + GetNodeFileOptionalParams, + DeleteNodeFileOptionalParams, + ListNodeExtensionsOptionalParams, + GetNodeExtensionOptionalParams, + ListNodesOptionalParams, + UploadNodeLogsOptionalParams, + GetNodeRemoteDesktopFileOptionalParams, + GetNodeRemoteLoginSettingsOptionalParams, + EnableNodeSchedulingOptionalParams, + DisableNodeSchedulingOptionalParams, + ReimageNodeOptionalParams, + RebootNodeOptionalParams, + GetNodeOptionalParams, + ReplaceNodeUserOptionalParams, + DeleteNodeUserOptionalParams, + CreateNodeUserOptionalParams, + ListTaskFilesOptionalParams, + GetTaskFilePropertiesOptionalParams, + GetTaskFileOptionalParams, + DeleteTaskFileOptionalParams, + ReactivateTaskOptionalParams, + TerminateTaskOptionalParams, + ListSubTasksOptionalParams, + ReplaceTaskOptionalParams, + GetTaskOptionalParams, + DeleteTaskOptionalParams, + CreateTaskCollectionOptionalParams, + ListTasksOptionalParams, + CreateTaskOptionalParams, + ListJobSchedulesOptionalParams, + CreateJobScheduleOptionalParams, + TerminateJobScheduleOptionalParams, + EnableJobScheduleOptionalParams, + DisableJobScheduleOptionalParams, + ReplaceJobScheduleOptionalParams, + UpdateJobScheduleOptionalParams, + GetJobScheduleOptionalParams, + DeleteJobScheduleOptionalParams, + JobScheduleExistsOptionalParams, + GetCertificateOptionalParams, + DeleteCertificateOptionalParams, + CancelCertificateDeletionOptionalParams, + ListCertificatesOptionalParams, + CreateCertificateOptionalParams, + GetJobTaskCountsOptionalParams, + ListJobPreparationAndReleaseTaskStatusOptionalParams, + ListJobsFromScheduleOptionalParams, + ListJobsOptionalParams, + CreateJobOptionalParams, + TerminateJobOptionalParams, + EnableJobOptionalParams, + DisableJobOptionalParams, + ReplaceJobOptionalParams, + UpdateJobOptionalParams, + GetJobOptionalParams, + DeleteJobOptionalParams, + ListPoolNodeCountsOptionalParams, + ListSupportedImagesOptionalParams, + RemoveNodesOptionalParams, + ReplacePoolPropertiesOptionalParams, + StopPoolResizeOptionalParams, + ResizePoolOptionalParams, + EvaluatePoolAutoScaleOptionalParams, + EnablePoolAutoScaleOptionalParams, + DisablePoolAutoScaleOptionalParams, + UpdatePoolOptionalParams, + GetPoolOptionalParams, + PoolExistsOptionalParams, + DeletePoolOptionalParams, + ListPoolsOptionalParams, + CreatePoolOptionalParams, + ListPoolUsageMetricsOptionalParams, + GetApplicationOptionalParams, + ListApplicationsOptionalParams, } from "./api/index.js"; import { BatchNodeUserCreateOptions, @@ -224,510 +224,440 @@ export class BatchClient { this.pipeline = this._client.pipeline; } - /** - * This operation returns only Applications and versions that are available for - * use on Compute Nodes; that is, that can be used in an Package reference. For - * administrator information about applications and versions that are not yet - * available to Compute Nodes, use the Azure portal or the Azure Resource Manager - * API. - */ - listApplications( - options: ListApplicationsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listApplications(this._client, options); - } - - /** - * This operation returns only Applications and versions that are available for - * use on Compute Nodes; that is, that can be used in an Package reference. For - * administrator information about Applications and versions that are not yet - * available to Compute Nodes, use the Azure portal or the Azure Resource Manager - * API. - */ - getApplication( - applicationId: string, - options: GetApplicationOptionalParams = { requestOptions: {} }, - ): Promise { - return getApplication(this._client, applicationId, options); - } - - /** - * If you do not specify a $filter clause including a poolId, the response - * includes all Pools that existed in the Account in the time range of the - * returned aggregation intervals. If you do not specify a $filter clause - * including a startTime or endTime these filters default to the start and end - * times of the last aggregation interval currently available; that is, only the - * last aggregation interval is returned. - */ - listPoolUsageMetrics( - options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listPoolUsageMetrics(this._client, options); + /** Lists all of the files in Task directories on the specified Compute Node. */ + listNodeFiles( + poolId: string, + nodeId: string, + options: ListNodeFilesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listNodeFiles(this._client, poolId, nodeId, options); } - /** - * When naming Pools, avoid including sensitive information such as user names or - * secret project names. This information may appear in telemetry logs accessible - * to Microsoft Support engineers. - */ - createPool( - body: BatchPoolCreateOptions, - options: CreatePoolOptionalParams = { requestOptions: {} }, + /** Gets the properties of the specified Compute Node file. */ + getNodeFileProperties( + poolId: string, + nodeId: string, + filePath: string, + options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, ): Promise { - return createPool(this._client, body, options); + return getNodeFileProperties( + this._client, + poolId, + nodeId, + filePath, + options, + ); } - /** Lists all of the Pools in the specified Account. */ - listPools( - options: ListPoolsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listPools(this._client, options); + /** Returns the content of the specified Compute Node file. */ + getNodeFile( + poolId: string, + nodeId: string, + filePath: string, + options: GetNodeFileOptionalParams = { requestOptions: {} }, + ): Promise { + return getNodeFile(this._client, poolId, nodeId, filePath, options); } - /** - * When you request that a Pool be deleted, the following actions occur: the Pool - * state is set to deleting; any ongoing resize operation on the Pool are stopped; - * the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks - * running on existing Compute Nodes are terminated and requeued (as if a resize - * Pool operation had been requested with the default requeue option); finally, - * the Pool is removed from the system. Because running Tasks are requeued, the - * user can rerun these Tasks by updating their Job to target a different Pool. - * The Tasks can then run on the new Pool. If you want to override the requeue - * behavior, then you should call resize Pool explicitly to shrink the Pool to - * zero size before deleting the Pool. If you call an Update, Patch or Delete API - * on a Pool in the deleting state, it will fail with HTTP status code 409 with - * error code PoolBeingDeleted. - */ - deletePool( + /** Deletes the specified file from the Compute Node. */ + deleteNodeFile( poolId: string, - options: DeletePoolOptionalParams = { requestOptions: {} }, + nodeId: string, + filePath: string, + options: DeleteNodeFileOptionalParams = { requestOptions: {} }, ): Promise { - return deletePool(this._client, poolId, options); + return deleteNodeFile(this._client, poolId, nodeId, filePath, options); } - /** Gets basic properties of a Pool. */ - poolExists( + /** Lists the Compute Nodes Extensions in the specified Pool. */ + listNodeExtensions( poolId: string, - options: PoolExistsOptionalParams = { requestOptions: {} }, - ): Promise { - return poolExists(this._client, poolId, options); + nodeId: string, + options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listNodeExtensions(this._client, poolId, nodeId, options); } - /** Gets information about the specified Pool. */ - getPool( + /** Gets information about the specified Compute Node Extension. */ + getNodeExtension( poolId: string, - options: GetPoolOptionalParams = { requestOptions: {} }, - ): Promise { - return getPool(this._client, poolId, options); + nodeId: string, + extensionName: string, + options: GetNodeExtensionOptionalParams = { requestOptions: {} }, + ): Promise { + return getNodeExtension( + this._client, + poolId, + nodeId, + extensionName, + options, + ); } - /** - * This only replaces the Pool properties specified in the request. For example, - * if the Pool has a StartTask associated with it, and a request does not specify - * a StartTask element, then the Pool keeps the existing StartTask. - */ - updatePool( + /** Lists the Compute Nodes in the specified Pool. */ + listNodes( poolId: string, - body: BatchPoolUpdateOptions, - options: UpdatePoolOptionalParams = { requestOptions: {} }, - ): Promise { - return updatePool(this._client, poolId, body, options); + options: ListNodesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listNodes(this._client, poolId, options); } - /** Disables automatic scaling for a Pool. */ - disablePoolAutoScale( + /** + * This is for gathering Azure Batch service log files in an automated fashion + * from Compute Nodes if you are experiencing an error and wish to escalate to + * Azure support. The Azure Batch service log files should be shared with Azure + * support to aid in debugging issues with the Batch service. + */ + uploadNodeLogs( poolId: string, - options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, - ): Promise { - return disablePoolAutoScale(this._client, poolId, options); + nodeId: string, + body: UploadBatchServiceLogsOptions, + options: UploadNodeLogsOptionalParams = { requestOptions: {} }, + ): Promise { + return uploadNodeLogs(this._client, poolId, nodeId, body, options); } /** - * You cannot enable automatic scaling on a Pool if a resize operation is in - * progress on the Pool. If automatic scaling of the Pool is currently disabled, - * you must specify a valid autoscale formula as part of the request. If automatic - * scaling of the Pool is already enabled, you may specify a new autoscale formula - * and/or a new evaluation interval. You cannot call this API for the same Pool - * more than once every 30 seconds. + * Before you can access a Compute Node by using the RDP file, you must create a + * user Account on the Compute Node. This API can only be invoked on Pools created + * with a cloud service configuration. For Pools created with a virtual machine + * configuration, see the GetRemoteLoginSettings API. */ - enablePoolAutoScale( + getNodeRemoteDesktopFile( poolId: string, - body: BatchPoolEnableAutoScaleOptions, - options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, - ): Promise { - return enablePoolAutoScale(this._client, poolId, body, options); + nodeId: string, + options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, + ): Promise { + return getNodeRemoteDesktopFile(this._client, poolId, nodeId, options); } /** - * This API is primarily for validating an autoscale formula, as it simply returns - * the result without applying the formula to the Pool. The Pool must have auto - * scaling enabled in order to evaluate a formula. + * Before you can remotely login to a Compute Node using the remote login + * settings, you must create a user Account on the Compute Node. This API can be + * invoked only on Pools created with the virtual machine configuration property. + * For Pools created with a cloud service configuration, see the GetRemoteDesktop + * API. */ - evaluatePoolAutoScale( + getNodeRemoteLoginSettings( poolId: string, - body: BatchPoolEvaluateAutoScaleOptions, - options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, - ): Promise { - return evaluatePoolAutoScale(this._client, poolId, body, options); + nodeId: string, + options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, + ): Promise { + return getNodeRemoteLoginSettings(this._client, poolId, nodeId, options); } /** - * You can only resize a Pool when its allocation state is steady. If the Pool is - * already resizing, the request fails with status code 409. When you resize a - * Pool, the Pool's allocation state changes from steady to resizing. You cannot - * resize Pools which are configured for automatic scaling. If you try to do this, - * the Batch service returns an error 409. If you resize a Pool downwards, the - * Batch service chooses which Compute Nodes to remove. To remove specific Compute - * Nodes, use the Pool remove Compute Nodes API instead. + * You can enable Task scheduling on a Compute Node only if its current scheduling + * state is disabled */ - resizePool( + enableNodeScheduling( poolId: string, - body: BatchPoolResizeOptions, - options: ResizePoolOptionalParams = { requestOptions: {} }, + nodeId: string, + options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, ): Promise { - return resizePool(this._client, poolId, body, options); + return enableNodeScheduling(this._client, poolId, nodeId, options); } /** - * This does not restore the Pool to its previous state before the resize - * operation: it only stops any further changes being made, and the Pool maintains - * its current state. After stopping, the Pool stabilizes at the number of Compute - * Nodes it was at when the stop operation was done. During the stop operation, - * the Pool allocation state changes first to stopping and then to steady. A - * resize operation need not be an explicit resize Pool request; this API can also - * be used to halt the initial sizing of the Pool when it is created. + * You can disable Task scheduling on a Compute Node only if its current + * scheduling state is enabled. */ - stopPoolResize( + disableNodeScheduling( poolId: string, - options: StopPoolResizeOptionalParams = { requestOptions: {} }, + nodeId: string, + options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, ): Promise { - return stopPoolResize(this._client, poolId, options); + return disableNodeScheduling(this._client, poolId, nodeId, options); } /** - * This fully replaces all the updatable properties of the Pool. For example, if - * the Pool has a StartTask associated with it and if StartTask is not specified - * with this request, then the Batch service will remove the existing StartTask. + * You can reinstall the operating system on a Compute Node only if it is in an + * idle or running state. This API can be invoked only on Pools created with the + * cloud service configuration property. */ - replacePoolProperties( + reimageNode( poolId: string, - body: BatchPoolReplaceOptions, - options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, + nodeId: string, + options: ReimageNodeOptionalParams = { requestOptions: {} }, ): Promise { - return replacePoolProperties(this._client, poolId, body, options); + return reimageNode(this._client, poolId, nodeId, options); } - /** - * This operation can only run when the allocation state of the Pool is steady. - * When this operation runs, the allocation state changes from steady to resizing. - * Each request may remove up to 100 nodes. - */ - removeNodes( + /** You can restart a Compute Node only if it is in an idle or running state. */ + rebootNode( poolId: string, - body: NodeRemoveOptions, - options: RemoveNodesOptionalParams = { requestOptions: {} }, + nodeId: string, + options: RebootNodeOptionalParams = { requestOptions: {} }, ): Promise { - return removeNodes(this._client, poolId, body, options); + return rebootNode(this._client, poolId, nodeId, options); } - /** Lists all Virtual Machine Images supported by the Azure Batch service. */ - listSupportedImages( - options: ListSupportedImagesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listSupportedImages(this._client, options); + /** Gets information about the specified Compute Node. */ + getNode( + poolId: string, + nodeId: string, + options: GetNodeOptionalParams = { requestOptions: {} }, + ): Promise { + return getNode(this._client, poolId, nodeId, options); } /** - * Gets the number of Compute Nodes in each state, grouped by Pool. Note that the - * numbers returned may not always be up to date. If you need exact node counts, - * use a list query. + * This operation replaces of all the updatable properties of the Account. For + * example, if the expiryTime element is not specified, the current value is + * replaced with the default value, not left unmodified. You can update a user + * Account on a Compute Node only when it is in the idle or running state. */ - listPoolNodeCounts( - options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listPoolNodeCounts(this._client, options); + replaceNodeUser( + poolId: string, + nodeId: string, + userName: string, + body: BatchNodeUserUpdateOptions, + options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, + ): Promise { + return replaceNodeUser( + this._client, + poolId, + nodeId, + userName, + body, + options, + ); } /** - * Deleting a Job also deletes all Tasks that are part of that Job, and all Job - * statistics. This also overrides the retention period for Task data; that is, if - * the Job contains Tasks which are still retained on Compute Nodes, the Batch - * services deletes those Tasks' working directories and all their contents. When - * a Delete Job request is received, the Batch service sets the Job to the - * deleting state. All update operations on a Job that is in deleting state will - * fail with status code 409 (Conflict), with additional information indicating - * that the Job is being deleted. + * You can delete a user Account to a Compute Node only when it is in the idle or + * running state. + */ + deleteNodeUser( + poolId: string, + nodeId: string, + userName: string, + options: DeleteNodeUserOptionalParams = { requestOptions: {} }, + ): Promise { + return deleteNodeUser(this._client, poolId, nodeId, userName, options); + } + + /** + * You can add a user Account to a Compute Node only when it is in the idle or + * running state. */ - deleteJob( - jobId: string, - options: DeleteJobOptionalParams = { requestOptions: {} }, + createNodeUser( + poolId: string, + nodeId: string, + body: BatchNodeUserCreateOptions, + options: CreateNodeUserOptionalParams = { requestOptions: {} }, ): Promise { - return deleteJob(this._client, jobId, options); + return createNodeUser(this._client, poolId, nodeId, body, options); } - /** Gets information about the specified Job. */ - getJob( + /** Lists the files in a Task's directory on its Compute Node. */ + listTaskFiles( jobId: string, - options: GetJobOptionalParams = { requestOptions: {} }, - ): Promise { - return getJob(this._client, jobId, options); + taskId: string, + options: ListTaskFilesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTaskFiles(this._client, jobId, taskId, options); } - /** - * This replaces only the Job properties specified in the request. For example, if - * the Job has constraints, and a request does not specify the constraints - * element, then the Job keeps the existing constraints. - */ - updateJob( + /** Gets the properties of the specified Task file. */ + getTaskFileProperties( jobId: string, - body: BatchJobUpdateOptions, - options: UpdateJobOptionalParams = { requestOptions: {} }, + taskId: string, + filePath: string, + options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, ): Promise { - return updateJob(this._client, jobId, body, options); + return getTaskFileProperties( + this._client, + jobId, + taskId, + filePath, + options, + ); } - /** - * This fully replaces all the updatable properties of the Job. For example, if - * the Job has constraints associated with it and if constraints is not specified - * with this request, then the Batch service will remove the existing constraints. - */ - replaceJob( + /** Returns the content of the specified Task file. */ + getTaskFile( jobId: string, - body: BatchJob, - options: ReplaceJobOptionalParams = { requestOptions: {} }, - ): Promise { - return replaceJob(this._client, jobId, body, options); + taskId: string, + filePath: string, + options: GetTaskFileOptionalParams = { requestOptions: {} }, + ): Promise { + return getTaskFile(this._client, jobId, taskId, filePath, options); } - /** - * The Batch Service immediately moves the Job to the disabling state. Batch then - * uses the disableTasks parameter to determine what to do with the currently - * running Tasks of the Job. The Job remains in the disabling state until the - * disable operation is completed and all Tasks have been dealt with according to - * the disableTasks option; the Job then moves to the disabled state. No new Tasks - * are started under the Job until it moves back to active state. If you try to - * disable a Job that is in any state other than active, disabling, or disabled, - * the request fails with status code 409. - */ - disableJob( + /** Deletes the specified Task file from the Compute Node where the Task ran. */ + deleteTaskFile( jobId: string, - body: BatchJobDisableOptions, - options: DisableJobOptionalParams = { requestOptions: {} }, + taskId: string, + filePath: string, + options: DeleteTaskFileOptionalParams = { requestOptions: {} }, ): Promise { - return disableJob(this._client, jobId, body, options); + return deleteTaskFile(this._client, jobId, taskId, filePath, options); } /** - * When you call this API, the Batch service sets a disabled Job to the enabling - * state. After the this operation is completed, the Job moves to the active - * state, and scheduling of new Tasks under the Job resumes. The Batch service - * does not allow a Task to remain in the active state for more than 180 days. - * Therefore, if you enable a Job containing active Tasks which were added more - * than 180 days ago, those Tasks will not run. + * Reactivation makes a Task eligible to be retried again up to its maximum retry + * count. The Task's state is changed to active. As the Task is no longer in the + * completed state, any previous exit code or failure information is no longer + * available after reactivation. Each time a Task is reactivated, its retry count + * is reset to 0. Reactivation will fail for Tasks that are not completed or that + * previously completed successfully (with an exit code of 0). Additionally, it + * will fail if the Job has completed (or is terminating or deleting). */ - enableJob( + reactivateTask( jobId: string, - options: EnableJobOptionalParams = { requestOptions: {} }, + taskId: string, + options: ReactivateTaskOptionalParams = { requestOptions: {} }, ): Promise { - return enableJob(this._client, jobId, options); + return reactivateTask(this._client, jobId, taskId, options); } /** - * When a Terminate Job request is received, the Batch service sets the Job to the - * terminating state. The Batch service then terminates any running Tasks - * associated with the Job and runs any required Job release Tasks. Then the Job - * moves into the completed state. If there are any Tasks in the Job in the active - * state, they will remain in the active state. Once a Job is terminated, new - * Tasks cannot be added and any remaining active Tasks will not be scheduled. + * When the Task has been terminated, it moves to the completed state. For + * multi-instance Tasks, the terminate Task operation applies synchronously to the + * primary task; subtasks are then terminated asynchronously in the background. */ - terminateJob( + terminateTask( jobId: string, - options: TerminateJobOptionalParams = { requestOptions: {} }, - ): Promise { - return terminateJob(this._client, jobId, options); - } - - /** - * The Batch service supports two ways to control the work done as part of a Job. - * In the first approach, the user specifies a Job Manager Task. The Batch service - * launches this Task when it is ready to start the Job. The Job Manager Task - * controls all other Tasks that run under this Job, by using the Task APIs. In - * the second approach, the user directly controls the execution of Tasks under an - * active Job, by using the Task APIs. Also note: when naming Jobs, avoid - * including sensitive information such as user names or secret project names. - * This information may appear in telemetry logs accessible to Microsoft Support - * engineers. - */ - createJob( - body: BatchJobCreateOptions, - options: CreateJobOptionalParams = { requestOptions: {} }, + taskId: string, + options: TerminateTaskOptionalParams = { requestOptions: {} }, ): Promise { - return createJob(this._client, body, options); + return terminateTask(this._client, jobId, taskId, options); } - /** Lists all of the Jobs in the specified Account. */ - listJobs( - options: ListJobsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listJobs(this._client, options); + /** If the Task is not a multi-instance Task then this returns an empty collection. */ + listSubTasks( + jobId: string, + taskId: string, + options: ListSubTasksOptionalParams = { requestOptions: {} }, + ): Promise { + return listSubTasks(this._client, jobId, taskId, options); } - /** Lists the Jobs that have been created under the specified Job Schedule. */ - listJobsFromSchedule( - jobScheduleId: string, - options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listJobsFromSchedule(this._client, jobScheduleId, options); + /** Updates the properties of the specified Task. */ + replaceTask( + jobId: string, + taskId: string, + body: BatchTask, + options: ReplaceTaskOptionalParams = { requestOptions: {} }, + ): Promise { + return replaceTask(this._client, jobId, taskId, body, options); } /** - * This API returns the Job Preparation and Job Release Task status on all Compute - * Nodes that have run the Job Preparation or Job Release Task. This includes - * Compute Nodes which have since been removed from the Pool. If this API is - * invoked on a Job which has no Job Preparation or Job Release Task, the Batch - * service returns HTTP status code 409 (Conflict) with an error code of - * JobPreparationTaskNotSpecified. + * For multi-instance Tasks, information such as affinityId, executionInfo and + * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve + * information about subtasks. */ - listJobPreparationAndReleaseTaskStatus( + getTask( jobId: string, - options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { - requestOptions: {}, - }, - ): PagedAsyncIterableIterator { - return listJobPreparationAndReleaseTaskStatus(this._client, jobId, options); + taskId: string, + options: GetTaskOptionalParams = { requestOptions: {} }, + ): Promise { + return getTask(this._client, jobId, taskId, options); } /** - * Task counts provide a count of the Tasks by active, running or completed Task - * state, and a count of Tasks which succeeded or failed. Tasks in the preparing - * state are counted as running. Note that the numbers returned may not always be - * up to date. If you need exact task counts, use a list query. + * When a Task is deleted, all of the files in its directory on the Compute Node + * where it ran are also deleted (regardless of the retention time). For + * multi-instance Tasks, the delete Task operation applies synchronously to the + * primary task; subtasks and their files are then deleted asynchronously in the + * background. */ - getJobTaskCounts( + deleteTask( jobId: string, - options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, - ): Promise { - return getJobTaskCounts(this._client, jobId, options); - } - - /** Creates a Certificate to the specified Account. */ - createCertificate( - body: BatchCertificate, - options: CreateCertificateOptionalParams = { requestOptions: {} }, + taskId: string, + options: DeleteTaskOptionalParams = { requestOptions: {} }, ): Promise { - return createCertificate(this._client, body, options); + return deleteTask(this._client, jobId, taskId, options); } - /** Lists all of the Certificates that have been added to the specified Account. */ - listCertificates( - options: ListCertificatesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listCertificates(this._client, options); + /** + * Note that each Task must have a unique ID. The Batch service may not return the + * results for each Task in the same order the Tasks were submitted in this + * request. If the server times out or the connection is closed during the + * request, the request may have been partially or fully processed, or not at all. + * In such cases, the user should re-issue the request. Note that it is up to the + * user to correctly handle failures when re-issuing a request. For example, you + * should use the same Task IDs during a retry so that if the prior operation + * succeeded, the retry will not create extra Tasks unexpectedly. If the response + * contains any Tasks which failed to add, a client can retry the request. In a + * retry, it is most efficient to resubmit only Tasks that failed to add, and to + * omit Tasks that were successfully added on the first attempt. The maximum + * lifetime of a Task from addition to completion is 180 days. If a Task has not + * completed within 180 days of being added it will be terminated by the Batch + * service and left in whatever state it was in at that time. + */ + createTaskCollection( + jobId: string, + collection: BatchTaskCollection, + options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, + ): Promise { + return createTaskCollection(this._client, jobId, collection, options); } /** - * If you try to delete a Certificate that is being used by a Pool or Compute - * Node, the status of the Certificate changes to deleteFailed. If you decide that - * you want to continue using the Certificate, you can use this operation to set - * the status of the Certificate back to active. If you intend to delete the - * Certificate, you do not need to run this operation after the deletion failed. - * You must make sure that the Certificate is not being used by any resources, and - * then you can try again to delete the Certificate. + * For multi-instance Tasks, information such as affinityId, executionInfo and + * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve + * information about subtasks. */ - cancelCertificateDeletion( - thumbprintAlgorithm: string, - thumbprint: string, - options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, - ): Promise { - return cancelCertificateDeletion( - this._client, - thumbprintAlgorithm, - thumbprint, - options, - ); + listTasks( + jobId: string, + options: ListTasksOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTasks(this._client, jobId, options); } /** - * You cannot delete a Certificate if a resource (Pool or Compute Node) is using - * it. Before you can delete a Certificate, you must therefore make sure that the - * Certificate is not associated with any existing Pools, the Certificate is not - * installed on any Nodes (even if you remove a Certificate from a Pool, it is not - * removed from existing Compute Nodes in that Pool until they restart), and no - * running Tasks depend on the Certificate. If you try to delete a Certificate - * that is in use, the deletion fails. The Certificate status changes to - * deleteFailed. You can use Cancel Delete Certificate to set the status back to - * active if you decide that you want to continue using the Certificate. + * The maximum lifetime of a Task from addition to completion is 180 days. If a + * Task has not completed within 180 days of being added it will be terminated by + * the Batch service and left in whatever state it was in at that time. */ - deleteCertificate( - thumbprintAlgorithm: string, - thumbprint: string, - options: DeleteCertificateOptionalParams = { requestOptions: {} }, + createTask( + jobId: string, + body: BatchTaskCreateOptions, + options: CreateTaskOptionalParams = { requestOptions: {} }, ): Promise { - return deleteCertificate( - this._client, - thumbprintAlgorithm, - thumbprint, - options, - ); + return createTask(this._client, jobId, body, options); } - /** Gets information about the specified Certificate. */ - getCertificate( - thumbprintAlgorithm: string, - thumbprint: string, - options: GetCertificateOptionalParams = { requestOptions: {} }, - ): Promise { - return getCertificate( - this._client, - thumbprintAlgorithm, - thumbprint, - options, - ); + /** Lists all of the Job Schedules in the specified Account. */ + listJobSchedules( + options: ListJobSchedulesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listJobSchedules(this._client, options); } - /** Checks the specified Job Schedule exists. */ - jobScheduleExists( - jobScheduleId: string, - options: JobScheduleExistsOptionalParams = { requestOptions: {} }, + /** Creates a Job Schedule to the specified Account. */ + createJobSchedule( + body: BatchJobScheduleCreateOptions, + options: CreateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - return jobScheduleExists(this._client, jobScheduleId, options); + return createJobSchedule(this._client, body, options); } - /** - * When you delete a Job Schedule, this also deletes all Jobs and Tasks under that - * schedule. When Tasks are deleted, all the files in their working directories on - * the Compute Nodes are also deleted (the retention period is ignored). The Job - * Schedule statistics are no longer accessible once the Job Schedule is deleted, - * though they are still counted towards Account lifetime statistics. - */ - deleteJobSchedule( + /** Terminates a Job Schedule. */ + terminateJobSchedule( jobScheduleId: string, - options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, + options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - return deleteJobSchedule(this._client, jobScheduleId, options); + return terminateJobSchedule(this._client, jobScheduleId, options); } - /** Gets information about the specified Job Schedule. */ - getJobSchedule( + /** Enables a Job Schedule. */ + enableJobSchedule( jobScheduleId: string, - options: GetJobScheduleOptionalParams = { requestOptions: {} }, - ): Promise { - return getJobSchedule(this._client, jobScheduleId, options); + options: EnableJobScheduleOptionalParams = { requestOptions: {} }, + ): Promise { + return enableJobSchedule(this._client, jobScheduleId, options); } - /** - * This replaces only the Job Schedule properties specified in the request. For - * example, if the schedule property is not specified with this request, then the - * Batch service will keep the existing schedule. Changes to a Job Schedule only - * impact Jobs created by the schedule after the update has taken place; currently - * running Jobs are unaffected. - */ - updateJobSchedule( + /** No new Jobs will be created until the Job Schedule is enabled again. */ + disableJobSchedule( jobScheduleId: string, - body: BatchJobScheduleUpdateOptions, - options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, + options: DisableJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - return updateJobSchedule(this._client, jobScheduleId, body, options); + return disableJobSchedule(this._client, jobScheduleId, options); } /** @@ -745,439 +675,509 @@ export class BatchClient { return replaceJobSchedule(this._client, jobScheduleId, body, options); } - /** No new Jobs will be created until the Job Schedule is enabled again. */ - disableJobSchedule( + /** + * This replaces only the Job Schedule properties specified in the request. For + * example, if the schedule property is not specified with this request, then the + * Batch service will keep the existing schedule. Changes to a Job Schedule only + * impact Jobs created by the schedule after the update has taken place; currently + * running Jobs are unaffected. + */ + updateJobSchedule( jobScheduleId: string, - options: DisableJobScheduleOptionalParams = { requestOptions: {} }, + body: BatchJobScheduleUpdateOptions, + options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - return disableJobSchedule(this._client, jobScheduleId, options); + return updateJobSchedule(this._client, jobScheduleId, body, options); } - /** Enables a Job Schedule. */ - enableJobSchedule( + /** Gets information about the specified Job Schedule. */ + getJobSchedule( jobScheduleId: string, - options: EnableJobScheduleOptionalParams = { requestOptions: {} }, - ): Promise { - return enableJobSchedule(this._client, jobScheduleId, options); + options: GetJobScheduleOptionalParams = { requestOptions: {} }, + ): Promise { + return getJobSchedule(this._client, jobScheduleId, options); } - /** Terminates a Job Schedule. */ - terminateJobSchedule( + /** + * When you delete a Job Schedule, this also deletes all Jobs and Tasks under that + * schedule. When Tasks are deleted, all the files in their working directories on + * the Compute Nodes are also deleted (the retention period is ignored). The Job + * Schedule statistics are no longer accessible once the Job Schedule is deleted, + * though they are still counted towards Account lifetime statistics. + */ + deleteJobSchedule( jobScheduleId: string, - options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, + options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { - return terminateJobSchedule(this._client, jobScheduleId, options); + return deleteJobSchedule(this._client, jobScheduleId, options); } - /** Creates a Job Schedule to the specified Account. */ - createJobSchedule( - body: BatchJobScheduleCreateOptions, - options: CreateJobScheduleOptionalParams = { requestOptions: {} }, + /** Checks the specified Job Schedule exists. */ + jobScheduleExists( + jobScheduleId: string, + options: JobScheduleExistsOptionalParams = { requestOptions: {} }, ): Promise { - return createJobSchedule(this._client, body, options); + return jobScheduleExists(this._client, jobScheduleId, options); } - /** Lists all of the Job Schedules in the specified Account. */ - listJobSchedules( - options: ListJobSchedulesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listJobSchedules(this._client, options); + /** Gets information about the specified Certificate. */ + getCertificate( + thumbprintAlgorithm: string, + thumbprint: string, + options: GetCertificateOptionalParams = { requestOptions: {} }, + ): Promise { + return getCertificate( + this._client, + thumbprintAlgorithm, + thumbprint, + options, + ); } /** - * The maximum lifetime of a Task from addition to completion is 180 days. If a - * Task has not completed within 180 days of being added it will be terminated by - * the Batch service and left in whatever state it was in at that time. + * You cannot delete a Certificate if a resource (Pool or Compute Node) is using + * it. Before you can delete a Certificate, you must therefore make sure that the + * Certificate is not associated with any existing Pools, the Certificate is not + * installed on any Nodes (even if you remove a Certificate from a Pool, it is not + * removed from existing Compute Nodes in that Pool until they restart), and no + * running Tasks depend on the Certificate. If you try to delete a Certificate + * that is in use, the deletion fails. The Certificate status changes to + * deleteFailed. You can use Cancel Delete Certificate to set the status back to + * active if you decide that you want to continue using the Certificate. */ - createTask( - jobId: string, - body: BatchTaskCreateOptions, - options: CreateTaskOptionalParams = { requestOptions: {} }, + deleteCertificate( + thumbprintAlgorithm: string, + thumbprint: string, + options: DeleteCertificateOptionalParams = { requestOptions: {} }, ): Promise { - return createTask(this._client, jobId, body, options); + return deleteCertificate( + this._client, + thumbprintAlgorithm, + thumbprint, + options, + ); } /** - * For multi-instance Tasks, information such as affinityId, executionInfo and - * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve - * information about subtasks. + * If you try to delete a Certificate that is being used by a Pool or Compute + * Node, the status of the Certificate changes to deleteFailed. If you decide that + * you want to continue using the Certificate, you can use this operation to set + * the status of the Certificate back to active. If you intend to delete the + * Certificate, you do not need to run this operation after the deletion failed. + * You must make sure that the Certificate is not being used by any resources, and + * then you can try again to delete the Certificate. */ - listTasks( - jobId: string, - options: ListTasksOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTasks(this._client, jobId, options); + cancelCertificateDeletion( + thumbprintAlgorithm: string, + thumbprint: string, + options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, + ): Promise { + return cancelCertificateDeletion( + this._client, + thumbprintAlgorithm, + thumbprint, + options, + ); } - /** - * Note that each Task must have a unique ID. The Batch service may not return the - * results for each Task in the same order the Tasks were submitted in this - * request. If the server times out or the connection is closed during the - * request, the request may have been partially or fully processed, or not at all. - * In such cases, the user should re-issue the request. Note that it is up to the - * user to correctly handle failures when re-issuing a request. For example, you - * should use the same Task IDs during a retry so that if the prior operation - * succeeded, the retry will not create extra Tasks unexpectedly. If the response - * contains any Tasks which failed to add, a client can retry the request. In a - * retry, it is most efficient to resubmit only Tasks that failed to add, and to - * omit Tasks that were successfully added on the first attempt. The maximum - * lifetime of a Task from addition to completion is 180 days. If a Task has not - * completed within 180 days of being added it will be terminated by the Batch - * service and left in whatever state it was in at that time. - */ - createTaskCollection( - jobId: string, - collection: BatchTaskCollection, - options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, - ): Promise { - return createTaskCollection(this._client, jobId, collection, options); + /** Lists all of the Certificates that have been added to the specified Account. */ + listCertificates( + options: ListCertificatesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listCertificates(this._client, options); + } + + /** Creates a Certificate to the specified Account. */ + createCertificate( + body: BatchCertificate, + options: CreateCertificateOptionalParams = { requestOptions: {} }, + ): Promise { + return createCertificate(this._client, body, options); } /** - * When a Task is deleted, all of the files in its directory on the Compute Node - * where it ran are also deleted (regardless of the retention time). For - * multi-instance Tasks, the delete Task operation applies synchronously to the - * primary task; subtasks and their files are then deleted asynchronously in the - * background. + * Task counts provide a count of the Tasks by active, running or completed Task + * state, and a count of Tasks which succeeded or failed. Tasks in the preparing + * state are counted as running. Note that the numbers returned may not always be + * up to date. If you need exact task counts, use a list query. */ - deleteTask( + getJobTaskCounts( jobId: string, - taskId: string, - options: DeleteTaskOptionalParams = { requestOptions: {} }, - ): Promise { - return deleteTask(this._client, jobId, taskId, options); + options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, + ): Promise { + return getJobTaskCounts(this._client, jobId, options); } /** - * For multi-instance Tasks, information such as affinityId, executionInfo and - * nodeInfo refer to the primary Task. Use the list subtasks API to retrieve - * information about subtasks. + * This API returns the Job Preparation and Job Release Task status on all Compute + * Nodes that have run the Job Preparation or Job Release Task. This includes + * Compute Nodes which have since been removed from the Pool. If this API is + * invoked on a Job which has no Job Preparation or Job Release Task, the Batch + * service returns HTTP status code 409 (Conflict) with an error code of + * JobPreparationTaskNotSpecified. */ - getTask( + listJobPreparationAndReleaseTaskStatus( jobId: string, - taskId: string, - options: GetTaskOptionalParams = { requestOptions: {} }, - ): Promise { - return getTask(this._client, jobId, taskId, options); + options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { + requestOptions: {}, + }, + ): PagedAsyncIterableIterator { + return listJobPreparationAndReleaseTaskStatus(this._client, jobId, options); } - /** Updates the properties of the specified Task. */ - replaceTask( - jobId: string, - taskId: string, - body: BatchTask, - options: ReplaceTaskOptionalParams = { requestOptions: {} }, - ): Promise { - return replaceTask(this._client, jobId, taskId, body, options); + /** Lists the Jobs that have been created under the specified Job Schedule. */ + listJobsFromSchedule( + jobScheduleId: string, + options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listJobsFromSchedule(this._client, jobScheduleId, options); } - /** If the Task is not a multi-instance Task then this returns an empty collection. */ - listSubTasks( - jobId: string, - taskId: string, - options: ListSubTasksOptionalParams = { requestOptions: {} }, - ): Promise { - return listSubTasks(this._client, jobId, taskId, options); + /** Lists all of the Jobs in the specified Account. */ + listJobs( + options: ListJobsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listJobs(this._client, options); } /** - * When the Task has been terminated, it moves to the completed state. For - * multi-instance Tasks, the terminate Task operation applies synchronously to the - * primary task; subtasks are then terminated asynchronously in the background. + * The Batch service supports two ways to control the work done as part of a Job. + * In the first approach, the user specifies a Job Manager Task. The Batch service + * launches this Task when it is ready to start the Job. The Job Manager Task + * controls all other Tasks that run under this Job, by using the Task APIs. In + * the second approach, the user directly controls the execution of Tasks under an + * active Job, by using the Task APIs. Also note: when naming Jobs, avoid + * including sensitive information such as user names or secret project names. + * This information may appear in telemetry logs accessible to Microsoft Support + * engineers. */ - terminateTask( - jobId: string, - taskId: string, - options: TerminateTaskOptionalParams = { requestOptions: {} }, + createJob( + body: BatchJobCreateOptions, + options: CreateJobOptionalParams = { requestOptions: {} }, ): Promise { - return terminateTask(this._client, jobId, taskId, options); + return createJob(this._client, body, options); } /** - * Reactivation makes a Task eligible to be retried again up to its maximum retry - * count. The Task's state is changed to active. As the Task is no longer in the - * completed state, any previous exit code or failure information is no longer - * available after reactivation. Each time a Task is reactivated, its retry count - * is reset to 0. Reactivation will fail for Tasks that are not completed or that - * previously completed successfully (with an exit code of 0). Additionally, it - * will fail if the Job has completed (or is terminating or deleting). + * When a Terminate Job request is received, the Batch service sets the Job to the + * terminating state. The Batch service then terminates any running Tasks + * associated with the Job and runs any required Job release Tasks. Then the Job + * moves into the completed state. If there are any Tasks in the Job in the active + * state, they will remain in the active state. Once a Job is terminated, new + * Tasks cannot be added and any remaining active Tasks will not be scheduled. */ - reactivateTask( + terminateJob( jobId: string, - taskId: string, - options: ReactivateTaskOptionalParams = { requestOptions: {} }, + options: TerminateJobOptionalParams = { requestOptions: {} }, ): Promise { - return reactivateTask(this._client, jobId, taskId, options); + return terminateJob(this._client, jobId, options); } - /** Deletes the specified Task file from the Compute Node where the Task ran. */ - deleteTaskFile( + /** + * When you call this API, the Batch service sets a disabled Job to the enabling + * state. After the this operation is completed, the Job moves to the active + * state, and scheduling of new Tasks under the Job resumes. The Batch service + * does not allow a Task to remain in the active state for more than 180 days. + * Therefore, if you enable a Job containing active Tasks which were added more + * than 180 days ago, those Tasks will not run. + */ + enableJob( jobId: string, - taskId: string, - filePath: string, - options: DeleteTaskFileOptionalParams = { requestOptions: {} }, + options: EnableJobOptionalParams = { requestOptions: {} }, ): Promise { - return deleteTaskFile(this._client, jobId, taskId, filePath, options); - } - - /** Returns the content of the specified Task file. */ - getTaskFile( - jobId: string, - taskId: string, - filePath: string, - options: GetTaskFileOptionalParams = { requestOptions: {} }, - ): Promise { - return getTaskFile(this._client, jobId, taskId, filePath, options); + return enableJob(this._client, jobId, options); } - /** Gets the properties of the specified Task file. */ - getTaskFileProperties( + /** + * The Batch Service immediately moves the Job to the disabling state. Batch then + * uses the disableTasks parameter to determine what to do with the currently + * running Tasks of the Job. The Job remains in the disabling state until the + * disable operation is completed and all Tasks have been dealt with according to + * the disableTasks option; the Job then moves to the disabled state. No new Tasks + * are started under the Job until it moves back to active state. If you try to + * disable a Job that is in any state other than active, disabling, or disabled, + * the request fails with status code 409. + */ + disableJob( jobId: string, - taskId: string, - filePath: string, - options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, + body: BatchJobDisableOptions, + options: DisableJobOptionalParams = { requestOptions: {} }, ): Promise { - return getTaskFileProperties( - this._client, - jobId, - taskId, - filePath, - options, - ); + return disableJob(this._client, jobId, body, options); } - /** Lists the files in a Task's directory on its Compute Node. */ - listTaskFiles( + /** + * This fully replaces all the updatable properties of the Job. For example, if + * the Job has constraints associated with it and if constraints is not specified + * with this request, then the Batch service will remove the existing constraints. + */ + replaceJob( jobId: string, - taskId: string, - options: ListTaskFilesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTaskFiles(this._client, jobId, taskId, options); + body: BatchJob, + options: ReplaceJobOptionalParams = { requestOptions: {} }, + ): Promise { + return replaceJob(this._client, jobId, body, options); } /** - * You can add a user Account to a Compute Node only when it is in the idle or - * running state. + * This replaces only the Job properties specified in the request. For example, if + * the Job has constraints, and a request does not specify the constraints + * element, then the Job keeps the existing constraints. */ - createNodeUser( - poolId: string, - nodeId: string, - body: BatchNodeUserCreateOptions, - options: CreateNodeUserOptionalParams = { requestOptions: {} }, + updateJob( + jobId: string, + body: BatchJobUpdateOptions, + options: UpdateJobOptionalParams = { requestOptions: {} }, ): Promise { - return createNodeUser(this._client, poolId, nodeId, body, options); + return updateJob(this._client, jobId, body, options); + } + + /** Gets information about the specified Job. */ + getJob( + jobId: string, + options: GetJobOptionalParams = { requestOptions: {} }, + ): Promise { + return getJob(this._client, jobId, options); } /** - * You can delete a user Account to a Compute Node only when it is in the idle or - * running state. + * Deleting a Job also deletes all Tasks that are part of that Job, and all Job + * statistics. This also overrides the retention period for Task data; that is, if + * the Job contains Tasks which are still retained on Compute Nodes, the Batch + * services deletes those Tasks' working directories and all their contents. When + * a Delete Job request is received, the Batch service sets the Job to the + * deleting state. All update operations on a Job that is in deleting state will + * fail with status code 409 (Conflict), with additional information indicating + * that the Job is being deleted. */ - deleteNodeUser( - poolId: string, - nodeId: string, - userName: string, - options: DeleteNodeUserOptionalParams = { requestOptions: {} }, + deleteJob( + jobId: string, + options: DeleteJobOptionalParams = { requestOptions: {} }, ): Promise { - return deleteNodeUser(this._client, poolId, nodeId, userName, options); + return deleteJob(this._client, jobId, options); } /** - * This operation replaces of all the updatable properties of the Account. For - * example, if the expiryTime element is not specified, the current value is - * replaced with the default value, not left unmodified. You can update a user - * Account on a Compute Node only when it is in the idle or running state. + * Gets the number of Compute Nodes in each state, grouped by Pool. Note that the + * numbers returned may not always be up to date. If you need exact node counts, + * use a list query. */ - replaceNodeUser( - poolId: string, - nodeId: string, - userName: string, - body: BatchNodeUserUpdateOptions, - options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, - ): Promise { - return replaceNodeUser( - this._client, - poolId, - nodeId, - userName, - body, - options, - ); + listPoolNodeCounts( + options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listPoolNodeCounts(this._client, options); } - /** Gets information about the specified Compute Node. */ - getNode( - poolId: string, - nodeId: string, - options: GetNodeOptionalParams = { requestOptions: {} }, - ): Promise { - return getNode(this._client, poolId, nodeId, options); + /** Lists all Virtual Machine Images supported by the Azure Batch service. */ + listSupportedImages( + options: ListSupportedImagesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listSupportedImages(this._client, options); } - /** You can restart a Compute Node only if it is in an idle or running state. */ - rebootNode( + /** + * This operation can only run when the allocation state of the Pool is steady. + * When this operation runs, the allocation state changes from steady to resizing. + * Each request may remove up to 100 nodes. + */ + removeNodes( poolId: string, - nodeId: string, - options: RebootNodeOptionalParams = { requestOptions: {} }, + body: NodeRemoveOptions, + options: RemoveNodesOptionalParams = { requestOptions: {} }, ): Promise { - return rebootNode(this._client, poolId, nodeId, options); + return removeNodes(this._client, poolId, body, options); } /** - * You can reinstall the operating system on a Compute Node only if it is in an - * idle or running state. This API can be invoked only on Pools created with the - * cloud service configuration property. + * This fully replaces all the updatable properties of the Pool. For example, if + * the Pool has a StartTask associated with it and if StartTask is not specified + * with this request, then the Batch service will remove the existing StartTask. */ - reimageNode( + replacePoolProperties( poolId: string, - nodeId: string, - options: ReimageNodeOptionalParams = { requestOptions: {} }, + body: BatchPoolReplaceOptions, + options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, ): Promise { - return reimageNode(this._client, poolId, nodeId, options); + return replacePoolProperties(this._client, poolId, body, options); } /** - * You can disable Task scheduling on a Compute Node only if its current - * scheduling state is enabled. + * This does not restore the Pool to its previous state before the resize + * operation: it only stops any further changes being made, and the Pool maintains + * its current state. After stopping, the Pool stabilizes at the number of Compute + * Nodes it was at when the stop operation was done. During the stop operation, + * the Pool allocation state changes first to stopping and then to steady. A + * resize operation need not be an explicit resize Pool request; this API can also + * be used to halt the initial sizing of the Pool when it is created. */ - disableNodeScheduling( + stopPoolResize( poolId: string, - nodeId: string, - options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, + options: StopPoolResizeOptionalParams = { requestOptions: {} }, ): Promise { - return disableNodeScheduling(this._client, poolId, nodeId, options); + return stopPoolResize(this._client, poolId, options); } /** - * You can enable Task scheduling on a Compute Node only if its current scheduling - * state is disabled + * You can only resize a Pool when its allocation state is steady. If the Pool is + * already resizing, the request fails with status code 409. When you resize a + * Pool, the Pool's allocation state changes from steady to resizing. You cannot + * resize Pools which are configured for automatic scaling. If you try to do this, + * the Batch service returns an error 409. If you resize a Pool downwards, the + * Batch service chooses which Compute Nodes to remove. To remove specific Compute + * Nodes, use the Pool remove Compute Nodes API instead. */ - enableNodeScheduling( + resizePool( poolId: string, - nodeId: string, - options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, + body: BatchPoolResizeOptions, + options: ResizePoolOptionalParams = { requestOptions: {} }, ): Promise { - return enableNodeScheduling(this._client, poolId, nodeId, options); + return resizePool(this._client, poolId, body, options); } /** - * Before you can remotely login to a Compute Node using the remote login - * settings, you must create a user Account on the Compute Node. This API can be - * invoked only on Pools created with the virtual machine configuration property. - * For Pools created with a cloud service configuration, see the GetRemoteDesktop - * API. + * This API is primarily for validating an autoscale formula, as it simply returns + * the result without applying the formula to the Pool. The Pool must have auto + * scaling enabled in order to evaluate a formula. */ - getNodeRemoteLoginSettings( + evaluatePoolAutoScale( poolId: string, - nodeId: string, - options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, - ): Promise { - return getNodeRemoteLoginSettings(this._client, poolId, nodeId, options); + body: BatchPoolEvaluateAutoScaleOptions, + options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, + ): Promise { + return evaluatePoolAutoScale(this._client, poolId, body, options); } /** - * Before you can access a Compute Node by using the RDP file, you must create a - * user Account on the Compute Node. This API can only be invoked on Pools created - * with a cloud service configuration. For Pools created with a virtual machine - * configuration, see the GetRemoteLoginSettings API. + * You cannot enable automatic scaling on a Pool if a resize operation is in + * progress on the Pool. If automatic scaling of the Pool is currently disabled, + * you must specify a valid autoscale formula as part of the request. If automatic + * scaling of the Pool is already enabled, you may specify a new autoscale formula + * and/or a new evaluation interval. You cannot call this API for the same Pool + * more than once every 30 seconds. */ - getNodeRemoteDesktopFile( + enablePoolAutoScale( poolId: string, - nodeId: string, - options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, - ): Promise { - return getNodeRemoteDesktopFile(this._client, poolId, nodeId, options); + body: BatchPoolEnableAutoScaleOptions, + options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, + ): Promise { + return enablePoolAutoScale(this._client, poolId, body, options); } - /** - * This is for gathering Azure Batch service log files in an automated fashion - * from Compute Nodes if you are experiencing an error and wish to escalate to - * Azure support. The Azure Batch service log files should be shared with Azure - * support to aid in debugging issues with the Batch service. - */ - uploadNodeLogs( + /** Disables automatic scaling for a Pool. */ + disablePoolAutoScale( poolId: string, - nodeId: string, - body: UploadBatchServiceLogsOptions, - options: UploadNodeLogsOptionalParams = { requestOptions: {} }, - ): Promise { - return uploadNodeLogs(this._client, poolId, nodeId, body, options); + options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, + ): Promise { + return disablePoolAutoScale(this._client, poolId, options); } - /** Lists the Compute Nodes in the specified Pool. */ - listNodes( + /** + * This only replaces the Pool properties specified in the request. For example, + * if the Pool has a StartTask associated with it, and a request does not specify + * a StartTask element, then the Pool keeps the existing StartTask. + */ + updatePool( poolId: string, - options: ListNodesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listNodes(this._client, poolId, options); + body: BatchPoolUpdateOptions, + options: UpdatePoolOptionalParams = { requestOptions: {} }, + ): Promise { + return updatePool(this._client, poolId, body, options); } - /** Gets information about the specified Compute Node Extension. */ - getNodeExtension( + /** Gets information about the specified Pool. */ + getPool( poolId: string, - nodeId: string, - extensionName: string, - options: GetNodeExtensionOptionalParams = { requestOptions: {} }, - ): Promise { - return getNodeExtension( - this._client, - poolId, - nodeId, - extensionName, - options, - ); + options: GetPoolOptionalParams = { requestOptions: {} }, + ): Promise { + return getPool(this._client, poolId, options); } - /** Lists the Compute Nodes Extensions in the specified Pool. */ - listNodeExtensions( + /** Gets basic properties of a Pool. */ + poolExists( poolId: string, - nodeId: string, - options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listNodeExtensions(this._client, poolId, nodeId, options); + options: PoolExistsOptionalParams = { requestOptions: {} }, + ): Promise { + return poolExists(this._client, poolId, options); } - /** Deletes the specified file from the Compute Node. */ - deleteNodeFile( + /** + * When you request that a Pool be deleted, the following actions occur: the Pool + * state is set to deleting; any ongoing resize operation on the Pool are stopped; + * the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks + * running on existing Compute Nodes are terminated and requeued (as if a resize + * Pool operation had been requested with the default requeue option); finally, + * the Pool is removed from the system. Because running Tasks are requeued, the + * user can rerun these Tasks by updating their Job to target a different Pool. + * The Tasks can then run on the new Pool. If you want to override the requeue + * behavior, then you should call resize Pool explicitly to shrink the Pool to + * zero size before deleting the Pool. If you call an Update, Patch or Delete API + * on a Pool in the deleting state, it will fail with HTTP status code 409 with + * error code PoolBeingDeleted. + */ + deletePool( poolId: string, - nodeId: string, - filePath: string, - options: DeleteNodeFileOptionalParams = { requestOptions: {} }, + options: DeletePoolOptionalParams = { requestOptions: {} }, ): Promise { - return deleteNodeFile(this._client, poolId, nodeId, filePath, options); + return deletePool(this._client, poolId, options); } - /** Returns the content of the specified Compute Node file. */ - getNodeFile( - poolId: string, - nodeId: string, - filePath: string, - options: GetNodeFileOptionalParams = { requestOptions: {} }, - ): Promise { - return getNodeFile(this._client, poolId, nodeId, filePath, options); + /** Lists all of the Pools in the specified Account. */ + listPools( + options: ListPoolsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listPools(this._client, options); } - /** Gets the properties of the specified Compute Node file. */ - getNodeFileProperties( - poolId: string, - nodeId: string, - filePath: string, - options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, + /** + * When naming Pools, avoid including sensitive information such as user names or + * secret project names. This information may appear in telemetry logs accessible + * to Microsoft Support engineers. + */ + createPool( + body: BatchPoolCreateOptions, + options: CreatePoolOptionalParams = { requestOptions: {} }, ): Promise { - return getNodeFileProperties( - this._client, - poolId, - nodeId, - filePath, - options, - ); + return createPool(this._client, body, options); } - /** Lists all of the files in Task directories on the specified Compute Node. */ - listNodeFiles( - poolId: string, - nodeId: string, - options: ListNodeFilesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listNodeFiles(this._client, poolId, nodeId, options); + /** + * If you do not specify a $filter clause including a poolId, the response + * includes all Pools that existed in the Account in the time range of the + * returned aggregation intervals. If you do not specify a $filter clause + * including a startTime or endTime these filters default to the start and end + * times of the last aggregation interval currently available; that is, only the + * last aggregation interval is returned. + */ + listPoolUsageMetrics( + options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listPoolUsageMetrics(this._client, options); + } + + /** + * This operation returns only Applications and versions that are available for + * use on Compute Nodes; that is, that can be used in an Package reference. For + * administrator information about Applications and versions that are not yet + * available to Compute Nodes, use the Azure portal or the Azure Resource Manager + * API. + */ + getApplication( + applicationId: string, + options: GetApplicationOptionalParams = { requestOptions: {} }, + ): Promise { + return getApplication(this._client, applicationId, options); + } + + /** + * This operation returns only Applications and versions that are available for + * use on Compute Nodes; that is, that can be used in an Package reference. For + * administrator information about applications and versions that are not yet + * available to Compute Nodes, use the Azure portal or the Azure Resource Manager + * API. + */ + listApplications( + options: ListApplicationsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listApplications(this._client, options); } } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts index da83f7f950..2395bdc817 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts @@ -204,81 +204,81 @@ export { } from "./models/index.js"; export { BatchClientOptionalParams, - ListApplicationsOptionalParams, - GetApplicationOptionalParams, - ListPoolUsageMetricsOptionalParams, - CreatePoolOptionalParams, - ListPoolsOptionalParams, - DeletePoolOptionalParams, - PoolExistsOptionalParams, - GetPoolOptionalParams, - UpdatePoolOptionalParams, - DisablePoolAutoScaleOptionalParams, - EnablePoolAutoScaleOptionalParams, - EvaluatePoolAutoScaleOptionalParams, - ResizePoolOptionalParams, - StopPoolResizeOptionalParams, - ReplacePoolPropertiesOptionalParams, - RemoveNodesOptionalParams, - ListSupportedImagesOptionalParams, - ListPoolNodeCountsOptionalParams, - DeleteJobOptionalParams, - GetJobOptionalParams, - UpdateJobOptionalParams, - ReplaceJobOptionalParams, - DisableJobOptionalParams, - EnableJobOptionalParams, - TerminateJobOptionalParams, - CreateJobOptionalParams, - ListJobsOptionalParams, - ListJobsFromScheduleOptionalParams, - ListJobPreparationAndReleaseTaskStatusOptionalParams, - GetJobTaskCountsOptionalParams, - CreateCertificateOptionalParams, - ListCertificatesOptionalParams, - CancelCertificateDeletionOptionalParams, - DeleteCertificateOptionalParams, - GetCertificateOptionalParams, - JobScheduleExistsOptionalParams, - DeleteJobScheduleOptionalParams, - GetJobScheduleOptionalParams, - UpdateJobScheduleOptionalParams, - ReplaceJobScheduleOptionalParams, - DisableJobScheduleOptionalParams, - EnableJobScheduleOptionalParams, - TerminateJobScheduleOptionalParams, - CreateJobScheduleOptionalParams, - ListJobSchedulesOptionalParams, - CreateTaskOptionalParams, - ListTasksOptionalParams, - CreateTaskCollectionOptionalParams, - DeleteTaskOptionalParams, - GetTaskOptionalParams, - ReplaceTaskOptionalParams, - ListSubTasksOptionalParams, - TerminateTaskOptionalParams, - ReactivateTaskOptionalParams, - DeleteTaskFileOptionalParams, - GetTaskFileOptionalParams, - GetTaskFilePropertiesOptionalParams, - ListTaskFilesOptionalParams, - CreateNodeUserOptionalParams, - DeleteNodeUserOptionalParams, - ReplaceNodeUserOptionalParams, - GetNodeOptionalParams, - RebootNodeOptionalParams, - ReimageNodeOptionalParams, - DisableNodeSchedulingOptionalParams, - EnableNodeSchedulingOptionalParams, - GetNodeRemoteLoginSettingsOptionalParams, - GetNodeRemoteDesktopFileOptionalParams, - UploadNodeLogsOptionalParams, - ListNodesOptionalParams, - GetNodeExtensionOptionalParams, - ListNodeExtensionsOptionalParams, - DeleteNodeFileOptionalParams, - GetNodeFileOptionalParams, - GetNodeFilePropertiesOptionalParams, ListNodeFilesOptionalParams, + GetNodeFilePropertiesOptionalParams, + GetNodeFileOptionalParams, + DeleteNodeFileOptionalParams, + ListNodeExtensionsOptionalParams, + GetNodeExtensionOptionalParams, + ListNodesOptionalParams, + UploadNodeLogsOptionalParams, + GetNodeRemoteDesktopFileOptionalParams, + GetNodeRemoteLoginSettingsOptionalParams, + EnableNodeSchedulingOptionalParams, + DisableNodeSchedulingOptionalParams, + ReimageNodeOptionalParams, + RebootNodeOptionalParams, + GetNodeOptionalParams, + ReplaceNodeUserOptionalParams, + DeleteNodeUserOptionalParams, + CreateNodeUserOptionalParams, + ListTaskFilesOptionalParams, + GetTaskFilePropertiesOptionalParams, + GetTaskFileOptionalParams, + DeleteTaskFileOptionalParams, + ReactivateTaskOptionalParams, + TerminateTaskOptionalParams, + ListSubTasksOptionalParams, + ReplaceTaskOptionalParams, + GetTaskOptionalParams, + DeleteTaskOptionalParams, + CreateTaskCollectionOptionalParams, + ListTasksOptionalParams, + CreateTaskOptionalParams, + ListJobSchedulesOptionalParams, + CreateJobScheduleOptionalParams, + TerminateJobScheduleOptionalParams, + EnableJobScheduleOptionalParams, + DisableJobScheduleOptionalParams, + ReplaceJobScheduleOptionalParams, + UpdateJobScheduleOptionalParams, + GetJobScheduleOptionalParams, + DeleteJobScheduleOptionalParams, + JobScheduleExistsOptionalParams, + GetCertificateOptionalParams, + DeleteCertificateOptionalParams, + CancelCertificateDeletionOptionalParams, + ListCertificatesOptionalParams, + CreateCertificateOptionalParams, + GetJobTaskCountsOptionalParams, + ListJobPreparationAndReleaseTaskStatusOptionalParams, + ListJobsFromScheduleOptionalParams, + ListJobsOptionalParams, + CreateJobOptionalParams, + TerminateJobOptionalParams, + EnableJobOptionalParams, + DisableJobOptionalParams, + ReplaceJobOptionalParams, + UpdateJobOptionalParams, + GetJobOptionalParams, + DeleteJobOptionalParams, + ListPoolNodeCountsOptionalParams, + ListSupportedImagesOptionalParams, + RemoveNodesOptionalParams, + ReplacePoolPropertiesOptionalParams, + StopPoolResizeOptionalParams, + ResizePoolOptionalParams, + EvaluatePoolAutoScaleOptionalParams, + EnablePoolAutoScaleOptionalParams, + DisablePoolAutoScaleOptionalParams, + UpdatePoolOptionalParams, + GetPoolOptionalParams, + PoolExistsOptionalParams, + DeletePoolOptionalParams, + ListPoolsOptionalParams, + CreatePoolOptionalParams, + ListPoolUsageMetricsOptionalParams, + GetApplicationOptionalParams, + ListApplicationsOptionalParams, } from "./api/index.js"; export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts index 95b397a59c..c1035ebe9e 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts @@ -23,7 +23,9 @@ export function batchNodeUserCreateOptionsSerializer( return { name: item["name"], isAdmin: item["isAdmin"], - expiryTime: item["expiryTime"]?.toISOString(), + expiryTime: !item["expiryTime"] + ? item["expiryTime"] + : item["expiryTime"].toISOString(), password: item["password"], sshPublicKey: item["sshPublicKey"], }; @@ -104,7 +106,9 @@ export function batchNodeUserUpdateOptionsSerializer( ): any { return { password: item["password"], - expiryTime: item["expiryTime"]?.toISOString(), + expiryTime: !item["expiryTime"] + ? item["expiryTime"] + : item["expiryTime"].toISOString(), sshPublicKey: item["sshPublicKey"], }; } @@ -1080,7 +1084,7 @@ export function uploadBatchServiceLogsOptionsSerializer( return { containerUrl: item["containerUrl"], startTime: item["startTime"].toISOString(), - endTime: item["endTime"]?.toISOString(), + endTime: !item["endTime"] ? item["endTime"] : item["endTime"].toISOString(), identityReference: !item["identityReference"] ? item["identityReference"] : batchNodeIdentityReferenceSerializer(item["identityReference"]), @@ -1144,10 +1148,10 @@ export function nodeVMExtensionDeserializer(item: any): NodeVMExtension { provisioningState: item["provisioningState"], vmExtension: !item["vmExtension"] ? item["vmExtension"] - : vmExtensionDeserializer(item["vmExtension"]), + : vMExtensionDeserializer(item["vmExtension"]), instanceView: !item["instanceView"] ? item["instanceView"] - : vmExtensionInstanceViewDeserializer(item["instanceView"]), + : vMExtensionInstanceViewDeserializer(item["instanceView"]), }; } @@ -1173,7 +1177,7 @@ export interface VMExtension { provisionAfterExtensions?: string[]; } -export function vmExtensionSerializer(item: VMExtension): any { +export function vMExtensionSerializer(item: VMExtension): any { return { name: item["name"], publisher: item["publisher"], @@ -1191,7 +1195,7 @@ export function vmExtensionSerializer(item: VMExtension): any { }; } -export function vmExtensionDeserializer(item: any): VMExtension { +export function vMExtensionDeserializer(item: any): VMExtension { return { name: item["name"], publisher: item["publisher"], @@ -1219,7 +1223,7 @@ export interface VMExtensionInstanceView { subStatuses?: InstanceViewStatus[]; } -export function vmExtensionInstanceViewDeserializer( +export function vMExtensionInstanceViewDeserializer( item: any, ): VMExtensionInstanceView { return { @@ -2549,8 +2553,12 @@ export interface Schedule { export function scheduleSerializer(item: Schedule): any { return { - doNotRunUntil: item["doNotRunUntil"]?.toISOString(), - doNotRunAfter: item["doNotRunAfter"]?.toISOString(), + doNotRunUntil: !item["doNotRunUntil"] + ? item["doNotRunUntil"] + : item["doNotRunUntil"].toISOString(), + doNotRunAfter: !item["doNotRunAfter"] + ? item["doNotRunAfter"] + : item["doNotRunAfter"].toISOString(), startWindow: item["startWindow"], recurrenceInterval: item["recurrenceInterval"], }; @@ -3378,8 +3386,8 @@ export function virtualMachineConfigurationSerializer( ), extensions: !item["extensions"] ? item["extensions"] - : vmExtensionArraySerializer(item["extensions"]), - osDisk: !item["osDisk"] ? item["osDisk"] : osDiskSerializer(item["osDisk"]), + : vMExtensionArraySerializer(item["extensions"]), + osDisk: !item["osDisk"] ? item["osDisk"] : oSDiskSerializer(item["osDisk"]), }; } @@ -3411,10 +3419,10 @@ export function virtualMachineConfigurationDeserializer( ), extensions: !item["extensions"] ? item["extensions"] - : vmExtensionArrayDeserializer(item["extensions"]), + : vMExtensionArrayDeserializer(item["extensions"]), osDisk: !item["osDisk"] ? item["osDisk"] - : osDiskDeserializer(item["osDisk"]), + : oSDiskDeserializer(item["osDisk"]), }; } @@ -3614,17 +3622,17 @@ export function nodePlacementConfigurationDeserializer( /** NodePlacementPolicyType enums */ export type NodePlacementPolicyType = "regional" | "zonal"; -export function vmExtensionArraySerializer(result: Array): any[] { +export function vMExtensionArraySerializer(result: Array): any[] { return result.map((item) => { - return vmExtensionSerializer(item); + return vMExtensionSerializer(item); }); } -export function vmExtensionArrayDeserializer( +export function vMExtensionArrayDeserializer( result: Array, ): any[] { return result.map((item) => { - return vmExtensionDeserializer(item); + return vMExtensionDeserializer(item); }); } @@ -3634,7 +3642,7 @@ export interface OSDisk { ephemeralOSDiskSettings?: DiffDiskSettings; } -export function osDiskSerializer(item: OSDisk): any { +export function oSDiskSerializer(item: OSDisk): any { return { ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] @@ -3642,7 +3650,7 @@ export function osDiskSerializer(item: OSDisk): any { }; } -export function osDiskDeserializer(item: any): OSDisk { +export function oSDiskDeserializer(item: any): OSDisk { return { ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] @@ -6233,5 +6241,5 @@ export function batchApplicationDeserializer(item: any): BatchApplication { /** The Azure Batch service version. */ export enum KnownVersions { /** API Version 2023-05-01.17.0 */ - "V2023-05-01.17.0" = "2023-05-01.17.0", + "2023-05-01.17.0" = "2023-05-01.17.0", } diff --git a/packages/typespec-test/test/batch_modular/spec/models.tsp b/packages/typespec-test/test/batch_modular/spec/models.tsp index 0a0f77fc03..ed31b70e4d 100644 --- a/packages/typespec-test/test/batch_modular/spec/models.tsp +++ b/packages/typespec-test/test/batch_modular/spec/models.tsp @@ -586,7 +586,7 @@ model ApplicationListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -642,7 +642,7 @@ model PoolListUsageMetricsResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -673,7 +673,7 @@ model AccountListSupportedImagesResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -738,7 +738,7 @@ model PoolNodeCountsListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -1001,7 +1001,7 @@ model CertificateListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -1017,7 +1017,7 @@ model NodeFileListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -2228,7 +2228,7 @@ model BatchJobScheduleListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -2461,7 +2461,7 @@ model BatchJobListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -2477,7 +2477,7 @@ model BatchJobListPreparationAndReleaseTaskStatusResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -2998,7 +2998,7 @@ model BatchPoolListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -3422,7 +3422,7 @@ model BatchTaskListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -3783,7 +3783,7 @@ model BatchNodeListResult { #suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase" @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } @@ -3840,6 +3840,6 @@ model NodeVMExtensionList { value?: NodeVMExtension[]; @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md index b29e03e333..2473225813 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md @@ -89,7 +89,7 @@ export type FinishReason = "stop" | "length"; // @public export enum KnownAPIVersion { // (undocumented) - V20231001Preview = "2023-10-01-preview" + v20231001Preview = "2023-10-01-preview" } // @public diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/chatProtocolContext.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/chatProtocolContext.ts index e78832bd25..6338acedbb 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/chatProtocolContext.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/chatProtocolContext.ts @@ -17,7 +17,8 @@ export function createChatProtocol( credential: KeyCredential | TokenCredential, options: ChatProtocolClientOptionalParams = {}, ): ChatProtocolContext { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`; + const endpointUrl = + options.endpoint ?? options.baseUrl ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-ai-chat-protocol/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts index 22560e6770..10e197885f 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts @@ -6,8 +6,8 @@ export { ChatProtocolContext, ChatProtocolClientOptionalParams, } from "./chatProtocolContext.js"; -export { createStreaming, create } from "./operations.js"; +export { create, createStreaming } from "./operations.js"; export { - CreateStreamingOptionalParams, CreateOptionalParams, + CreateStreamingOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts index c5dbadb244..73b52d498c 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts @@ -23,70 +23,80 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createStreamingSend( +export function _createSend( context: Client, - body: StreamingChatCompletionOptionsRecord, - options: CreateStreamingOptionalParams = { requestOptions: {} }, + body: ChatCompletionOptionsRecord, + options: CreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/chat") .post({ ...operationOptionsToRequestParameters(options), - body: streamingChatCompletionOptionsRecordSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: chatCompletionOptionsRecordSerializer(body), }); } -export async function _createStreamingDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return chatCompletionChunkRecordDeserializer(result.body); + return chatCompletionRecordDeserializer(result.body); } -/** Creates a new streaming chat completion. */ -export async function createStreaming( +/** Creates a new chat completion. */ +export async function create( context: Client, - body: StreamingChatCompletionOptionsRecord, - options: CreateStreamingOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createStreamingSend(context, body, options); - return _createStreamingDeserialize(result); + body: ChatCompletionOptionsRecord, + options: CreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend(context, body, options); + return _createDeserialize(result); } -export function _createSend( +export function _createStreamingSend( context: Client, - body: ChatCompletionOptionsRecord, - options: CreateOptionalParams = { requestOptions: {} }, + body: StreamingChatCompletionOptionsRecord, + options: CreateStreamingOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/chat") .post({ ...operationOptionsToRequestParameters(options), - body: chatCompletionOptionsRecordSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: streamingChatCompletionOptionsRecordSerializer(body), }); } -export async function _createDeserialize( +export async function _createStreamingDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return chatCompletionRecordDeserializer(result.body); + return chatCompletionChunkRecordDeserializer(result.body); } -/** Creates a new chat completion. */ -export async function create( +/** Creates a new streaming chat completion. */ +export async function createStreaming( context: Client, - body: ChatCompletionOptionsRecord, - options: CreateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createSend(context, body, options); - return _createDeserialize(result); + body: StreamingChatCompletionOptionsRecord, + options: CreateStreamingOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createStreamingSend(context, body, options); + return _createStreamingDeserialize(result); } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/options.ts index 05af57f5c0..a18cbb9bc2 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/options.ts @@ -4,7 +4,7 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface CreateStreamingOptionalParams extends OperationOptions {} +export interface CreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface CreateOptionalParams extends OperationOptions {} +export interface CreateStreamingOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/chatProtocolClient.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/chatProtocolClient.ts index 2e2d174669..80ac51737a 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/chatProtocolClient.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/chatProtocolClient.ts @@ -5,10 +5,10 @@ import { createChatProtocol, ChatProtocolContext, ChatProtocolClientOptionalParams, - createStreaming, create, - CreateStreamingOptionalParams, + createStreaming, CreateOptionalParams, + CreateStreamingOptionalParams, } from "./api/index.js"; import { StreamingChatCompletionOptionsRecord, @@ -43,14 +43,6 @@ export class ChatProtocolClient { this.pipeline = this._client.pipeline; } - /** Creates a new streaming chat completion. */ - createStreaming( - body: StreamingChatCompletionOptionsRecord, - options: CreateStreamingOptionalParams = { requestOptions: {} }, - ): Promise { - return createStreaming(this._client, body, options); - } - /** Creates a new chat completion. */ create( body: ChatCompletionOptionsRecord, @@ -58,4 +50,12 @@ export class ChatProtocolClient { ): Promise { return create(this._client, body, options); } + + /** Creates a new streaming chat completion. */ + createStreaming( + body: StreamingChatCompletionOptionsRecord, + options: CreateStreamingOptionalParams = { requestOptions: {} }, + ): Promise { + return createStreaming(this._client, body, options); + } } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts index e55dfe4e8d..e0afac0868 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts @@ -17,6 +17,6 @@ export { } from "./models/index.js"; export { ChatProtocolClientOptionalParams, - CreateStreamingOptionalParams, CreateOptionalParams, + CreateStreamingOptionalParams, } from "./api/index.js"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts index b0fc5be2ac..2d295dd082 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts @@ -247,5 +247,5 @@ export function chatChoiceRecordDeserializer(item: any): ChatChoiceRecord { /** Known values of {@link APIVersion} that the service accepts. */ export enum KnownAPIVersion { - V20231001Preview = "2023-10-01-preview", + v20231001Preview = "2023-10-01-preview", } diff --git a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/confidentialLedger/spec/main.tsp b/packages/typespec-test/test/confidentialLedger/spec/main.tsp index 653ab931b6..26edbefcb2 100644 --- a/packages/typespec-test/test/confidentialLedger/spec/main.tsp +++ b/packages/typespec-test/test/confidentialLedger/spec/main.tsp @@ -163,7 +163,7 @@ model PagedLedgerEntries { state: LedgerQueryState; @doc("Path from which to retrieve the next page of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink nextLink?: ResourceLocation; } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md index 3c8c0c2feb..07e1e23dc7 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md @@ -93,7 +93,6 @@ export type ContinuablePage = TPage & { // @public export interface CreateOrUpdateTextBlocklistOptionalParams extends OperationOptions { - contentType?: string; } // @public @@ -126,7 +125,7 @@ export interface ImageData { // @public export enum KnownVersions { // (undocumented) - V2023_10_01 = "2023-10-01" + v2023_10_01 = "2023-10-01" } // @public diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/contentSafetyContext.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/contentSafetyContext.ts index 3c7372177c..09cecf3b5d 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/contentSafetyContext.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/contentSafetyContext.ts @@ -7,7 +7,11 @@ import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { KeyCredential, TokenCredential } from "@azure/core-auth"; /** Analyze harmful content */ -export interface ContentSafetyContext extends Client {} +export interface ContentSafetyContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface ContentSafetyClientOptionalParams extends ClientOptions { @@ -59,5 +63,5 @@ export function createContentSafety( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as ContentSafetyContext; } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/index.ts index cfe55ac498..f1e125761b 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/index.ts @@ -7,26 +7,26 @@ export { ContentSafetyClientOptionalParams, } from "./contentSafetyContext.js"; export { - analyzeText, - analyzeImage, - getTextBlocklist, - createOrUpdateTextBlocklist, - deleteTextBlocklist, - listTextBlocklists, - addOrUpdateBlockItems, - removeBlockItems, - getTextBlocklistItem, listTextBlocklistItems, + getTextBlocklistItem, + removeBlockItems, + addOrUpdateBlockItems, + listTextBlocklists, + deleteTextBlocklist, + createOrUpdateTextBlocklist, + getTextBlocklist, + analyzeImage, + analyzeText, } from "./operations.js"; export { - AnalyzeTextOptionalParams, - AnalyzeImageOptionalParams, - GetTextBlocklistOptionalParams, - CreateOrUpdateTextBlocklistOptionalParams, - DeleteTextBlocklistOptionalParams, - ListTextBlocklistsOptionalParams, - AddOrUpdateBlockItemsOptionalParams, - RemoveBlockItemsOptionalParams, - GetTextBlocklistItemOptionalParams, ListTextBlocklistItemsOptionalParams, + GetTextBlocklistItemOptionalParams, + RemoveBlockItemsOptionalParams, + AddOrUpdateBlockItemsOptionalParams, + ListTextBlocklistsOptionalParams, + DeleteTextBlocklistOptionalParams, + CreateOrUpdateTextBlocklistOptionalParams, + GetTextBlocklistOptionalParams, + AnalyzeImageOptionalParams, + AnalyzeTextOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/operations.ts index 9620a7e5c4..25b6e6d764 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/operations.ts @@ -50,181 +50,198 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _analyzeTextSend( +export function _listTextBlocklistItemsSend( context: Client, - body: AnalyzeTextOptions, - options: AnalyzeTextOptionalParams = { requestOptions: {} }, + blocklistName: string, + options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/text:analyze") - .post({ + .path("/text/blocklists/{blocklistName}/blockItems", blocklistName) + .get({ ...operationOptionsToRequestParameters(options), - body: analyzeTextOptionsSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + top: options?.top, + skip: options?.skip, + maxpagesize: options?.maxpagesize, + }, }); } -export async function _analyzeTextDeserialize( +export async function _listTextBlocklistItemsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_PagedTextBlockItem> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return analyzeTextResultDeserializer(result.body); + return _pagedTextBlockItemDeserializer(result.body); } -/** A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ -export async function analyzeText( +/** Get all blockItems in a text blocklist */ +export function listTextBlocklistItems( context: Client, - body: AnalyzeTextOptions, - options: AnalyzeTextOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _analyzeTextSend(context, body, options); - return _analyzeTextDeserialize(result); + blocklistName: string, + options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listTextBlocklistItemsSend(context, blocklistName, options), + _listTextBlocklistItemsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); } -export function _analyzeImageSend( +export function _getTextBlocklistItemSend( context: Client, - body: AnalyzeImageOptions, - options: AnalyzeImageOptionalParams = { requestOptions: {} }, + blocklistName: string, + blockItemId: string, + options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/image:analyze") - .post({ + .path( + "/text/blocklists/{blocklistName}/blockItems/{blockItemId}", + blocklistName, + blockItemId, + ) + .get({ ...operationOptionsToRequestParameters(options), - body: analyzeImageOptionsSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _analyzeImageDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return analyzeImageResultDeserializer(result.body); -} - -/** A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ -export async function analyzeImage( - context: Client, - body: AnalyzeImageOptions, - options: AnalyzeImageOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _analyzeImageSend(context, body, options); - return _analyzeImageDeserialize(result); -} - -export function _getTextBlocklistSend( - context: Client, - blocklistName: string, - options: GetTextBlocklistOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/text/blocklists/{blocklistName}", blocklistName) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _getTextBlocklistDeserialize( +export async function _getTextBlocklistItemDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return textBlocklistDeserializer(result.body); + return textBlockItemDeserializer(result.body); } -/** Returns text blocklist details. */ -export async function getTextBlocklist( +/** Get blockItem By blockItemId from a text blocklist. */ +export async function getTextBlocklistItem( context: Client, blocklistName: string, - options: GetTextBlocklistOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getTextBlocklistSend(context, blocklistName, options); - return _getTextBlocklistDeserialize(result); + blockItemId: string, + options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTextBlocklistItemSend( + context, + blocklistName, + blockItemId, + options, + ); + return _getTextBlocklistItemDeserialize(result); } -export function _createOrUpdateTextBlocklistSend( +export function _removeBlockItemsSend( context: Client, blocklistName: string, - resource: TextBlocklist, - options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, + body: RemoveBlockItemsOptions, + options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/text/blocklists/{blocklistName}", blocklistName) - .patch({ + .path("/text/blocklists/{blocklistName}:removeBlockItems", blocklistName) + .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: textBlocklistSerializer(resource), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: removeBlockItemsOptionsSerializer(body), }); } -export async function _createOrUpdateTextBlocklistDeserialize( +export async function _removeBlockItemsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return textBlocklistDeserializer(result.body); + return; } -/** Updates a text blocklist, if blocklistName does not exist, create a new blocklist. */ -export async function createOrUpdateTextBlocklist( +/** Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. */ +export async function removeBlockItems( context: Client, blocklistName: string, - resource: TextBlocklist, - options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createOrUpdateTextBlocklistSend( + body: RemoveBlockItemsOptions, + options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _removeBlockItemsSend( context, blocklistName, - resource, + body, options, ); - return _createOrUpdateTextBlocklistDeserialize(result); + return _removeBlockItemsDeserialize(result); } -export function _deleteTextBlocklistSend( +export function _addOrUpdateBlockItemsSend( context: Client, blocklistName: string, - options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, + body: AddOrUpdateBlockItemsOptions, + options: AddOrUpdateBlockItemsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/text/blocklists/{blocklistName}", blocklistName) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path( + "/text/blocklists/{blocklistName}:addOrUpdateBlockItems", + blocklistName, + ) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: addOrUpdateBlockItemsOptionsSerializer(body), + }); } -export async function _deleteTextBlocklistDeserialize( +export async function _addOrUpdateBlockItemsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return addOrUpdateBlockItemsResultDeserializer(result.body); } -/** Deletes a text blocklist. */ -export async function deleteTextBlocklist( +/** Add or update blockItems to a text blocklist. You can add or update at most 100 BlockItems in one request. */ +export async function addOrUpdateBlockItems( context: Client, blocklistName: string, - options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteTextBlocklistSend( + body: AddOrUpdateBlockItemsOptions, + options: AddOrUpdateBlockItemsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _addOrUpdateBlockItemsSend( context, blocklistName, + body, options, ); - return _deleteTextBlocklistDeserialize(result); + return _addOrUpdateBlockItemsDeserialize(result); } export function _listTextBlocklistsSend( @@ -233,7 +250,14 @@ export function _listTextBlocklistsSend( ): StreamableMethod { return context .path("/text/blocklists") - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _listTextBlocklistsDeserialize( @@ -261,172 +285,209 @@ export function listTextBlocklists( ); } -export function _addOrUpdateBlockItemsSend( +export function _deleteTextBlocklistSend( context: Client, blocklistName: string, - body: AddOrUpdateBlockItemsOptions, - options: AddOrUpdateBlockItemsOptionalParams = { requestOptions: {} }, + options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/text/blocklists/{blocklistName}:addOrUpdateBlockItems", - blocklistName, - ) - .post({ + .path("/text/blocklists/{blocklistName}", blocklistName) + .delete({ ...operationOptionsToRequestParameters(options), - body: addOrUpdateBlockItemsOptionsSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _addOrUpdateBlockItemsDeserialize( +export async function _deleteTextBlocklistDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return addOrUpdateBlockItemsResultDeserializer(result.body); + return; } -/** Add or update blockItems to a text blocklist. You can add or update at most 100 BlockItems in one request. */ -export async function addOrUpdateBlockItems( +/** Deletes a text blocklist. */ +export async function deleteTextBlocklist( context: Client, blocklistName: string, - body: AddOrUpdateBlockItemsOptions, - options: AddOrUpdateBlockItemsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _addOrUpdateBlockItemsSend( + options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteTextBlocklistSend( context, blocklistName, - body, options, ); - return _addOrUpdateBlockItemsDeserialize(result); + return _deleteTextBlocklistDeserialize(result); } -export function _removeBlockItemsSend( +export function _createOrUpdateTextBlocklistSend( context: Client, blocklistName: string, - body: RemoveBlockItemsOptions, - options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, + resource: TextBlocklist, + options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/text/blocklists/{blocklistName}:removeBlockItems", blocklistName) - .post({ + .path("/text/blocklists/{blocklistName}", blocklistName) + .patch({ ...operationOptionsToRequestParameters(options), - body: removeBlockItemsOptionsSerializer(body), + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: textBlocklistSerializer(resource), }); } -export async function _removeBlockItemsDeserialize( +export async function _createOrUpdateTextBlocklistDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return textBlocklistDeserializer(result.body); } -/** Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. */ -export async function removeBlockItems( +/** Updates a text blocklist, if blocklistName does not exist, create a new blocklist. */ +export async function createOrUpdateTextBlocklist( context: Client, blocklistName: string, - body: RemoveBlockItemsOptions, - options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _removeBlockItemsSend( + resource: TextBlocklist, + options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateTextBlocklistSend( context, blocklistName, - body, + resource, options, ); - return _removeBlockItemsDeserialize(result); + return _createOrUpdateTextBlocklistDeserialize(result); } -export function _getTextBlocklistItemSend( +export function _getTextBlocklistSend( context: Client, blocklistName: string, - blockItemId: string, - options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, + options: GetTextBlocklistOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/text/blocklists/{blocklistName}/blockItems/{blockItemId}", - blocklistName, - blockItemId, - ) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/text/blocklists/{blocklistName}", blocklistName) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getTextBlocklistItemDeserialize( +export async function _getTextBlocklistDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return textBlockItemDeserializer(result.body); + return textBlocklistDeserializer(result.body); } -/** Get blockItem By blockItemId from a text blocklist. */ -export async function getTextBlocklistItem( +/** Returns text blocklist details. */ +export async function getTextBlocklist( context: Client, blocklistName: string, - blockItemId: string, - options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getTextBlocklistItemSend( - context, - blocklistName, - blockItemId, - options, - ); - return _getTextBlocklistItemDeserialize(result); + options: GetTextBlocklistOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTextBlocklistSend(context, blocklistName, options); + return _getTextBlocklistDeserialize(result); } -export function _listTextBlocklistItemsSend( +export function _analyzeImageSend( context: Client, - blocklistName: string, - options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, + body: AnalyzeImageOptions, + options: AnalyzeImageOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/text/blocklists/{blocklistName}/blockItems", blocklistName) - .get({ + .path("/image:analyze") + .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { - top: options?.top, - skip: options?.skip, - maxpagesize: options?.maxpagesize, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, + body: analyzeImageOptionsSerializer(body), }); } -export async function _listTextBlocklistItemsDeserialize( +export async function _analyzeImageDeserialize( result: PathUncheckedResponse, -): Promise<_PagedTextBlockItem> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedTextBlockItemDeserializer(result.body); + return analyzeImageResultDeserializer(result.body); } -/** Get all blockItems in a text blocklist */ -export function listTextBlocklistItems( +/** A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ +export async function analyzeImage( context: Client, - blocklistName: string, - options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listTextBlocklistItemsSend(context, blocklistName, options), - _listTextBlocklistItemsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); + body: AnalyzeImageOptions, + options: AnalyzeImageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _analyzeImageSend(context, body, options); + return _analyzeImageDeserialize(result); +} + +export function _analyzeTextSend( + context: Client, + body: AnalyzeTextOptions, + options: AnalyzeTextOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/text:analyze") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: analyzeTextOptionsSerializer(body), + }); +} + +export async function _analyzeTextDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return analyzeTextResultDeserializer(result.body); +} + +/** A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ +export async function analyzeText( + context: Client, + body: AnalyzeTextOptions, + options: AnalyzeTextOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _analyzeTextSend(context, body, options); + return _analyzeTextDeserialize(result); } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/options.ts index 0e939a2597..44fc6c8c48 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/options.ts @@ -4,42 +4,39 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface AnalyzeTextOptionalParams extends OperationOptions {} +export interface ListTextBlocklistItemsOptionalParams extends OperationOptions { + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} /** Optional parameters. */ -export interface AnalyzeImageOptionalParams extends OperationOptions {} +export interface GetTextBlocklistItemOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetTextBlocklistOptionalParams extends OperationOptions {} +export interface RemoveBlockItemsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface CreateOrUpdateTextBlocklistOptionalParams - extends OperationOptions { - /** This request has a JSON Merge Patch body. */ - contentType?: string; -} +export interface AddOrUpdateBlockItemsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DeleteTextBlocklistOptionalParams extends OperationOptions {} +export interface ListTextBlocklistsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ListTextBlocklistsOptionalParams extends OperationOptions {} +export interface DeleteTextBlocklistOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AddOrUpdateBlockItemsOptionalParams extends OperationOptions {} +export interface CreateOrUpdateTextBlocklistOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface RemoveBlockItemsOptionalParams extends OperationOptions {} +export interface GetTextBlocklistOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetTextBlocklistItemOptionalParams extends OperationOptions {} +export interface AnalyzeImageOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ListTextBlocklistItemsOptionalParams extends OperationOptions { - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} +export interface AnalyzeTextOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/contentSafetyClient.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/contentSafetyClient.ts index ad87ba7dec..a98e2357f9 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/contentSafetyClient.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/contentSafetyClient.ts @@ -5,26 +5,26 @@ import { createContentSafety, ContentSafetyContext, ContentSafetyClientOptionalParams, - analyzeText, - analyzeImage, - getTextBlocklist, - createOrUpdateTextBlocklist, - deleteTextBlocklist, - listTextBlocklists, - addOrUpdateBlockItems, - removeBlockItems, - getTextBlocklistItem, listTextBlocklistItems, - AnalyzeTextOptionalParams, - AnalyzeImageOptionalParams, - GetTextBlocklistOptionalParams, - CreateOrUpdateTextBlocklistOptionalParams, - DeleteTextBlocklistOptionalParams, - ListTextBlocklistsOptionalParams, - AddOrUpdateBlockItemsOptionalParams, - RemoveBlockItemsOptionalParams, - GetTextBlocklistItemOptionalParams, + getTextBlocklistItem, + removeBlockItems, + addOrUpdateBlockItems, + listTextBlocklists, + deleteTextBlocklist, + createOrUpdateTextBlocklist, + getTextBlocklist, + analyzeImage, + analyzeText, ListTextBlocklistItemsOptionalParams, + GetTextBlocklistItemOptionalParams, + RemoveBlockItemsOptionalParams, + AddOrUpdateBlockItemsOptionalParams, + ListTextBlocklistsOptionalParams, + DeleteTextBlocklistOptionalParams, + CreateOrUpdateTextBlocklistOptionalParams, + GetTextBlocklistOptionalParams, + AnalyzeImageOptionalParams, + AnalyzeTextOptionalParams, } from "./api/index.js"; import { TextBlocklist, @@ -65,57 +65,35 @@ export class ContentSafetyClient { this.pipeline = this._client.pipeline; } - /** A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ - analyzeText( - body: AnalyzeTextOptions, - options: AnalyzeTextOptionalParams = { requestOptions: {} }, - ): Promise { - return analyzeText(this._client, body, options); - } - - /** A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ - analyzeImage( - body: AnalyzeImageOptions, - options: AnalyzeImageOptionalParams = { requestOptions: {} }, - ): Promise { - return analyzeImage(this._client, body, options); - } - - /** Returns text blocklist details. */ - getTextBlocklist( + /** Get all blockItems in a text blocklist */ + listTextBlocklistItems( blocklistName: string, - options: GetTextBlocklistOptionalParams = { requestOptions: {} }, - ): Promise { - return getTextBlocklist(this._client, blocklistName, options); + options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTextBlocklistItems(this._client, blocklistName, options); } - /** Updates a text blocklist, if blocklistName does not exist, create a new blocklist. */ - createOrUpdateTextBlocklist( + /** Get blockItem By blockItemId from a text blocklist. */ + getTextBlocklistItem( blocklistName: string, - resource: TextBlocklist, - options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, - ): Promise { - return createOrUpdateTextBlocklist( + blockItemId: string, + options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, + ): Promise { + return getTextBlocklistItem( this._client, blocklistName, - resource, + blockItemId, options, ); } - /** Deletes a text blocklist. */ - deleteTextBlocklist( + /** Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. */ + removeBlockItems( blocklistName: string, - options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, + body: RemoveBlockItemsOptions, + options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, ): Promise { - return deleteTextBlocklist(this._client, blocklistName, options); - } - - /** Get all text blocklists details. */ - listTextBlocklists( - options: ListTextBlocklistsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTextBlocklists(this._client, options); + return removeBlockItems(this._client, blocklistName, body, options); } /** Add or update blockItems to a text blocklist. You can add or update at most 100 BlockItems in one request. */ @@ -127,34 +105,56 @@ export class ContentSafetyClient { return addOrUpdateBlockItems(this._client, blocklistName, body, options); } - /** Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. */ - removeBlockItems( + /** Get all text blocklists details. */ + listTextBlocklists( + options: ListTextBlocklistsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTextBlocklists(this._client, options); + } + + /** Deletes a text blocklist. */ + deleteTextBlocklist( blocklistName: string, - body: RemoveBlockItemsOptions, - options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, + options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, ): Promise { - return removeBlockItems(this._client, blocklistName, body, options); + return deleteTextBlocklist(this._client, blocklistName, options); } - /** Get blockItem By blockItemId from a text blocklist. */ - getTextBlocklistItem( + /** Updates a text blocklist, if blocklistName does not exist, create a new blocklist. */ + createOrUpdateTextBlocklist( blocklistName: string, - blockItemId: string, - options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, - ): Promise { - return getTextBlocklistItem( + resource: TextBlocklist, + options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, + ): Promise { + return createOrUpdateTextBlocklist( this._client, blocklistName, - blockItemId, + resource, options, ); } - /** Get all blockItems in a text blocklist */ - listTextBlocklistItems( + /** Returns text blocklist details. */ + getTextBlocklist( blocklistName: string, - options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTextBlocklistItems(this._client, blocklistName, options); + options: GetTextBlocklistOptionalParams = { requestOptions: {} }, + ): Promise { + return getTextBlocklist(this._client, blocklistName, options); + } + + /** A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ + analyzeImage( + body: AnalyzeImageOptions, + options: AnalyzeImageOptionalParams = { requestOptions: {} }, + ): Promise { + return analyzeImage(this._client, body, options); + } + + /** A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ + analyzeText( + body: AnalyzeTextOptions, + options: AnalyzeTextOptionalParams = { requestOptions: {} }, + ): Promise { + return analyzeText(this._client, body, options); } } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts index 547f3619df..147bfb0e2e 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts @@ -31,15 +31,15 @@ export { } from "./models/index.js"; export { ContentSafetyClientOptionalParams, - AnalyzeTextOptionalParams, - AnalyzeImageOptionalParams, - GetTextBlocklistOptionalParams, - CreateOrUpdateTextBlocklistOptionalParams, - DeleteTextBlocklistOptionalParams, - ListTextBlocklistsOptionalParams, - AddOrUpdateBlockItemsOptionalParams, - RemoveBlockItemsOptionalParams, - GetTextBlocklistItemOptionalParams, ListTextBlocklistItemsOptionalParams, + GetTextBlocklistItemOptionalParams, + RemoveBlockItemsOptionalParams, + AddOrUpdateBlockItemsOptionalParams, + ListTextBlocklistsOptionalParams, + DeleteTextBlocklistOptionalParams, + CreateOrUpdateTextBlocklistOptionalParams, + GetTextBlocklistOptionalParams, + AnalyzeImageOptionalParams, + AnalyzeTextOptionalParams, } from "./api/index.js"; export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts index cba0b5cd18..922664ed1a 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts @@ -361,5 +361,5 @@ export function textAnalyzeSeverityResultDeserializer( /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - V2023_10_01 = "2023-10-01", + v2023_10_01 = "2023-10-01", } diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/contoso/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/customWrapper/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/customWrapper/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/customWrapper/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/customWrapper/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md index 722fc5a835..4165dc18d3 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md @@ -11,7 +11,6 @@ import { Pipeline } from '@azure/core-rest-pipeline'; // @public export interface AcknowledgeCloudEventsOptionalParams extends OperationOptions { - contentType?: string; } // @public @@ -74,17 +73,15 @@ export interface FailedLockToken { // @public export enum KnownServiceApiVersions { // (undocumented) - V2023_06_01_Preview = "2023-06-01-preview" + v2023_06_01_preview = "2023-06-01-preview" } // @public export interface PublishCloudEventOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface PublishCloudEventsOptionalParams extends OperationOptions { - contentType?: string; } // @public @@ -110,7 +107,6 @@ export interface ReceiveResult { // @public export interface RejectCloudEventsOptionalParams extends OperationOptions { - contentType?: string; } // @public @@ -126,7 +122,6 @@ export interface RejectResult { // @public export interface ReleaseCloudEventsOptionalParams extends OperationOptions { - contentType?: string; } // @public diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/eventGridContext.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/eventGridContext.ts index 6389fc8731..305de28694 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/eventGridContext.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/eventGridContext.ts @@ -7,7 +7,11 @@ import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { KeyCredential } from "@azure/core-auth"; /** Azure Messaging EventGrid Client */ -export interface EventGridContext extends Client {} +export interface EventGridContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownServiceApiVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface EventGridClientOptionalParams extends ClientOptions { @@ -22,7 +26,8 @@ export function createEventGrid( credential: KeyCredential, options: EventGridClientOptionalParams = {}, ): EventGridContext { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`; + const endpointUrl = + options.endpoint ?? options.baseUrl ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-eventgrid/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions @@ -55,5 +60,5 @@ export function createEventGrid( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as EventGridContext; } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts index 8a029ed362..fd2135207b 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts @@ -7,18 +7,18 @@ export { EventGridClientOptionalParams, } from "./eventGridContext.js"; export { - publishCloudEvent, - publishCloudEvents, - receiveCloudEvents, - acknowledgeCloudEvents, - releaseCloudEvents, rejectCloudEvents, + releaseCloudEvents, + acknowledgeCloudEvents, + receiveCloudEvents, + publishCloudEvents, + publishCloudEvent, } from "./operations.js"; export { - PublishCloudEventOptionalParams, - PublishCloudEventsOptionalParams, - ReceiveCloudEventsOptionalParams, - AcknowledgeCloudEventsOptionalParams, - ReleaseCloudEventsOptionalParams, RejectCloudEventsOptionalParams, + ReleaseCloudEventsOptionalParams, + AcknowledgeCloudEventsOptionalParams, + ReceiveCloudEventsOptionalParams, + PublishCloudEventsOptionalParams, + PublishCloudEventOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts index a204297726..2be45096ef 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts @@ -13,6 +13,7 @@ import { import { _publishCloudEventRequestSerializer, CloudEvent, + cloudEventSerializer, PublishResult, publishResultDeserializer, ReceiveResult, @@ -29,7 +30,6 @@ import { rejectOptionsSerializer, RejectResult, rejectResultDeserializer, - cloudEventArraySerializer, } from "../models/models.js"; import { StreamableMethod, @@ -38,144 +38,112 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _publishCloudEventSend( - context: Client, - topicName: string, - event: { - event: CloudEvent; - }, - options: PublishCloudEventOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/topics/{topicName}:publish", topicName) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/cloudevents+json; charset=utf-8", - body: _publishCloudEventRequestSerializer(event), - }); -} - -export async function _publishCloudEventDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return publishResultDeserializer(result.body); -} - -/** Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ -export async function publishCloudEvent( - context: Client, - topicName: string, - event: { - event: CloudEvent; - }, - options: PublishCloudEventOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _publishCloudEventSend( - context, - topicName, - event, - options, - ); - return _publishCloudEventDeserialize(result); -} - -export function _publishCloudEventsSend( +export function _rejectCloudEventsSend( context: Client, topicName: string, - events: CloudEvent[], - options: PublishCloudEventsOptionalParams = { requestOptions: {} }, + eventSubscriptionName: string, + lockTokens: RejectOptions, + options: RejectCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/topics/{topicName}:publish", topicName) + .path( + "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject", + topicName, + eventSubscriptionName, + ) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? - "application/cloudevents-batch+json; charset=utf-8", - body: cloudEventArraySerializer(events), + contentType: "application/json; charset=utf-8", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: rejectOptionsSerializer(lockTokens), }); } -export async function _publishCloudEventsDeserialize( +export async function _rejectCloudEventsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return publishResultDeserializer(result.body); + return rejectResultDeserializer(result.body); } -/** Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ -export async function publishCloudEvents( +/** Reject batch of Cloud Events. */ +export async function rejectCloudEvents( context: Client, topicName: string, - events: CloudEvent[], - options: PublishCloudEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _publishCloudEventsSend( + eventSubscriptionName: string, + lockTokens: RejectOptions, + options: RejectCloudEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _rejectCloudEventsSend( context, topicName, - events, + eventSubscriptionName, + lockTokens, options, ); - return _publishCloudEventsDeserialize(result); + return _rejectCloudEventsDeserialize(result); } -export function _receiveCloudEventsSend( +export function _releaseCloudEventsSend( context: Client, topicName: string, eventSubscriptionName: string, - options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, + lockTokens: ReleaseOptions, + options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive", + "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release", topicName, eventSubscriptionName, ) .post({ ...operationOptionsToRequestParameters(options), - queryParameters: { - maxEvents: options?.maxEvents, - maxWaitTime: options?.maxWaitTime, + contentType: "application/json; charset=utf-8", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, + body: releaseOptionsSerializer(lockTokens), }); } -export async function _receiveCloudEventsDeserialize( +export async function _releaseCloudEventsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return receiveResultDeserializer(result.body); + return releaseResultDeserializer(result.body); } -/** Receive Batch of Cloud Events from the Event Subscription. */ -export async function receiveCloudEvents( +/** Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */ +export async function releaseCloudEvents( context: Client, topicName: string, eventSubscriptionName: string, - options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _receiveCloudEventsSend( + lockTokens: ReleaseOptions, + options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _releaseCloudEventsSend( context, topicName, eventSubscriptionName, + lockTokens, options, ); - return _receiveCloudEventsDeserialize(result); + return _releaseCloudEventsDeserialize(result); } export function _acknowledgeCloudEventsSend( @@ -193,8 +161,12 @@ export function _acknowledgeCloudEventsSend( ) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/json; charset=utf-8", + contentType: "application/json; charset=utf-8", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: acknowledgeOptionsSerializer(lockTokens), }); } @@ -228,102 +200,150 @@ export async function acknowledgeCloudEvents( return _acknowledgeCloudEventsDeserialize(result); } -export function _releaseCloudEventsSend( +export function _receiveCloudEventsSend( context: Client, topicName: string, eventSubscriptionName: string, - lockTokens: ReleaseOptions, - options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, + options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( - "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release", + "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive", topicName, eventSubscriptionName, ) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/json; charset=utf-8", - body: releaseOptionsSerializer(lockTokens), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + maxEvents: options?.maxEvents, + maxWaitTime: options?.maxWaitTime, + }, }); } -export async function _releaseCloudEventsDeserialize( +export async function _receiveCloudEventsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return releaseResultDeserializer(result.body); + return receiveResultDeserializer(result.body); } -/** Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */ -export async function releaseCloudEvents( +/** Receive Batch of Cloud Events from the Event Subscription. */ +export async function receiveCloudEvents( context: Client, topicName: string, eventSubscriptionName: string, - lockTokens: ReleaseOptions, - options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _releaseCloudEventsSend( + options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _receiveCloudEventsSend( context, topicName, eventSubscriptionName, - lockTokens, options, ); - return _releaseCloudEventsDeserialize(result); + return _receiveCloudEventsDeserialize(result); } -export function _rejectCloudEventsSend( +export function _publishCloudEventsSend( context: Client, topicName: string, - eventSubscriptionName: string, - lockTokens: RejectOptions, - options: RejectCloudEventsOptionalParams = { requestOptions: {} }, + events: CloudEvent[], + options: PublishCloudEventsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context.path("/topics/{topicName}:publish", topicName).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/cloudevents-batch+json; charset=utf-8", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + queryParameters: { "api-version": context.apiVersion }, + body: events.map((p: any) => { + return cloudEventSerializer(p); + }), + }); +} + +export async function _publishCloudEventsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return publishResultDeserializer(result.body); +} + +/** Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ +export async function publishCloudEvents( + context: Client, + topicName: string, + events: CloudEvent[], + options: PublishCloudEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _publishCloudEventsSend( + context, + topicName, + events, + options, + ); + return _publishCloudEventsDeserialize(result); +} + +export function _publishCloudEventSend( + context: Client, + topicName: string, + event: { + event: CloudEvent; + }, + options: PublishCloudEventOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject", - topicName, - eventSubscriptionName, - ) + .path("/topics/{topicName}:publish", topicName) .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/json; charset=utf-8", - body: rejectOptionsSerializer(lockTokens), + contentType: "application/cloudevents+json; charset=utf-8", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: _publishCloudEventRequestSerializer(event), }); } -export async function _rejectCloudEventsDeserialize( +export async function _publishCloudEventDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return rejectResultDeserializer(result.body); + return publishResultDeserializer(result.body); } -/** Reject batch of Cloud Events. */ -export async function rejectCloudEvents( +/** Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ +export async function publishCloudEvent( context: Client, topicName: string, - eventSubscriptionName: string, - lockTokens: RejectOptions, - options: RejectCloudEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _rejectCloudEventsSend( + event: { + event: CloudEvent; + }, + options: PublishCloudEventOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _publishCloudEventSend( context, topicName, - eventSubscriptionName, - lockTokens, + event, options, ); - return _rejectCloudEventsDeserialize(result); + return _publishCloudEventDeserialize(result); } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/options.ts index 289cd79ae7..1d731f3367 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/options.ts @@ -4,16 +4,14 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface PublishCloudEventOptionalParams extends OperationOptions { - /** content type */ - contentType?: string; -} +export interface RejectCloudEventsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface PublishCloudEventsOptionalParams extends OperationOptions { - /** content type */ - contentType?: string; -} +export interface ReleaseCloudEventsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AcknowledgeCloudEventsOptionalParams + extends OperationOptions {} /** Optional parameters. */ export interface ReceiveCloudEventsOptionalParams extends OperationOptions { @@ -24,19 +22,7 @@ export interface ReceiveCloudEventsOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface AcknowledgeCloudEventsOptionalParams extends OperationOptions { - /** content type */ - contentType?: string; -} +export interface PublishCloudEventsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ReleaseCloudEventsOptionalParams extends OperationOptions { - /** content type */ - contentType?: string; -} - -/** Optional parameters. */ -export interface RejectCloudEventsOptionalParams extends OperationOptions { - /** content type */ - contentType?: string; -} +export interface PublishCloudEventOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/eventGridClient.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/eventGridClient.ts index 388daa6fa6..b50357700d 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/eventGridClient.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/eventGridClient.ts @@ -5,18 +5,18 @@ import { createEventGrid, EventGridContext, EventGridClientOptionalParams, - publishCloudEvent, - publishCloudEvents, - receiveCloudEvents, - acknowledgeCloudEvents, - releaseCloudEvents, rejectCloudEvents, - PublishCloudEventOptionalParams, - PublishCloudEventsOptionalParams, - ReceiveCloudEventsOptionalParams, - AcknowledgeCloudEventsOptionalParams, - ReleaseCloudEventsOptionalParams, + releaseCloudEvents, + acknowledgeCloudEvents, + receiveCloudEvents, + publishCloudEvents, + publishCloudEvent, RejectCloudEventsOptionalParams, + ReleaseCloudEventsOptionalParams, + AcknowledgeCloudEventsOptionalParams, + ReceiveCloudEventsOptionalParams, + PublishCloudEventsOptionalParams, + PublishCloudEventOptionalParams, } from "./api/index.js"; import { CloudEvent, @@ -56,36 +56,34 @@ export class EventGridClient { this.pipeline = this._client.pipeline; } - /** Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ - publishCloudEvent( - topicName: string, - event: { - event: CloudEvent; - }, - options: PublishCloudEventOptionalParams = { requestOptions: {} }, - ): Promise { - return publishCloudEvent(this._client, topicName, event, options); - } - - /** Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ - publishCloudEvents( + /** Reject batch of Cloud Events. */ + rejectCloudEvents( topicName: string, - events: CloudEvent[], - options: PublishCloudEventsOptionalParams = { requestOptions: {} }, - ): Promise { - return publishCloudEvents(this._client, topicName, events, options); + eventSubscriptionName: string, + lockTokens: RejectOptions, + options: RejectCloudEventsOptionalParams = { requestOptions: {} }, + ): Promise { + return rejectCloudEvents( + this._client, + topicName, + eventSubscriptionName, + lockTokens, + options, + ); } - /** Receive Batch of Cloud Events from the Event Subscription. */ - receiveCloudEvents( + /** Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */ + releaseCloudEvents( topicName: string, eventSubscriptionName: string, - options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, - ): Promise { - return receiveCloudEvents( + lockTokens: ReleaseOptions, + options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, + ): Promise { + return releaseCloudEvents( this._client, topicName, eventSubscriptionName, + lockTokens, options, ); } @@ -106,35 +104,37 @@ export class EventGridClient { ); } - /** Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */ - releaseCloudEvents( + /** Receive Batch of Cloud Events from the Event Subscription. */ + receiveCloudEvents( topicName: string, eventSubscriptionName: string, - lockTokens: ReleaseOptions, - options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, - ): Promise { - return releaseCloudEvents( + options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, + ): Promise { + return receiveCloudEvents( this._client, topicName, eventSubscriptionName, - lockTokens, options, ); } - /** Reject batch of Cloud Events. */ - rejectCloudEvents( + /** Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ + publishCloudEvents( topicName: string, - eventSubscriptionName: string, - lockTokens: RejectOptions, - options: RejectCloudEventsOptionalParams = { requestOptions: {} }, - ): Promise { - return rejectCloudEvents( - this._client, - topicName, - eventSubscriptionName, - lockTokens, - options, - ); + events: CloudEvent[], + options: PublishCloudEventsOptionalParams = { requestOptions: {} }, + ): Promise { + return publishCloudEvents(this._client, topicName, events, options); + } + + /** Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */ + publishCloudEvent( + topicName: string, + event: { + event: CloudEvent; + }, + options: PublishCloudEventOptionalParams = { requestOptions: {} }, + ): Promise { + return publishCloudEvent(this._client, topicName, event, options); } } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts index 710d80405e..7453f778b6 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts @@ -19,10 +19,10 @@ export { } from "./models/index.js"; export { EventGridClientOptionalParams, - PublishCloudEventOptionalParams, - PublishCloudEventsOptionalParams, - ReceiveCloudEventsOptionalParams, - AcknowledgeCloudEventsOptionalParams, - ReleaseCloudEventsOptionalParams, RejectCloudEventsOptionalParams, + ReleaseCloudEventsOptionalParams, + AcknowledgeCloudEventsOptionalParams, + ReceiveCloudEventsOptionalParams, + PublishCloudEventsOptionalParams, + PublishCloudEventOptionalParams, } from "./api/index.js"; diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts index c8d3ba29a7..7700a165ca 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts @@ -47,7 +47,7 @@ export function cloudEventSerializer(item: CloudEvent): any { ? item["dataBase64"] : uint8ArrayToString(item["dataBase64"], "base64"), type: item["type"], - time: item["time"]?.toISOString(), + time: !item["time"] ? item["time"] : item["time"].toISOString(), specversion: item["specversion"], dataschema: item["dataschema"], datacontenttype: item["datacontenttype"], @@ -258,7 +258,7 @@ export function rejectResultDeserializer(item: any): RejectResult { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - V2023_06_01_Preview = "2023-06-01-preview", + v2023_06_01_preview = "2023-06-01-preview", } export function cloudEventArraySerializer(result: Array): any[] { diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/faceai/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md index 43f144149b..b69456632a 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md @@ -6,7 +6,6 @@ import { AbortSignalLike } from '@azure/abort-controller'; import { ClientOptions } from '@azure-rest/core-client'; -import { ErrorModel } from '@azure-rest/core-client'; import { KeyCredential } from '@azure/core-auth'; import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; @@ -183,16 +182,6 @@ export interface GenericProcedureRecommendation extends ProcedureRecommendation kind: "genericProcedureRecommendation"; } -// @public -export interface HealthInsightsOperationStatusError { - readonly createdDateTime?: Date; - error?: ErrorModel; - readonly expirationDateTime?: Date; - readonly id: string; - readonly lastUpdateDateTime?: Date; - readonly status: JobStatus; -} - // @public export interface Identifier extends Element { assigner?: Reference; @@ -227,13 +216,10 @@ export interface InferRadiologyInsightsOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type JobStatus = "notStarted" | "running" | "succeeded" | "failed" | "canceled"; - // @public export enum KnownApiVersion { // (undocumented) - V2023_09_01_Preview = "2023-09-01-preview" + v2023_09_01_Preview = "2023-09-01-preview" } // @public @@ -457,17 +443,6 @@ export interface RadiologyInsightsPatientResult { patientId: string; } -// @public -export interface RadiologyInsightsResult { - readonly createdDateTime?: Date; - error?: ErrorModel; - readonly expirationDateTime?: Date; - readonly id: string; - readonly lastUpdateDateTime?: Date; - result?: RadiologyInsightsInferenceResult; - readonly status: JobStatus; -} - // @public export interface RadiologyProcedureInference extends RadiologyInsightsInference { imagingProcedures: ImagingProcedure[]; diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/operations.ts index c95cdae3f5..c5c2a995ec 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/operations.ts @@ -7,8 +7,8 @@ import { } from "./index.js"; import { PatientRecord, - patientRecordSerializer, - radiologyInsightsInferenceOptionsSerializer, + radiologyInsightsModelConfigurationSerializer, + patientRecordArraySerializer, RadiologyInsightsInferenceResult, radiologyInsightsInferenceResultDeserializer, } from "../models/models.js"; @@ -26,41 +26,35 @@ export function _inferRadiologyInsightsSend( patients: PatientRecord[], options: InferRadiologyInsightsOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/radiology-insights/jobs").post({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.repeatabilityRequestId !== undefined - ? { "Repeatability-Request-ID": options?.repeatabilityRequestId } - : {}), - ...(options?.repeatabilityFirstSent !== undefined - ? { - "Repeatability-First-Sent": !options?.repeatabilityFirstSent - ? options?.repeatabilityFirstSent - : options?.repeatabilityFirstSent.toUTCString(), - } - : {}), - }, - body: { - patients: patients.map((p: any) => { - return patientRecordSerializer(p); - }), - configuration: { - verbose: options?.configuration?.["verbose"], - includeEvidence: options?.configuration?.["includeEvidence"], - inferenceTypes: !options?.configuration?.["inferenceTypes"] - ? options?.configuration?.["inferenceTypes"] - : options?.configuration?.["inferenceTypes"].map((p: any) => { - return p; - }), - inferenceOptions: !options?.configuration?.["inferenceOptions"] - ? options?.configuration?.["inferenceOptions"] - : radiologyInsightsInferenceOptionsSerializer( - options?.configuration?.["inferenceOptions"], + return context + .path("/radiology-insights/jobs") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.repeatabilityRequestId !== undefined + ? { "Repeatability-Request-ID": options?.repeatabilityRequestId } + : {}), + ...(options?.repeatabilityFirstSent !== undefined + ? { + "Repeatability-First-Sent": !options?.repeatabilityFirstSent + ? options?.repeatabilityFirstSent + : options?.repeatabilityFirstSent.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: { + patients: patientRecordArraySerializer(patients), + configuration: !options?.configuration + ? options?.configuration + : radiologyInsightsModelConfigurationSerializer( + options?.configuration, ), - locale: options?.configuration?.["locale"], }, - }, - }); + }); } export async function _inferRadiologyInsightsDeserialize( diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/options.ts index 81b1a219a7..51a2dae974 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/options.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OperationOptions } from "@azure-rest/core-client"; import { RadiologyInsightsModelConfiguration } from "../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ export interface InferRadiologyInsightsOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; + /** Configuration affecting the Radiology Insights model's inference. */ + configuration?: RadiologyInsightsModelConfiguration; /** An opaque, globally-unique, client-generated string identifier for the request. */ repeatabilityRequestId?: string; /** Specifies the date and time at which the request was first created. */ repeatabilityFirstSent?: Date; - /** Configuration affecting the Radiology Insights model's inference. */ - configuration?: RadiologyInsightsModelConfiguration; } diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/radiologyInsightsContext.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/radiologyInsightsContext.ts index 5fd8dc7a43..e24c57f5b4 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/radiologyInsightsContext.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/api/radiologyInsightsContext.ts @@ -6,7 +6,11 @@ import { KnownApiVersion } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { KeyCredential } from "@azure/core-auth"; -export interface RadiologyInsightsContext extends Client {} +export interface RadiologyInsightsContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownApiVersion} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface RadiologyInsightsClientOptionalParams extends ClientOptions { @@ -54,5 +58,5 @@ export function createRadiologyInsights( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as RadiologyInsightsContext; } diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/index.ts index cf9291e52d..0cfba46950 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/index.ts @@ -38,8 +38,6 @@ export { RadiologyInsightsInferenceOptions, FollowupRecommendationOptions, FindingOptions, - HealthInsightsOperationStatusError, - JobStatus, RadiologyInsightsInferenceResult, RadiologyInsightsPatientResult, RadiologyInsightsInference, @@ -73,7 +71,6 @@ export { DomainResource, DomainResourceUnion, Narrative, - RadiologyInsightsResult, RepeatabilityResult, KnownApiVersion, } from "./models/index.js"; diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/index.ts index 531f1eb373..d253e262ce 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/index.ts @@ -36,8 +36,6 @@ export { RadiologyInsightsInferenceOptions, FollowupRecommendationOptions, FindingOptions, - HealthInsightsOperationStatusError, - JobStatus, RadiologyInsightsInferenceResult, RadiologyInsightsPatientResult, RadiologyInsightsInference, @@ -71,7 +69,6 @@ export { DomainResource, DomainResourceUnion, Narrative, - RadiologyInsightsResult, RepeatabilityResult, KnownApiVersion, } from "./models.js"; diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts index 12398f54b7..c35d6172da 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { ErrorModel } from "@azure-rest/core-client"; - /** A patient record, including their clinical information and data. */ export interface PatientRecord { /** A given identifier for the patient. Has to be unique across all patients in a single request. */ @@ -249,8 +247,8 @@ export interface TimePeriod { export function timePeriodSerializer(item: TimePeriod): any { return { - start: item["start"]?.toISOString(), - end: item["end"]?.toISOString(), + start: !item["start"] ? item["start"] : item["start"].toISOString(), + end: !item["end"] ? item["end"] : item["end"].toISOString(), }; } @@ -299,7 +297,9 @@ export function patientDocumentSerializer(item: PatientDocument): any { clinicalType: item["clinicalType"], id: item["id"], language: item["language"], - createdDateTime: item["createdDateTime"]?.toISOString(), + createdDateTime: !item["createdDateTime"] + ? item["createdDateTime"] + : item["createdDateTime"].toISOString(), authors: !item["authors"] ? item["authors"] : documentAuthorArraySerializer(item["authors"]), @@ -1069,49 +1069,6 @@ export function patientRecordArraySerializer( }); } -/** Provides status details for long running operations. */ -export interface HealthInsightsOperationStatusError { - /** The unique ID of the operation. */ - readonly id: string; - /** The status of the operation */ - readonly status: JobStatus; - /** The date and time when the processing job was created. */ - readonly createdDateTime?: Date; - /** The date and time when the processing job is set to expire. */ - readonly expirationDateTime?: Date; - /** The date and time when the processing job was last updated. */ - readonly lastUpdateDateTime?: Date; - /** Error object that describes the error when status is "Failed". */ - error?: ErrorModel; -} - -export function healthInsightsOperationStatusErrorDeserializer( - item: any, -): HealthInsightsOperationStatusError { - return { - id: item["id"], - status: item["status"], - createdDateTime: !item["createdDateTime"] - ? item["createdDateTime"] - : new Date(item["createdDateTime"]), - expirationDateTime: !item["expirationDateTime"] - ? item["expirationDateTime"] - : new Date(item["expirationDateTime"]), - lastUpdateDateTime: !item["lastUpdateDateTime"] - ? item["lastUpdateDateTime"] - : new Date(item["lastUpdateDateTime"]), - error: !item["error"] ? item["error"] : item["error"], - }; -} - -/** The status of the processing job. */ -export type JobStatus = - | "notStarted" - | "running" - | "succeeded" - | "failed" - | "canceled"; - /** The inference results for the Radiology Insights request. */ export interface RadiologyInsightsInferenceResult { /** Results for the patients given in the request. */ @@ -1522,6 +1479,7 @@ export interface Observation extends DomainResource { export function observationDeserializer(item: any): Observation { return { ...item, + resourceType: item["resourceType"], text: !item["text"] ? item["text"] : narrativeDeserializer(item["text"]), contained: !item["contained"] ? item["contained"] @@ -1532,7 +1490,6 @@ export function observationDeserializer(item: any): Observation { modifierExtension: !item["modifierExtension"] ? item["modifierExtension"] : extensionArrayDeserializer(item["modifierExtension"]), - resourceType: item["resourceType"], id: item["id"], meta: !item["meta"] ? item["meta"] : metaDeserializer(item["meta"]), implicitRules: item["implicitRules"], @@ -2246,50 +2203,10 @@ export function narrativeDeserializer(item: any): Narrative { }; } -/** The response for the Radiology Insights request. */ -export interface RadiologyInsightsResult { - /** The unique ID of the operation. */ - readonly id: string; - /** The status of the operation */ - readonly status: JobStatus; - /** The date and time when the processing job was created. */ - readonly createdDateTime?: Date; - /** The date and time when the processing job is set to expire. */ - readonly expirationDateTime?: Date; - /** The date and time when the processing job was last updated. */ - readonly lastUpdateDateTime?: Date; - /** Error object that describes the error when status is "Failed". */ - error?: ErrorModel; - /** The result of the operation. */ - result?: RadiologyInsightsInferenceResult; -} - -export function radiologyInsightsResultDeserializer( - item: any, -): RadiologyInsightsResult { - return { - id: item["id"], - status: item["status"], - createdDateTime: !item["createdDateTime"] - ? item["createdDateTime"] - : new Date(item["createdDateTime"]), - expirationDateTime: !item["expirationDateTime"] - ? item["expirationDateTime"] - : new Date(item["expirationDateTime"]), - lastUpdateDateTime: !item["lastUpdateDateTime"] - ? item["lastUpdateDateTime"] - : new Date(item["lastUpdateDateTime"]), - error: !item["error"] ? item["error"] : item["error"], - result: !item["result"] - ? item["result"] - : radiologyInsightsInferenceResultDeserializer(item["result"]), - }; -} - /** Repeatability Result header options */ export type RepeatabilityResult = "accepted" | "rejected"; /** Known values of {@link ApiVersion} that the service accepts. */ export enum KnownApiVersion { - V2023_09_01_Preview = "2023-09-01-preview", + v2023_09_01_Preview = "2023-09-01-preview", } diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json index bd395c7c4f..127887b3fd 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json @@ -13,10 +13,10 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/b": "./src/api/b/index.ts", - "./api/b/e/c": "./src/api/b/e/c/index.ts", + "./api/d": "./src/api/d/index.ts", "./api/b/c": "./src/api/b/c/index.ts", - "./api/d": "./src/api/d/index.ts" + "./api/b/e/c": "./src/api/b/e/c/index.ts", + "./api/b": "./src/api/b/index.ts" }, "dialects": [ "esm", @@ -144,40 +144,22 @@ "default": "./dist/commonjs/api/index.js" } }, - "./api/b": { - "browser": { - "types": "./dist/browser/api/b/index.d.ts", - "default": "./dist/browser/api/b/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/b/index.d.ts", - "default": "./dist/react-native/api/b/index.js" - }, - "import": { - "types": "./dist/esm/api/b/index.d.ts", - "default": "./dist/esm/api/b/index.js" - }, - "require": { - "types": "./dist/commonjs/api/b/index.d.ts", - "default": "./dist/commonjs/api/b/index.js" - } - }, - "./api/b/e/c": { + "./api/d": { "browser": { - "types": "./dist/browser/api/b/e/c/index.d.ts", - "default": "./dist/browser/api/b/e/c/index.js" + "types": "./dist/browser/api/d/index.d.ts", + "default": "./dist/browser/api/d/index.js" }, "react-native": { - "types": "./dist/react-native/api/b/e/c/index.d.ts", - "default": "./dist/react-native/api/b/e/c/index.js" + "types": "./dist/react-native/api/d/index.d.ts", + "default": "./dist/react-native/api/d/index.js" }, "import": { - "types": "./dist/esm/api/b/e/c/index.d.ts", - "default": "./dist/esm/api/b/e/c/index.js" + "types": "./dist/esm/api/d/index.d.ts", + "default": "./dist/esm/api/d/index.js" }, "require": { - "types": "./dist/commonjs/api/b/e/c/index.d.ts", - "default": "./dist/commonjs/api/b/e/c/index.js" + "types": "./dist/commonjs/api/d/index.d.ts", + "default": "./dist/commonjs/api/d/index.js" } }, "./api/b/c": { @@ -198,22 +180,40 @@ "default": "./dist/commonjs/api/b/c/index.js" } }, - "./api/d": { + "./api/b/e/c": { "browser": { - "types": "./dist/browser/api/d/index.d.ts", - "default": "./dist/browser/api/d/index.js" + "types": "./dist/browser/api/b/e/c/index.d.ts", + "default": "./dist/browser/api/b/e/c/index.js" }, "react-native": { - "types": "./dist/react-native/api/d/index.d.ts", - "default": "./dist/react-native/api/d/index.js" + "types": "./dist/react-native/api/b/e/c/index.d.ts", + "default": "./dist/react-native/api/b/e/c/index.js" }, "import": { - "types": "./dist/esm/api/d/index.d.ts", - "default": "./dist/esm/api/d/index.js" + "types": "./dist/esm/api/b/e/c/index.d.ts", + "default": "./dist/esm/api/b/e/c/index.js" }, "require": { - "types": "./dist/commonjs/api/d/index.d.ts", - "default": "./dist/commonjs/api/d/index.js" + "types": "./dist/commonjs/api/b/e/c/index.d.ts", + "default": "./dist/commonjs/api/b/e/c/index.js" + } + }, + "./api/b": { + "browser": { + "types": "./dist/browser/api/b/index.d.ts", + "default": "./dist/browser/api/b/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/b/index.d.ts", + "default": "./dist/react-native/api/b/index.js" + }, + "import": { + "types": "./dist/esm/api/b/index.d.ts", + "default": "./dist/esm/api/b/index.js" + }, + "require": { + "types": "./dist/commonjs/api/b/index.d.ts", + "default": "./dist/commonjs/api/b/index.js" } } }, diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md index eb2fa8be93..3f86be7cf8 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md @@ -15,7 +15,7 @@ export interface A { } // @public -export interface BA { +export interface Ba { // (undocumented) prop2: string; } @@ -27,11 +27,11 @@ export interface BCOp1OptionalParams extends OperationOptions { // @public export interface BCOperations { // (undocumented) - op1: (body: BA, options?: BCOp1OptionalParams) => Promise; + op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; } // @public -export interface BEA { +export interface Bea { // (undocumented) prop3: string; } @@ -43,7 +43,7 @@ export interface BECOp1OptionalParams extends OperationOptions { // @public export interface BECOperations { // (undocumented) - op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; + op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; } // @public @@ -63,7 +63,7 @@ export interface BOperations { // (undocumented) e: BEOperations; // (undocumented) - op1: (body: BA, options?: BOp1OptionalParams) => Promise; + op1: (body: Ba, options?: BOp1OptionalParams) => Promise; } // @public diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts index 8c60f5a4ae..6b08c7be47 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BCOp1OptionalParams, FooContext as Client } from "../../index.js"; -import { BA, baSerializer } from "../../../models/models.js"; +import { Ba, baSerializer } from "../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,13 +12,14 @@ import { export function _op1Send( context: Client, - body: BA, + body: Ba, options: BCOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b/c") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", body: baSerializer(body), }); } @@ -36,7 +37,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: BA, + body: Ba, options: BCOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts index 4508c37416..fb3d4a5208 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BECOp1OptionalParams, FooContext as Client } from "../../../index.js"; -import { BEA, beaSerializer } from "../../../../models/models.js"; +import { Bea, beaSerializer } from "../../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,13 +12,14 @@ import { export function _op1Send( context: Client, - body: BEA, + body: Bea, options: BECOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b/e") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", body: beaSerializer(body), }); } @@ -36,7 +37,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: BEA, + body: Bea, options: BECOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts index b047ea4873..1a7051ad54 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BOp1OptionalParams, FooContext as Client } from "../index.js"; -import { BA, baSerializer } from "../../models/models.js"; +import { Ba, baSerializer } from "../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,13 +12,14 @@ import { export function _op1Send( context: Client, - body: BA, + body: Ba, options: BOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", body: baSerializer(body), }); } @@ -36,7 +37,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: BA, + body: Ba, options: BOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts index 88a9c3c693..4917071436 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts @@ -19,6 +19,7 @@ export function _op1Send( .path("/d") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", body: aSerializer(body), }); } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/fooContext.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/fooContext.ts index c044a71254..318e2aa4fb 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/fooContext.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/fooContext.ts @@ -13,6 +13,8 @@ export function createFoo( endpointParam: string, options: FooClientOptionalParams = {}, ): FooContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-hierarchy-generic/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions @@ -23,11 +25,7 @@ export function createFoo( userAgentOptions: { userAgentPrefix }, loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, }; - const clientContext = getClient( - options.endpoint ?? options.baseUrl ?? String(endpointParam), - undefined, - updatedOptions, - ); + const clientContext = getClient(endpointUrl, undefined, updatedOptions); clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); if (options.apiVersion) { logger.warning( diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts index f65f356c47..400dc8964e 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts @@ -8,9 +8,9 @@ export { } from "./fooContext.js"; export { op1 } from "./operations.js"; export { - Op1OptionalParams, - BOp1OptionalParams, - BECOp1OptionalParams, - BCOp1OptionalParams, DOp1OptionalParams, + BCOp1OptionalParams, + BECOp1OptionalParams, + BOp1OptionalParams, + Op1OptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts index 158936ffaa..f2fac5451d 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts @@ -19,6 +19,7 @@ export function _op1Send( .path("/") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", body: aSerializer(body), }); } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/options.ts index 7dfde86d85..1f1282ddaf 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/options.ts @@ -4,16 +4,16 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface Op1OptionalParams extends OperationOptions {} +export interface DOp1OptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface BOp1OptionalParams extends OperationOptions {} +export interface BCOp1OptionalParams extends OperationOptions {} /** Optional parameters. */ export interface BECOp1OptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface BCOp1OptionalParams extends OperationOptions {} +export interface BOp1OptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DOp1OptionalParams extends OperationOptions {} +export interface Op1OptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts index 1d20656f74..1f8670ba73 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../api/fooContext.js"; import { op1 } from "../../../api/b/c/index.js"; -import { BA } from "../../../models/models.js"; +import { Ba } from "../../../models/models.js"; import { BCOp1OptionalParams } from "../../../api/options.js"; /** Interface representing a BC operations. */ export interface BCOperations { - op1: (body: BA, options?: BCOp1OptionalParams) => Promise; + op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; } export function getBC(context: FooContext) { return { - op1: (body: BA, options?: BCOp1OptionalParams) => + op1: (body: Ba, options?: BCOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts index 7301229b88..f8ab6c6ed1 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../../api/fooContext.js"; import { op1 } from "../../../../api/b/e/c/index.js"; -import { BEA } from "../../../../models/models.js"; +import { Bea } from "../../../../models/models.js"; import { BECOp1OptionalParams } from "../../../../api/options.js"; /** Interface representing a BEC operations. */ export interface BECOperations { - op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; + op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; } export function getBEC(context: FooContext) { return { - op1: (body: BEA, options?: BECOp1OptionalParams) => + op1: (body: Bea, options?: BECOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts index 71e4d436d7..4ae4bcc6d4 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts @@ -3,21 +3,21 @@ import { FooContext } from "../../api/fooContext.js"; import { op1 } from "../../api/b/index.js"; -import { BA } from "../../models/models.js"; +import { Ba } from "../../models/models.js"; import { BOp1OptionalParams } from "../../api/options.js"; import { BCOperations, getBCOperations } from "./c/index.js"; import { BEOperations, getBEOperations } from "./e/index.js"; /** Interface representing a B operations. */ export interface BOperations { - op1: (body: BA, options?: BOp1OptionalParams) => Promise; - e: BEOperations; + op1: (body: Ba, options?: BOp1OptionalParams) => Promise; c: BCOperations; + e: BEOperations; } export function getB(context: FooContext) { return { - op1: (body: BA, options?: BOp1OptionalParams) => + op1: (body: Ba, options?: BOp1OptionalParams) => op1(context, body, options), }; } @@ -25,7 +25,7 @@ export function getB(context: FooContext) { export function getBOperations(context: FooContext): BOperations { return { ...getB(context), - e: getBEOperations(context), c: getBCOperations(context), + e: getBEOperations(context), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/fooClient.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/fooClient.ts index 37cc6badaf..c60543c5d9 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/fooClient.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/fooClient.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getBOperations, BOperations } from "./classic/b/index.js"; import { getDOperations, DOperations } from "./classic/d/index.js"; +import { getBOperations, BOperations } from "./classic/b/index.js"; import { createFoo, FooContext, @@ -30,19 +30,19 @@ export class FooClient { userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; - this.b = getBOperations(this._client); this.d = getDOperations(this._client); + this.b = getBOperations(this._client); } + /** The operation groups for d */ + public readonly d: DOperations; + /** The operation groups for b */ + public readonly b: BOperations; + op1( body: A, options: Op1OptionalParams = { requestOptions: {} }, ): Promise { return op1(this._client, body, options); } - - /** The operation groups for B */ - public readonly b: BOperations; - /** The operation groups for D */ - public readonly d: DOperations; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts index 2170b0a3c6..96e5c0c3b1 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts @@ -2,14 +2,14 @@ // Licensed under the MIT License. export { FooClient } from "./fooClient.js"; -export { A, BA, BEA } from "./models/index.js"; +export { A, Ba, Bea } from "./models/index.js"; export { FooClientOptionalParams, - Op1OptionalParams, - BOp1OptionalParams, - BECOp1OptionalParams, - BCOp1OptionalParams, DOp1OptionalParams, + BCOp1OptionalParams, + BECOp1OptionalParams, + BOp1OptionalParams, + Op1OptionalParams, } from "./api/index.js"; export { BOperations, diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts index 10352581f8..8e00d409af 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export { A, BA, BEA } from "./models.js"; +export { A, Ba, Bea } from "./models.js"; diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts index b8f9cf5f20..6ea4c3b715 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts @@ -10,20 +10,20 @@ export function aSerializer(item: A): any { return { prop1: item["prop1"] }; } -/** model interface BA */ -export interface BA { +/** model interface Ba */ +export interface Ba { prop2: string; } -export function baSerializer(item: BA): any { +export function baSerializer(item: Ba): any { return { prop2: item["prop2"] }; } -/** model interface BEA */ -export interface BEA { +/** model interface Bea */ +export interface Bea { prop3: string; } -export function beaSerializer(item: BEA): any { +export function beaSerializer(item: Bea): any { return { prop3: item["prop3"] }; } diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/loadTest/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index fb0569faaf..5ffc76bdf1 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -53,32 +53,26 @@ export type ContinuablePage = TPage & { // @public export interface CreateOrUpdateAppComponentsOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface CreateOrUpdateServerMetricsConfigOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface CreateOrUpdateTestOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface CreateOrUpdateTestProfileOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface CreateOrUpdateTestProfileRunOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface CreateOrUpdateTestRunOptionalParams extends OperationOptions { - contentType?: string; oldTestRunId?: string; } @@ -476,12 +470,10 @@ export class LoadTestRunClient { // @public export interface LoadTestRunClientCreateOrUpdateAppComponentsOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface LoadTestRunClientCreateOrUpdateServerMetricsConfigOptionalParams extends OperationOptions { - contentType?: string; } // @public @@ -932,7 +924,6 @@ export interface TimeSeriesElement { // @public export interface UploadTestFileOptionalParams extends OperationOptions { - contentType?: string; fileType?: FileType; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts index 29ca730c59..2a72c5bb19 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts @@ -94,52 +94,52 @@ export { } from "./models/index.js"; export { LoadTestAdministrationClientOptionalParams, - CreateOrUpdateTestOptionalParams, - CreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams, - GetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams, - GetTestOptionalParams, - GetTestFileOptionalParams, - ListTestFilesOptionalParams, - ListTestsOptionalParams, - UploadTestFileOptionalParams, - DeleteTestFileOptionalParams, DeleteTestOptionalParams, + DeleteTestFileOptionalParams, + UploadTestFileOptionalParams, + ListTestsOptionalParams, + ListTestFilesOptionalParams, + GetTestFileOptionalParams, + GetTestOptionalParams, + GetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestOptionalParams, } from "./loadTestAdministration/api/index.js"; export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; export { LoadTestRunClient } from "./loadTestRun/loadTestRunClient.js"; export { LoadTestRunClientOptionalParams, - CreateOrUpdateTestRunOptionalParams, - CreateOrUpdateAppComponentsOptionalParams as LoadTestRunClientCreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams as LoadTestRunClientCreateOrUpdateServerMetricsConfigOptionalParams, - DeleteTestRunOptionalParams, - GetAppComponentsOptionalParams as LoadTestRunClientGetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams as LoadTestRunClientGetServerMetricsConfigOptionalParams, - GetTestRunOptionalParams, - GetTestRunFileOptionalParams, - ListMetricDimensionValuesOptionalParams, - ListMetricDefinitionsOptionalParams, - ListMetricNamespacesOptionalParams, - ListMetricsOptionalParams, - ListTestRunsOptionalParams, StopTestRunOptionalParams, + ListTestRunsOptionalParams, + ListMetricsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricDimensionValuesOptionalParams, + GetTestRunFileOptionalParams, + GetTestRunOptionalParams, + GetServerMetricsConfigOptionalParams as LoadTestRunClientGetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams as LoadTestRunClientGetAppComponentsOptionalParams, + DeleteTestRunOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams as LoadTestRunClientCreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams as LoadTestRunClientCreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestRunOptionalParams, } from "./loadTestRun/api/index.js"; export { TestProfileAdministrationClient } from "./testProfileAdministration/testProfileAdministrationClient.js"; export { - CreateOrUpdateTestProfileOptionalParams, - DeleteTestProfileOptionalParams, - GetTestProfileOptionalParams, ListTestProfilesOptionalParams, + GetTestProfileOptionalParams, + DeleteTestProfileOptionalParams, + CreateOrUpdateTestProfileOptionalParams, TestProfileAdministrationClientOptionalParams, } from "./testProfileAdministration/api/index.js"; export { TestProfileRunClient } from "./testProfileRun/testProfileRunClient.js"; export { - CreateOrUpdateTestProfileRunOptionalParams, - DeleteTestProfileRunOptionalParams, - GetTestProfileRunOptionalParams, - ListTestProfileRunsOptionalParams, StopTestProfileRunOptionalParams, + ListTestProfileRunsOptionalParams, + GetTestProfileRunOptionalParams, + DeleteTestProfileRunOptionalParams, + CreateOrUpdateTestProfileRunOptionalParams, TestProfileRunClientOptionalParams, } from "./testProfileRun/api/index.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/index.ts index 44e82f5edd..2c8e84081a 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/index.ts @@ -7,30 +7,30 @@ export { LoadTestAdministrationClientOptionalParams, } from "./loadTestAdministrationContext.js"; export { - createOrUpdateTest, - createOrUpdateAppComponents, - createOrUpdateServerMetricsConfig, - getAppComponents, - getServerMetricsConfig, - getTest, - getTestFile, - listTestFiles, - listTests, - uploadTestFile, - deleteTestFile, deleteTest, + deleteTestFile, + uploadTestFile, + listTests, + listTestFiles, + getTestFile, + getTest, + getServerMetricsConfig, + getAppComponents, + createOrUpdateServerMetricsConfig, + createOrUpdateAppComponents, + createOrUpdateTest, } from "./operations.js"; export { - CreateOrUpdateTestOptionalParams, - CreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams, - GetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams, - GetTestOptionalParams, - GetTestFileOptionalParams, - ListTestFilesOptionalParams, - ListTestsOptionalParams, - UploadTestFileOptionalParams, - DeleteTestFileOptionalParams, DeleteTestOptionalParams, + DeleteTestFileOptionalParams, + UploadTestFileOptionalParams, + ListTestsOptionalParams, + ListTestFilesOptionalParams, + GetTestFileOptionalParams, + GetTestOptionalParams, + GetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/loadTestAdministrationContext.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/loadTestAdministrationContext.ts index 938d630deb..3b2416714f 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/loadTestAdministrationContext.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/loadTestAdministrationContext.ts @@ -6,7 +6,11 @@ import { KnownAPIVersions } from "../../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface LoadTestAdministrationContext extends Client {} +export interface LoadTestAdministrationContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownAPIVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface LoadTestAdministrationClientOptionalParams @@ -56,5 +60,5 @@ export function createLoadTestAdministration( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as LoadTestAdministrationContext; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/operations.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/operations.ts index c5da4f8cf1..d003541b28 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/operations.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/operations.ts @@ -44,452 +44,529 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createOrUpdateTestSend( +export function _deleteTestSend( context: Client, testId: string, - body: Test, - options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, + options: DeleteTestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/tests/{testId}", testId) - .patch({ + .delete({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: testSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createOrUpdateTestDeserialize( +export async function _deleteTestDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201", "200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testDeserializer(result.body); + return; } -/** Create a new test or update an existing test by providing the test Id. */ -export async function createOrUpdateTest( +/** Delete a test by its test Id. */ +export async function deleteTest( context: Client, testId: string, - body: Test, - options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createOrUpdateTestSend(context, testId, body, options); - return _createOrUpdateTestDeserialize(result); + options: DeleteTestOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteTestSend(context, testId, options); + return _deleteTestDeserialize(result); } -export function _createOrUpdateAppComponentsSend( +export function _deleteTestFileSend( context: Client, testId: string, - body: TestAppComponents, - options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, + fileName: string, + options: DeleteTestFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}/app-components", testId) - .patch({ + .path("/tests/{testId}/files/{fileName}", testId, fileName) + .delete({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: testAppComponentsSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createOrUpdateAppComponentsDeserialize( +export async function _deleteTestFileDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201", "200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testAppComponentsDeserializer(result.body); + return; } -/** Add an app component to a test by providing the resource Id, name and type. */ -export async function createOrUpdateAppComponents( +/** Delete file by the file name for a test */ +export async function deleteTestFile( context: Client, testId: string, - body: TestAppComponents, - options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createOrUpdateAppComponentsSend( - context, - testId, - body, - options, - ); - return _createOrUpdateAppComponentsDeserialize(result); + fileName: string, + options: DeleteTestFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteTestFileSend(context, testId, fileName, options); + return _deleteTestFileDeserialize(result); } -export function _createOrUpdateServerMetricsConfigSend( +export function _uploadTestFileSend( context: Client, testId: string, - body: TestServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptionalParams = { - requestOptions: {}, - }, + fileName: string, + body: Uint8Array, + options: UploadTestFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}/server-metrics-config", testId) - .patch({ + .path("/tests/{testId}/files/{fileName}", testId, fileName) + .put({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: testServerMetricConfigSerializer(body), + contentType: "application/octet-stream", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + fileType: options?.fileType, + }, + body: body, }); } -export async function _createOrUpdateServerMetricsConfigDeserialize( +export async function _uploadTestFileDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201", "200"]; +): Promise { + const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testServerMetricConfigDeserializer(result.body); + return testFileInfoDeserializer(result.body); } -/** Configure server metrics for a test */ -export async function createOrUpdateServerMetricsConfig( +/** + * Upload input file for a given test Id. File size can't be more than 50 MB. + * Existing file with same name for the given test will be overwritten. File + * should be provided in the request body as application/octet-stream. + */ +export async function uploadTestFile( context: Client, testId: string, - body: TestServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _createOrUpdateServerMetricsConfigSend( + fileName: string, + body: Uint8Array, + options: UploadTestFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _uploadTestFileSend( context, testId, + fileName, body, options, ); - return _createOrUpdateServerMetricsConfigDeserialize(result); + return _uploadTestFileDeserialize(result); } -export function _getAppComponentsSend( +export function _listTestsSend( context: Client, - testId: string, - options: GetAppComponentsOptionalParams = { requestOptions: {} }, + options: ListTestsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}/app-components", testId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/tests") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + orderby: options?.orderby, + search: options?.search, + lastModifiedStartTime: !options?.lastModifiedStartTime + ? options?.lastModifiedStartTime + : options?.lastModifiedStartTime.toISOString(), + lastModifiedEndTime: !options?.lastModifiedEndTime + ? options?.lastModifiedEndTime + : options?.lastModifiedEndTime.toISOString(), + maxpagesize: options?.maxpagesize, + }, + }); } -export async function _getAppComponentsDeserialize( +export async function _listTestsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_PagedTest> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testAppComponentsDeserializer(result.body); + return _pagedTestDeserializer(result.body); } -/** Get associated app component (collection of azure resources) for the given test. */ -export async function getAppComponents( +/** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + */ +export function listTests( context: Client, - testId: string, - options: GetAppComponentsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getAppComponentsSend(context, testId, options); - return _getAppComponentsDeserialize(result); + options: ListTestsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listTestsSend(context, options), + _listTestsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); } -export function _getServerMetricsConfigSend( +export function _listTestFilesSend( context: Client, testId: string, - options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, + options: ListTestFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}/server-metrics-config", testId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/tests/{testId}/files", testId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getServerMetricsConfigDeserialize( +export async function _listTestFilesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_PagedTestFileInfo> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testServerMetricConfigDeserializer(result.body); + return _pagedTestFileInfoDeserializer(result.body); } -/** List server metrics configuration for the given test. */ -export async function getServerMetricsConfig( +/** Get all test files. */ +export function listTestFiles( context: Client, testId: string, - options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getServerMetricsConfigSend(context, testId, options); - return _getServerMetricsConfigDeserialize(result); + options: ListTestFilesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listTestFilesSend(context, testId, options), + _listTestFilesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); } -export function _getTestSend( +export function _getTestFileSend( context: Client, testId: string, - options: GetTestOptionalParams = { requestOptions: {} }, + fileName: string, + options: GetTestFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}", testId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/tests/{testId}/files/{fileName}", testId, fileName) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getTestDeserialize( +export async function _getTestFileDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testDeserializer(result.body); + return testFileInfoDeserializer(result.body); } -/** Get load test details by test Id */ -export async function getTest( +/** Get all the files that are associated with a test. */ +export async function getTestFile( context: Client, testId: string, - options: GetTestOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getTestSend(context, testId, options); - return _getTestDeserialize(result); + fileName: string, + options: GetTestFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTestFileSend(context, testId, fileName, options); + return _getTestFileDeserialize(result); } -export function _getTestFileSend( +export function _getTestSend( context: Client, testId: string, - fileName: string, - options: GetTestFileOptionalParams = { requestOptions: {} }, + options: GetTestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}/files/{fileName}", testId, fileName) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/tests/{testId}", testId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getTestFileDeserialize( +export async function _getTestDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testFileInfoDeserializer(result.body); + return testDeserializer(result.body); } -/** Get all the files that are associated with a test. */ -export async function getTestFile( +/** Get load test details by test Id */ +export async function getTest( context: Client, testId: string, - fileName: string, - options: GetTestFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getTestFileSend(context, testId, fileName, options); - return _getTestFileDeserialize(result); + options: GetTestOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTestSend(context, testId, options); + return _getTestDeserialize(result); } -export function _listTestFilesSend( +export function _getServerMetricsConfigSend( context: Client, testId: string, - options: ListTestFilesOptionalParams = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}/files", testId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/tests/{testId}/server-metrics-config", testId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _listTestFilesDeserialize( +export async function _getServerMetricsConfigDeserialize( result: PathUncheckedResponse, -): Promise<_PagedTestFileInfo> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedTestFileInfoDeserializer(result.body); + return testServerMetricConfigDeserializer(result.body); } -/** Get all test files. */ -export function listTestFiles( +/** List server metrics configuration for the given test. */ +export async function getServerMetricsConfig( context: Client, testId: string, - options: ListTestFilesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listTestFilesSend(context, testId, options), - _listTestFilesDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getServerMetricsConfigSend(context, testId, options); + return _getServerMetricsConfigDeserialize(result); } -export function _listTestsSend( +export function _getAppComponentsSend( context: Client, - options: ListTestsOptionalParams = { requestOptions: {} }, + testId: string, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests") + .path("/tests/{testId}/app-components", testId) .get({ ...operationOptionsToRequestParameters(options), - queryParameters: { - orderby: options?.orderby, - search: options?.search, - lastModifiedStartTime: options?.lastModifiedStartTime?.toISOString(), - lastModifiedEndTime: options?.lastModifiedEndTime?.toISOString(), - maxpagesize: options?.maxpagesize, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _listTestsDeserialize( +export async function _getAppComponentsDeserialize( result: PathUncheckedResponse, -): Promise<_PagedTest> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedTestDeserializer(result.body); + return testAppComponentsDeserializer(result.body); } -/** - * Get all load tests by the fully qualified resource Id e.g - * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. - */ -export function listTests( +/** Get associated app component (collection of azure resources) for the given test. */ +export async function getAppComponents( context: Client, - options: ListTestsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listTestsSend(context, options), - _listTestsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); + testId: string, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getAppComponentsSend(context, testId, options); + return _getAppComponentsDeserialize(result); } -export function _uploadTestFileSend( +export function _createOrUpdateServerMetricsConfigSend( context: Client, testId: string, - fileName: string, - body: Uint8Array, - options: UploadTestFileOptionalParams = { requestOptions: {} }, + body: TestServerMetricConfig, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/tests/{testId}/files/{fileName}", testId, fileName) - .put({ + .path("/tests/{testId}/server-metrics-config", testId) + .patch({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "application/octet-stream", - queryParameters: { fileType: options?.fileType }, - body: body, + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: testServerMetricConfigSerializer(body), }); } -export async function _uploadTestFileDeserialize( +export async function _createOrUpdateServerMetricsConfigDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testFileInfoDeserializer(result.body); + return testServerMetricConfigDeserializer(result.body); } -/** - * Upload input file for a given test Id. File size can't be more than 50 MB. - * Existing file with same name for the given test will be overwritten. File - * should be provided in the request body as application/octet-stream. - */ -export async function uploadTestFile( +/** Configure server metrics for a test */ +export async function createOrUpdateServerMetricsConfig( context: Client, testId: string, - fileName: string, - body: Uint8Array, - options: UploadTestFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _uploadTestFileSend( + body: TestServerMetricConfig, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _createOrUpdateServerMetricsConfigSend( context, testId, - fileName, body, options, ); - return _uploadTestFileDeserialize(result); + return _createOrUpdateServerMetricsConfigDeserialize(result); } -export function _deleteTestFileSend( +export function _createOrUpdateAppComponentsSend( context: Client, testId: string, - fileName: string, - options: DeleteTestFileOptionalParams = { requestOptions: {} }, + body: TestAppComponents, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/tests/{testId}/files/{fileName}", testId, fileName) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/tests/{testId}/app-components", testId) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: testAppComponentsSerializer(body), + }); } -export async function _deleteTestFileDeserialize( +export async function _createOrUpdateAppComponentsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return testAppComponentsDeserializer(result.body); } -/** Delete file by the file name for a test */ -export async function deleteTestFile( +/** Add an app component to a test by providing the resource Id, name and type. */ +export async function createOrUpdateAppComponents( context: Client, testId: string, - fileName: string, - options: DeleteTestFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteTestFileSend(context, testId, fileName, options); - return _deleteTestFileDeserialize(result); + body: TestAppComponents, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateAppComponentsSend( + context, + testId, + body, + options, + ); + return _createOrUpdateAppComponentsDeserialize(result); } -export function _deleteTestSend( +export function _createOrUpdateTestSend( context: Client, testId: string, - options: DeleteTestOptionalParams = { requestOptions: {} }, + body: Test, + options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/tests/{testId}", testId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: testSerializer(body), + }); } -export async function _deleteTestDeserialize( +export async function _createOrUpdateTestDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return testDeserializer(result.body); } -/** Delete a test by its test Id. */ -export async function deleteTest( +/** Create a new test or update an existing test by providing the test Id. */ +export async function createOrUpdateTest( context: Client, testId: string, - options: DeleteTestOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteTestSend(context, testId, options); - return _deleteTestDeserialize(result); + body: Test, + options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateTestSend(context, testId, body, options); + return _createOrUpdateTestDeserialize(result); } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/options.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/options.ts index 5f76c93bb7..2386d06167 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/options.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/api/options.ts @@ -1,45 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OperationOptions } from "@azure-rest/core-client"; import { FileType } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface CreateOrUpdateTestOptionalParams extends OperationOptions { - /** This request has a JSON Merge Patch body. */ - contentType?: string; -} +export interface DeleteTestOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface CreateOrUpdateAppComponentsOptionalParams - extends OperationOptions { - /** Content type. */ - contentType?: string; -} +export interface DeleteTestFileOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface CreateOrUpdateServerMetricsConfigOptionalParams - extends OperationOptions { - /** Content type. */ - contentType?: string; +export interface UploadTestFileOptionalParams extends OperationOptions { + /** File type */ + fileType?: FileType; } -/** Optional parameters. */ -export interface GetAppComponentsOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface GetServerMetricsConfigOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface GetTestOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface GetTestFileOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface ListTestFilesOptionalParams extends OperationOptions {} - /** Optional parameters. */ export interface ListTestsOptionalParams extends OperationOptions { /** @@ -62,15 +38,28 @@ export interface ListTestsOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface UploadTestFileOptionalParams extends OperationOptions { - /** Content type. */ - contentType?: string; - /** File type */ - fileType?: FileType; -} +export interface ListTestFilesOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DeleteTestFileOptionalParams extends OperationOptions {} +export interface GetTestFileOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DeleteTestOptionalParams extends OperationOptions {} +export interface GetTestOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GetServerMetricsConfigOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GetAppComponentsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CreateOrUpdateServerMetricsConfigOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface CreateOrUpdateAppComponentsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface CreateOrUpdateTestOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/index.ts index 8470bd3fad..ac4696f65d 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/index.ts @@ -5,16 +5,16 @@ export { LoadTestAdministrationClient } from "./loadTestAdministrationClient.js" export { LoadTestAdministrationContext, LoadTestAdministrationClientOptionalParams, - CreateOrUpdateTestOptionalParams, - CreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams, - GetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams, - GetTestOptionalParams, - GetTestFileOptionalParams, - ListTestFilesOptionalParams, - ListTestsOptionalParams, - UploadTestFileOptionalParams, - DeleteTestFileOptionalParams, DeleteTestOptionalParams, + DeleteTestFileOptionalParams, + UploadTestFileOptionalParams, + ListTestsOptionalParams, + ListTestFilesOptionalParams, + GetTestFileOptionalParams, + GetTestOptionalParams, + GetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestOptionalParams, } from "./api/index.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/loadTestAdministrationClient.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/loadTestAdministrationClient.ts index 5408604ba4..0c6b16a608 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/loadTestAdministrationClient.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestAdministration/loadTestAdministrationClient.ts @@ -5,30 +5,30 @@ import { createLoadTestAdministration, LoadTestAdministrationContext, LoadTestAdministrationClientOptionalParams, - createOrUpdateTest, - createOrUpdateAppComponents, - createOrUpdateServerMetricsConfig, - getAppComponents, - getServerMetricsConfig, - getTest, - getTestFile, - listTestFiles, - listTests, - uploadTestFile, - deleteTestFile, deleteTest, - CreateOrUpdateTestOptionalParams, - CreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams, - GetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams, - GetTestOptionalParams, - GetTestFileOptionalParams, - ListTestFilesOptionalParams, - ListTestsOptionalParams, - UploadTestFileOptionalParams, - DeleteTestFileOptionalParams, + deleteTestFile, + uploadTestFile, + listTests, + listTestFiles, + getTestFile, + getTest, + getServerMetricsConfig, + getAppComponents, + createOrUpdateServerMetricsConfig, + createOrUpdateAppComponents, + createOrUpdateTest, DeleteTestOptionalParams, + DeleteTestFileOptionalParams, + UploadTestFileOptionalParams, + ListTestsOptionalParams, + ListTestFilesOptionalParams, + GetTestFileOptionalParams, + GetTestOptionalParams, + GetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestOptionalParams, } from "./api/index.js"; import { Test, @@ -63,54 +63,62 @@ export class LoadTestAdministrationClient { this.pipeline = this._client.pipeline; } - /** Create a new test or update an existing test by providing the test Id. */ - createOrUpdateTest( + /** Delete a test by its test Id. */ + deleteTest( testId: string, - body: Test, - options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, - ): Promise { - return createOrUpdateTest(this._client, testId, body, options); + options: DeleteTestOptionalParams = { requestOptions: {} }, + ): Promise { + return deleteTest(this._client, testId, options); } - /** Add an app component to a test by providing the resource Id, name and type. */ - createOrUpdateAppComponents( + /** Delete file by the file name for a test */ + deleteTestFile( testId: string, - body: TestAppComponents, - options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, - ): Promise { - return createOrUpdateAppComponents(this._client, testId, body, options); + fileName: string, + options: DeleteTestFileOptionalParams = { requestOptions: {} }, + ): Promise { + return deleteTestFile(this._client, testId, fileName, options); } - /** Configure server metrics for a test */ - createOrUpdateServerMetricsConfig( + /** + * Upload input file for a given test Id. File size can't be more than 50 MB. + * Existing file with same name for the given test will be overwritten. File + * should be provided in the request body as application/octet-stream. + */ + uploadTestFile( testId: string, - body: TestServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return createOrUpdateServerMetricsConfig( - this._client, - testId, - body, - options, - ); + fileName: string, + body: Uint8Array, + options: UploadTestFileOptionalParams = { requestOptions: {} }, + ): Promise { + return uploadTestFile(this._client, testId, fileName, body, options); } - /** Get associated app component (collection of azure resources) for the given test. */ - getAppComponents( + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + */ + listTests( + options: ListTestsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTests(this._client, options); + } + + /** Get all test files. */ + listTestFiles( testId: string, - options: GetAppComponentsOptionalParams = { requestOptions: {} }, - ): Promise { - return getAppComponents(this._client, testId, options); + options: ListTestFilesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTestFiles(this._client, testId, options); } - /** List server metrics configuration for the given test. */ - getServerMetricsConfig( + /** Get all the files that are associated with a test. */ + getTestFile( testId: string, - options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, - ): Promise { - return getServerMetricsConfig(this._client, testId, options); + fileName: string, + options: GetTestFileOptionalParams = { requestOptions: {} }, + ): Promise { + return getTestFile(this._client, testId, fileName, options); } /** Get load test details by test Id */ @@ -121,61 +129,53 @@ export class LoadTestAdministrationClient { return getTest(this._client, testId, options); } - /** Get all the files that are associated with a test. */ - getTestFile( + /** List server metrics configuration for the given test. */ + getServerMetricsConfig( testId: string, - fileName: string, - options: GetTestFileOptionalParams = { requestOptions: {} }, - ): Promise { - return getTestFile(this._client, testId, fileName, options); + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, + ): Promise { + return getServerMetricsConfig(this._client, testId, options); } - /** Get all test files. */ - listTestFiles( + /** Get associated app component (collection of azure resources) for the given test. */ + getAppComponents( testId: string, - options: ListTestFilesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTestFiles(this._client, testId, options); - } - - /** - * Get all load tests by the fully qualified resource Id e.g - * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. - */ - listTests( - options: ListTestsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTests(this._client, options); + options: GetAppComponentsOptionalParams = { requestOptions: {} }, + ): Promise { + return getAppComponents(this._client, testId, options); } - /** - * Upload input file for a given test Id. File size can't be more than 50 MB. - * Existing file with same name for the given test will be overwritten. File - * should be provided in the request body as application/octet-stream. - */ - uploadTestFile( + /** Configure server metrics for a test */ + createOrUpdateServerMetricsConfig( testId: string, - fileName: string, - body: Uint8Array, - options: UploadTestFileOptionalParams = { requestOptions: {} }, - ): Promise { - return uploadTestFile(this._client, testId, fileName, body, options); + body: TestServerMetricConfig, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return createOrUpdateServerMetricsConfig( + this._client, + testId, + body, + options, + ); } - /** Delete file by the file name for a test */ - deleteTestFile( + /** Add an app component to a test by providing the resource Id, name and type. */ + createOrUpdateAppComponents( testId: string, - fileName: string, - options: DeleteTestFileOptionalParams = { requestOptions: {} }, - ): Promise { - return deleteTestFile(this._client, testId, fileName, options); + body: TestAppComponents, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, + ): Promise { + return createOrUpdateAppComponents(this._client, testId, body, options); } - /** Delete a test by its test Id. */ - deleteTest( + /** Create a new test or update an existing test by providing the test Id. */ + createOrUpdateTest( testId: string, - options: DeleteTestOptionalParams = { requestOptions: {} }, - ): Promise { - return deleteTest(this._client, testId, options); + body: Test, + options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, + ): Promise { + return createOrUpdateTest(this._client, testId, body, options); } } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/index.ts index 5180ae7e37..89b564274c 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/index.ts @@ -7,34 +7,34 @@ export { LoadTestRunClientOptionalParams, } from "./loadTestRunContext.js"; export { - createOrUpdateTestRun, - createOrUpdateAppComponents, - createOrUpdateServerMetricsConfig, - deleteTestRun, - getAppComponents, - getServerMetricsConfig, - getTestRun, - getTestRunFile, - listMetricDimensionValues, - listMetricDefinitions, - listMetricNamespaces, - listMetrics, - listTestRuns, stopTestRun, + listTestRuns, + listMetrics, + listMetricNamespaces, + listMetricDefinitions, + listMetricDimensionValues, + getTestRunFile, + getTestRun, + getServerMetricsConfig, + getAppComponents, + deleteTestRun, + createOrUpdateServerMetricsConfig, + createOrUpdateAppComponents, + createOrUpdateTestRun, } from "./operations.js"; export { - CreateOrUpdateTestRunOptionalParams, - CreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams, - DeleteTestRunOptionalParams, - GetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams, - GetTestRunOptionalParams, - GetTestRunFileOptionalParams, - ListMetricDimensionValuesOptionalParams, - ListMetricDefinitionsOptionalParams, - ListMetricNamespacesOptionalParams, - ListMetricsOptionalParams, - ListTestRunsOptionalParams, StopTestRunOptionalParams, + ListTestRunsOptionalParams, + ListMetricsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricDimensionValuesOptionalParams, + GetTestRunFileOptionalParams, + GetTestRunOptionalParams, + GetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + DeleteTestRunOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestRunOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/loadTestRunContext.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/loadTestRunContext.ts index 71d1362608..bcf2b1bc42 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/loadTestRunContext.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/loadTestRunContext.ts @@ -6,7 +6,11 @@ import { KnownAPIVersions } from "../../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface LoadTestRunContext extends Client {} +export interface LoadTestRunContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownAPIVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface LoadTestRunClientOptionalParams extends ClientOptions { @@ -55,5 +59,5 @@ export function createLoadTestRun( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as LoadTestRunContext; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/operations.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/operations.ts index 4f9e14838f..fe256ba686 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/operations.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/operations.ts @@ -54,27 +54,27 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createOrUpdateTestRunSend( +export function _stopTestRunSend( context: Client, testRunId: string, - body: TestRun, - options: CreateOrUpdateTestRunOptionalParams = { requestOptions: {} }, + options: StopTestRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}", testRunId) - .patch({ + .path("/test-runs/{testRunId}:stop", testRunId) + .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - queryParameters: { oldTestRunId: options?.oldTestRunId }, - body: testRunSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createOrUpdateTestRunDeserialize( +export async function _stopTestRunDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["201", "200"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -82,237 +82,286 @@ export async function _createOrUpdateTestRunDeserialize( return testRunDeserializer(result.body); } -/** Create and start a new test run with the given test run Id. */ -export async function createOrUpdateTestRun( +/** Stop test run by test run Id. */ +export async function stopTestRun( context: Client, testRunId: string, - body: TestRun, - options: CreateOrUpdateTestRunOptionalParams = { requestOptions: {} }, + options: StopTestRunOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createOrUpdateTestRunSend( - context, - testRunId, - body, - options, - ); - return _createOrUpdateTestRunDeserialize(result); + const result = await _stopTestRunSend(context, testRunId, options); + return _stopTestRunDeserialize(result); } -export function _createOrUpdateAppComponentsSend( +export function _listTestRunsSend( context: Client, - testRunId: string, - body: TestRunAppComponents, - options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, + options: ListTestRunsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}/app-components", testRunId) - .patch({ + .path("/test-runs") + .get({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: testRunAppComponentsSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + orderby: options?.orderby, + search: options?.search, + testId: options?.testId, + executionFrom: !options?.executionFrom + ? options?.executionFrom + : options?.executionFrom.toISOString(), + executionTo: !options?.executionTo + ? options?.executionTo + : options?.executionTo.toISOString(), + status: options?.status, + maxpagesize: options?.maxpagesize, + }, }); } -export async function _createOrUpdateAppComponentsDeserialize( +export async function _listTestRunsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201", "200"]; +): Promise<_PagedTestRun> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testRunAppComponentsDeserializer(result.body); + return _pagedTestRunDeserializer(result.body); } -/** Add an app component to a test run by providing the resource Id, name and type. */ -export async function createOrUpdateAppComponents( +/** Get all test runs for the given filters. */ +export function listTestRuns( context: Client, - testRunId: string, - body: TestRunAppComponents, - options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createOrUpdateAppComponentsSend( + options: ListTestRunsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - testRunId, - body, - options, + () => _listTestRunsSend(context, options), + _listTestRunsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, ); - return _createOrUpdateAppComponentsDeserialize(result); } -export function _createOrUpdateServerMetricsConfigSend( +export function _listMetricsSend( context: Client, testRunId: string, - body: TestRunServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptionalParams = { - requestOptions: {}, - }, + metricname: string, + metricNamespace: string, + timespan: string, + options: ListMetricsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}/server-metrics-config", testRunId) - .patch({ + .path("/test-runs/{testRunId}/metrics", testRunId) + .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: testRunServerMetricConfigSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + aggregation: options?.aggregation, + metricname: metricname, + interval: options?.interval, + metricNamespace: metricNamespace, + timespan: timespan, + }, + body: !options["body"] + ? options["body"] + : metricRequestPayloadSerializer(options["body"]), }); } -export async function _createOrUpdateServerMetricsConfigDeserialize( +export async function _listMetricsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201", "200"]; +): Promise<_Metrics> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testRunServerMetricConfigDeserializer(result.body); + return _metricsDeserializer(result.body); } -/** Configure server metrics for a test run */ -export async function createOrUpdateServerMetricsConfig( +/** List the metric values for a load test run. */ +export function listMetrics( context: Client, testRunId: string, - body: TestRunServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _createOrUpdateServerMetricsConfigSend( + metricname: string, + metricNamespace: string, + timespan: string, + options: ListMetricsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - testRunId, - body, - options, + () => + _listMetricsSend( + context, + testRunId, + metricname, + metricNamespace, + timespan, + options, + ), + _listMetricsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, ); - return _createOrUpdateServerMetricsConfigDeserialize(result); -} - -export function _deleteTestRunSend( - context: Client, - testRunId: string, - options: DeleteTestRunOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/test-runs/{testRunId}", testRunId) - .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _deleteTestRunDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return; -} - -/** Delete an existing load test run by providing the testRunId. */ -export async function deleteTestRun( - context: Client, - testRunId: string, - options: DeleteTestRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteTestRunSend(context, testRunId, options); - return _deleteTestRunDeserialize(result); -} - -export function _getAppComponentsSend( +export function _listMetricNamespacesSend( context: Client, testRunId: string, - options: GetAppComponentsOptionalParams = { requestOptions: {} }, + options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}/app-components", testRunId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/test-runs/{testRunId}/metric-namespaces", testRunId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _getAppComponentsDeserialize( +export async function _listMetricNamespacesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testRunAppComponentsDeserializer(result.body); + return metricNamespaceCollectionDeserializer(result.body); } -/** - * Get associated app component (collection of azure resources) for the given test - * run. - */ -export async function getAppComponents( +/** List the metric namespaces for a load test run. */ +export async function listMetricNamespaces( context: Client, testRunId: string, - options: GetAppComponentsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getAppComponentsSend(context, testRunId, options); - return _getAppComponentsDeserialize(result); + options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listMetricNamespacesSend(context, testRunId, options); + return _listMetricNamespacesDeserialize(result); } -export function _getServerMetricsConfigSend( +export function _listMetricDefinitionsSend( context: Client, testRunId: string, - options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, + metricNamespace: string, + options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}/server-metrics-config", testRunId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/test-runs/{testRunId}/metric-definitions", testRunId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + metricNamespace: metricNamespace, + }, + }); } -export async function _getServerMetricsConfigDeserialize( +export async function _listMetricDefinitionsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testRunServerMetricConfigDeserializer(result.body); + return metricDefinitionCollectionDeserializer(result.body); } -/** Get associated server metrics configuration for the given test run. */ -export async function getServerMetricsConfig( +/** List the metric definitions for a load test run. */ +export async function listMetricDefinitions( context: Client, testRunId: string, - options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getServerMetricsConfigSend(context, testRunId, options); - return _getServerMetricsConfigDeserialize(result); + metricNamespace: string, + options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listMetricDefinitionsSend( + context, + testRunId, + metricNamespace, + options, + ); + return _listMetricDefinitionsDeserialize(result); } -export function _getTestRunSend( +export function _listMetricDimensionValuesSend( context: Client, testRunId: string, - options: GetTestRunOptionalParams = { requestOptions: {} }, + name: string, + metricname: string, + metricNamespace: string, + timespan: string, + options: ListMetricDimensionValuesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}", testRunId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path( + "/test-runs/{testRunId}/metric-dimensions/{name}/values", + testRunId, + name, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + metricname: metricname, + interval: options?.interval, + metricNamespace: metricNamespace, + timespan: timespan, + }, + }); } -export async function _getTestRunDeserialize( +export async function _listMetricDimensionValuesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return testRunDeserializer(result.body); + return dimensionValueListDeserializer(result.body); } -/** Get test run details by test run Id. */ -export async function getTestRun( +/** List the dimension values for the given metric dimension name. */ +export async function listMetricDimensionValues( context: Client, testRunId: string, - options: GetTestRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getTestRunSend(context, testRunId, options); - return _getTestRunDeserialize(result); + name: string, + metricname: string, + metricNamespace: string, + timespan: string, + options: ListMetricDimensionValuesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listMetricDimensionValuesSend( + context, + testRunId, + name, + metricname, + metricNamespace, + timespan, + options, + ); + return _listMetricDimensionValuesDeserialize(result); } export function _getTestRunFileSend( @@ -323,7 +372,14 @@ export function _getTestRunFileSend( ): StreamableMethod { return context .path("/test-runs/{testRunId}/files/{fileName}", testRunId, fileName) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _getTestRunFileDeserialize( @@ -353,258 +409,286 @@ export async function getTestRunFile( return _getTestRunFileDeserialize(result); } -export function _listMetricDimensionValuesSend( +export function _getTestRunSend( + context: Client, + testRunId: string, + options: GetTestRunOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/test-runs/{testRunId}", testRunId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _getTestRunDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return testRunDeserializer(result.body); +} + +/** Get test run details by test run Id. */ +export async function getTestRun( + context: Client, + testRunId: string, + options: GetTestRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTestRunSend(context, testRunId, options); + return _getTestRunDeserialize(result); +} + +export function _getServerMetricsConfigSend( context: Client, testRunId: string, - name: string, - metricname: string, - metricNamespace: string, - timespan: string, - options: ListMetricDimensionValuesOptionalParams = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path( - "/test-runs/{testRunId}/metric-dimensions/{name}/values", - testRunId, - name, - ) + .path("/test-runs/{testRunId}/server-metrics-config", testRunId) .get({ ...operationOptionsToRequestParameters(options), - queryParameters: { - metricname: metricname, - interval: options?.interval, - metricNamespace: metricNamespace, - timespan: timespan, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _listMetricDimensionValuesDeserialize( +export async function _getServerMetricsConfigDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return dimensionValueListDeserializer(result.body); + return testRunServerMetricConfigDeserializer(result.body); } -/** List the dimension values for the given metric dimension name. */ -export async function listMetricDimensionValues( +/** Get associated server metrics configuration for the given test run. */ +export async function getServerMetricsConfig( context: Client, testRunId: string, - name: string, - metricname: string, - metricNamespace: string, - timespan: string, - options: ListMetricDimensionValuesOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listMetricDimensionValuesSend( - context, - testRunId, - name, - metricname, - metricNamespace, - timespan, - options, - ); - return _listMetricDimensionValuesDeserialize(result); + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getServerMetricsConfigSend(context, testRunId, options); + return _getServerMetricsConfigDeserialize(result); } -export function _listMetricDefinitionsSend( +export function _getAppComponentsSend( context: Client, testRunId: string, - metricNamespace: string, - options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}/metric-definitions", testRunId) + .path("/test-runs/{testRunId}/app-components", testRunId) .get({ ...operationOptionsToRequestParameters(options), - queryParameters: { metricNamespace: metricNamespace }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _listMetricDefinitionsDeserialize( +export async function _getAppComponentsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return metricDefinitionCollectionDeserializer(result.body); + return testRunAppComponentsDeserializer(result.body); } -/** List the metric definitions for a load test run. */ -export async function listMetricDefinitions( +/** + * Get associated app component (collection of azure resources) for the given test + * run. + */ +export async function getAppComponents( context: Client, testRunId: string, - metricNamespace: string, - options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listMetricDefinitionsSend( - context, - testRunId, - metricNamespace, - options, - ); - return _listMetricDefinitionsDeserialize(result); + options: GetAppComponentsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getAppComponentsSend(context, testRunId, options); + return _getAppComponentsDeserialize(result); } -export function _listMetricNamespacesSend( +export function _deleteTestRunSend( context: Client, testRunId: string, - options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, + options: DeleteTestRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}/metric-namespaces", testRunId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/test-runs/{testRunId}", testRunId) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } -export async function _listMetricNamespacesDeserialize( +export async function _deleteTestRunDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return metricNamespaceCollectionDeserializer(result.body); + return; } -/** List the metric namespaces for a load test run. */ -export async function listMetricNamespaces( +/** Delete an existing load test run by providing the testRunId. */ +export async function deleteTestRun( context: Client, testRunId: string, - options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listMetricNamespacesSend(context, testRunId, options); - return _listMetricNamespacesDeserialize(result); + options: DeleteTestRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteTestRunSend(context, testRunId, options); + return _deleteTestRunDeserialize(result); } -export function _listMetricsSend( +export function _createOrUpdateServerMetricsConfigSend( context: Client, testRunId: string, - metricname: string, - metricNamespace: string, - timespan: string, - options: ListMetricsOptionalParams = { requestOptions: {} }, + body: TestRunServerMetricConfig, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}/metrics", testRunId) - .post({ + .path("/test-runs/{testRunId}/server-metrics-config", testRunId) + .patch({ ...operationOptionsToRequestParameters(options), - queryParameters: { - aggregation: options?.aggregation, - metricname: metricname, - interval: options?.interval, - metricNamespace: metricNamespace, - timespan: timespan, + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, - body: !options["body"] - ? options["body"] - : metricRequestPayloadSerializer(options["body"]), + queryParameters: { "api-version": context.apiVersion }, + body: testRunServerMetricConfigSerializer(body), }); } -export async function _listMetricsDeserialize( +export async function _createOrUpdateServerMetricsConfigDeserialize( result: PathUncheckedResponse, -): Promise<_Metrics> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _metricsDeserializer(result.body); + return testRunServerMetricConfigDeserializer(result.body); } -/** List the metric values for a load test run. */ -export function listMetrics( +/** Configure server metrics for a test run */ +export async function createOrUpdateServerMetricsConfig( context: Client, testRunId: string, - metricname: string, - metricNamespace: string, - timespan: string, - options: ListMetricsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( + body: TestRunServerMetricConfig, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _createOrUpdateServerMetricsConfigSend( context, - () => - _listMetricsSend( - context, - testRunId, - metricname, - metricNamespace, - timespan, - options, - ), - _listMetricsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, + testRunId, + body, + options, ); + return _createOrUpdateServerMetricsConfigDeserialize(result); } -export function _listTestRunsSend( +export function _createOrUpdateAppComponentsSend( context: Client, - options: ListTestRunsOptionalParams = { requestOptions: {} }, + testRunId: string, + body: TestRunAppComponents, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs") - .get({ + .path("/test-runs/{testRunId}/app-components", testRunId) + .patch({ ...operationOptionsToRequestParameters(options), - queryParameters: { - orderby: options?.orderby, - search: options?.search, - testId: options?.testId, - executionFrom: options?.executionFrom?.toISOString(), - executionTo: options?.executionTo?.toISOString(), - status: options?.status, - maxpagesize: options?.maxpagesize, + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, + body: testRunAppComponentsSerializer(body), }); } -export async function _listTestRunsDeserialize( +export async function _createOrUpdateAppComponentsDeserialize( result: PathUncheckedResponse, -): Promise<_PagedTestRun> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedTestRunDeserializer(result.body); + return testRunAppComponentsDeserializer(result.body); } -/** Get all test runs for the given filters. */ -export function listTestRuns( +/** Add an app component to a test run by providing the resource Id, name and type. */ +export async function createOrUpdateAppComponents( context: Client, - options: ListTestRunsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( + testRunId: string, + body: TestRunAppComponents, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateAppComponentsSend( context, - () => _listTestRunsSend(context, options), - _listTestRunsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, + testRunId, + body, + options, ); + return _createOrUpdateAppComponentsDeserialize(result); } -export function _stopTestRunSend( +export function _createOrUpdateTestRunSend( context: Client, testRunId: string, - options: StopTestRunOptionalParams = { requestOptions: {} }, + body: TestRun, + options: CreateOrUpdateTestRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-runs/{testRunId}:stop", testRunId) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/test-runs/{testRunId}", testRunId) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + oldTestRunId: options?.oldTestRunId, + }, + body: testRunSerializer(body), + }); } -export async function _stopTestRunDeserialize( +export async function _createOrUpdateTestRunDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -612,12 +696,18 @@ export async function _stopTestRunDeserialize( return testRunDeserializer(result.body); } -/** Stop test run by test run Id. */ -export async function stopTestRun( +/** Create and start a new test run with the given test run Id. */ +export async function createOrUpdateTestRun( context: Client, testRunId: string, - options: StopTestRunOptionalParams = { requestOptions: {} }, + body: TestRun, + options: CreateOrUpdateTestRunOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _stopTestRunSend(context, testRunId, options); - return _stopTestRunDeserialize(result); + const result = await _createOrUpdateTestRunSend( + context, + testRunId, + body, + options, + ); + return _createOrUpdateTestRunDeserialize(result); } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/options.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/options.ts index 994804cd76..9813190065 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/options.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/api/options.ts @@ -1,99 +1,91 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OperationOptions } from "@azure-rest/core-client"; import { TimeGrain, MetricRequestPayload } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface CreateOrUpdateTestRunOptionalParams extends OperationOptions { - /** This request has a JSON Merge Patch body. */ - contentType?: string; +export interface StopTestRunOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ListTestRunsOptionalParams extends OperationOptions { /** - * Existing test run identifier that should be rerun, if this is provided, the - * test will run with the JMX file, configuration and app components from the - * existing test run. You can override the configuration values for new test run - * in the request body. + * Sort on the supported fields in (field asc/desc) format. eg: executedDateTime + * asc. Supported fields - executedDateTime */ - oldTestRunId?: string; + orderby?: string; + /** + * Prefix based, case sensitive search on searchable fields - description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500. + */ + search?: string; + /** Unique name of an existing load test. */ + testId?: string; + /** Start DateTime(RFC 3339 literal format) of test-run execution time filter range. */ + executionFrom?: Date; + /** End DateTime(RFC 3339 literal format) of test-run execution time filter range. */ + executionTo?: Date; + /** Comma separated list of test run status. */ + status?: string; + /** Number of results in response. */ + maxpagesize?: number; } /** Optional parameters. */ -export interface CreateOrUpdateAppComponentsOptionalParams - extends OperationOptions { - /** Content type. */ - contentType?: string; +export interface ListMetricsOptionalParams extends OperationOptions { + /** The aggregation */ + aggregation?: string; + /** The interval (i.e. timegrain) of the query. */ + interval?: TimeGrain; + /** Metric dimension filter */ + body?: MetricRequestPayload; } /** Optional parameters. */ -export interface CreateOrUpdateServerMetricsConfigOptionalParams - extends OperationOptions { - /** Content type. */ - contentType?: string; -} +export interface ListMetricNamespacesOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DeleteTestRunOptionalParams extends OperationOptions {} +export interface ListMetricDefinitionsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetAppComponentsOptionalParams extends OperationOptions {} +export interface ListMetricDimensionValuesOptionalParams + extends OperationOptions { + /** The interval (i.e. timegrain) of the query. */ + interval?: TimeGrain; +} /** Optional parameters. */ -export interface GetServerMetricsConfigOptionalParams - extends OperationOptions {} +export interface GetTestRunFileOptionalParams extends OperationOptions {} /** Optional parameters. */ export interface GetTestRunOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetTestRunFileOptionalParams extends OperationOptions {} +export interface GetServerMetricsConfigOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ListMetricDimensionValuesOptionalParams - extends OperationOptions { - /** The interval (i.e. timegrain) of the query. */ - interval?: TimeGrain; -} +export interface GetAppComponentsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ListMetricDefinitionsOptionalParams extends OperationOptions {} +export interface DeleteTestRunOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ListMetricNamespacesOptionalParams extends OperationOptions {} +export interface CreateOrUpdateServerMetricsConfigOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ListMetricsOptionalParams extends OperationOptions { - /** The aggregation */ - aggregation?: string; - /** The interval (i.e. timegrain) of the query. */ - interval?: TimeGrain; - /** Metric dimension filter */ - body?: MetricRequestPayload; -} +export interface CreateOrUpdateAppComponentsOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ListTestRunsOptionalParams extends OperationOptions { - /** - * Sort on the supported fields in (field asc/desc) format. eg: executedDateTime - * asc. Supported fields - executedDateTime - */ - orderby?: string; +export interface CreateOrUpdateTestRunOptionalParams extends OperationOptions { /** - * Prefix based, case sensitive search on searchable fields - description, - * executedUser. For example, to search for a test run, with description 500 VUs, - * the search parameter can be 500. + * Existing test run identifier that should be rerun, if this is provided, the + * test will run with the JMX file, configuration and app components from the + * existing test run. You can override the configuration values for new test run + * in the request body. */ - search?: string; - /** Unique name of an existing load test. */ - testId?: string; - /** Start DateTime(RFC 3339 literal format) of test-run execution time filter range. */ - executionFrom?: Date; - /** End DateTime(RFC 3339 literal format) of test-run execution time filter range. */ - executionTo?: Date; - /** Comma separated list of test run status. */ - status?: string; - /** Number of results in response. */ - maxpagesize?: number; + oldTestRunId?: string; } - -/** Optional parameters. */ -export interface StopTestRunOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/index.ts index 3cbd04210a..baf81b8d23 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/index.ts @@ -5,18 +5,18 @@ export { LoadTestRunClient } from "./loadTestRunClient.js"; export { LoadTestRunContext, LoadTestRunClientOptionalParams, - CreateOrUpdateTestRunOptionalParams, - CreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams, - DeleteTestRunOptionalParams, - GetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams, - GetTestRunOptionalParams, - GetTestRunFileOptionalParams, - ListMetricDimensionValuesOptionalParams, - ListMetricDefinitionsOptionalParams, - ListMetricNamespacesOptionalParams, - ListMetricsOptionalParams, - ListTestRunsOptionalParams, StopTestRunOptionalParams, + ListTestRunsOptionalParams, + ListMetricsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricDimensionValuesOptionalParams, + GetTestRunFileOptionalParams, + GetTestRunOptionalParams, + GetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + DeleteTestRunOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestRunOptionalParams, } from "./api/index.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/loadTestRunClient.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/loadTestRunClient.ts index 085f3cce1a..3b191868a6 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/loadTestRunClient.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/loadTestRun/loadTestRunClient.ts @@ -5,34 +5,34 @@ import { createLoadTestRun, LoadTestRunContext, LoadTestRunClientOptionalParams, - createOrUpdateTestRun, - createOrUpdateAppComponents, - createOrUpdateServerMetricsConfig, - deleteTestRun, - getAppComponents, - getServerMetricsConfig, - getTestRun, - getTestRunFile, - listMetricDimensionValues, - listMetricDefinitions, - listMetricNamespaces, - listMetrics, - listTestRuns, stopTestRun, - CreateOrUpdateTestRunOptionalParams, - CreateOrUpdateAppComponentsOptionalParams, - CreateOrUpdateServerMetricsConfigOptionalParams, - DeleteTestRunOptionalParams, - GetAppComponentsOptionalParams, - GetServerMetricsConfigOptionalParams, - GetTestRunOptionalParams, - GetTestRunFileOptionalParams, - ListMetricDimensionValuesOptionalParams, - ListMetricDefinitionsOptionalParams, - ListMetricNamespacesOptionalParams, - ListMetricsOptionalParams, - ListTestRunsOptionalParams, + listTestRuns, + listMetrics, + listMetricNamespaces, + listMetricDefinitions, + listMetricDimensionValues, + getTestRunFile, + getTestRun, + getServerMetricsConfig, + getAppComponents, + deleteTestRun, + createOrUpdateServerMetricsConfig, + createOrUpdateAppComponents, + createOrUpdateTestRun, StopTestRunOptionalParams, + ListTestRunsOptionalParams, + ListMetricsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricDimensionValuesOptionalParams, + GetTestRunFileOptionalParams, + GetTestRunOptionalParams, + GetServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + DeleteTestRunOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateTestRunOptionalParams, } from "./api/index.js"; import { TestRun, @@ -71,82 +71,59 @@ export class LoadTestRunClient { this.pipeline = this._client.pipeline; } - /** Create and start a new test run with the given test run Id. */ - createOrUpdateTestRun( + /** Stop test run by test run Id. */ + stopTestRun( testRunId: string, - body: TestRun, - options: CreateOrUpdateTestRunOptionalParams = { requestOptions: {} }, + options: StopTestRunOptionalParams = { requestOptions: {} }, ): Promise { - return createOrUpdateTestRun(this._client, testRunId, body, options); + return stopTestRun(this._client, testRunId, options); } - /** Add an app component to a test run by providing the resource Id, name and type. */ - createOrUpdateAppComponents( - testRunId: string, - body: TestRunAppComponents, - options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, - ): Promise { - return createOrUpdateAppComponents(this._client, testRunId, body, options); + /** Get all test runs for the given filters. */ + listTestRuns( + options: ListTestRunsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTestRuns(this._client, options); } - /** Configure server metrics for a test run */ - createOrUpdateServerMetricsConfig( + /** List the metric values for a load test run. */ + listMetrics( testRunId: string, - body: TestRunServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return createOrUpdateServerMetricsConfig( + metricname: string, + metricNamespace: string, + timespan: string, + options: ListMetricsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listMetrics( this._client, testRunId, - body, + metricname, + metricNamespace, + timespan, options, ); } - /** Delete an existing load test run by providing the testRunId. */ - deleteTestRun( - testRunId: string, - options: DeleteTestRunOptionalParams = { requestOptions: {} }, - ): Promise { - return deleteTestRun(this._client, testRunId, options); - } - - /** - * Get associated app component (collection of azure resources) for the given test - * run. - */ - getAppComponents( - testRunId: string, - options: GetAppComponentsOptionalParams = { requestOptions: {} }, - ): Promise { - return getAppComponents(this._client, testRunId, options); - } - - /** Get associated server metrics configuration for the given test run. */ - getServerMetricsConfig( - testRunId: string, - options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, - ): Promise { - return getServerMetricsConfig(this._client, testRunId, options); - } - - /** Get test run details by test run Id. */ - getTestRun( + /** List the metric namespaces for a load test run. */ + listMetricNamespaces( testRunId: string, - options: GetTestRunOptionalParams = { requestOptions: {} }, - ): Promise { - return getTestRun(this._client, testRunId, options); + options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, + ): Promise { + return listMetricNamespaces(this._client, testRunId, options); } - /** Get test run file by file name. */ - getTestRunFile( + /** List the metric definitions for a load test run. */ + listMetricDefinitions( testRunId: string, - fileName: string, - options: GetTestRunFileOptionalParams = { requestOptions: {} }, - ): Promise { - return getTestRunFile(this._client, testRunId, fileName, options); + metricNamespace: string, + options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, + ): Promise { + return listMetricDefinitions( + this._client, + testRunId, + metricNamespace, + options, + ); } /** List the dimension values for the given metric dimension name. */ @@ -169,58 +146,81 @@ export class LoadTestRunClient { ); } - /** List the metric definitions for a load test run. */ - listMetricDefinitions( + /** Get test run file by file name. */ + getTestRunFile( testRunId: string, - metricNamespace: string, - options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, - ): Promise { - return listMetricDefinitions( - this._client, - testRunId, - metricNamespace, - options, - ); + fileName: string, + options: GetTestRunFileOptionalParams = { requestOptions: {} }, + ): Promise { + return getTestRunFile(this._client, testRunId, fileName, options); } - /** List the metric namespaces for a load test run. */ - listMetricNamespaces( + /** Get test run details by test run Id. */ + getTestRun( testRunId: string, - options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, - ): Promise { - return listMetricNamespaces(this._client, testRunId, options); + options: GetTestRunOptionalParams = { requestOptions: {} }, + ): Promise { + return getTestRun(this._client, testRunId, options); } - /** List the metric values for a load test run. */ - listMetrics( + /** Get associated server metrics configuration for the given test run. */ + getServerMetricsConfig( testRunId: string, - metricname: string, - metricNamespace: string, - timespan: string, - options: ListMetricsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listMetrics( + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, + ): Promise { + return getServerMetricsConfig(this._client, testRunId, options); + } + + /** + * Get associated app component (collection of azure resources) for the given test + * run. + */ + getAppComponents( + testRunId: string, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, + ): Promise { + return getAppComponents(this._client, testRunId, options); + } + + /** Delete an existing load test run by providing the testRunId. */ + deleteTestRun( + testRunId: string, + options: DeleteTestRunOptionalParams = { requestOptions: {} }, + ): Promise { + return deleteTestRun(this._client, testRunId, options); + } + + /** Configure server metrics for a test run */ + createOrUpdateServerMetricsConfig( + testRunId: string, + body: TestRunServerMetricConfig, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return createOrUpdateServerMetricsConfig( this._client, testRunId, - metricname, - metricNamespace, - timespan, + body, options, ); } - /** Get all test runs for the given filters. */ - listTestRuns( - options: ListTestRunsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTestRuns(this._client, options); + /** Add an app component to a test run by providing the resource Id, name and type. */ + createOrUpdateAppComponents( + testRunId: string, + body: TestRunAppComponents, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, + ): Promise { + return createOrUpdateAppComponents(this._client, testRunId, body, options); } - /** Stop test run by test run Id. */ - stopTestRun( + /** Create and start a new test run with the given test run Id. */ + createOrUpdateTestRun( testRunId: string, - options: StopTestRunOptionalParams = { requestOptions: {} }, + body: TestRun, + options: CreateOrUpdateTestRunOptionalParams = { requestOptions: {} }, ): Promise { - return stopTestRun(this._client, testRunId, options); + return createOrUpdateTestRun(this._client, testRunId, body, options); } } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/index.ts index 3c55ffe9d3..6e3da8b933 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/index.ts @@ -2,16 +2,16 @@ // Licensed under the MIT License. export { - createOrUpdateTestProfile, - deleteTestProfile, - getTestProfile, listTestProfiles, + getTestProfile, + deleteTestProfile, + createOrUpdateTestProfile, } from "./operations.js"; export { - CreateOrUpdateTestProfileOptionalParams, - DeleteTestProfileOptionalParams, - GetTestProfileOptionalParams, ListTestProfilesOptionalParams, + GetTestProfileOptionalParams, + DeleteTestProfileOptionalParams, + CreateOrUpdateTestProfileOptionalParams, } from "./options.js"; export { createTestProfileAdministration, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/operations.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/operations.ts index 20e50d48a3..39e33a2648 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/operations.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/operations.ts @@ -26,26 +26,79 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createOrUpdateTestProfileSend( +export function _listTestProfilesSend( + context: Client, + options: ListTestProfilesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/test-profiles") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + maxpagesize: options?.maxpagesize, + lastModifiedStartTime: !options?.lastModifiedStartTime + ? options?.lastModifiedStartTime + : options?.lastModifiedStartTime.toISOString(), + lastModifiedEndTime: !options?.lastModifiedEndTime + ? options?.lastModifiedEndTime + : options?.lastModifiedEndTime.toISOString(), + testProfileIds: options?.testProfileIds, + testIds: options?.testIds, + }, + }); +} + +export async function _listTestProfilesDeserialize( + result: PathUncheckedResponse, +): Promise<_PagedTestProfile> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _pagedTestProfileDeserializer(result.body); +} + +/** Get all test profiles for the given filters. */ +export function listTestProfiles( + context: Client, + options: ListTestProfilesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listTestProfilesSend(context, options), + _listTestProfilesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _getTestProfileSend( context: Client, testProfileId: string, - body: TestProfile, - options: CreateOrUpdateTestProfileOptionalParams = { requestOptions: {} }, + options: GetTestProfileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/test-profiles/{testProfileId}", testProfileId) - .patch({ + .get({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: testProfileSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createOrUpdateTestProfileDeserialize( +export async function _getTestProfileDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["201", "200"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -53,20 +106,14 @@ export async function _createOrUpdateTestProfileDeserialize( return testProfileDeserializer(result.body); } -/** Create a new test profile or update an existing test profile by providing the test profile Id. */ -export async function createOrUpdateTestProfile( +/** Get load test profile details by test profile Id. */ +export async function getTestProfile( context: Client, testProfileId: string, - body: TestProfile, - options: CreateOrUpdateTestProfileOptionalParams = { requestOptions: {} }, + options: GetTestProfileOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createOrUpdateTestProfileSend( - context, - testProfileId, - body, - options, - ); - return _createOrUpdateTestProfileDeserialize(result); + const result = await _getTestProfileSend(context, testProfileId, options); + return _getTestProfileDeserialize(result); } export function _deleteTestProfileSend( @@ -76,7 +123,14 @@ export function _deleteTestProfileSend( ): StreamableMethod { return context .path("/test-profiles/{testProfileId}", testProfileId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _deleteTestProfileDeserialize( @@ -100,20 +154,30 @@ export async function deleteTestProfile( return _deleteTestProfileDeserialize(result); } -export function _getTestProfileSend( +export function _createOrUpdateTestProfileSend( context: Client, testProfileId: string, - options: GetTestProfileOptionalParams = { requestOptions: {} }, + body: TestProfile, + options: CreateOrUpdateTestProfileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/test-profiles/{testProfileId}", testProfileId) - .get({ ...operationOptionsToRequestParameters(options) }); + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: testProfileSerializer(body), + }); } -export async function _getTestProfileDeserialize( +export async function _createOrUpdateTestProfileDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -121,55 +185,18 @@ export async function _getTestProfileDeserialize( return testProfileDeserializer(result.body); } -/** Get load test profile details by test profile Id. */ -export async function getTestProfile( +/** Create a new test profile or update an existing test profile by providing the test profile Id. */ +export async function createOrUpdateTestProfile( context: Client, testProfileId: string, - options: GetTestProfileOptionalParams = { requestOptions: {} }, + body: TestProfile, + options: CreateOrUpdateTestProfileOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getTestProfileSend(context, testProfileId, options); - return _getTestProfileDeserialize(result); -} - -export function _listTestProfilesSend( - context: Client, - options: ListTestProfilesOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/test-profiles") - .get({ - ...operationOptionsToRequestParameters(options), - queryParameters: { - maxpagesize: options?.maxpagesize, - lastModifiedStartTime: options?.lastModifiedStartTime?.toISOString(), - lastModifiedEndTime: options?.lastModifiedEndTime?.toISOString(), - testProfileIds: options?.testProfileIds, - testIds: options?.testIds, - }, - }); -} - -export async function _listTestProfilesDeserialize( - result: PathUncheckedResponse, -): Promise<_PagedTestProfile> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return _pagedTestProfileDeserializer(result.body); -} - -/** Get all test profiles for the given filters. */ -export function listTestProfiles( - context: Client, - options: ListTestProfilesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( + const result = await _createOrUpdateTestProfileSend( context, - () => _listTestProfilesSend(context, options), - _listTestProfilesDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, + testProfileId, + body, + options, ); + return _createOrUpdateTestProfileDeserialize(result); } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/options.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/options.ts index 7f021b292d..554ca8cbf6 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/options.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/options.ts @@ -3,19 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -/** Optional parameters. */ -export interface CreateOrUpdateTestProfileOptionalParams - extends OperationOptions { - /** This request has a JSON Merge Patch body. */ - contentType?: string; -} - -/** Optional parameters. */ -export interface DeleteTestProfileOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface GetTestProfileOptionalParams extends OperationOptions {} - /** Optional parameters. */ export interface ListTestProfilesOptionalParams extends OperationOptions { /** Maximum number of results to include in a single response. */ @@ -29,3 +16,13 @@ export interface ListTestProfilesOptionalParams extends OperationOptions { /** Comma separated list IDs of the tests which should be associated with the test profiles to fetch. */ testIds?: string; } + +/** Optional parameters. */ +export interface GetTestProfileOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DeleteTestProfileOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CreateOrUpdateTestProfileOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/testProfileAdministrationContext.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/testProfileAdministrationContext.ts index e2920aa082..772f92223e 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/testProfileAdministrationContext.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/api/testProfileAdministrationContext.ts @@ -6,7 +6,11 @@ import { KnownAPIVersions } from "../../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface TestProfileAdministrationContext extends Client {} +export interface TestProfileAdministrationContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownAPIVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface TestProfileAdministrationClientOptionalParams @@ -56,5 +60,5 @@ export function createTestProfileAdministration( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as TestProfileAdministrationContext; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/index.ts index 9cd5d80591..3f4c23cc35 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/index.ts @@ -3,10 +3,10 @@ export { TestProfileAdministrationClient } from "./testProfileAdministrationClient.js"; export { - CreateOrUpdateTestProfileOptionalParams, - DeleteTestProfileOptionalParams, - GetTestProfileOptionalParams, ListTestProfilesOptionalParams, + GetTestProfileOptionalParams, + DeleteTestProfileOptionalParams, + CreateOrUpdateTestProfileOptionalParams, TestProfileAdministrationContext, TestProfileAdministrationClientOptionalParams, } from "./api/index.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/testProfileAdministrationClient.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/testProfileAdministrationClient.ts index 61f820586e..9db474f98a 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/testProfileAdministrationClient.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileAdministration/testProfileAdministrationClient.ts @@ -2,14 +2,14 @@ // Licensed under the MIT License. import { - createOrUpdateTestProfile, - deleteTestProfile, - getTestProfile, listTestProfiles, - CreateOrUpdateTestProfileOptionalParams, - DeleteTestProfileOptionalParams, - GetTestProfileOptionalParams, + getTestProfile, + deleteTestProfile, + createOrUpdateTestProfile, ListTestProfilesOptionalParams, + GetTestProfileOptionalParams, + DeleteTestProfileOptionalParams, + CreateOrUpdateTestProfileOptionalParams, createTestProfileAdministration, TestProfileAdministrationContext, TestProfileAdministrationClientOptionalParams, @@ -42,18 +42,19 @@ export class TestProfileAdministrationClient { this.pipeline = this._client.pipeline; } - /** Create a new test profile or update an existing test profile by providing the test profile Id. */ - createOrUpdateTestProfile( + /** Get all test profiles for the given filters. */ + listTestProfiles( + options: ListTestProfilesOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTestProfiles(this._client, options); + } + + /** Get load test profile details by test profile Id. */ + getTestProfile( testProfileId: string, - body: TestProfile, - options: CreateOrUpdateTestProfileOptionalParams = { requestOptions: {} }, + options: GetTestProfileOptionalParams = { requestOptions: {} }, ): Promise { - return createOrUpdateTestProfile( - this._client, - testProfileId, - body, - options, - ); + return getTestProfile(this._client, testProfileId, options); } /** Delete a test profile by its test profile Id. */ @@ -64,18 +65,17 @@ export class TestProfileAdministrationClient { return deleteTestProfile(this._client, testProfileId, options); } - /** Get load test profile details by test profile Id. */ - getTestProfile( + /** Create a new test profile or update an existing test profile by providing the test profile Id. */ + createOrUpdateTestProfile( testProfileId: string, - options: GetTestProfileOptionalParams = { requestOptions: {} }, + body: TestProfile, + options: CreateOrUpdateTestProfileOptionalParams = { requestOptions: {} }, ): Promise { - return getTestProfile(this._client, testProfileId, options); - } - - /** Get all test profiles for the given filters. */ - listTestProfiles( - options: ListTestProfilesOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTestProfiles(this._client, options); + return createOrUpdateTestProfile( + this._client, + testProfileId, + body, + options, + ); } } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/index.ts index 4f3d1b732f..850cb1c092 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/index.ts @@ -2,18 +2,18 @@ // Licensed under the MIT License. export { - createOrUpdateTestProfileRun, - deleteTestProfileRun, - getTestProfileRun, - listTestProfileRuns, stopTestProfileRun, + listTestProfileRuns, + getTestProfileRun, + deleteTestProfileRun, + createOrUpdateTestProfileRun, } from "./operations.js"; export { - CreateOrUpdateTestProfileRunOptionalParams, - DeleteTestProfileRunOptionalParams, - GetTestProfileRunOptionalParams, - ListTestProfileRunsOptionalParams, StopTestProfileRunOptionalParams, + ListTestProfileRunsOptionalParams, + GetTestProfileRunOptionalParams, + DeleteTestProfileRunOptionalParams, + CreateOrUpdateTestProfileRunOptionalParams, } from "./options.js"; export { createTestProfileRun, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/operations.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/operations.ts index 865818a82f..b3a813750e 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/operations.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/operations.ts @@ -27,26 +27,27 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createOrUpdateTestProfileRunSend( +export function _stopTestProfileRunSend( context: Client, testProfileRunId: string, - body: TestProfileRun, - options: CreateOrUpdateTestProfileRunOptionalParams = { requestOptions: {} }, + options: StopTestProfileRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .patch({ + .path("/test-profile-runs/{testProfileRunId}:stop", testProfileRunId) + .post({ ...operationOptionsToRequestParameters(options), - contentType: - (options.contentType as any) ?? "application/merge-patch+json", - body: testProfileRunSerializer(body), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _createOrUpdateTestProfileRunDeserialize( +export async function _stopTestProfileRunDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["201", "200"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -54,55 +55,83 @@ export async function _createOrUpdateTestProfileRunDeserialize( return testProfileRunDeserializer(result.body); } -/** Create and start a new test profile run with the given test profile run Id. */ -export async function createOrUpdateTestProfileRun( +/** Stop test profile run for the given test profile run Id. */ +export async function stopTestProfileRun( context: Client, testProfileRunId: string, - body: TestProfileRun, - options: CreateOrUpdateTestProfileRunOptionalParams = { requestOptions: {} }, + options: StopTestProfileRunOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createOrUpdateTestProfileRunSend( + const result = await _stopTestProfileRunSend( context, testProfileRunId, - body, options, ); - return _createOrUpdateTestProfileRunDeserialize(result); + return _stopTestProfileRunDeserialize(result); } -export function _deleteTestProfileRunSend( +export function _listTestProfileRunsSend( context: Client, - testProfileRunId: string, - options: DeleteTestProfileRunOptionalParams = { requestOptions: {} }, + options: ListTestProfileRunsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/test-profile-runs") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { + "api-version": context.apiVersion, + maxpagesize: options?.maxpagesize, + minStartDateTime: !options?.minStartDateTime + ? options?.minStartDateTime + : options?.minStartDateTime.toISOString(), + maxStartDateTime: !options?.maxStartDateTime + ? options?.maxStartDateTime + : options?.maxStartDateTime.toISOString(), + minEndDateTime: !options?.minEndDateTime + ? options?.minEndDateTime + : options?.minEndDateTime.toISOString(), + maxEndDateTime: !options?.maxEndDateTime + ? options?.maxEndDateTime + : options?.maxEndDateTime.toISOString(), + createdDateStartTime: !options?.createdDateStartTime + ? options?.createdDateStartTime + : options?.createdDateStartTime.toISOString(), + createdDateEndTime: !options?.createdDateEndTime + ? options?.createdDateEndTime + : options?.createdDateEndTime.toISOString(), + testProfileRunIds: options?.testProfileRunIds, + testProfileIds: options?.testProfileIds, + statuses: options?.statuses, + }, + }); } -export async function _deleteTestProfileRunDeserialize( +export async function _listTestProfileRunsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise<_PagedTestProfileRun> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _pagedTestProfileRunDeserializer(result.body); } -/** Delete an existing load test profile run by providing the test profile run Id. */ -export async function deleteTestProfileRun( +/** Get all test profile runs for the given filters. */ +export function listTestProfileRuns( context: Client, - testProfileRunId: string, - options: DeleteTestProfileRunOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteTestProfileRunSend( + options: ListTestProfileRunsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - testProfileRunId, - options, + () => _listTestProfileRunsSend(context, options), + _listTestProfileRunsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, ); - return _deleteTestProfileRunDeserialize(result); } export function _getTestProfileRunSend( @@ -112,7 +141,14 @@ export function _getTestProfileRunSend( ): StreamableMethod { return context .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _getTestProfileRunDeserialize( @@ -140,68 +176,72 @@ export async function getTestProfileRun( return _getTestProfileRunDeserialize(result); } -export function _listTestProfileRunsSend( +export function _deleteTestProfileRunSend( context: Client, - options: ListTestProfileRunsOptionalParams = { requestOptions: {} }, + testProfileRunId: string, + options: DeleteTestProfileRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-profile-runs") - .get({ + .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) + .delete({ ...operationOptionsToRequestParameters(options), - queryParameters: { - maxpagesize: options?.maxpagesize, - minStartDateTime: options?.minStartDateTime?.toISOString(), - maxStartDateTime: options?.maxStartDateTime?.toISOString(), - minEndDateTime: options?.minEndDateTime?.toISOString(), - maxEndDateTime: options?.maxEndDateTime?.toISOString(), - createdDateStartTime: options?.createdDateStartTime?.toISOString(), - createdDateEndTime: options?.createdDateEndTime?.toISOString(), - testProfileRunIds: options?.testProfileRunIds, - testProfileIds: options?.testProfileIds, - statuses: options?.statuses, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _listTestProfileRunsDeserialize( +export async function _deleteTestProfileRunDeserialize( result: PathUncheckedResponse, -): Promise<_PagedTestProfileRun> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedTestProfileRunDeserializer(result.body); + return; } -/** Get all test profile runs for the given filters. */ -export function listTestProfileRuns( +/** Delete an existing load test profile run by providing the test profile run Id. */ +export async function deleteTestProfileRun( context: Client, - options: ListTestProfileRunsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( + testProfileRunId: string, + options: DeleteTestProfileRunOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteTestProfileRunSend( context, - () => _listTestProfileRunsSend(context, options), - _listTestProfileRunsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, + testProfileRunId, + options, ); + return _deleteTestProfileRunDeserialize(result); } -export function _stopTestProfileRunSend( +export function _createOrUpdateTestProfileRunSend( context: Client, testProfileRunId: string, - options: StopTestProfileRunOptionalParams = { requestOptions: {} }, + body: TestProfileRun, + options: CreateOrUpdateTestProfileRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test-profile-runs/{testProfileRunId}:stop", testProfileRunId) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: testProfileRunSerializer(body), + }); } -export async function _stopTestProfileRunDeserialize( +export async function _createOrUpdateTestProfileRunDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200"]; + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -209,16 +249,18 @@ export async function _stopTestProfileRunDeserialize( return testProfileRunDeserializer(result.body); } -/** Stop test profile run for the given test profile run Id. */ -export async function stopTestProfileRun( +/** Create and start a new test profile run with the given test profile run Id. */ +export async function createOrUpdateTestProfileRun( context: Client, testProfileRunId: string, - options: StopTestProfileRunOptionalParams = { requestOptions: {} }, + body: TestProfileRun, + options: CreateOrUpdateTestProfileRunOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _stopTestProfileRunSend( + const result = await _createOrUpdateTestProfileRunSend( context, testProfileRunId, + body, options, ); - return _stopTestProfileRunDeserialize(result); + return _createOrUpdateTestProfileRunDeserialize(result); } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/options.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/options.ts index 1a73b36436..b0c48446f5 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/options.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/options.ts @@ -4,17 +4,7 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface CreateOrUpdateTestProfileRunOptionalParams - extends OperationOptions { - /** This request has a JSON Merge Patch body. */ - contentType?: string; -} - -/** Optional parameters. */ -export interface DeleteTestProfileRunOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface GetTestProfileRunOptionalParams extends OperationOptions {} +export interface StopTestProfileRunOptionalParams extends OperationOptions {} /** Optional parameters. */ export interface ListTestProfileRunsOptionalParams extends OperationOptions { @@ -41,4 +31,11 @@ export interface ListTestProfileRunsOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface StopTestProfileRunOptionalParams extends OperationOptions {} +export interface GetTestProfileRunOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DeleteTestProfileRunOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CreateOrUpdateTestProfileRunOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/testProfileRunContext.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/testProfileRunContext.ts index 7cd16e05b8..80942a03d1 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/testProfileRunContext.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/api/testProfileRunContext.ts @@ -6,7 +6,11 @@ import { KnownAPIVersions } from "../../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface TestProfileRunContext extends Client {} +export interface TestProfileRunContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownAPIVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface TestProfileRunClientOptionalParams extends ClientOptions { @@ -55,5 +59,5 @@ export function createTestProfileRun( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as TestProfileRunContext; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/index.ts index 6ec95ed4ae..20c4401e86 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/index.ts @@ -3,11 +3,11 @@ export { TestProfileRunClient } from "./testProfileRunClient.js"; export { - CreateOrUpdateTestProfileRunOptionalParams, - DeleteTestProfileRunOptionalParams, - GetTestProfileRunOptionalParams, - ListTestProfileRunsOptionalParams, StopTestProfileRunOptionalParams, + ListTestProfileRunsOptionalParams, + GetTestProfileRunOptionalParams, + DeleteTestProfileRunOptionalParams, + CreateOrUpdateTestProfileRunOptionalParams, TestProfileRunContext, TestProfileRunClientOptionalParams, } from "./api/index.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/testProfileRunClient.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/testProfileRunClient.ts index 79185f89b6..b9edb097d2 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/testProfileRunClient.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testProfileRun/testProfileRunClient.ts @@ -2,16 +2,16 @@ // Licensed under the MIT License. import { - createOrUpdateTestProfileRun, - deleteTestProfileRun, - getTestProfileRun, - listTestProfileRuns, stopTestProfileRun, - CreateOrUpdateTestProfileRunOptionalParams, - DeleteTestProfileRunOptionalParams, - GetTestProfileRunOptionalParams, - ListTestProfileRunsOptionalParams, + listTestProfileRuns, + getTestProfileRun, + deleteTestProfileRun, + createOrUpdateTestProfileRun, StopTestProfileRunOptionalParams, + ListTestProfileRunsOptionalParams, + GetTestProfileRunOptionalParams, + DeleteTestProfileRunOptionalParams, + CreateOrUpdateTestProfileRunOptionalParams, createTestProfileRun, TestProfileRunContext, TestProfileRunClientOptionalParams, @@ -44,28 +44,19 @@ export class TestProfileRunClient { this.pipeline = this._client.pipeline; } - /** Create and start a new test profile run with the given test profile run Id. */ - createOrUpdateTestProfileRun( + /** Stop test profile run for the given test profile run Id. */ + stopTestProfileRun( testProfileRunId: string, - body: TestProfileRun, - options: CreateOrUpdateTestProfileRunOptionalParams = { - requestOptions: {}, - }, + options: StopTestProfileRunOptionalParams = { requestOptions: {} }, ): Promise { - return createOrUpdateTestProfileRun( - this._client, - testProfileRunId, - body, - options, - ); + return stopTestProfileRun(this._client, testProfileRunId, options); } - /** Delete an existing load test profile run by providing the test profile run Id. */ - deleteTestProfileRun( - testProfileRunId: string, - options: DeleteTestProfileRunOptionalParams = { requestOptions: {} }, - ): Promise { - return deleteTestProfileRun(this._client, testProfileRunId, options); + /** Get all test profile runs for the given filters. */ + listTestProfileRuns( + options: ListTestProfileRunsOptionalParams = { requestOptions: {} }, + ): PagedAsyncIterableIterator { + return listTestProfileRuns(this._client, options); } /** Get test profile run details by test profile run Id. */ @@ -76,18 +67,27 @@ export class TestProfileRunClient { return getTestProfileRun(this._client, testProfileRunId, options); } - /** Get all test profile runs for the given filters. */ - listTestProfileRuns( - options: ListTestProfileRunsOptionalParams = { requestOptions: {} }, - ): PagedAsyncIterableIterator { - return listTestProfileRuns(this._client, options); + /** Delete an existing load test profile run by providing the test profile run Id. */ + deleteTestProfileRun( + testProfileRunId: string, + options: DeleteTestProfileRunOptionalParams = { requestOptions: {} }, + ): Promise { + return deleteTestProfileRun(this._client, testProfileRunId, options); } - /** Stop test profile run for the given test profile run Id. */ - stopTestProfileRun( + /** Create and start a new test profile run with the given test profile run Id. */ + createOrUpdateTestProfileRun( testProfileRunId: string, - options: StopTestProfileRunOptionalParams = { requestOptions: {} }, + body: TestProfileRun, + options: CreateOrUpdateTestProfileRunOptionalParams = { + requestOptions: {}, + }, ): Promise { - return stopTestProfileRun(this._client, testProfileRunId, options); + return createOrUpdateTestProfileRun( + this._client, + testProfileRunId, + body, + options, + ); } } diff --git a/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml b/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml index 72b89a9fd2..5fe68fa528 100644 --- a/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml +++ b/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml @@ -13,7 +13,6 @@ options: isModularLibrary: true hierarchyClient: false experimentalExtensibleEnums: true - ignoreEnumMemberNameNormalize: true packageDetails: name: "@azure/load-testing" description: This package contains Microsoft Azure LoadTestingClient client library. diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/openai/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/openai/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/openai_generic/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_generic/generated/typespec-ts/package.json index 7e28d7c96a..0beb0a835e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/package.json @@ -13,18 +13,18 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/audio/transcriptions": "./src/api/audio/transcriptions/index.ts", - "./api/audio/translations": "./src/api/audio/translations/index.ts", - "./api/chat/completions": "./src/api/chat/completions/index.ts", - "./api/fineTuning/jobs": "./src/api/fineTuning/jobs/index.ts", - "./api/completions": "./src/api/completions/index.ts", - "./api/edits": "./src/api/edits/index.ts", - "./api/embeddings": "./src/api/embeddings/index.ts", - "./api/files": "./src/api/files/index.ts", - "./api/fineTunes": "./src/api/fineTunes/index.ts", - "./api/models": "./src/api/models/index.ts", + "./api/moderations": "./src/api/moderations/index.ts", "./api/images": "./src/api/images/index.ts", - "./api/moderations": "./src/api/moderations/index.ts" + "./api/models": "./src/api/models/index.ts", + "./api/fineTunes": "./src/api/fineTunes/index.ts", + "./api/files": "./src/api/files/index.ts", + "./api/embeddings": "./src/api/embeddings/index.ts", + "./api/edits": "./src/api/edits/index.ts", + "./api/completions": "./src/api/completions/index.ts", + "./api/fineTuning/jobs": "./src/api/fineTuning/jobs/index.ts", + "./api/chat/completions": "./src/api/chat/completions/index.ts", + "./api/audio/translations": "./src/api/audio/translations/index.ts", + "./api/audio/transcriptions": "./src/api/audio/transcriptions/index.ts" }, "dialects": [ "esm", @@ -152,112 +152,94 @@ "default": "./dist/commonjs/api/index.js" } }, - "./api/audio/transcriptions": { - "browser": { - "types": "./dist/browser/api/audio/transcriptions/index.d.ts", - "default": "./dist/browser/api/audio/transcriptions/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/audio/transcriptions/index.d.ts", - "default": "./dist/react-native/api/audio/transcriptions/index.js" - }, - "import": { - "types": "./dist/esm/api/audio/transcriptions/index.d.ts", - "default": "./dist/esm/api/audio/transcriptions/index.js" - }, - "require": { - "types": "./dist/commonjs/api/audio/transcriptions/index.d.ts", - "default": "./dist/commonjs/api/audio/transcriptions/index.js" - } - }, - "./api/audio/translations": { + "./api/moderations": { "browser": { - "types": "./dist/browser/api/audio/translations/index.d.ts", - "default": "./dist/browser/api/audio/translations/index.js" + "types": "./dist/browser/api/moderations/index.d.ts", + "default": "./dist/browser/api/moderations/index.js" }, "react-native": { - "types": "./dist/react-native/api/audio/translations/index.d.ts", - "default": "./dist/react-native/api/audio/translations/index.js" + "types": "./dist/react-native/api/moderations/index.d.ts", + "default": "./dist/react-native/api/moderations/index.js" }, "import": { - "types": "./dist/esm/api/audio/translations/index.d.ts", - "default": "./dist/esm/api/audio/translations/index.js" + "types": "./dist/esm/api/moderations/index.d.ts", + "default": "./dist/esm/api/moderations/index.js" }, "require": { - "types": "./dist/commonjs/api/audio/translations/index.d.ts", - "default": "./dist/commonjs/api/audio/translations/index.js" + "types": "./dist/commonjs/api/moderations/index.d.ts", + "default": "./dist/commonjs/api/moderations/index.js" } }, - "./api/chat/completions": { + "./api/images": { "browser": { - "types": "./dist/browser/api/chat/completions/index.d.ts", - "default": "./dist/browser/api/chat/completions/index.js" + "types": "./dist/browser/api/images/index.d.ts", + "default": "./dist/browser/api/images/index.js" }, "react-native": { - "types": "./dist/react-native/api/chat/completions/index.d.ts", - "default": "./dist/react-native/api/chat/completions/index.js" + "types": "./dist/react-native/api/images/index.d.ts", + "default": "./dist/react-native/api/images/index.js" }, "import": { - "types": "./dist/esm/api/chat/completions/index.d.ts", - "default": "./dist/esm/api/chat/completions/index.js" + "types": "./dist/esm/api/images/index.d.ts", + "default": "./dist/esm/api/images/index.js" }, "require": { - "types": "./dist/commonjs/api/chat/completions/index.d.ts", - "default": "./dist/commonjs/api/chat/completions/index.js" + "types": "./dist/commonjs/api/images/index.d.ts", + "default": "./dist/commonjs/api/images/index.js" } }, - "./api/fineTuning/jobs": { + "./api/models": { "browser": { - "types": "./dist/browser/api/fineTuning/jobs/index.d.ts", - "default": "./dist/browser/api/fineTuning/jobs/index.js" + "types": "./dist/browser/api/models/index.d.ts", + "default": "./dist/browser/api/models/index.js" }, "react-native": { - "types": "./dist/react-native/api/fineTuning/jobs/index.d.ts", - "default": "./dist/react-native/api/fineTuning/jobs/index.js" + "types": "./dist/react-native/api/models/index.d.ts", + "default": "./dist/react-native/api/models/index.js" }, "import": { - "types": "./dist/esm/api/fineTuning/jobs/index.d.ts", - "default": "./dist/esm/api/fineTuning/jobs/index.js" + "types": "./dist/esm/api/models/index.d.ts", + "default": "./dist/esm/api/models/index.js" }, "require": { - "types": "./dist/commonjs/api/fineTuning/jobs/index.d.ts", - "default": "./dist/commonjs/api/fineTuning/jobs/index.js" + "types": "./dist/commonjs/api/models/index.d.ts", + "default": "./dist/commonjs/api/models/index.js" } }, - "./api/completions": { + "./api/fineTunes": { "browser": { - "types": "./dist/browser/api/completions/index.d.ts", - "default": "./dist/browser/api/completions/index.js" + "types": "./dist/browser/api/fineTunes/index.d.ts", + "default": "./dist/browser/api/fineTunes/index.js" }, "react-native": { - "types": "./dist/react-native/api/completions/index.d.ts", - "default": "./dist/react-native/api/completions/index.js" + "types": "./dist/react-native/api/fineTunes/index.d.ts", + "default": "./dist/react-native/api/fineTunes/index.js" }, "import": { - "types": "./dist/esm/api/completions/index.d.ts", - "default": "./dist/esm/api/completions/index.js" + "types": "./dist/esm/api/fineTunes/index.d.ts", + "default": "./dist/esm/api/fineTunes/index.js" }, "require": { - "types": "./dist/commonjs/api/completions/index.d.ts", - "default": "./dist/commonjs/api/completions/index.js" + "types": "./dist/commonjs/api/fineTunes/index.d.ts", + "default": "./dist/commonjs/api/fineTunes/index.js" } }, - "./api/edits": { + "./api/files": { "browser": { - "types": "./dist/browser/api/edits/index.d.ts", - "default": "./dist/browser/api/edits/index.js" + "types": "./dist/browser/api/files/index.d.ts", + "default": "./dist/browser/api/files/index.js" }, "react-native": { - "types": "./dist/react-native/api/edits/index.d.ts", - "default": "./dist/react-native/api/edits/index.js" + "types": "./dist/react-native/api/files/index.d.ts", + "default": "./dist/react-native/api/files/index.js" }, "import": { - "types": "./dist/esm/api/edits/index.d.ts", - "default": "./dist/esm/api/edits/index.js" + "types": "./dist/esm/api/files/index.d.ts", + "default": "./dist/esm/api/files/index.js" }, "require": { - "types": "./dist/commonjs/api/edits/index.d.ts", - "default": "./dist/commonjs/api/edits/index.js" + "types": "./dist/commonjs/api/files/index.d.ts", + "default": "./dist/commonjs/api/files/index.js" } }, "./api/embeddings": { @@ -278,94 +260,112 @@ "default": "./dist/commonjs/api/embeddings/index.js" } }, - "./api/files": { + "./api/edits": { "browser": { - "types": "./dist/browser/api/files/index.d.ts", - "default": "./dist/browser/api/files/index.js" + "types": "./dist/browser/api/edits/index.d.ts", + "default": "./dist/browser/api/edits/index.js" }, "react-native": { - "types": "./dist/react-native/api/files/index.d.ts", - "default": "./dist/react-native/api/files/index.js" + "types": "./dist/react-native/api/edits/index.d.ts", + "default": "./dist/react-native/api/edits/index.js" }, "import": { - "types": "./dist/esm/api/files/index.d.ts", - "default": "./dist/esm/api/files/index.js" + "types": "./dist/esm/api/edits/index.d.ts", + "default": "./dist/esm/api/edits/index.js" }, "require": { - "types": "./dist/commonjs/api/files/index.d.ts", - "default": "./dist/commonjs/api/files/index.js" + "types": "./dist/commonjs/api/edits/index.d.ts", + "default": "./dist/commonjs/api/edits/index.js" } }, - "./api/fineTunes": { + "./api/completions": { "browser": { - "types": "./dist/browser/api/fineTunes/index.d.ts", - "default": "./dist/browser/api/fineTunes/index.js" + "types": "./dist/browser/api/completions/index.d.ts", + "default": "./dist/browser/api/completions/index.js" }, "react-native": { - "types": "./dist/react-native/api/fineTunes/index.d.ts", - "default": "./dist/react-native/api/fineTunes/index.js" + "types": "./dist/react-native/api/completions/index.d.ts", + "default": "./dist/react-native/api/completions/index.js" }, "import": { - "types": "./dist/esm/api/fineTunes/index.d.ts", - "default": "./dist/esm/api/fineTunes/index.js" + "types": "./dist/esm/api/completions/index.d.ts", + "default": "./dist/esm/api/completions/index.js" }, "require": { - "types": "./dist/commonjs/api/fineTunes/index.d.ts", - "default": "./dist/commonjs/api/fineTunes/index.js" + "types": "./dist/commonjs/api/completions/index.d.ts", + "default": "./dist/commonjs/api/completions/index.js" } }, - "./api/models": { + "./api/fineTuning/jobs": { "browser": { - "types": "./dist/browser/api/models/index.d.ts", - "default": "./dist/browser/api/models/index.js" + "types": "./dist/browser/api/fineTuning/jobs/index.d.ts", + "default": "./dist/browser/api/fineTuning/jobs/index.js" }, "react-native": { - "types": "./dist/react-native/api/models/index.d.ts", - "default": "./dist/react-native/api/models/index.js" + "types": "./dist/react-native/api/fineTuning/jobs/index.d.ts", + "default": "./dist/react-native/api/fineTuning/jobs/index.js" }, "import": { - "types": "./dist/esm/api/models/index.d.ts", - "default": "./dist/esm/api/models/index.js" + "types": "./dist/esm/api/fineTuning/jobs/index.d.ts", + "default": "./dist/esm/api/fineTuning/jobs/index.js" }, "require": { - "types": "./dist/commonjs/api/models/index.d.ts", - "default": "./dist/commonjs/api/models/index.js" + "types": "./dist/commonjs/api/fineTuning/jobs/index.d.ts", + "default": "./dist/commonjs/api/fineTuning/jobs/index.js" } }, - "./api/images": { + "./api/chat/completions": { "browser": { - "types": "./dist/browser/api/images/index.d.ts", - "default": "./dist/browser/api/images/index.js" + "types": "./dist/browser/api/chat/completions/index.d.ts", + "default": "./dist/browser/api/chat/completions/index.js" }, "react-native": { - "types": "./dist/react-native/api/images/index.d.ts", - "default": "./dist/react-native/api/images/index.js" + "types": "./dist/react-native/api/chat/completions/index.d.ts", + "default": "./dist/react-native/api/chat/completions/index.js" }, "import": { - "types": "./dist/esm/api/images/index.d.ts", - "default": "./dist/esm/api/images/index.js" + "types": "./dist/esm/api/chat/completions/index.d.ts", + "default": "./dist/esm/api/chat/completions/index.js" }, "require": { - "types": "./dist/commonjs/api/images/index.d.ts", - "default": "./dist/commonjs/api/images/index.js" + "types": "./dist/commonjs/api/chat/completions/index.d.ts", + "default": "./dist/commonjs/api/chat/completions/index.js" } }, - "./api/moderations": { + "./api/audio/translations": { "browser": { - "types": "./dist/browser/api/moderations/index.d.ts", - "default": "./dist/browser/api/moderations/index.js" + "types": "./dist/browser/api/audio/translations/index.d.ts", + "default": "./dist/browser/api/audio/translations/index.js" }, "react-native": { - "types": "./dist/react-native/api/moderations/index.d.ts", - "default": "./dist/react-native/api/moderations/index.js" + "types": "./dist/react-native/api/audio/translations/index.d.ts", + "default": "./dist/react-native/api/audio/translations/index.js" }, "import": { - "types": "./dist/esm/api/moderations/index.d.ts", - "default": "./dist/esm/api/moderations/index.js" + "types": "./dist/esm/api/audio/translations/index.d.ts", + "default": "./dist/esm/api/audio/translations/index.js" }, "require": { - "types": "./dist/commonjs/api/moderations/index.d.ts", - "default": "./dist/commonjs/api/moderations/index.js" + "types": "./dist/commonjs/api/audio/translations/index.d.ts", + "default": "./dist/commonjs/api/audio/translations/index.js" + } + }, + "./api/audio/transcriptions": { + "browser": { + "types": "./dist/browser/api/audio/transcriptions/index.d.ts", + "default": "./dist/browser/api/audio/transcriptions/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/audio/transcriptions/index.d.ts", + "default": "./dist/react-native/api/audio/transcriptions/index.js" + }, + "import": { + "types": "./dist/esm/api/audio/transcriptions/index.d.ts", + "default": "./dist/esm/api/audio/transcriptions/index.js" + }, + "require": { + "types": "./dist/commonjs/api/audio/transcriptions/index.d.ts", + "default": "./dist/commonjs/api/audio/transcriptions/index.js" } } }, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md index fc3cda6dc5..767b0f1ff3 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md @@ -19,8 +19,6 @@ export interface AudioOperations { // @public export interface AudioTranscriptionsCreateOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -31,8 +29,6 @@ export interface AudioTranscriptionsOperations { // @public export interface AudioTranslationsCreateOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -413,8 +409,6 @@ export interface EmbeddingsOperations { // @public export interface FilesCreateOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -607,8 +601,6 @@ export interface Image { // @public export interface ImagesCreateEditOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -617,8 +609,6 @@ export interface ImagesCreateOptionalParams extends OperationOptions { // @public export interface ImagesCreateVariationOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts index 26ffb3b318..4389237d2d 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts @@ -27,7 +27,11 @@ export function _createSend( .path("/audio/transcriptions") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createTranscriptionRequestSerializer(audio), }); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts index 876f9d3989..6505ddb7db 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts @@ -27,7 +27,11 @@ export function _createSend( .path("/audio/translations") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createTranslationRequestSerializer(audio), }); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts index 780f78bc69..2467b4d106 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts @@ -27,6 +27,11 @@ export function _createSend( .path("/chat/completions") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createChatCompletionRequestSerializer(body), }); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts index c30a9b41b5..5bbaa6597a 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts @@ -27,6 +27,11 @@ export function _createSend( .path("/completions") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createCompletionRequestSerializer(body), }); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts index 5d2b38bb1e..ced0da9379 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts @@ -27,6 +27,11 @@ export function _createSend( .path("/edits") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createEditRequestSerializer(edit), }); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts index ba2da39b80..9b00a2cf98 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts @@ -27,6 +27,11 @@ export function _createSend( .path("/embeddings") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createEmbeddingRequestSerializer(embedding), }); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts index 899412257a..6edf072989 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts @@ -26,66 +26,81 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _listSend( +export function _downloadSend( context: Client, - options: FilesListOptionalParams = { requestOptions: {} }, + fileId: string, + options: FilesDownloadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files") - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/files/files/{file_id}/content", fileId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _listDeserialize( +export async function _downloadDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFilesResponseDeserializer(result.body); + return result.body; } -export async function list( +export async function download( context: Client, - options: FilesListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + fileId: string, + options: FilesDownloadOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _downloadSend(context, fileId, options); + return _downloadDeserialize(result); } -export function _createSend( +export function _$deleteSend( context: Client, - file: CreateFileRequest, - options: FilesCreateOptionalParams = { requestOptions: {} }, + fileId: string, + options: FilesDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files") - .post({ + .path("/files/files/{file_id}", fileId) + .delete({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: createFileRequestSerializer(file), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _createDeserialize( +export async function _$deleteDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return deleteFileResponseDeserializer(result.body); } -export async function create( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, - file: CreateFileRequest, - options: FilesCreateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createSend(context, file, options); - return _createDeserialize(result); + fileId: string, + options: FilesDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, fileId, options); + return _$deleteDeserialize(result); } export function _retrieveSend( @@ -95,7 +110,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/files/files/{file_id}", fileId) - .post({ ...operationOptionsToRequestParameters(options) }); + .post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -118,67 +139,74 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _$deleteSend( +export function _createSend( context: Client, - fileId: string, - options: FilesDeleteOptionalParams = { requestOptions: {} }, + file: CreateFileRequest, + options: FilesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files/files/{file_id}", fileId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/files") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createFileRequestSerializer(file), + }); } -export async function _$deleteDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return deleteFileResponseDeserializer(result.body); + return openAIFileDeserializer(result.body); } -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export async function $delete( +export async function create( context: Client, - fileId: string, - options: FilesDeleteOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _$deleteSend(context, fileId, options); - return _$deleteDeserialize(result); + file: CreateFileRequest, + options: FilesCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend(context, file, options); + return _createDeserialize(result); } -export function _downloadSend( +export function _listSend( context: Client, - fileId: string, - options: FilesDownloadOptionalParams = { requestOptions: {} }, + options: FilesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files/files/{file_id}/content", fileId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/files") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _downloadDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return result.body; + return listFilesResponseDeserializer(result.body); } -export async function download( +export async function list( context: Client, - fileId: string, - options: FilesDownloadOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _downloadSend(context, fileId, options); - return _downloadDeserialize(result); + options: FilesListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts index aa5de3fc20..6764d79401 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts @@ -26,20 +26,23 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createSend( +export function _cancelSend( context: Client, - fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptionalParams = { requestOptions: {} }, + fineTuneId: string, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes") + .path("/fine-tunes/{fine_tune_id}/cancel", fineTuneId) .post({ ...operationOptionsToRequestParameters(options), - body: createFineTuneRequestSerializer(fineTune), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _createDeserialize( +export async function _cancelDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -50,41 +53,50 @@ export async function _createDeserialize( return fineTuneDeserializer(result.body); } -export async function create( +export async function cancel( context: Client, - fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptionalParams = { requestOptions: {} }, + fineTuneId: string, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createSend(context, fineTune, options); - return _createDeserialize(result); + const result = await _cancelSend(context, fineTuneId, options); + return _cancelDeserialize(result); } -export function _listSend( +export function _listEventsSend( context: Client, - options: FineTunesListOptionalParams = { requestOptions: {} }, + fineTuneId: string, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes") - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/fine-tunes/{fine_tune_id}/events", fineTuneId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { stream: options?.stream }, + }); } -export async function _listDeserialize( +export async function _listEventsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFineTunesResponseDeserializer(result.body); + return listFineTuneEventsResponseDeserializer(result.body); } -export async function list( +export async function listEvents( context: Client, - options: FineTunesListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + fineTuneId: string, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listEventsSend(context, fineTuneId, options); + return _listEventsDeserialize(result); } export function _retrieveSend( @@ -94,7 +106,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/fine-tunes/{fine_tune_id}", fineTuneId) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -117,50 +135,59 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _listEventsSend( +export function _listSend( context: Client, - fineTuneId: string, - options: FineTunesListEventsOptionalParams = { requestOptions: {} }, + options: FineTunesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes/{fine_tune_id}/events", fineTuneId) + .path("/fine-tunes") .get({ ...operationOptionsToRequestParameters(options), - queryParameters: { stream: options?.stream }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _listEventsDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFineTuneEventsResponseDeserializer(result.body); + return listFineTunesResponseDeserializer(result.body); } -export async function listEvents( +export async function list( context: Client, - fineTuneId: string, - options: FineTunesListEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listEventsSend(context, fineTuneId, options); - return _listEventsDeserialize(result); + options: FineTunesListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } -export function _cancelSend( +export function _createSend( context: Client, - fineTuneId: string, - options: FineTunesCancelOptionalParams = { requestOptions: {} }, + fineTune: CreateFineTuneRequest, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes/{fine_tune_id}/cancel", fineTuneId) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/fine-tunes") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createFineTuneRequestSerializer(fineTune), + }); } -export async function _cancelDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -171,11 +198,11 @@ export async function _cancelDeserialize( return fineTuneDeserializer(result.body); } -export async function cancel( +export async function create( context: Client, - fineTuneId: string, - options: FineTunesCancelOptionalParams = { requestOptions: {} }, + fineTune: CreateFineTuneRequest, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _cancelSend(context, fineTuneId, options); - return _cancelDeserialize(result); + const result = await _createSend(context, fineTune, options); + return _createDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts index 07d9c5e064..f38bf271ac 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts @@ -26,20 +26,23 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createSend( +export function _cancelSend( context: Client, - job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, + fineTuningJobId: string, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs") + .path("/fine_tuning/jobs/{fine_tuning_job_id}/cancel", fineTuningJobId) .post({ ...operationOptionsToRequestParameters(options), - body: createFineTuningJobRequestSerializer(job), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _createDeserialize( +export async function _cancelDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -50,52 +53,50 @@ export async function _createDeserialize( return fineTuningJobDeserializer(result.body); } -/** - * Creates a job that fine-tunes a specified model from a given dataset. - * - * Response includes details of the enqueued job including job status and the name of the - * fine-tuned models once complete. - * - * [Learn more about fine-tuning](/docs/guides/fine-tuning) - */ -export async function create( +export async function cancel( context: Client, - job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, + fineTuningJobId: string, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createSend(context, job, options); - return _createDeserialize(result); + const result = await _cancelSend(context, fineTuningJobId, options); + return _cancelDeserialize(result); } -export function _listSend( +export function _listEventsSend( context: Client, - options: FineTuningJobsListOptionalParams = { requestOptions: {} }, + fineTuningJobId: string, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs") + .path("/fine_tuning/jobs/{fine_tuning_job_id}/events", fineTuningJobId) .get({ ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { after: options?.after, limit: options?.limit }, }); } -export async function _listDeserialize( +export async function _listEventsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listPaginatedFineTuningJobsResponseDeserializer(result.body); + return listFineTuningJobEventsResponseDeserializer(result.body); } -export async function list( +export async function listEvents( context: Client, - options: FineTuningJobsListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + fineTuningJobId: string, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listEventsSend(context, fineTuningJobId, options); + return _listEventsDeserialize(result); } export function _retrieveSend( @@ -105,7 +106,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/fine_tuning/jobs/{fine_tuning_job_id}", fineTuningJobId) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -128,50 +135,60 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _listEventsSend( +export function _listSend( context: Client, - fineTuningJobId: string, - options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs/{fine_tuning_job_id}/events", fineTuningJobId) + .path("/fine_tuning/jobs") .get({ ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { after: options?.after, limit: options?.limit }, }); } -export async function _listEventsDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFineTuningJobEventsResponseDeserializer(result.body); + return listPaginatedFineTuningJobsResponseDeserializer(result.body); } -export async function listEvents( +export async function list( context: Client, - fineTuningJobId: string, - options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listEventsSend(context, fineTuningJobId, options); - return _listEventsDeserialize(result); + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } -export function _cancelSend( +export function _createSend( context: Client, - fineTuningJobId: string, - options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, + job: CreateFineTuningJobRequest, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs/{fine_tuning_job_id}/cancel", fineTuningJobId) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/fine_tuning/jobs") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createFineTuningJobRequestSerializer(job), + }); } -export async function _cancelDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -182,11 +199,19 @@ export async function _cancelDeserialize( return fineTuningJobDeserializer(result.body); } -export async function cancel( +/** + * Creates a job that fine-tunes a specified model from a given dataset. + * + * Response includes details of the enqueued job including job status and the name of the + * fine-tuned models once complete. + * + * [Learn more about fine-tuning](/docs/guides/fine-tuning) + */ +export async function create( context: Client, - fineTuningJobId: string, - options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, + job: CreateFineTuningJobRequest, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _cancelSend(context, fineTuningJobId, options); - return _cancelDeserialize(result); + const result = await _createSend(context, job, options); + return _createDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts index edb0ad1832..8a3d1e8f9e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts @@ -24,20 +24,25 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _createSend( +export function _createVariationSend( context: Client, - image: CreateImageRequest, - options: ImagesCreateOptionalParams = { requestOptions: {} }, + image: CreateImageVariationRequest, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/images/generations") + .path("/images/variations") .post({ ...operationOptionsToRequestParameters(options), - body: createImageRequestSerializer(image), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createImageVariationRequestSerializer(image), }); } -export async function _createDeserialize( +export async function _createVariationDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -48,13 +53,13 @@ export async function _createDeserialize( return imagesResponseDeserializer(result.body); } -export async function create( +export async function createVariation( context: Client, - image: CreateImageRequest, - options: ImagesCreateOptionalParams = { requestOptions: {} }, + image: CreateImageVariationRequest, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createSend(context, image, options); - return _createDeserialize(result); + const result = await _createVariationSend(context, image, options); + return _createVariationDeserialize(result); } export function _createEditSend( @@ -66,7 +71,11 @@ export function _createEditSend( .path("/images/edits") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createImageEditRequestSerializer(image), }); } @@ -91,21 +100,25 @@ export async function createEdit( return _createEditDeserialize(result); } -export function _createVariationSend( +export function _createSend( context: Client, - image: CreateImageVariationRequest, - options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, + image: CreateImageRequest, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/images/variations") + .path("/images/generations") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: createImageVariationRequestSerializer(image), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createImageRequestSerializer(image), }); } -export async function _createVariationDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -116,11 +129,11 @@ export async function _createVariationDeserialize( return imagesResponseDeserializer(result.body); } -export async function createVariation( +export async function create( context: Client, - image: CreateImageVariationRequest, - options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, + image: CreateImageRequest, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createVariationSend(context, image, options); - return _createVariationDeserialize(result); + const result = await _createSend(context, image, options); + return _createDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts index 2f0d3bb507..454d813f96 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts @@ -7,32 +7,32 @@ export { OpenAIClientOptionalParams, } from "./openAIContext.js"; export { - AudioTranscriptionsCreateOptionalParams, - AudioTranslationsCreateOptionalParams, - ChatCompletionsCreateOptionalParams, - FineTuningJobsCreateOptionalParams, - FineTuningJobsListOptionalParams, - FineTuningJobsRetrieveOptionalParams, - FineTuningJobsListEventsOptionalParams, - FineTuningJobsCancelOptionalParams, - CompletionsCreateOptionalParams, - EditsCreateOptionalParams, - EmbeddingsCreateOptionalParams, - FilesListOptionalParams, - FilesCreateOptionalParams, - FilesRetrieveOptionalParams, - FilesDeleteOptionalParams, - FilesDownloadOptionalParams, - FineTunesCreateOptionalParams, - FineTunesListOptionalParams, - FineTunesRetrieveOptionalParams, - FineTunesListEventsOptionalParams, - FineTunesCancelOptionalParams, - ModelsListOptionalParams, - ModelsRetrieveOptionalParams, - ModelsDeleteOptionalParams, - ImagesCreateOptionalParams, - ImagesCreateEditOptionalParams, - ImagesCreateVariationOptionalParams, ModerationsCreateOptionalParams, + ImagesCreateVariationOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateOptionalParams, + ModelsDeleteOptionalParams, + ModelsRetrieveOptionalParams, + ModelsListOptionalParams, + FineTunesCancelOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListOptionalParams, + FineTunesCreateOptionalParams, + FilesDownloadOptionalParams, + FilesDeleteOptionalParams, + FilesRetrieveOptionalParams, + FilesCreateOptionalParams, + FilesListOptionalParams, + EmbeddingsCreateOptionalParams, + EditsCreateOptionalParams, + CompletionsCreateOptionalParams, + FineTuningJobsCancelOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + AudioTranscriptionsCreateOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts index 1192f91414..bd67b66367 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts @@ -22,32 +22,45 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _listSend( +export function _$deleteSend( context: Client, - options: ModelsListOptionalParams = { requestOptions: {} }, + model: string, + options: ModelsDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/models") - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/models/{model}", model) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _listDeserialize( +export async function _$deleteDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listModelsResponseDeserializer(result.body); + return deleteModelResponseDeserializer(result.body); } -export async function list( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, - options: ModelsListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + model: string, + options: ModelsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, model, options); + return _$deleteDeserialize(result); } export function _retrieveSend( @@ -57,7 +70,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/models/{model}", model) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -80,37 +99,36 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _$deleteSend( +export function _listSend( context: Client, - model: string, - options: ModelsDeleteOptionalParams = { requestOptions: {} }, + options: ModelsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/models/{model}", model) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/models") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _$deleteDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return deleteModelResponseDeserializer(result.body); + return listModelsResponseDeserializer(result.body); } -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export async function $delete( +export async function list( context: Client, - model: string, - options: ModelsDeleteOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _$deleteSend(context, model, options); - return _$deleteDeserialize(result); + options: ModelsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts index b8bbbdc014..0efa0c54ce 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts @@ -27,6 +27,11 @@ export function _createSend( .path("/moderations") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createModerationRequestSerializer(content), }); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts index ed669d35e4..7039d46e8e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts @@ -17,7 +17,7 @@ export function createOpenAI( options: OpenAIClientOptionalParams = {}, ): OpenAIContext { const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; + options.endpoint ?? options.baseUrl ?? "https://api.openai.com/v1"; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-openai-generic/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/options.ts index e5b8e43472..338edd5c86 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/options.ts @@ -4,120 +4,110 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface AudioTranscriptionsCreateOptionalParams - extends OperationOptions { - contentType?: string; -} +export interface ModerationsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AudioTranslationsCreateOptionalParams - extends OperationOptions { - contentType?: string; -} +export interface ImagesCreateVariationOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ChatCompletionsCreateOptionalParams extends OperationOptions {} +export interface ImagesCreateEditOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsCreateOptionalParams extends OperationOptions {} +export interface ImagesCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsListOptionalParams extends OperationOptions { - /** Identifier for the last job from the previous pagination request. */ - after?: string; - /** Number of fine-tuning jobs to retrieve. */ - limit?: number; -} +export interface ModelsDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsRetrieveOptionalParams - extends OperationOptions {} +export interface ModelsRetrieveOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsListEventsOptionalParams - extends OperationOptions { - /** Identifier for the last event from the previous pagination request. */ - after?: string; - /** Number of events to retrieve. */ - limit?: number; -} +export interface ModelsListOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsCancelOptionalParams extends OperationOptions {} +export interface FineTunesCancelOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface CompletionsCreateOptionalParams extends OperationOptions {} +export interface FineTunesListEventsOptionalParams extends OperationOptions { + /** + * Whether to stream events for the fine-tune job. If set to true, events will be sent as + * data-only + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + * as they become available. The stream will terminate with a `data: [DONE]` message when the + * job is finished (succeeded, cancelled, or failed). + * + * If set to false, only events generated so far will be returned. + */ + stream?: boolean; +} /** Optional parameters. */ -export interface EditsCreateOptionalParams extends OperationOptions {} +export interface FineTunesRetrieveOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EmbeddingsCreateOptionalParams extends OperationOptions {} +export interface FineTunesListOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesListOptionalParams extends OperationOptions {} +export interface FineTunesCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesCreateOptionalParams extends OperationOptions { - contentType?: string; -} +export interface FilesDownloadOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesRetrieveOptionalParams extends OperationOptions {} +export interface FilesDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesDeleteOptionalParams extends OperationOptions {} +export interface FilesRetrieveOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesDownloadOptionalParams extends OperationOptions {} +export interface FilesCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesCreateOptionalParams extends OperationOptions {} +export interface FilesListOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesListOptionalParams extends OperationOptions {} +export interface EmbeddingsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesRetrieveOptionalParams extends OperationOptions {} +export interface EditsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesListEventsOptionalParams extends OperationOptions { - /** - * Whether to stream events for the fine-tune job. If set to true, events will be sent as - * data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available. The stream will terminate with a `data: [DONE]` message when the - * job is finished (succeeded, cancelled, or failed). - * - * If set to false, only events generated so far will be returned. - */ - stream?: boolean; -} +export interface CompletionsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesCancelOptionalParams extends OperationOptions {} +export interface FineTuningJobsCancelOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ModelsListOptionalParams extends OperationOptions {} +export interface FineTuningJobsListEventsOptionalParams + extends OperationOptions { + /** Identifier for the last event from the previous pagination request. */ + after?: string; + /** Number of events to retrieve. */ + limit?: number; +} /** Optional parameters. */ -export interface ModelsRetrieveOptionalParams extends OperationOptions {} +export interface FineTuningJobsRetrieveOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ModelsDeleteOptionalParams extends OperationOptions {} +export interface FineTuningJobsListOptionalParams extends OperationOptions { + /** Identifier for the last job from the previous pagination request. */ + after?: string; + /** Number of fine-tuning jobs to retrieve. */ + limit?: number; +} /** Optional parameters. */ -export interface ImagesCreateOptionalParams extends OperationOptions {} +export interface FineTuningJobsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ImagesCreateEditOptionalParams extends OperationOptions { - contentType?: string; -} +export interface ChatCompletionsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ImagesCreateVariationOptionalParams extends OperationOptions { - contentType?: string; -} +export interface AudioTranslationsCreateOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ModerationsCreateOptionalParams extends OperationOptions {} +export interface AudioTranscriptionsCreateOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts index a86bb79fc7..d11286f91e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts @@ -13,13 +13,13 @@ import { /** Interface representing a Audio operations. */ export interface AudioOperations { - transcriptions: AudioTranscriptionsOperations; translations: AudioTranslationsOperations; + transcriptions: AudioTranscriptionsOperations; } export function getAudioOperations(context: OpenAIContext): AudioOperations { return { - transcriptions: getAudioTranscriptionsOperations(context), translations: getAudioTranslationsOperations(context), + transcriptions: getAudioTranscriptionsOperations(context), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts index 3cb48b2f67..1f3f8e2890 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts @@ -3,11 +3,11 @@ import { OpenAIContext } from "../../api/openAIContext.js"; import { - list, - create, - retrieve, - $delete, download, + $delete, + retrieve, + create, + list, } from "../../api/files/index.js"; import { OpenAIFile, @@ -16,24 +16,19 @@ import { DeleteFileResponse, } from "../../models/models.js"; import { - FilesListOptionalParams, - FilesCreateOptionalParams, - FilesRetrieveOptionalParams, - FilesDeleteOptionalParams, FilesDownloadOptionalParams, + FilesDeleteOptionalParams, + FilesRetrieveOptionalParams, + FilesCreateOptionalParams, + FilesListOptionalParams, } from "../../api/options.js"; /** Interface representing a Files operations. */ export interface FilesOperations { - list: (options?: FilesListOptionalParams) => Promise; - create: ( - file: CreateFileRequest, - options?: FilesCreateOptionalParams, - ) => Promise; - retrieve: ( + download: ( fileId: string, - options?: FilesRetrieveOptionalParams, - ) => Promise; + options?: FilesDownloadOptionalParams, + ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") @@ -43,23 +38,28 @@ export interface FilesOperations { fileId: string, options?: FilesDeleteOptionalParams, ) => Promise; - download: ( + retrieve: ( fileId: string, - options?: FilesDownloadOptionalParams, - ) => Promise; + options?: FilesRetrieveOptionalParams, + ) => Promise; + create: ( + file: CreateFileRequest, + options?: FilesCreateOptionalParams, + ) => Promise; + list: (options?: FilesListOptionalParams) => Promise; } export function getFiles(context: OpenAIContext) { return { - list: (options?: FilesListOptionalParams) => list(context, options), - create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => - create(context, file, options), - retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => - retrieve(context, fileId, options), - delete: (fileId: string, options?: FilesDeleteOptionalParams) => - $delete(context, fileId, options), download: (fileId: string, options?: FilesDownloadOptionalParams) => download(context, fileId, options), + delete: (fileId: string, options?: FilesDeleteOptionalParams) => + $delete(context, fileId, options), + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => + retrieve(context, fileId, options), + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => + create(context, file, options), + list: (options?: FilesListOptionalParams) => list(context, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts index c30d9578f6..37f6dd176f 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -3,11 +3,11 @@ import { OpenAIContext } from "../../api/openAIContext.js"; import { - create, - list, - retrieve, - listEvents, cancel, + listEvents, + retrieve, + list, + create, } from "../../api/fineTunes/index.js"; import { CreateFineTuneRequest, @@ -16,51 +16,51 @@ import { ListFineTuneEventsResponse, } from "../../models/models.js"; import { - FineTunesCreateOptionalParams, - FineTunesListOptionalParams, - FineTunesRetrieveOptionalParams, - FineTunesListEventsOptionalParams, FineTunesCancelOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListOptionalParams, + FineTunesCreateOptionalParams, } from "../../api/options.js"; /** Interface representing a FineTunes operations. */ export interface FineTunesOperations { - create: ( - fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptionalParams, - ) => Promise; - list: ( - options?: FineTunesListOptionalParams, - ) => Promise; - retrieve: ( + cancel: ( fineTuneId: string, - options?: FineTunesRetrieveOptionalParams, + options?: FineTunesCancelOptionalParams, ) => Promise; listEvents: ( fineTuneId: string, options?: FineTunesListEventsOptionalParams, ) => Promise; - cancel: ( + retrieve: ( fineTuneId: string, - options?: FineTunesCancelOptionalParams, + options?: FineTunesRetrieveOptionalParams, + ) => Promise; + list: ( + options?: FineTunesListOptionalParams, + ) => Promise; + create: ( + fineTune: CreateFineTuneRequest, + options?: FineTunesCreateOptionalParams, ) => Promise; } export function getFineTunes(context: OpenAIContext) { return { - create: ( - fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptionalParams, - ) => create(context, fineTune, options), - list: (options?: FineTunesListOptionalParams) => list(context, options), - retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => - retrieve(context, fineTuneId, options), + cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => + cancel(context, fineTuneId, options), listEvents: ( fineTuneId: string, options?: FineTunesListEventsOptionalParams, ) => listEvents(context, fineTuneId, options), - cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => - cancel(context, fineTuneId, options), + retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => + retrieve(context, fineTuneId, options), + list: (options?: FineTunesListOptionalParams) => list(context, options), + create: ( + fineTune: CreateFineTuneRequest, + options?: FineTunesCreateOptionalParams, + ) => create(context, fineTune, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index 9013f8af67..deb200203e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -3,11 +3,11 @@ import { OpenAIContext } from "../../../api/openAIContext.js"; import { - create, - list, - retrieve, - listEvents, cancel, + listEvents, + retrieve, + list, + create, } from "../../../api/fineTuning/jobs/index.js"; import { CreateFineTuningJobRequest, @@ -16,15 +16,30 @@ import { ListFineTuningJobEventsResponse, } from "../../../models/models.js"; import { - FineTuningJobsCreateOptionalParams, - FineTuningJobsListOptionalParams, - FineTuningJobsRetrieveOptionalParams, - FineTuningJobsListEventsOptionalParams, FineTuningJobsCancelOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsCreateOptionalParams, } from "../../../api/options.js"; /** Interface representing a FineTuningJobs operations. */ export interface FineTuningJobsOperations { + cancel: ( + fineTuningJobId: string, + options?: FineTuningJobsCancelOptionalParams, + ) => Promise; + listEvents: ( + fineTuningJobId: string, + options?: FineTuningJobsListEventsOptionalParams, + ) => Promise; + retrieve: ( + fineTuningJobId: string, + options?: FineTuningJobsRetrieveOptionalParams, + ) => Promise; + list: ( + options?: FineTuningJobsListOptionalParams, + ) => Promise; /** * Creates a job that fine-tunes a specified model from a given dataset. * @@ -37,43 +52,28 @@ export interface FineTuningJobsOperations { job: CreateFineTuningJobRequest, options?: FineTuningJobsCreateOptionalParams, ) => Promise; - list: ( - options?: FineTuningJobsListOptionalParams, - ) => Promise; - retrieve: ( - fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptionalParams, - ) => Promise; - listEvents: ( - fineTuningJobId: string, - options?: FineTuningJobsListEventsOptionalParams, - ) => Promise; - cancel: ( - fineTuningJobId: string, - options?: FineTuningJobsCancelOptionalParams, - ) => Promise; } export function getFineTuningJobs(context: OpenAIContext) { return { - create: ( - job: CreateFineTuningJobRequest, - options?: FineTuningJobsCreateOptionalParams, - ) => create(context, job, options), - list: (options?: FineTuningJobsListOptionalParams) => - list(context, options), - retrieve: ( + cancel: ( fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptionalParams, - ) => retrieve(context, fineTuningJobId, options), + options?: FineTuningJobsCancelOptionalParams, + ) => cancel(context, fineTuningJobId, options), listEvents: ( fineTuningJobId: string, options?: FineTuningJobsListEventsOptionalParams, ) => listEvents(context, fineTuningJobId, options), - cancel: ( + retrieve: ( fineTuningJobId: string, - options?: FineTuningJobsCancelOptionalParams, - ) => cancel(context, fineTuningJobId, options), + options?: FineTuningJobsRetrieveOptionalParams, + ) => retrieve(context, fineTuningJobId, options), + list: (options?: FineTuningJobsListOptionalParams) => + list(context, options), + create: ( + job: CreateFineTuningJobRequest, + options?: FineTuningJobsCreateOptionalParams, + ) => create(context, job, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts index 0e0f93f1f7..5d32d46bd0 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { OpenAIContext } from "../../api/openAIContext.js"; -import { create, createEdit, createVariation } from "../../api/images/index.js"; +import { createVariation, createEdit, create } from "../../api/images/index.js"; import { CreateImageRequest, ImagesResponse, @@ -10,39 +10,39 @@ import { CreateImageVariationRequest, } from "../../models/models.js"; import { - ImagesCreateOptionalParams, - ImagesCreateEditOptionalParams, ImagesCreateVariationOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateOptionalParams, } from "../../api/options.js"; /** Interface representing a Images operations. */ export interface ImagesOperations { - create: ( - image: CreateImageRequest, - options?: ImagesCreateOptionalParams, + createVariation: ( + image: CreateImageVariationRequest, + options?: ImagesCreateVariationOptionalParams, ) => Promise; createEdit: ( image: CreateImageEditRequest, options?: ImagesCreateEditOptionalParams, ) => Promise; - createVariation: ( - image: CreateImageVariationRequest, - options?: ImagesCreateVariationOptionalParams, + create: ( + image: CreateImageRequest, + options?: ImagesCreateOptionalParams, ) => Promise; } export function getImages(context: OpenAIContext) { return { - create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => - create(context, image, options), - createEdit: ( - image: CreateImageEditRequest, - options?: ImagesCreateEditOptionalParams, - ) => createEdit(context, image, options), createVariation: ( image: CreateImageVariationRequest, options?: ImagesCreateVariationOptionalParams, ) => createVariation(context, image, options), + createEdit: ( + image: CreateImageEditRequest, + options?: ImagesCreateEditOptionalParams, + ) => createEdit(context, image, options), + create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => + create(context, image, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts index 8c6f78bdc4..38b996ece4 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts @@ -2,25 +2,20 @@ // Licensed under the MIT License. import { OpenAIContext } from "../../api/openAIContext.js"; -import { list, retrieve, $delete } from "../../api/models/index.js"; +import { $delete, retrieve, list } from "../../api/models/index.js"; import { ListModelsResponse, Model, DeleteModelResponse, } from "../../models/models.js"; import { - ModelsListOptionalParams, - ModelsRetrieveOptionalParams, ModelsDeleteOptionalParams, + ModelsRetrieveOptionalParams, + ModelsListOptionalParams, } from "../../api/options.js"; /** Interface representing a Models operations. */ export interface ModelsOperations { - list: (options?: ModelsListOptionalParams) => Promise; - retrieve: ( - model: string, - options?: ModelsRetrieveOptionalParams, - ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") @@ -30,15 +25,20 @@ export interface ModelsOperations { model: string, options?: ModelsDeleteOptionalParams, ) => Promise; + retrieve: ( + model: string, + options?: ModelsRetrieveOptionalParams, + ) => Promise; + list: (options?: ModelsListOptionalParams) => Promise; } export function getModels(context: OpenAIContext) { return { - list: (options?: ModelsListOptionalParams) => list(context, options), - retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => - retrieve(context, model, options), delete: (model: string, options?: ModelsDeleteOptionalParams) => $delete(context, model, options), + retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => + retrieve(context, model, options), + list: (options?: ModelsListOptionalParams) => list(context, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts index e67b5edf9f..700934d6b7 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts @@ -51,34 +51,34 @@ export { } from "./models/index.js"; export { OpenAIClientOptionalParams, - AudioTranscriptionsCreateOptionalParams, - AudioTranslationsCreateOptionalParams, - ChatCompletionsCreateOptionalParams, - FineTuningJobsCreateOptionalParams, - FineTuningJobsListOptionalParams, - FineTuningJobsRetrieveOptionalParams, - FineTuningJobsListEventsOptionalParams, - FineTuningJobsCancelOptionalParams, - CompletionsCreateOptionalParams, - EditsCreateOptionalParams, - EmbeddingsCreateOptionalParams, - FilesListOptionalParams, - FilesCreateOptionalParams, - FilesRetrieveOptionalParams, - FilesDeleteOptionalParams, - FilesDownloadOptionalParams, - FineTunesCreateOptionalParams, - FineTunesListOptionalParams, - FineTunesRetrieveOptionalParams, - FineTunesListEventsOptionalParams, - FineTunesCancelOptionalParams, - ModelsListOptionalParams, - ModelsRetrieveOptionalParams, - ModelsDeleteOptionalParams, - ImagesCreateOptionalParams, - ImagesCreateEditOptionalParams, - ImagesCreateVariationOptionalParams, ModerationsCreateOptionalParams, + ImagesCreateVariationOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateOptionalParams, + ModelsDeleteOptionalParams, + ModelsRetrieveOptionalParams, + ModelsListOptionalParams, + FineTunesCancelOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListOptionalParams, + FineTunesCreateOptionalParams, + FilesDownloadOptionalParams, + FilesDeleteOptionalParams, + FilesRetrieveOptionalParams, + FilesCreateOptionalParams, + FilesListOptionalParams, + EmbeddingsCreateOptionalParams, + EditsCreateOptionalParams, + CompletionsCreateOptionalParams, + FineTuningJobsCancelOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + AudioTranscriptionsCreateOptionalParams, } from "./api/index.js"; export { AudioOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts index dda8339c3e..792a7a3674 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts @@ -1180,13 +1180,13 @@ export function createCompletionRequestSerializer( ): any { return { model: item["model"], - prompt: item["prompt"], + prompt: !item["prompt"] ? item["prompt"] : promptSerializer(item["prompt"]), suffix: item["suffix"], temperature: item["temperature"], top_p: item["top_p"], n: item["n"], max_tokens: item["max_tokens"], - stop: item["stop"], + stop: !item["stop"] ? item["stop"] : stopSerializer(item["stop"]), presence_penalty: item["presence_penalty"], frequency_penalty: item["frequency_penalty"], logit_bias: item["logit_bias"], @@ -1289,7 +1289,9 @@ export function _createCompletionResponseChoiceDeserializer( return { index: item["index"], text: item["text"], - logprobs: item["logprobs"], + logprobs: !item["logprobs"] + ? item["logprobs"] + : _createCompletionResponseChoiceLogprobsDeserializer(item["logprobs"]), finish_reason: item["finish_reason"], }; } @@ -1489,9 +1491,7 @@ export function fineTuningJobDeserializer(item: any): FineTuningJob { created_at: new Date(item["created_at"] * 1000), finished_at: !item["finished_at"] ? item["finished_at"] - : !item["finished_at"] - ? item["finished_at"] - : new Date(item["finished_at"] * 1000), + : new Date(item["finished_at"] * 1000), model: item["model"], fine_tuned_model: item["fine_tuned_model"], organization_id: item["organization_id"], @@ -1505,7 +1505,9 @@ export function fineTuningJobDeserializer(item: any): FineTuningJob { return p; }), trained_tokens: item["trained_tokens"], - error: item["error"], + error: !item["error"] + ? item["error"] + : _fineTuningJobErrorDeserializer(item["error"]), }; } @@ -1750,7 +1752,7 @@ export function createChatCompletionRequestSerializer( top_p: item["top_p"], n: item["n"], max_tokens: item["max_tokens"], - stop: item["stop"], + stop: !item["stop"] ? item["stop"] : stopSerializer(item["stop"]), presence_penalty: item["presence_penalty"], frequency_penalty: item["frequency_penalty"], logit_bias: item["logit_bias"], diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts index 8552a6504d..78a6912612 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts @@ -1,38 +1,38 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; -import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; import { - getFineTuningOperations, - FineTuningOperations, -} from "./classic/fineTuning/index.js"; + getModerationsOperations, + ModerationsOperations, +} from "./classic/moderations/index.js"; import { - getCompletionsOperations, - CompletionsOperations, -} from "./classic/completions/index.js"; -import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; + getImagesOperations, + ImagesOperations, +} from "./classic/images/index.js"; import { - getEmbeddingsOperations, - EmbeddingsOperations, -} from "./classic/embeddings/index.js"; -import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; + getModelsOperations, + ModelsOperations, +} from "./classic/models/index.js"; import { getFineTunesOperations, FineTunesOperations, } from "./classic/fineTunes/index.js"; +import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; import { - getModelsOperations, - ModelsOperations, -} from "./classic/models/index.js"; + getEmbeddingsOperations, + EmbeddingsOperations, +} from "./classic/embeddings/index.js"; +import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; import { - getImagesOperations, - ImagesOperations, -} from "./classic/images/index.js"; + getCompletionsOperations, + CompletionsOperations, +} from "./classic/completions/index.js"; import { - getModerationsOperations, - ModerationsOperations, -} from "./classic/moderations/index.js"; + getFineTuningOperations, + FineTuningOperations, +} from "./classic/fineTuning/index.js"; +import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; +import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; import { createOpenAI, OpenAIContext, @@ -62,39 +62,39 @@ export class OpenAIClient { userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; - this.audio = getAudioOperations(this._client); - this.chat = getChatOperations(this._client); - this.fineTuning = getFineTuningOperations(this._client); - this.completions = getCompletionsOperations(this._client); - this.edits = getEditsOperations(this._client); - this.embeddings = getEmbeddingsOperations(this._client); - this.files = getFilesOperations(this._client); - this.fineTunes = getFineTunesOperations(this._client); - this.models = getModelsOperations(this._client); - this.images = getImagesOperations(this._client); this.moderations = getModerationsOperations(this._client); + this.images = getImagesOperations(this._client); + this.models = getModelsOperations(this._client); + this.fineTunes = getFineTunesOperations(this._client); + this.files = getFilesOperations(this._client); + this.embeddings = getEmbeddingsOperations(this._client); + this.edits = getEditsOperations(this._client); + this.completions = getCompletionsOperations(this._client); + this.fineTuning = getFineTuningOperations(this._client); + this.chat = getChatOperations(this._client); + this.audio = getAudioOperations(this._client); } - /** The operation groups for AudioTranscriptions */ - public readonly audio: AudioOperations; - /** The operation groups for ChatCompletions */ - public readonly chat: ChatOperations; - /** The operation groups for FineTuningJobs */ - public readonly fineTuning: FineTuningOperations; - /** The operation groups for Completions */ - public readonly completions: CompletionsOperations; - /** The operation groups for Edits */ - public readonly edits: EditsOperations; - /** The operation groups for Embeddings */ - public readonly embeddings: EmbeddingsOperations; - /** The operation groups for Files */ - public readonly files: FilesOperations; - /** The operation groups for FineTunes */ - public readonly fineTunes: FineTunesOperations; - /** The operation groups for Models */ - public readonly models: ModelsOperations; - /** The operation groups for Images */ - public readonly images: ImagesOperations; - /** The operation groups for Moderations */ + /** The operation groups for moderations */ public readonly moderations: ModerationsOperations; + /** The operation groups for images */ + public readonly images: ImagesOperations; + /** The operation groups for models */ + public readonly models: ModelsOperations; + /** The operation groups for fineTunes */ + public readonly fineTunes: FineTunesOperations; + /** The operation groups for files */ + public readonly files: FilesOperations; + /** The operation groups for embeddings */ + public readonly embeddings: EmbeddingsOperations; + /** The operation groups for edits */ + public readonly edits: EditsOperations; + /** The operation groups for completions */ + public readonly completions: CompletionsOperations; + /** The operation groups for fineTuning */ + public readonly fineTuning: FineTuningOperations; + /** The operation groups for chat */ + public readonly chat: ChatOperations; + /** The operation groups for audio */ + public readonly audio: AudioOperations; } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/openai_modular/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md index 53f2fb069c..4766f76ba8 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md @@ -732,22 +732,18 @@ export interface GenerateSpeechFromTextOptionalParams extends OperationOptions { // @public export interface GetAudioTranscriptionAsPlainTextOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface GetAudioTranscriptionAsResponseObjectOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface GetAudioTranslationAsPlainTextOptionalParams extends OperationOptions { - contentType?: string; } // @public export interface GetAudioTranslationAsResponseObjectOptionalParams extends OperationOptions { - contentType?: string; } // @public @@ -827,13 +823,13 @@ export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "102 // @public export enum KnownServiceApiVersions { // (undocumented) - V2022_12_01 = "2022-12-01", + v2022_12_01 = "2022-12-01", // (undocumented) - V2023_05_15 = "2023-05-15", + v2023_05_15 = "2023-05-15", // (undocumented) - V2024_02_01 = "2024-02-01", + v2024_02_01 = "2024-02-01", // (undocumented) - V2024_06_01 = "2024-06-01" + v2024_06_01 = "2024-06-01" } // @public diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts index 1c4edce4d8..9d3fdfbcdd 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts @@ -7,24 +7,24 @@ export { OpenAIClientOptionalParams, } from "./openAIContext.js"; export { - getAudioTranscriptionAsPlainText, - getAudioTranscriptionAsResponseObject, - getAudioTranslationAsPlainText, - getAudioTranslationAsResponseObject, - getCompletions, - getChatCompletions, - getImageGenerations, - generateSpeechFromText, getEmbeddings, + generateSpeechFromText, + getImageGenerations, + getChatCompletions, + getCompletions, + getAudioTranslationAsResponseObject, + getAudioTranslationAsPlainText, + getAudioTranscriptionAsResponseObject, + getAudioTranscriptionAsPlainText, } from "./operations.js"; export { - GetAudioTranscriptionAsPlainTextOptionalParams, - GetAudioTranscriptionAsResponseObjectOptionalParams, - GetAudioTranslationAsPlainTextOptionalParams, - GetAudioTranslationAsResponseObjectOptionalParams, - GetCompletionsOptionalParams, - GetChatCompletionsOptionalParams, - GetImageGenerationsOptionalParams, - GenerateSpeechFromTextOptionalParams, GetEmbeddingsOptionalParams, + GenerateSpeechFromTextOptionalParams, + GetImageGenerationsOptionalParams, + GetChatCompletionsOptionalParams, + GetCompletionsOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranscriptionAsPlainTextOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts index 5f3f4b9ed2..54bcbc5408 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts @@ -6,7 +6,11 @@ import { KnownServiceApiVersions } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { KeyCredential, TokenCredential } from "@azure/core-auth"; -export interface OpenAIContext extends Client {} +export interface OpenAIContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownServiceApiVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface OpenAIClientOptionalParams extends ClientOptions { @@ -56,5 +60,5 @@ export function createOpenAI( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as OpenAIContext; } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts index 76da673e8d..c96810fc39 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts @@ -48,194 +48,191 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _getAudioTranscriptionAsPlainTextSend( +export function _getEmbeddingsSend( context: Client, deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptionalParams = { - requestOptions: {}, - }, + body: EmbeddingsOptions, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/audio/transcriptions", deploymentId) + .path("/deployments/{deploymentId}/embeddings", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: audioTranscriptionOptionsSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: embeddingsOptionsSerializer(body), }); } -export async function _getAudioTranscriptionAsPlainTextDeserialize( +export async function _getEmbeddingsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return result.body; + return embeddingsDeserializer(result.body); } -/** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. - */ -export async function getAudioTranscriptionAsPlainText( +/** Return the embeddings for a given prompt. */ +export async function getEmbeddings( context: Client, deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _getAudioTranscriptionAsPlainTextSend( - context, - deploymentId, - body, - options, - ); - return _getAudioTranscriptionAsPlainTextDeserialize(result); + body: EmbeddingsOptions, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getEmbeddingsSend(context, deploymentId, body, options); + return _getEmbeddingsDeserialize(result); } -export function _getAudioTranscriptionAsResponseObjectSend( +export function _generateSpeechFromTextSend( context: Client, deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptionalParams = { - requestOptions: {}, - }, + body: SpeechGenerationOptions, + options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/audio/transcriptions", deploymentId) + .path("/deployments/{deploymentId}/audio/speech", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: audioTranscriptionOptionsSerializer(body), + contentType: "application/json", + headers: { + accept: "application/octet-stream", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: speechGenerationOptionsSerializer(body), }); } -export async function _getAudioTranscriptionAsResponseObjectDeserialize( +export async function _generateSpeechFromTextDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return audioTranscriptionDeserializer(result.body); + return result.body; } -/** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. - */ -export async function getAudioTranscriptionAsResponseObject( +/** Generates text-to-speech audio from the input text. */ +export async function generateSpeechFromText( context: Client, deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _getAudioTranscriptionAsResponseObjectSend( + body: SpeechGenerationOptions, + options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _generateSpeechFromTextSend( context, deploymentId, body, options, ); - return _getAudioTranscriptionAsResponseObjectDeserialize(result); + return _generateSpeechFromTextDeserialize(result); } -export function _getAudioTranslationAsPlainTextSend( +export function _getImageGenerationsSend( context: Client, deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsPlainTextOptionalParams = { - requestOptions: {}, - }, + body: ImageGenerationOptions, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/audio/translations", deploymentId) + .path("/deployments/{deploymentId}/images/generations", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: audioTranslationOptionsSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: imageGenerationOptionsSerializer(body), }); } -export async function _getAudioTranslationAsPlainTextDeserialize( +export async function _getImageGenerationsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return result.body; + return imageGenerationsDeserializer(result.body); } -/** Gets English language transcribed text and associated metadata from provided spoken audio data. */ -export async function getAudioTranslationAsPlainText( +/** Creates an image given a prompt. */ +export async function getImageGenerations( context: Client, deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsPlainTextOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _getAudioTranslationAsPlainTextSend( + body: ImageGenerationOptions, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getImageGenerationsSend( context, deploymentId, body, options, ); - return _getAudioTranslationAsPlainTextDeserialize(result); + return _getImageGenerationsDeserialize(result); } -export function _getAudioTranslationAsResponseObjectSend( +export function _getChatCompletionsSend( context: Client, deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptionalParams = { - requestOptions: {}, - }, + body: ChatCompletionsOptions, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/audio/translations", deploymentId) + .path("/deployments/{deploymentId}/chat/completions", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: audioTranslationOptionsSerializer(body), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: chatCompletionsOptionsSerializer(body), }); } -export async function _getAudioTranslationAsResponseObjectDeserialize( +export async function _getChatCompletionsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return audioTranslationDeserializer(result.body); + return chatCompletionsDeserializer(result.body); } -/** Gets English language transcribed text and associated metadata from provided spoken audio data. */ -export async function getAudioTranslationAsResponseObject( +/** + * Gets chat completions for the provided chat messages. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. + */ +export async function getChatCompletions( context: Client, deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _getAudioTranslationAsResponseObjectSend( + body: ChatCompletionsOptions, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getChatCompletionsSend( context, deploymentId, body, options, ); - return _getAudioTranslationAsResponseObjectDeserialize(result); + return _getChatCompletionsDeserialize(result); } export function _getCompletionsSend( @@ -248,6 +245,12 @@ export function _getCompletionsSend( .path("/deployments/{deploymentId}/completions", deploymentId) .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: completionsOptionsSerializer(body), }); } @@ -283,165 +286,206 @@ export async function getCompletions( return _getCompletionsDeserialize(result); } -export function _getChatCompletionsSend( +export function _getAudioTranslationAsResponseObjectSend( context: Client, deploymentId: string, - body: ChatCompletionsOptions, - options: GetChatCompletionsOptionalParams = { requestOptions: {} }, + body: AudioTranslationOptions, + options: GetAudioTranslationAsResponseObjectOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/chat/completions", deploymentId) + .path("/deployments/{deploymentId}/audio/translations", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - body: chatCompletionsOptionsSerializer(body), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: audioTranslationOptionsSerializer(body), }); } -export async function _getChatCompletionsDeserialize( +export async function _getAudioTranslationAsResponseObjectDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return chatCompletionsDeserializer(result.body); + return audioTranslationDeserializer(result.body); } -/** - * Gets chat completions for the provided chat messages. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. - */ -export async function getChatCompletions( +/** Gets English language transcribed text and associated metadata from provided spoken audio data. */ +export async function getAudioTranslationAsResponseObject( context: Client, deploymentId: string, - body: ChatCompletionsOptions, - options: GetChatCompletionsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getChatCompletionsSend( + body: AudioTranslationOptions, + options: GetAudioTranslationAsResponseObjectOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getAudioTranslationAsResponseObjectSend( context, deploymentId, body, options, ); - return _getChatCompletionsDeserialize(result); + return _getAudioTranslationAsResponseObjectDeserialize(result); } -export function _getImageGenerationsSend( +export function _getAudioTranslationAsPlainTextSend( context: Client, deploymentId: string, - body: ImageGenerationOptions, - options: GetImageGenerationsOptionalParams = { requestOptions: {} }, + body: AudioTranslationOptions, + options: GetAudioTranslationAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/images/generations", deploymentId) + .path("/deployments/{deploymentId}/audio/translations", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - body: imageGenerationOptionsSerializer(body), + contentType: "multipart/form-data", + headers: { accept: "text/plain", ...options.requestOptions?.headers }, + queryParameters: { "api-version": context.apiVersion }, + body: audioTranslationOptionsSerializer(body), }); } -export async function _getImageGenerationsDeserialize( +export async function _getAudioTranslationAsPlainTextDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return imageGenerationsDeserializer(result.body); + return result.body; } -/** Creates an image given a prompt. */ -export async function getImageGenerations( +/** Gets English language transcribed text and associated metadata from provided spoken audio data. */ +export async function getAudioTranslationAsPlainText( context: Client, deploymentId: string, - body: ImageGenerationOptions, - options: GetImageGenerationsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getImageGenerationsSend( + body: AudioTranslationOptions, + options: GetAudioTranslationAsPlainTextOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getAudioTranslationAsPlainTextSend( context, deploymentId, body, options, ); - return _getImageGenerationsDeserialize(result); + return _getAudioTranslationAsPlainTextDeserialize(result); } -export function _generateSpeechFromTextSend( +export function _getAudioTranscriptionAsResponseObjectSend( context: Client, deploymentId: string, - body: SpeechGenerationOptions, - options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/audio/speech", deploymentId) + .path("/deployments/{deploymentId}/audio/transcriptions", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - body: speechGenerationOptionsSerializer(body), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: audioTranscriptionOptionsSerializer(body), }); } -export async function _generateSpeechFromTextDeserialize( +export async function _getAudioTranscriptionAsResponseObjectDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return result.body; + return audioTranscriptionDeserializer(result.body); } -/** Generates text-to-speech audio from the input text. */ -export async function generateSpeechFromText( +/** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + */ +export async function getAudioTranscriptionAsResponseObject( context: Client, deploymentId: string, - body: SpeechGenerationOptions, - options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _generateSpeechFromTextSend( + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getAudioTranscriptionAsResponseObjectSend( context, deploymentId, body, options, ); - return _generateSpeechFromTextDeserialize(result); + return _getAudioTranscriptionAsResponseObjectDeserialize(result); } -export function _getEmbeddingsSend( +export function _getAudioTranscriptionAsPlainTextSend( context: Client, deploymentId: string, - body: EmbeddingsOptions, - options: GetEmbeddingsOptionalParams = { requestOptions: {} }, + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context - .path("/deployments/{deploymentId}/embeddings", deploymentId) + .path("/deployments/{deploymentId}/audio/transcriptions", deploymentId) .post({ ...operationOptionsToRequestParameters(options), - body: embeddingsOptionsSerializer(body), + contentType: "multipart/form-data", + headers: { accept: "text/plain", ...options.requestOptions?.headers }, + queryParameters: { "api-version": context.apiVersion }, + body: audioTranscriptionOptionsSerializer(body), }); } -export async function _getEmbeddingsDeserialize( +export async function _getAudioTranscriptionAsPlainTextDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return embeddingsDeserializer(result.body); + return result.body; } -/** Return the embeddings for a given prompt. */ -export async function getEmbeddings( +/** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + */ +export async function getAudioTranscriptionAsPlainText( context: Client, deploymentId: string, - body: EmbeddingsOptions, - options: GetEmbeddingsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getEmbeddingsSend(context, deploymentId, body, options); - return _getEmbeddingsDeserialize(result); + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getAudioTranscriptionAsPlainTextSend( + context, + deploymentId, + body, + options, + ); + return _getAudioTranscriptionAsPlainTextDeserialize(result); } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/options.ts index 9b47a834bd..7dd03a88ac 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/options.ts @@ -4,45 +4,33 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface GetAudioTranscriptionAsPlainTextOptionalParams - extends OperationOptions { - /** The content type for the operation. Always multipart/form-data for this operation. */ - contentType?: string; -} +export interface GetEmbeddingsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetAudioTranscriptionAsResponseObjectOptionalParams - extends OperationOptions { - /** The content type for the operation. Always multipart/form-data for this operation. */ - contentType?: string; -} +export interface GenerateSpeechFromTextOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface GetAudioTranslationAsPlainTextOptionalParams - extends OperationOptions { - /** The content type for the operation. Always multipart/form-data for this operation. */ - contentType?: string; -} +export interface GetImageGenerationsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetAudioTranslationAsResponseObjectOptionalParams - extends OperationOptions { - /** The content type for the operation. Always multipart/form-data for this operation. */ - contentType?: string; -} +export interface GetChatCompletionsOptionalParams extends OperationOptions {} /** Optional parameters. */ export interface GetCompletionsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetChatCompletionsOptionalParams extends OperationOptions {} +export interface GetAudioTranslationAsResponseObjectOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface GetImageGenerationsOptionalParams extends OperationOptions {} +export interface GetAudioTranslationAsPlainTextOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface GenerateSpeechFromTextOptionalParams +export interface GetAudioTranscriptionAsResponseObjectOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GetEmbeddingsOptionalParams extends OperationOptions {} +export interface GetAudioTranscriptionAsPlainTextOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts index 62b0893cbf..9d384be0c3 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts @@ -147,13 +147,13 @@ export { } from "./models/index.js"; export { OpenAIClientOptionalParams, - GetAudioTranscriptionAsPlainTextOptionalParams, - GetAudioTranscriptionAsResponseObjectOptionalParams, - GetAudioTranslationAsPlainTextOptionalParams, - GetAudioTranslationAsResponseObjectOptionalParams, - GetCompletionsOptionalParams, - GetChatCompletionsOptionalParams, - GetImageGenerationsOptionalParams, - GenerateSpeechFromTextOptionalParams, GetEmbeddingsOptionalParams, + GenerateSpeechFromTextOptionalParams, + GetImageGenerationsOptionalParams, + GetChatCompletionsOptionalParams, + GetCompletionsOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranscriptionAsPlainTextOptionalParams, } from "./api/index.js"; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts index 386f8e7a19..75c3fd4e82 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts @@ -715,7 +715,9 @@ export function choiceDeserializer(item: any): Choice { : contentFilterResultsForChoiceDeserializer( item["content_filter_results"], ), - logprobs: item["logprobs"], + logprobs: !item["logprobs"] + ? item["logprobs"] + : completionsLogProbabilityModelDeserializer(item["logprobs"]), finishReason: item["finish_reason"], }; } @@ -2971,7 +2973,9 @@ export function chatChoiceDeserializer(item: any): ChatChoice { message: !item["message"] ? item["message"] : chatResponseMessageDeserializer(item["message"]), - logprobs: item["logprobs"], + logprobs: !item["logprobs"] + ? item["logprobs"] + : chatChoiceLogProbabilityInfoDeserializer(item["logprobs"]), index: item["index"], finishReason: item["finish_reason"], finishDetails: !item["finish_details"] @@ -3176,11 +3180,7 @@ export function chatChoiceLogProbabilityInfoDeserializer( return { content: !item["content"] ? item["content"] - : !item["content"] - ? item["content"] - : item["content"].map((p: any) => { - return chatTokenLogProbabilityResultDeserializer(p); - }), + : chatTokenLogProbabilityResultArrayDeserializer(item["content"]), }; } @@ -3212,18 +3212,12 @@ export function chatTokenLogProbabilityResultDeserializer( logprob: item["logprob"], bytes: !item["bytes"] ? item["bytes"] - : !item["bytes"] - ? item["bytes"] - : item["bytes"].map((p: any) => { - return p; - }), + : item["bytes"].map((p: any) => { + return p; + }), topLogprobs: !item["top_logprobs"] ? item["top_logprobs"] - : !item["top_logprobs"] - ? item["top_logprobs"] - : item["top_logprobs"].map((p: any) => { - return chatTokenLogProbabilityInfoDeserializer(p); - }), + : chatTokenLogProbabilityInfoArrayDeserializer(item["top_logprobs"]), }; } @@ -3253,11 +3247,9 @@ export function chatTokenLogProbabilityInfoDeserializer( logprob: item["logprob"], bytes: !item["bytes"] ? item["bytes"] - : !item["bytes"] - ? item["bytes"] - : item["bytes"].map((p: any) => { - return p; - }), + : item["bytes"].map((p: any) => { + return p; + }), }; } @@ -3873,8 +3865,8 @@ export function embeddingsUsageDeserializer(item: any): EmbeddingsUsage { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - V2022_12_01 = "2022-12-01", - V2023_05_15 = "2023-05-15", - V2024_02_01 = "2024-02-01", - V2024_06_01 = "2024-06-01", + v2022_12_01 = "2022-12-01", + v2023_05_15 = "2023-05-15", + v2024_02_01 = "2024-02-01", + v2024_06_01 = "2024-06-01", } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts index 854e3de96e..756a6a7c9e 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts @@ -5,24 +5,24 @@ import { createOpenAI, OpenAIContext, OpenAIClientOptionalParams, - getAudioTranscriptionAsPlainText, - getAudioTranscriptionAsResponseObject, - getAudioTranslationAsPlainText, - getAudioTranslationAsResponseObject, - getCompletions, - getChatCompletions, - getImageGenerations, - generateSpeechFromText, getEmbeddings, - GetAudioTranscriptionAsPlainTextOptionalParams, - GetAudioTranscriptionAsResponseObjectOptionalParams, - GetAudioTranslationAsPlainTextOptionalParams, - GetAudioTranslationAsResponseObjectOptionalParams, - GetCompletionsOptionalParams, - GetChatCompletionsOptionalParams, - GetImageGenerationsOptionalParams, - GenerateSpeechFromTextOptionalParams, + generateSpeechFromText, + getImageGenerations, + getChatCompletions, + getCompletions, + getAudioTranslationAsResponseObject, + getAudioTranslationAsPlainText, + getAudioTranscriptionAsResponseObject, + getAudioTranscriptionAsPlainText, GetEmbeddingsOptionalParams, + GenerateSpeechFromTextOptionalParams, + GetImageGenerationsOptionalParams, + GetChatCompletionsOptionalParams, + GetCompletionsOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranscriptionAsPlainTextOptionalParams, } from "./api/index.js"; import { AudioTranscriptionOptions, @@ -65,37 +65,68 @@ export class OpenAIClient { this.pipeline = this._client.pipeline; } + /** Return the embeddings for a given prompt. */ + getEmbeddings( + deploymentId: string, + body: EmbeddingsOptions, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, + ): Promise { + return getEmbeddings(this._client, deploymentId, body, options); + } + + /** Generates text-to-speech audio from the input text. */ + generateSpeechFromText( + deploymentId: string, + body: SpeechGenerationOptions, + options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, + ): Promise { + return generateSpeechFromText(this._client, deploymentId, body, options); + } + + /** Creates an image given a prompt. */ + getImageGenerations( + deploymentId: string, + body: ImageGenerationOptions, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, + ): Promise { + return getImageGenerations(this._client, deploymentId, body, options); + } + /** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. + * Gets chat completions for the provided chat messages. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. */ - getAudioTranscriptionAsPlainText( + getChatCompletions( deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptionalParams = { - requestOptions: {}, - }, - ): Promise { - return getAudioTranscriptionAsPlainText( - this._client, - deploymentId, - body, - options, - ); + body: ChatCompletionsOptions, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, + ): Promise { + return getChatCompletions(this._client, deploymentId, body, options); } /** - * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the - * written language corresponding to the language it was spoken in. + * Gets completions for the provided input prompts. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. */ - getAudioTranscriptionAsResponseObject( + getCompletions( deploymentId: string, - body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptionalParams = { + body: CompletionsOptions, + options: GetCompletionsOptionalParams = { requestOptions: {} }, + ): Promise { + return getCompletions(this._client, deploymentId, body, options); + } + + /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ + getAudioTranslationAsResponseObject( + deploymentId: string, + body: AudioTranslationOptions, + options: GetAudioTranslationAsResponseObjectOptionalParams = { requestOptions: {}, }, - ): Promise { - return getAudioTranscriptionAsResponseObject( + ): Promise { + return getAudioTranslationAsResponseObject( this._client, deploymentId, body, @@ -119,15 +150,18 @@ export class OpenAIClient { ); } - /** Gets English language transcribed text and associated metadata from provided spoken audio data. */ - getAudioTranslationAsResponseObject( + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + */ + getAudioTranscriptionAsResponseObject( deploymentId: string, - body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptionalParams = { + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { requestOptions: {}, }, - ): Promise { - return getAudioTranslationAsResponseObject( + ): Promise { + return getAudioTranscriptionAsResponseObject( this._client, deploymentId, body, @@ -136,55 +170,21 @@ export class OpenAIClient { } /** - * Gets completions for the provided input prompts. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. - */ - getCompletions( - deploymentId: string, - body: CompletionsOptions, - options: GetCompletionsOptionalParams = { requestOptions: {} }, - ): Promise { - return getCompletions(this._client, deploymentId, body, options); - } - - /** - * Gets chat completions for the provided chat messages. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. */ - getChatCompletions( - deploymentId: string, - body: ChatCompletionsOptions, - options: GetChatCompletionsOptionalParams = { requestOptions: {} }, - ): Promise { - return getChatCompletions(this._client, deploymentId, body, options); - } - - /** Creates an image given a prompt. */ - getImageGenerations( - deploymentId: string, - body: ImageGenerationOptions, - options: GetImageGenerationsOptionalParams = { requestOptions: {} }, - ): Promise { - return getImageGenerations(this._client, deploymentId, body, options); - } - - /** Generates text-to-speech audio from the input text. */ - generateSpeechFromText( - deploymentId: string, - body: SpeechGenerationOptions, - options: GenerateSpeechFromTextOptionalParams = { requestOptions: {} }, - ): Promise { - return generateSpeechFromText(this._client, deploymentId, body, options); - } - - /** Return the embeddings for a given prompt. */ - getEmbeddings( + getAudioTranscriptionAsPlainText( deploymentId: string, - body: EmbeddingsOptions, - options: GetEmbeddingsOptionalParams = { requestOptions: {} }, - ): Promise { - return getEmbeddings(this._client, deploymentId, body, options); + body: AudioTranscriptionOptions, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, + ): Promise { + return getAudioTranscriptionAsPlainText( + this._client, + deploymentId, + body, + options, + ); } } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json index 6c3aa56336..3dae102ff3 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json @@ -13,18 +13,18 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/audio/transcriptions": "./src/api/audio/transcriptions/index.ts", - "./api/audio/translations": "./src/api/audio/translations/index.ts", - "./api/chat/completions": "./src/api/chat/completions/index.ts", - "./api/fineTuning/jobs": "./src/api/fineTuning/jobs/index.ts", - "./api/completions": "./src/api/completions/index.ts", - "./api/edits": "./src/api/edits/index.ts", - "./api/embeddings": "./src/api/embeddings/index.ts", - "./api/files": "./src/api/files/index.ts", - "./api/fineTunes": "./src/api/fineTunes/index.ts", - "./api/models": "./src/api/models/index.ts", + "./api/moderations": "./src/api/moderations/index.ts", "./api/images": "./src/api/images/index.ts", - "./api/moderations": "./src/api/moderations/index.ts" + "./api/models": "./src/api/models/index.ts", + "./api/fineTunes": "./src/api/fineTunes/index.ts", + "./api/files": "./src/api/files/index.ts", + "./api/embeddings": "./src/api/embeddings/index.ts", + "./api/edits": "./src/api/edits/index.ts", + "./api/completions": "./src/api/completions/index.ts", + "./api/fineTuning/jobs": "./src/api/fineTuning/jobs/index.ts", + "./api/chat/completions": "./src/api/chat/completions/index.ts", + "./api/audio/translations": "./src/api/audio/translations/index.ts", + "./api/audio/transcriptions": "./src/api/audio/transcriptions/index.ts" }, "dialects": [ "esm", @@ -56,7 +56,7 @@ }, "dependencies": { "tslib": "^2.6.2", - "@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2" + "@typespec/ts-http-runtime": "0.1.0" }, "exports": { "./package.json": "./package.json", @@ -114,112 +114,94 @@ "default": "./dist/commonjs/api/index.js" } }, - "./api/audio/transcriptions": { - "browser": { - "types": "./dist/browser/api/audio/transcriptions/index.d.ts", - "default": "./dist/browser/api/audio/transcriptions/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/audio/transcriptions/index.d.ts", - "default": "./dist/react-native/api/audio/transcriptions/index.js" - }, - "import": { - "types": "./dist/esm/api/audio/transcriptions/index.d.ts", - "default": "./dist/esm/api/audio/transcriptions/index.js" - }, - "require": { - "types": "./dist/commonjs/api/audio/transcriptions/index.d.ts", - "default": "./dist/commonjs/api/audio/transcriptions/index.js" - } - }, - "./api/audio/translations": { + "./api/moderations": { "browser": { - "types": "./dist/browser/api/audio/translations/index.d.ts", - "default": "./dist/browser/api/audio/translations/index.js" + "types": "./dist/browser/api/moderations/index.d.ts", + "default": "./dist/browser/api/moderations/index.js" }, "react-native": { - "types": "./dist/react-native/api/audio/translations/index.d.ts", - "default": "./dist/react-native/api/audio/translations/index.js" + "types": "./dist/react-native/api/moderations/index.d.ts", + "default": "./dist/react-native/api/moderations/index.js" }, "import": { - "types": "./dist/esm/api/audio/translations/index.d.ts", - "default": "./dist/esm/api/audio/translations/index.js" + "types": "./dist/esm/api/moderations/index.d.ts", + "default": "./dist/esm/api/moderations/index.js" }, "require": { - "types": "./dist/commonjs/api/audio/translations/index.d.ts", - "default": "./dist/commonjs/api/audio/translations/index.js" + "types": "./dist/commonjs/api/moderations/index.d.ts", + "default": "./dist/commonjs/api/moderations/index.js" } }, - "./api/chat/completions": { + "./api/images": { "browser": { - "types": "./dist/browser/api/chat/completions/index.d.ts", - "default": "./dist/browser/api/chat/completions/index.js" + "types": "./dist/browser/api/images/index.d.ts", + "default": "./dist/browser/api/images/index.js" }, "react-native": { - "types": "./dist/react-native/api/chat/completions/index.d.ts", - "default": "./dist/react-native/api/chat/completions/index.js" + "types": "./dist/react-native/api/images/index.d.ts", + "default": "./dist/react-native/api/images/index.js" }, "import": { - "types": "./dist/esm/api/chat/completions/index.d.ts", - "default": "./dist/esm/api/chat/completions/index.js" + "types": "./dist/esm/api/images/index.d.ts", + "default": "./dist/esm/api/images/index.js" }, "require": { - "types": "./dist/commonjs/api/chat/completions/index.d.ts", - "default": "./dist/commonjs/api/chat/completions/index.js" + "types": "./dist/commonjs/api/images/index.d.ts", + "default": "./dist/commonjs/api/images/index.js" } }, - "./api/fineTuning/jobs": { + "./api/models": { "browser": { - "types": "./dist/browser/api/fineTuning/jobs/index.d.ts", - "default": "./dist/browser/api/fineTuning/jobs/index.js" + "types": "./dist/browser/api/models/index.d.ts", + "default": "./dist/browser/api/models/index.js" }, "react-native": { - "types": "./dist/react-native/api/fineTuning/jobs/index.d.ts", - "default": "./dist/react-native/api/fineTuning/jobs/index.js" + "types": "./dist/react-native/api/models/index.d.ts", + "default": "./dist/react-native/api/models/index.js" }, "import": { - "types": "./dist/esm/api/fineTuning/jobs/index.d.ts", - "default": "./dist/esm/api/fineTuning/jobs/index.js" + "types": "./dist/esm/api/models/index.d.ts", + "default": "./dist/esm/api/models/index.js" }, "require": { - "types": "./dist/commonjs/api/fineTuning/jobs/index.d.ts", - "default": "./dist/commonjs/api/fineTuning/jobs/index.js" + "types": "./dist/commonjs/api/models/index.d.ts", + "default": "./dist/commonjs/api/models/index.js" } }, - "./api/completions": { + "./api/fineTunes": { "browser": { - "types": "./dist/browser/api/completions/index.d.ts", - "default": "./dist/browser/api/completions/index.js" + "types": "./dist/browser/api/fineTunes/index.d.ts", + "default": "./dist/browser/api/fineTunes/index.js" }, "react-native": { - "types": "./dist/react-native/api/completions/index.d.ts", - "default": "./dist/react-native/api/completions/index.js" + "types": "./dist/react-native/api/fineTunes/index.d.ts", + "default": "./dist/react-native/api/fineTunes/index.js" }, "import": { - "types": "./dist/esm/api/completions/index.d.ts", - "default": "./dist/esm/api/completions/index.js" + "types": "./dist/esm/api/fineTunes/index.d.ts", + "default": "./dist/esm/api/fineTunes/index.js" }, "require": { - "types": "./dist/commonjs/api/completions/index.d.ts", - "default": "./dist/commonjs/api/completions/index.js" + "types": "./dist/commonjs/api/fineTunes/index.d.ts", + "default": "./dist/commonjs/api/fineTunes/index.js" } }, - "./api/edits": { + "./api/files": { "browser": { - "types": "./dist/browser/api/edits/index.d.ts", - "default": "./dist/browser/api/edits/index.js" + "types": "./dist/browser/api/files/index.d.ts", + "default": "./dist/browser/api/files/index.js" }, "react-native": { - "types": "./dist/react-native/api/edits/index.d.ts", - "default": "./dist/react-native/api/edits/index.js" + "types": "./dist/react-native/api/files/index.d.ts", + "default": "./dist/react-native/api/files/index.js" }, "import": { - "types": "./dist/esm/api/edits/index.d.ts", - "default": "./dist/esm/api/edits/index.js" + "types": "./dist/esm/api/files/index.d.ts", + "default": "./dist/esm/api/files/index.js" }, "require": { - "types": "./dist/commonjs/api/edits/index.d.ts", - "default": "./dist/commonjs/api/edits/index.js" + "types": "./dist/commonjs/api/files/index.d.ts", + "default": "./dist/commonjs/api/files/index.js" } }, "./api/embeddings": { @@ -240,94 +222,112 @@ "default": "./dist/commonjs/api/embeddings/index.js" } }, - "./api/files": { + "./api/edits": { "browser": { - "types": "./dist/browser/api/files/index.d.ts", - "default": "./dist/browser/api/files/index.js" + "types": "./dist/browser/api/edits/index.d.ts", + "default": "./dist/browser/api/edits/index.js" }, "react-native": { - "types": "./dist/react-native/api/files/index.d.ts", - "default": "./dist/react-native/api/files/index.js" + "types": "./dist/react-native/api/edits/index.d.ts", + "default": "./dist/react-native/api/edits/index.js" }, "import": { - "types": "./dist/esm/api/files/index.d.ts", - "default": "./dist/esm/api/files/index.js" + "types": "./dist/esm/api/edits/index.d.ts", + "default": "./dist/esm/api/edits/index.js" }, "require": { - "types": "./dist/commonjs/api/files/index.d.ts", - "default": "./dist/commonjs/api/files/index.js" + "types": "./dist/commonjs/api/edits/index.d.ts", + "default": "./dist/commonjs/api/edits/index.js" } }, - "./api/fineTunes": { + "./api/completions": { "browser": { - "types": "./dist/browser/api/fineTunes/index.d.ts", - "default": "./dist/browser/api/fineTunes/index.js" + "types": "./dist/browser/api/completions/index.d.ts", + "default": "./dist/browser/api/completions/index.js" }, "react-native": { - "types": "./dist/react-native/api/fineTunes/index.d.ts", - "default": "./dist/react-native/api/fineTunes/index.js" + "types": "./dist/react-native/api/completions/index.d.ts", + "default": "./dist/react-native/api/completions/index.js" }, "import": { - "types": "./dist/esm/api/fineTunes/index.d.ts", - "default": "./dist/esm/api/fineTunes/index.js" + "types": "./dist/esm/api/completions/index.d.ts", + "default": "./dist/esm/api/completions/index.js" }, "require": { - "types": "./dist/commonjs/api/fineTunes/index.d.ts", - "default": "./dist/commonjs/api/fineTunes/index.js" + "types": "./dist/commonjs/api/completions/index.d.ts", + "default": "./dist/commonjs/api/completions/index.js" } }, - "./api/models": { + "./api/fineTuning/jobs": { "browser": { - "types": "./dist/browser/api/models/index.d.ts", - "default": "./dist/browser/api/models/index.js" + "types": "./dist/browser/api/fineTuning/jobs/index.d.ts", + "default": "./dist/browser/api/fineTuning/jobs/index.js" }, "react-native": { - "types": "./dist/react-native/api/models/index.d.ts", - "default": "./dist/react-native/api/models/index.js" + "types": "./dist/react-native/api/fineTuning/jobs/index.d.ts", + "default": "./dist/react-native/api/fineTuning/jobs/index.js" }, "import": { - "types": "./dist/esm/api/models/index.d.ts", - "default": "./dist/esm/api/models/index.js" + "types": "./dist/esm/api/fineTuning/jobs/index.d.ts", + "default": "./dist/esm/api/fineTuning/jobs/index.js" }, "require": { - "types": "./dist/commonjs/api/models/index.d.ts", - "default": "./dist/commonjs/api/models/index.js" + "types": "./dist/commonjs/api/fineTuning/jobs/index.d.ts", + "default": "./dist/commonjs/api/fineTuning/jobs/index.js" } }, - "./api/images": { + "./api/chat/completions": { "browser": { - "types": "./dist/browser/api/images/index.d.ts", - "default": "./dist/browser/api/images/index.js" + "types": "./dist/browser/api/chat/completions/index.d.ts", + "default": "./dist/browser/api/chat/completions/index.js" }, "react-native": { - "types": "./dist/react-native/api/images/index.d.ts", - "default": "./dist/react-native/api/images/index.js" + "types": "./dist/react-native/api/chat/completions/index.d.ts", + "default": "./dist/react-native/api/chat/completions/index.js" }, "import": { - "types": "./dist/esm/api/images/index.d.ts", - "default": "./dist/esm/api/images/index.js" + "types": "./dist/esm/api/chat/completions/index.d.ts", + "default": "./dist/esm/api/chat/completions/index.js" }, "require": { - "types": "./dist/commonjs/api/images/index.d.ts", - "default": "./dist/commonjs/api/images/index.js" + "types": "./dist/commonjs/api/chat/completions/index.d.ts", + "default": "./dist/commonjs/api/chat/completions/index.js" } }, - "./api/moderations": { + "./api/audio/translations": { "browser": { - "types": "./dist/browser/api/moderations/index.d.ts", - "default": "./dist/browser/api/moderations/index.js" + "types": "./dist/browser/api/audio/translations/index.d.ts", + "default": "./dist/browser/api/audio/translations/index.js" }, "react-native": { - "types": "./dist/react-native/api/moderations/index.d.ts", - "default": "./dist/react-native/api/moderations/index.js" + "types": "./dist/react-native/api/audio/translations/index.d.ts", + "default": "./dist/react-native/api/audio/translations/index.js" }, "import": { - "types": "./dist/esm/api/moderations/index.d.ts", - "default": "./dist/esm/api/moderations/index.js" + "types": "./dist/esm/api/audio/translations/index.d.ts", + "default": "./dist/esm/api/audio/translations/index.js" }, "require": { - "types": "./dist/commonjs/api/moderations/index.d.ts", - "default": "./dist/commonjs/api/moderations/index.js" + "types": "./dist/commonjs/api/audio/translations/index.d.ts", + "default": "./dist/commonjs/api/audio/translations/index.js" + } + }, + "./api/audio/transcriptions": { + "browser": { + "types": "./dist/browser/api/audio/transcriptions/index.d.ts", + "default": "./dist/browser/api/audio/transcriptions/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/audio/transcriptions/index.d.ts", + "default": "./dist/react-native/api/audio/transcriptions/index.js" + }, + "import": { + "types": "./dist/esm/api/audio/transcriptions/index.d.ts", + "default": "./dist/esm/api/audio/transcriptions/index.js" + }, + "require": { + "types": "./dist/commonjs/api/audio/transcriptions/index.d.ts", + "default": "./dist/commonjs/api/audio/transcriptions/index.js" } } }, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index a9c72c3068..8f54a36e38 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -19,8 +19,6 @@ export interface AudioOperations { // @public export interface AudioTranscriptionsCreateOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -31,8 +29,6 @@ export interface AudioTranscriptionsOperations { // @public export interface AudioTranslationsCreateOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -306,29 +302,29 @@ export interface CreateModerationResponse { flagged: boolean; categories: { hate: boolean; - hateThreatening: boolean; + "hate/threatening": boolean; harassment: boolean; - harassmentThreatening: boolean; + "harassment/threatening": boolean; selfHarm: boolean; - selfHarmIntent: boolean; - selfHarmInstructive: boolean; + "selfHarm/intent": boolean; + "selfHarm/instructive": boolean; sexual: boolean; - sexualMinors: boolean; + "sexual/minors": boolean; violence: boolean; - violenceGraphic: boolean; + "violence/graphic": boolean; }; categoryScores: { hate: number; - hateThreatening: number; + "hate/threatening": number; harassment: number; - harassmentThreatening: number; + "harassment/threatening": number; selfHarm: number; - selfHarmIntent: number; - selfHarmInstructive: number; + "selfHarm/intent": number; + "selfHarm/instructive": number; sexual: number; - sexualMinors: number; + "sexual/minors": number; violence: number; - violenceGraphic: number; + "violence/graphic": number; }; }[]; } @@ -413,8 +409,6 @@ export interface EmbeddingsOperations { // @public export interface FilesCreateOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -607,8 +601,6 @@ export interface Image { // @public export interface ImagesCreateEditOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -617,8 +609,6 @@ export interface ImagesCreateOptionalParams extends OperationOptions { // @public export interface ImagesCreateVariationOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts index 838d4b582a..4fa70bbb6a 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts @@ -26,7 +26,11 @@ export function _createSend( .path("/audio/transcriptions") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createTranscriptionRequestSerializer(audio), }); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts index 3ea71814e4..621c6a3a6c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts @@ -26,7 +26,11 @@ export function _createSend( .path("/audio/translations") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createTranslationRequestSerializer(audio), }); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts index 9c44d2c245..b9fd1eb069 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts @@ -26,6 +26,11 @@ export function _createSend( .path("/chat/completions") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createChatCompletionRequestSerializer(body), }); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts index ae8fa55f21..feda7690d9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts @@ -26,6 +26,11 @@ export function _createSend( .path("/completions") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createCompletionRequestSerializer(body), }); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts index 732bc9d9a8..35227cbc86 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts @@ -26,6 +26,11 @@ export function _createSend( .path("/edits") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createEditRequestSerializer(edit), }); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts index 091d9c344d..458506734e 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts @@ -26,6 +26,11 @@ export function _createSend( .path("/embeddings") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createEmbeddingRequestSerializer(embedding), }); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts index 8b00a519c6..50184f9c4d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts @@ -25,66 +25,81 @@ import { operationOptionsToRequestParameters, } from "@typespec/ts-http-runtime"; -export function _listSend( +export function _downloadSend( context: Client, - options: FilesListOptionalParams = { requestOptions: {} }, + fileId: string, + options: FilesDownloadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files") - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/files/files/{file_id}/content", fileId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _listDeserialize( +export async function _downloadDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFilesResponseDeserializer(result.body); + return result.body; } -export async function list( +export async function download( context: Client, - options: FilesListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + fileId: string, + options: FilesDownloadOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _downloadSend(context, fileId, options); + return _downloadDeserialize(result); } -export function _createSend( +export function _$deleteSend( context: Client, - file: CreateFileRequest, - options: FilesCreateOptionalParams = { requestOptions: {} }, + fileId: string, + options: FilesDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files") - .post({ + .path("/files/files/{file_id}", fileId) + .delete({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: createFileRequestSerializer(file), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _createDeserialize( +export async function _$deleteDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return openAIFileDeserializer(result.body); + return deleteFileResponseDeserializer(result.body); } -export async function create( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, - file: CreateFileRequest, - options: FilesCreateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createSend(context, file, options); - return _createDeserialize(result); + fileId: string, + options: FilesDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, fileId, options); + return _$deleteDeserialize(result); } export function _retrieveSend( @@ -94,7 +109,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/files/files/{file_id}", fileId) - .post({ ...operationOptionsToRequestParameters(options) }); + .post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -117,67 +138,74 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _$deleteSend( +export function _createSend( context: Client, - fileId: string, - options: FilesDeleteOptionalParams = { requestOptions: {} }, + file: CreateFileRequest, + options: FilesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files/files/{file_id}", fileId) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/files") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createFileRequestSerializer(file), + }); } -export async function _$deleteDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return deleteFileResponseDeserializer(result.body); + return openAIFileDeserializer(result.body); } -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export async function $delete( +export async function create( context: Client, - fileId: string, - options: FilesDeleteOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _$deleteSend(context, fileId, options); - return _$deleteDeserialize(result); + file: CreateFileRequest, + options: FilesCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend(context, file, options); + return _createDeserialize(result); } -export function _downloadSend( +export function _listSend( context: Client, - fileId: string, - options: FilesDownloadOptionalParams = { requestOptions: {} }, + options: FilesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/files/files/{file_id}/content", fileId) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/files") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _downloadDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return result.body; + return listFilesResponseDeserializer(result.body); } -export async function download( +export async function list( context: Client, - fileId: string, - options: FilesDownloadOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _downloadSend(context, fileId, options); - return _downloadDeserialize(result); + options: FilesListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts index 75574deb85..46a98e774c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts @@ -25,20 +25,23 @@ import { operationOptionsToRequestParameters, } from "@typespec/ts-http-runtime"; -export function _createSend( +export function _cancelSend( context: Client, - fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptionalParams = { requestOptions: {} }, + fineTuneId: string, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes") + .path("/fine-tunes/{fine_tune_id}/cancel", fineTuneId) .post({ ...operationOptionsToRequestParameters(options), - body: createFineTuneRequestSerializer(fineTune), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _createDeserialize( +export async function _cancelDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -49,41 +52,50 @@ export async function _createDeserialize( return fineTuneDeserializer(result.body); } -export async function create( +export async function cancel( context: Client, - fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptionalParams = { requestOptions: {} }, + fineTuneId: string, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createSend(context, fineTune, options); - return _createDeserialize(result); + const result = await _cancelSend(context, fineTuneId, options); + return _cancelDeserialize(result); } -export function _listSend( +export function _listEventsSend( context: Client, - options: FineTunesListOptionalParams = { requestOptions: {} }, + fineTuneId: string, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes") - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/fine-tunes/{fine_tune_id}/events", fineTuneId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { stream: options?.stream }, + }); } -export async function _listDeserialize( +export async function _listEventsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFineTunesResponseDeserializer(result.body); + return listFineTuneEventsResponseDeserializer(result.body); } -export async function list( +export async function listEvents( context: Client, - options: FineTunesListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + fineTuneId: string, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listEventsSend(context, fineTuneId, options); + return _listEventsDeserialize(result); } export function _retrieveSend( @@ -93,7 +105,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/fine-tunes/{fine_tune_id}", fineTuneId) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -116,50 +134,59 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _listEventsSend( +export function _listSend( context: Client, - fineTuneId: string, - options: FineTunesListEventsOptionalParams = { requestOptions: {} }, + options: FineTunesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes/{fine_tune_id}/events", fineTuneId) + .path("/fine-tunes") .get({ ...operationOptionsToRequestParameters(options), - queryParameters: { stream: options?.stream }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _listEventsDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFineTuneEventsResponseDeserializer(result.body); + return listFineTunesResponseDeserializer(result.body); } -export async function listEvents( +export async function list( context: Client, - fineTuneId: string, - options: FineTunesListEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listEventsSend(context, fineTuneId, options); - return _listEventsDeserialize(result); + options: FineTunesListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } -export function _cancelSend( +export function _createSend( context: Client, - fineTuneId: string, - options: FineTunesCancelOptionalParams = { requestOptions: {} }, + fineTune: CreateFineTuneRequest, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine-tunes/{fine_tune_id}/cancel", fineTuneId) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/fine-tunes") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createFineTuneRequestSerializer(fineTune), + }); } -export async function _cancelDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -170,11 +197,11 @@ export async function _cancelDeserialize( return fineTuneDeserializer(result.body); } -export async function cancel( +export async function create( context: Client, - fineTuneId: string, - options: FineTunesCancelOptionalParams = { requestOptions: {} }, + fineTune: CreateFineTuneRequest, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _cancelSend(context, fineTuneId, options); - return _cancelDeserialize(result); + const result = await _createSend(context, fineTune, options); + return _createDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts index 868832e3c3..3a711104a9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts @@ -25,20 +25,23 @@ import { operationOptionsToRequestParameters, } from "@typespec/ts-http-runtime"; -export function _createSend( +export function _cancelSend( context: Client, - job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, + fineTuningJobId: string, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs") + .path("/fine_tuning/jobs/{fine_tuning_job_id}/cancel", fineTuningJobId) .post({ ...operationOptionsToRequestParameters(options), - body: createFineTuningJobRequestSerializer(job), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _createDeserialize( +export async function _cancelDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -49,52 +52,50 @@ export async function _createDeserialize( return fineTuningJobDeserializer(result.body); } -/** - * Creates a job that fine-tunes a specified model from a given dataset. - * - * Response includes details of the enqueued job including job status and the name of the - * fine-tuned models once complete. - * - * [Learn more about fine-tuning](/docs/guides/fine-tuning) - */ -export async function create( +export async function cancel( context: Client, - job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, + fineTuningJobId: string, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createSend(context, job, options); - return _createDeserialize(result); + const result = await _cancelSend(context, fineTuningJobId, options); + return _cancelDeserialize(result); } -export function _listSend( +export function _listEventsSend( context: Client, - options: FineTuningJobsListOptionalParams = { requestOptions: {} }, + fineTuningJobId: string, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs") + .path("/fine_tuning/jobs/{fine_tuning_job_id}/events", fineTuningJobId) .get({ ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { after: options?.after, limit: options?.limit }, }); } -export async function _listDeserialize( +export async function _listEventsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listPaginatedFineTuningJobsResponseDeserializer(result.body); + return listFineTuningJobEventsResponseDeserializer(result.body); } -export async function list( +export async function listEvents( context: Client, - options: FineTuningJobsListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + fineTuningJobId: string, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listEventsSend(context, fineTuningJobId, options); + return _listEventsDeserialize(result); } export function _retrieveSend( @@ -104,7 +105,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/fine_tuning/jobs/{fine_tuning_job_id}", fineTuningJobId) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -127,50 +134,60 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _listEventsSend( +export function _listSend( context: Client, - fineTuningJobId: string, - options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs/{fine_tuning_job_id}/events", fineTuningJobId) + .path("/fine_tuning/jobs") .get({ ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, queryParameters: { after: options?.after, limit: options?.limit }, }); } -export async function _listEventsDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listFineTuningJobEventsResponseDeserializer(result.body); + return listPaginatedFineTuningJobsResponseDeserializer(result.body); } -export async function listEvents( +export async function list( context: Client, - fineTuningJobId: string, - options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listEventsSend(context, fineTuningJobId, options); - return _listEventsDeserialize(result); + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } -export function _cancelSend( +export function _createSend( context: Client, - fineTuningJobId: string, - options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, + job: CreateFineTuningJobRequest, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/fine_tuning/jobs/{fine_tuning_job_id}/cancel", fineTuningJobId) - .post({ ...operationOptionsToRequestParameters(options) }); + .path("/fine_tuning/jobs") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createFineTuningJobRequestSerializer(job), + }); } -export async function _cancelDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -181,11 +198,19 @@ export async function _cancelDeserialize( return fineTuningJobDeserializer(result.body); } -export async function cancel( +/** + * Creates a job that fine-tunes a specified model from a given dataset. + * + * Response includes details of the enqueued job including job status and the name of the + * fine-tuned models once complete. + * + * [Learn more about fine-tuning](/docs/guides/fine-tuning) + */ +export async function create( context: Client, - fineTuningJobId: string, - options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, + job: CreateFineTuningJobRequest, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _cancelSend(context, fineTuningJobId, options); - return _cancelDeserialize(result); + const result = await _createSend(context, job, options); + return _createDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts index 66640eae39..5948ebf223 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts @@ -23,20 +23,25 @@ import { operationOptionsToRequestParameters, } from "@typespec/ts-http-runtime"; -export function _createSend( +export function _createVariationSend( context: Client, - image: CreateImageRequest, - options: ImagesCreateOptionalParams = { requestOptions: {} }, + image: CreateImageVariationRequest, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/images/generations") + .path("/images/variations") .post({ ...operationOptionsToRequestParameters(options), - body: createImageRequestSerializer(image), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createImageVariationRequestSerializer(image), }); } -export async function _createDeserialize( +export async function _createVariationDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -47,13 +52,13 @@ export async function _createDeserialize( return imagesResponseDeserializer(result.body); } -export async function create( +export async function createVariation( context: Client, - image: CreateImageRequest, - options: ImagesCreateOptionalParams = { requestOptions: {} }, + image: CreateImageVariationRequest, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createSend(context, image, options); - return _createDeserialize(result); + const result = await _createVariationSend(context, image, options); + return _createVariationDeserialize(result); } export function _createEditSend( @@ -65,7 +70,11 @@ export function _createEditSend( .path("/images/edits") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createImageEditRequestSerializer(image), }); } @@ -90,21 +99,25 @@ export async function createEdit( return _createEditDeserialize(result); } -export function _createVariationSend( +export function _createSend( context: Client, - image: CreateImageVariationRequest, - options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, + image: CreateImageRequest, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/images/variations") + .path("/images/generations") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "multipart/form-data", - body: createImageVariationRequestSerializer(image), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createImageRequestSerializer(image), }); } -export async function _createVariationDeserialize( +export async function _createDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -115,11 +128,11 @@ export async function _createVariationDeserialize( return imagesResponseDeserializer(result.body); } -export async function createVariation( +export async function create( context: Client, - image: CreateImageVariationRequest, - options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, + image: CreateImageRequest, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createVariationSend(context, image, options); - return _createVariationDeserialize(result); + const result = await _createSend(context, image, options); + return _createDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts index 0676bdf731..439f5da06c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts @@ -6,32 +6,32 @@ export { OpenAIClientOptionalParams, } from "./openAIContext.js"; export { - AudioTranscriptionsCreateOptionalParams, - AudioTranslationsCreateOptionalParams, - ChatCompletionsCreateOptionalParams, - FineTuningJobsCreateOptionalParams, - FineTuningJobsListOptionalParams, - FineTuningJobsRetrieveOptionalParams, - FineTuningJobsListEventsOptionalParams, - FineTuningJobsCancelOptionalParams, - CompletionsCreateOptionalParams, - EditsCreateOptionalParams, - EmbeddingsCreateOptionalParams, - FilesListOptionalParams, - FilesCreateOptionalParams, - FilesRetrieveOptionalParams, - FilesDeleteOptionalParams, - FilesDownloadOptionalParams, - FineTunesCreateOptionalParams, - FineTunesListOptionalParams, - FineTunesRetrieveOptionalParams, - FineTunesListEventsOptionalParams, - FineTunesCancelOptionalParams, - ModelsListOptionalParams, - ModelsRetrieveOptionalParams, - ModelsDeleteOptionalParams, - ImagesCreateOptionalParams, - ImagesCreateEditOptionalParams, - ImagesCreateVariationOptionalParams, ModerationsCreateOptionalParams, + ImagesCreateVariationOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateOptionalParams, + ModelsDeleteOptionalParams, + ModelsRetrieveOptionalParams, + ModelsListOptionalParams, + FineTunesCancelOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListOptionalParams, + FineTunesCreateOptionalParams, + FilesDownloadOptionalParams, + FilesDeleteOptionalParams, + FilesRetrieveOptionalParams, + FilesCreateOptionalParams, + FilesListOptionalParams, + EmbeddingsCreateOptionalParams, + EditsCreateOptionalParams, + CompletionsCreateOptionalParams, + FineTuningJobsCancelOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + AudioTranscriptionsCreateOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts index ac1bd7ae38..3e03c2837c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts @@ -21,32 +21,45 @@ import { operationOptionsToRequestParameters, } from "@typespec/ts-http-runtime"; -export function _listSend( +export function _$deleteSend( context: Client, - options: ModelsListOptionalParams = { requestOptions: {} }, + model: string, + options: ModelsDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/models") - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/models/{model}", model) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _listDeserialize( +export async function _$deleteDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return listModelsResponseDeserializer(result.body); + return deleteModelResponseDeserializer(result.body); } -export async function list( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, - options: ModelsListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + model: string, + options: ModelsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, model, options); + return _$deleteDeserialize(result); } export function _retrieveSend( @@ -56,7 +69,13 @@ export function _retrieveSend( ): StreamableMethod { return context .path("/models/{model}", model) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } export async function _retrieveDeserialize( @@ -79,37 +98,36 @@ export async function retrieve( return _retrieveDeserialize(result); } -export function _$deleteSend( +export function _listSend( context: Client, - model: string, - options: ModelsDeleteOptionalParams = { requestOptions: {} }, + options: ModelsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/models/{model}", model) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/models") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _$deleteDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return deleteModelResponseDeserializer(result.body); + return listModelsResponseDeserializer(result.body); } -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export async function $delete( +export async function list( context: Client, - model: string, - options: ModelsDeleteOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _$deleteSend(context, model, options); - return _$deleteDeserialize(result); + options: ModelsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, options); + return _listDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts index db0953fec8..5e216ad436 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts @@ -26,6 +26,11 @@ export function _createSend( .path("/moderations") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: createModerationRequestSerializer(content), }); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts index 7bd77ff53a..826fd72f7d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts @@ -19,8 +19,7 @@ export function createOpenAI( credential: KeyCredential, options: OpenAIClientOptionalParams = {}, ): OpenAIContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? `https://api.openai.com/v1`; + const endpointUrl = options.endpoint ?? "https://api.openai.com/v1"; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-openai-non-branded/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/options.ts index 74f7da4d43..b49d3a0dee 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/options.ts @@ -3,120 +3,110 @@ import { OperationOptions } from "@typespec/ts-http-runtime"; /** Optional parameters. */ -export interface AudioTranscriptionsCreateOptionalParams - extends OperationOptions { - contentType?: string; -} +export interface ModerationsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface AudioTranslationsCreateOptionalParams - extends OperationOptions { - contentType?: string; -} +export interface ImagesCreateVariationOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ChatCompletionsCreateOptionalParams extends OperationOptions {} +export interface ImagesCreateEditOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsCreateOptionalParams extends OperationOptions {} +export interface ImagesCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsListOptionalParams extends OperationOptions { - /** Identifier for the last job from the previous pagination request. */ - after?: string; - /** Number of fine-tuning jobs to retrieve. */ - limit?: number; -} +export interface ModelsDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsRetrieveOptionalParams - extends OperationOptions {} +export interface ModelsRetrieveOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsListEventsOptionalParams - extends OperationOptions { - /** Identifier for the last event from the previous pagination request. */ - after?: string; - /** Number of events to retrieve. */ - limit?: number; -} +export interface ModelsListOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTuningJobsCancelOptionalParams extends OperationOptions {} +export interface FineTunesCancelOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface CompletionsCreateOptionalParams extends OperationOptions {} +export interface FineTunesListEventsOptionalParams extends OperationOptions { + /** + * Whether to stream events for the fine-tune job. If set to true, events will be sent as + * data-only + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + * as they become available. The stream will terminate with a `data: [DONE]` message when the + * job is finished (succeeded, cancelled, or failed). + * + * If set to false, only events generated so far will be returned. + */ + stream?: boolean; +} /** Optional parameters. */ -export interface EditsCreateOptionalParams extends OperationOptions {} +export interface FineTunesRetrieveOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EmbeddingsCreateOptionalParams extends OperationOptions {} +export interface FineTunesListOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesListOptionalParams extends OperationOptions {} +export interface FineTunesCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesCreateOptionalParams extends OperationOptions { - contentType?: string; -} +export interface FilesDownloadOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesRetrieveOptionalParams extends OperationOptions {} +export interface FilesDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesDeleteOptionalParams extends OperationOptions {} +export interface FilesRetrieveOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FilesDownloadOptionalParams extends OperationOptions {} +export interface FilesCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesCreateOptionalParams extends OperationOptions {} +export interface FilesListOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesListOptionalParams extends OperationOptions {} +export interface EmbeddingsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesRetrieveOptionalParams extends OperationOptions {} +export interface EditsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesListEventsOptionalParams extends OperationOptions { - /** - * Whether to stream events for the fine-tune job. If set to true, events will be sent as - * data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available. The stream will terminate with a `data: [DONE]` message when the - * job is finished (succeeded, cancelled, or failed). - * - * If set to false, only events generated so far will be returned. - */ - stream?: boolean; -} +export interface CompletionsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FineTunesCancelOptionalParams extends OperationOptions {} +export interface FineTuningJobsCancelOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ModelsListOptionalParams extends OperationOptions {} +export interface FineTuningJobsListEventsOptionalParams + extends OperationOptions { + /** Identifier for the last event from the previous pagination request. */ + after?: string; + /** Number of events to retrieve. */ + limit?: number; +} /** Optional parameters. */ -export interface ModelsRetrieveOptionalParams extends OperationOptions {} +export interface FineTuningJobsRetrieveOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ModelsDeleteOptionalParams extends OperationOptions {} +export interface FineTuningJobsListOptionalParams extends OperationOptions { + /** Identifier for the last job from the previous pagination request. */ + after?: string; + /** Number of fine-tuning jobs to retrieve. */ + limit?: number; +} /** Optional parameters. */ -export interface ImagesCreateOptionalParams extends OperationOptions {} +export interface FineTuningJobsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ImagesCreateEditOptionalParams extends OperationOptions { - contentType?: string; -} +export interface ChatCompletionsCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ImagesCreateVariationOptionalParams extends OperationOptions { - contentType?: string; -} +export interface AudioTranslationsCreateOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ModerationsCreateOptionalParams extends OperationOptions {} +export interface AudioTranscriptionsCreateOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts index 9273df0eda..f41cb3f14d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts @@ -12,13 +12,13 @@ import { /** Interface representing a Audio operations. */ export interface AudioOperations { - transcriptions: AudioTranscriptionsOperations; translations: AudioTranslationsOperations; + transcriptions: AudioTranscriptionsOperations; } export function getAudioOperations(context: OpenAIContext): AudioOperations { return { - transcriptions: getAudioTranscriptionsOperations(context), translations: getAudioTranslationsOperations(context), + transcriptions: getAudioTranscriptionsOperations(context), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts index 3b6ba9fabb..1e672fd0c5 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts @@ -2,11 +2,11 @@ import { OpenAIContext } from "../../api/openAIContext.js"; import { - list, - create, - retrieve, - $delete, download, + $delete, + retrieve, + create, + list, } from "../../api/files/index.js"; import { OpenAIFile, @@ -15,24 +15,19 @@ import { DeleteFileResponse, } from "../../models/models.js"; import { - FilesListOptionalParams, - FilesCreateOptionalParams, - FilesRetrieveOptionalParams, - FilesDeleteOptionalParams, FilesDownloadOptionalParams, + FilesDeleteOptionalParams, + FilesRetrieveOptionalParams, + FilesCreateOptionalParams, + FilesListOptionalParams, } from "../../api/options.js"; /** Interface representing a Files operations. */ export interface FilesOperations { - list: (options?: FilesListOptionalParams) => Promise; - create: ( - file: CreateFileRequest, - options?: FilesCreateOptionalParams, - ) => Promise; - retrieve: ( + download: ( fileId: string, - options?: FilesRetrieveOptionalParams, - ) => Promise; + options?: FilesDownloadOptionalParams, + ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") @@ -42,23 +37,28 @@ export interface FilesOperations { fileId: string, options?: FilesDeleteOptionalParams, ) => Promise; - download: ( + retrieve: ( fileId: string, - options?: FilesDownloadOptionalParams, - ) => Promise; + options?: FilesRetrieveOptionalParams, + ) => Promise; + create: ( + file: CreateFileRequest, + options?: FilesCreateOptionalParams, + ) => Promise; + list: (options?: FilesListOptionalParams) => Promise; } export function getFiles(context: OpenAIContext) { return { - list: (options?: FilesListOptionalParams) => list(context, options), - create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => - create(context, file, options), - retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => - retrieve(context, fileId, options), - delete: (fileId: string, options?: FilesDeleteOptionalParams) => - $delete(context, fileId, options), download: (fileId: string, options?: FilesDownloadOptionalParams) => download(context, fileId, options), + delete: (fileId: string, options?: FilesDeleteOptionalParams) => + $delete(context, fileId, options), + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => + retrieve(context, fileId, options), + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => + create(context, file, options), + list: (options?: FilesListOptionalParams) => list(context, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts index bed4951bbc..4398eb0dee 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -2,11 +2,11 @@ import { OpenAIContext } from "../../api/openAIContext.js"; import { - create, - list, - retrieve, - listEvents, cancel, + listEvents, + retrieve, + list, + create, } from "../../api/fineTunes/index.js"; import { CreateFineTuneRequest, @@ -15,51 +15,51 @@ import { ListFineTuneEventsResponse, } from "../../models/models.js"; import { - FineTunesCreateOptionalParams, - FineTunesListOptionalParams, - FineTunesRetrieveOptionalParams, - FineTunesListEventsOptionalParams, FineTunesCancelOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListOptionalParams, + FineTunesCreateOptionalParams, } from "../../api/options.js"; /** Interface representing a FineTunes operations. */ export interface FineTunesOperations { - create: ( - fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptionalParams, - ) => Promise; - list: ( - options?: FineTunesListOptionalParams, - ) => Promise; - retrieve: ( + cancel: ( fineTuneId: string, - options?: FineTunesRetrieveOptionalParams, + options?: FineTunesCancelOptionalParams, ) => Promise; listEvents: ( fineTuneId: string, options?: FineTunesListEventsOptionalParams, ) => Promise; - cancel: ( + retrieve: ( fineTuneId: string, - options?: FineTunesCancelOptionalParams, + options?: FineTunesRetrieveOptionalParams, + ) => Promise; + list: ( + options?: FineTunesListOptionalParams, + ) => Promise; + create: ( + fineTune: CreateFineTuneRequest, + options?: FineTunesCreateOptionalParams, ) => Promise; } export function getFineTunes(context: OpenAIContext) { return { - create: ( - fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptionalParams, - ) => create(context, fineTune, options), - list: (options?: FineTunesListOptionalParams) => list(context, options), - retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => - retrieve(context, fineTuneId, options), + cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => + cancel(context, fineTuneId, options), listEvents: ( fineTuneId: string, options?: FineTunesListEventsOptionalParams, ) => listEvents(context, fineTuneId, options), - cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => - cancel(context, fineTuneId, options), + retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => + retrieve(context, fineTuneId, options), + list: (options?: FineTunesListOptionalParams) => list(context, options), + create: ( + fineTune: CreateFineTuneRequest, + options?: FineTunesCreateOptionalParams, + ) => create(context, fineTune, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index b6f4048954..4f7c0c6b31 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -2,11 +2,11 @@ import { OpenAIContext } from "../../../api/openAIContext.js"; import { - create, - list, - retrieve, - listEvents, cancel, + listEvents, + retrieve, + list, + create, } from "../../../api/fineTuning/jobs/index.js"; import { CreateFineTuningJobRequest, @@ -15,15 +15,30 @@ import { ListFineTuningJobEventsResponse, } from "../../../models/models.js"; import { - FineTuningJobsCreateOptionalParams, - FineTuningJobsListOptionalParams, - FineTuningJobsRetrieveOptionalParams, - FineTuningJobsListEventsOptionalParams, FineTuningJobsCancelOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsCreateOptionalParams, } from "../../../api/options.js"; /** Interface representing a FineTuningJobs operations. */ export interface FineTuningJobsOperations { + cancel: ( + fineTuningJobId: string, + options?: FineTuningJobsCancelOptionalParams, + ) => Promise; + listEvents: ( + fineTuningJobId: string, + options?: FineTuningJobsListEventsOptionalParams, + ) => Promise; + retrieve: ( + fineTuningJobId: string, + options?: FineTuningJobsRetrieveOptionalParams, + ) => Promise; + list: ( + options?: FineTuningJobsListOptionalParams, + ) => Promise; /** * Creates a job that fine-tunes a specified model from a given dataset. * @@ -36,43 +51,28 @@ export interface FineTuningJobsOperations { job: CreateFineTuningJobRequest, options?: FineTuningJobsCreateOptionalParams, ) => Promise; - list: ( - options?: FineTuningJobsListOptionalParams, - ) => Promise; - retrieve: ( - fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptionalParams, - ) => Promise; - listEvents: ( - fineTuningJobId: string, - options?: FineTuningJobsListEventsOptionalParams, - ) => Promise; - cancel: ( - fineTuningJobId: string, - options?: FineTuningJobsCancelOptionalParams, - ) => Promise; } export function getFineTuningJobs(context: OpenAIContext) { return { - create: ( - job: CreateFineTuningJobRequest, - options?: FineTuningJobsCreateOptionalParams, - ) => create(context, job, options), - list: (options?: FineTuningJobsListOptionalParams) => - list(context, options), - retrieve: ( + cancel: ( fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptionalParams, - ) => retrieve(context, fineTuningJobId, options), + options?: FineTuningJobsCancelOptionalParams, + ) => cancel(context, fineTuningJobId, options), listEvents: ( fineTuningJobId: string, options?: FineTuningJobsListEventsOptionalParams, ) => listEvents(context, fineTuningJobId, options), - cancel: ( + retrieve: ( fineTuningJobId: string, - options?: FineTuningJobsCancelOptionalParams, - ) => cancel(context, fineTuningJobId, options), + options?: FineTuningJobsRetrieveOptionalParams, + ) => retrieve(context, fineTuningJobId, options), + list: (options?: FineTuningJobsListOptionalParams) => + list(context, options), + create: ( + job: CreateFineTuningJobRequest, + options?: FineTuningJobsCreateOptionalParams, + ) => create(context, job, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts index fe1069ee65..729687dfc9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts @@ -1,7 +1,7 @@ // Licensed under the MIT License. import { OpenAIContext } from "../../api/openAIContext.js"; -import { create, createEdit, createVariation } from "../../api/images/index.js"; +import { createVariation, createEdit, create } from "../../api/images/index.js"; import { CreateImageRequest, ImagesResponse, @@ -9,39 +9,39 @@ import { CreateImageVariationRequest, } from "../../models/models.js"; import { - ImagesCreateOptionalParams, - ImagesCreateEditOptionalParams, ImagesCreateVariationOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateOptionalParams, } from "../../api/options.js"; /** Interface representing a Images operations. */ export interface ImagesOperations { - create: ( - image: CreateImageRequest, - options?: ImagesCreateOptionalParams, + createVariation: ( + image: CreateImageVariationRequest, + options?: ImagesCreateVariationOptionalParams, ) => Promise; createEdit: ( image: CreateImageEditRequest, options?: ImagesCreateEditOptionalParams, ) => Promise; - createVariation: ( - image: CreateImageVariationRequest, - options?: ImagesCreateVariationOptionalParams, + create: ( + image: CreateImageRequest, + options?: ImagesCreateOptionalParams, ) => Promise; } export function getImages(context: OpenAIContext) { return { - create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => - create(context, image, options), - createEdit: ( - image: CreateImageEditRequest, - options?: ImagesCreateEditOptionalParams, - ) => createEdit(context, image, options), createVariation: ( image: CreateImageVariationRequest, options?: ImagesCreateVariationOptionalParams, ) => createVariation(context, image, options), + createEdit: ( + image: CreateImageEditRequest, + options?: ImagesCreateEditOptionalParams, + ) => createEdit(context, image, options), + create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => + create(context, image, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts index 44118ec4e1..ed612205af 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts @@ -1,25 +1,20 @@ // Licensed under the MIT License. import { OpenAIContext } from "../../api/openAIContext.js"; -import { list, retrieve, $delete } from "../../api/models/index.js"; +import { $delete, retrieve, list } from "../../api/models/index.js"; import { ListModelsResponse, Model, DeleteModelResponse, } from "../../models/models.js"; import { - ModelsListOptionalParams, - ModelsRetrieveOptionalParams, ModelsDeleteOptionalParams, + ModelsRetrieveOptionalParams, + ModelsListOptionalParams, } from "../../api/options.js"; /** Interface representing a Models operations. */ export interface ModelsOperations { - list: (options?: ModelsListOptionalParams) => Promise; - retrieve: ( - model: string, - options?: ModelsRetrieveOptionalParams, - ) => Promise; /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") @@ -29,15 +24,20 @@ export interface ModelsOperations { model: string, options?: ModelsDeleteOptionalParams, ) => Promise; + retrieve: ( + model: string, + options?: ModelsRetrieveOptionalParams, + ) => Promise; + list: (options?: ModelsListOptionalParams) => Promise; } export function getModels(context: OpenAIContext) { return { - list: (options?: ModelsListOptionalParams) => list(context, options), - retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => - retrieve(context, model, options), delete: (model: string, options?: ModelsDeleteOptionalParams) => $delete(context, model, options), + retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => + retrieve(context, model, options), + list: (options?: ModelsListOptionalParams) => list(context, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts index 03f8ddb9d2..2a75996e5a 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts @@ -50,34 +50,34 @@ export { } from "./models/index.js"; export { OpenAIClientOptionalParams, - AudioTranscriptionsCreateOptionalParams, - AudioTranslationsCreateOptionalParams, - ChatCompletionsCreateOptionalParams, - FineTuningJobsCreateOptionalParams, - FineTuningJobsListOptionalParams, - FineTuningJobsRetrieveOptionalParams, - FineTuningJobsListEventsOptionalParams, - FineTuningJobsCancelOptionalParams, - CompletionsCreateOptionalParams, - EditsCreateOptionalParams, - EmbeddingsCreateOptionalParams, - FilesListOptionalParams, - FilesCreateOptionalParams, - FilesRetrieveOptionalParams, - FilesDeleteOptionalParams, - FilesDownloadOptionalParams, - FineTunesCreateOptionalParams, - FineTunesListOptionalParams, - FineTunesRetrieveOptionalParams, - FineTunesListEventsOptionalParams, - FineTunesCancelOptionalParams, - ModelsListOptionalParams, - ModelsRetrieveOptionalParams, - ModelsDeleteOptionalParams, - ImagesCreateOptionalParams, - ImagesCreateEditOptionalParams, - ImagesCreateVariationOptionalParams, ModerationsCreateOptionalParams, + ImagesCreateVariationOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateOptionalParams, + ModelsDeleteOptionalParams, + ModelsRetrieveOptionalParams, + ModelsListOptionalParams, + FineTunesCancelOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListOptionalParams, + FineTunesCreateOptionalParams, + FilesDownloadOptionalParams, + FilesDeleteOptionalParams, + FilesRetrieveOptionalParams, + FilesCreateOptionalParams, + FilesListOptionalParams, + EmbeddingsCreateOptionalParams, + EditsCreateOptionalParams, + CompletionsCreateOptionalParams, + FineTuningJobsCancelOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + AudioTranscriptionsCreateOptionalParams, } from "./api/index.js"; export { AudioOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index 844bff4d15..db2a532e2c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -48,29 +48,29 @@ export interface CreateModerationResponse { flagged: boolean; categories: { hate: boolean; - hateThreatening: boolean; + "hate/threatening": boolean; harassment: boolean; - harassmentThreatening: boolean; + "harassment/threatening": boolean; selfHarm: boolean; - selfHarmIntent: boolean; - selfHarmInstructive: boolean; + "selfHarm/intent": boolean; + "selfHarm/instructive": boolean; sexual: boolean; - sexualMinors: boolean; + "sexual/minors": boolean; violence: boolean; - violenceGraphic: boolean; + "violence/graphic": boolean; }; categoryScores: { hate: number; - hateThreatening: number; + "hate/threatening": number; harassment: number; - harassmentThreatening: number; + "harassment/threatening": number; selfHarm: number; - selfHarmIntent: number; - selfHarmInstructive: number; + "selfHarm/intent": number; + "selfHarm/instructive": number; sexual: number; - sexualMinors: number; + "sexual/minors": number; violence: number; - violenceGraphic: number; + "violence/graphic": number; }; }[]; } @@ -100,30 +100,30 @@ export interface _CreateModerationResponseResult { /** A list of the categories, and whether they are flagged or not. */ categories: { hate: boolean; - hateThreatening: boolean; + "hate/threatening": boolean; harassment: boolean; - harassmentThreatening: boolean; + "harassment/threatening": boolean; selfHarm: boolean; - selfHarmIntent: boolean; - selfHarmInstructive: boolean; + "selfHarm/intent": boolean; + "selfHarm/instructive": boolean; sexual: boolean; - sexualMinors: boolean; + "sexual/minors": boolean; violence: boolean; - violenceGraphic: boolean; + "violence/graphic": boolean; }; /** A list of the categories along with their scores as predicted by model. */ categoryScores: { hate: number; - hateThreatening: number; + "hate/threatening": number; harassment: number; - harassmentThreatening: number; + "harassment/threatening": number; selfHarm: number; - selfHarmIntent: number; - selfHarmInstructive: number; + "selfHarm/intent": number; + "selfHarm/instructive": number; sexual: number; - sexualMinors: number; + "sexual/minors": number; violence: number; - violenceGraphic: number; + "violence/graphic": number; }; } @@ -154,11 +154,11 @@ export interface _CreateModerationResponseResultCategories { * based on race, gender, ethnicity, religion, nationality, sexual orientation, disability * status, or caste. */ - hateThreatening: boolean; + "hate/threatening": boolean; /** Content that expresses, incites, or promotes harassing language towards any target. */ harassment: boolean; /** Harassment content that also includes violence or serious harm towards any target. */ - harassmentThreatening: boolean; + "harassment/threatening": boolean; /** * Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, * and eating disorders. @@ -168,23 +168,23 @@ export interface _CreateModerationResponseResultCategories { * Content where the speaker expresses that they are engaging or intend to engage in acts of * self-harm, such as suicide, cutting, and eating disorders. */ - selfHarmIntent: boolean; + "selfHarm/intent": boolean; /** * Content that encourages performing acts of self-harm, such as suicide, cutting, and eating * disorders, or that gives instructions or advice on how to commit such acts. */ - selfHarmInstructive: boolean; + "selfHarm/instructive": boolean; /** * Content meant to arouse sexual excitement, such as the description of sexual activity, or * that promotes sexual services (excluding sex education and wellness). */ sexual: boolean; /** Sexual content that includes an individual who is under 18 years old. */ - sexualMinors: boolean; + "sexual/minors": boolean; /** Content that depicts death, violence, or physical injury. */ violence: boolean; /** Content that depicts death, violence, or physical injury in graphic detail. */ - violenceGraphic: boolean; + "violence/graphic": boolean; } export function _createModerationResponseResultCategoriesDeserializer( @@ -192,16 +192,16 @@ export function _createModerationResponseResultCategoriesDeserializer( ): _CreateModerationResponseResultCategories { return { hate: item["hate"], - hateThreatening: item["hate/threatening"], + "hate/threatening": item["hate/threatening"], harassment: item["harassment"], - harassmentThreatening: item["harassment/threatening"], + "harassment/threatening": item["harassment/threatening"], selfHarm: item["self-harm"], - selfHarmIntent: item["self-harm/intent"], - selfHarmInstructive: item["self-harm/instructive"], + "selfHarm/intent": item["self-harm/intent"], + "selfHarm/instructive": item["self-harm/instructive"], sexual: item["sexual"], - sexualMinors: item["sexual/minors"], + "sexual/minors": item["sexual/minors"], violence: item["violence"], - violenceGraphic: item["violence/graphic"], + "violence/graphic": item["violence/graphic"], }; } @@ -210,25 +210,25 @@ export interface _CreateModerationResponseResultCategoryScores { /** The score for the category 'hate'. */ hate: number; /** The score for the category 'hate/threatening'. */ - hateThreatening: number; + "hate/threatening": number; /** The score for the category 'harassment'. */ harassment: number; /** The score for the category 'harassment/threatening'. */ - harassmentThreatening: number; + "harassment/threatening": number; /** The score for the category 'self-harm'. */ selfHarm: number; /** The score for the category 'self-harm/intent'. */ - selfHarmIntent: number; + "selfHarm/intent": number; /** The score for the category 'self-harm/instructive'. */ - selfHarmInstructive: number; + "selfHarm/instructive": number; /** The score for the category 'sexual'. */ sexual: number; /** The score for the category 'sexual/minors'. */ - sexualMinors: number; + "sexual/minors": number; /** The score for the category 'violence'. */ violence: number; /** The score for the category 'violence/graphic'. */ - violenceGraphic: number; + "violence/graphic": number; } export function _createModerationResponseResultCategoryScoresDeserializer( @@ -236,16 +236,16 @@ export function _createModerationResponseResultCategoryScoresDeserializer( ): _CreateModerationResponseResultCategoryScores { return { hate: item["hate"], - hateThreatening: item["hate/threatening"], + "hate/threatening": item["hate/threatening"], harassment: item["harassment"], - harassmentThreatening: item["harassment/threatening"], + "harassment/threatening": item["harassment/threatening"], selfHarm: item["self-harm"], - selfHarmIntent: item["self-harm/intent"], - selfHarmInstructive: item["self-harm/instructive"], + "selfHarm/intent": item["self-harm/intent"], + "selfHarm/instructive": item["self-harm/instructive"], sexual: item["sexual"], - sexualMinors: item["sexual/minors"], + "sexual/minors": item["sexual/minors"], violence: item["violence"], - violenceGraphic: item["violence/graphic"], + "violence/graphic": item["violence/graphic"], }; } @@ -1182,13 +1182,13 @@ export function createCompletionRequestSerializer( ): any { return { model: item["model"], - prompt: item["prompt"], + prompt: !item["prompt"] ? item["prompt"] : promptSerializer(item["prompt"]), suffix: item["suffix"], temperature: item["temperature"], top_p: item["topP"], n: item["n"], max_tokens: item["maxTokens"], - stop: item["stop"], + stop: !item["stop"] ? item["stop"] : stopSerializer(item["stop"]), presence_penalty: item["presencePenalty"], frequency_penalty: item["frequencyPenalty"], logit_bias: item["logitBias"], @@ -1291,7 +1291,9 @@ export function _createCompletionResponseChoiceDeserializer( return { index: item["index"], text: item["text"], - logprobs: item["logprobs"], + logprobs: !item["logprobs"] + ? item["logprobs"] + : _createCompletionResponseChoiceLogprobsDeserializer(item["logprobs"]), finishReason: item["finish_reason"], }; } @@ -1491,9 +1493,7 @@ export function fineTuningJobDeserializer(item: any): FineTuningJob { createdAt: new Date(item["created_at"] * 1000), finishedAt: !item["finished_at"] ? item["finished_at"] - : !item["finished_at"] - ? item["finished_at"] - : new Date(item["finished_at"] * 1000), + : new Date(item["finished_at"] * 1000), model: item["model"], fineTunedModel: item["fine_tuned_model"], organizationId: item["organization_id"], @@ -1507,7 +1507,9 @@ export function fineTuningJobDeserializer(item: any): FineTuningJob { return p; }), trainedTokens: item["trained_tokens"], - error: item["error"], + error: !item["error"] + ? item["error"] + : _fineTuningJobErrorDeserializer(item["error"]), }; } @@ -1752,7 +1754,7 @@ export function createChatCompletionRequestSerializer( top_p: item["topP"], n: item["n"], max_tokens: item["maxTokens"], - stop: item["stop"], + stop: !item["stop"] ? item["stop"] : stopSerializer(item["stop"]), presence_penalty: item["presencePenalty"], frequency_penalty: item["frequencyPenalty"], logit_bias: item["logitBias"], diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts index 4aeb70305a..9afbc19c16 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts @@ -1,37 +1,37 @@ // Licensed under the MIT License. -import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; -import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; import { - getFineTuningOperations, - FineTuningOperations, -} from "./classic/fineTuning/index.js"; + getModerationsOperations, + ModerationsOperations, +} from "./classic/moderations/index.js"; import { - getCompletionsOperations, - CompletionsOperations, -} from "./classic/completions/index.js"; -import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; + getImagesOperations, + ImagesOperations, +} from "./classic/images/index.js"; import { - getEmbeddingsOperations, - EmbeddingsOperations, -} from "./classic/embeddings/index.js"; -import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; + getModelsOperations, + ModelsOperations, +} from "./classic/models/index.js"; import { getFineTunesOperations, FineTunesOperations, } from "./classic/fineTunes/index.js"; +import { getFilesOperations, FilesOperations } from "./classic/files/index.js"; import { - getModelsOperations, - ModelsOperations, -} from "./classic/models/index.js"; + getEmbeddingsOperations, + EmbeddingsOperations, +} from "./classic/embeddings/index.js"; +import { getEditsOperations, EditsOperations } from "./classic/edits/index.js"; import { - getImagesOperations, - ImagesOperations, -} from "./classic/images/index.js"; + getCompletionsOperations, + CompletionsOperations, +} from "./classic/completions/index.js"; import { - getModerationsOperations, - ModerationsOperations, -} from "./classic/moderations/index.js"; + getFineTuningOperations, + FineTuningOperations, +} from "./classic/fineTuning/index.js"; +import { getChatOperations, ChatOperations } from "./classic/chat/index.js"; +import { getAudioOperations, AudioOperations } from "./classic/audio/index.js"; import { createOpenAI, OpenAIContext, @@ -60,39 +60,39 @@ export class OpenAIClient { userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; - this.audio = getAudioOperations(this._client); - this.chat = getChatOperations(this._client); - this.fineTuning = getFineTuningOperations(this._client); - this.completions = getCompletionsOperations(this._client); - this.edits = getEditsOperations(this._client); - this.embeddings = getEmbeddingsOperations(this._client); - this.files = getFilesOperations(this._client); - this.fineTunes = getFineTunesOperations(this._client); - this.models = getModelsOperations(this._client); - this.images = getImagesOperations(this._client); this.moderations = getModerationsOperations(this._client); + this.images = getImagesOperations(this._client); + this.models = getModelsOperations(this._client); + this.fineTunes = getFineTunesOperations(this._client); + this.files = getFilesOperations(this._client); + this.embeddings = getEmbeddingsOperations(this._client); + this.edits = getEditsOperations(this._client); + this.completions = getCompletionsOperations(this._client); + this.fineTuning = getFineTuningOperations(this._client); + this.chat = getChatOperations(this._client); + this.audio = getAudioOperations(this._client); } - /** The operation groups for AudioTranscriptions */ - public readonly audio: AudioOperations; - /** The operation groups for ChatCompletions */ - public readonly chat: ChatOperations; - /** The operation groups for FineTuningJobs */ - public readonly fineTuning: FineTuningOperations; - /** The operation groups for Completions */ - public readonly completions: CompletionsOperations; - /** The operation groups for Edits */ - public readonly edits: EditsOperations; - /** The operation groups for Embeddings */ - public readonly embeddings: EmbeddingsOperations; - /** The operation groups for Files */ - public readonly files: FilesOperations; - /** The operation groups for FineTunes */ - public readonly fineTunes: FineTunesOperations; - /** The operation groups for Models */ - public readonly models: ModelsOperations; - /** The operation groups for Images */ - public readonly images: ImagesOperations; - /** The operation groups for Moderations */ + /** The operation groups for moderations */ public readonly moderations: ModerationsOperations; + /** The operation groups for images */ + public readonly images: ImagesOperations; + /** The operation groups for models */ + public readonly models: ModelsOperations; + /** The operation groups for fineTunes */ + public readonly fineTunes: FineTunesOperations; + /** The operation groups for files */ + public readonly files: FilesOperations; + /** The operation groups for embeddings */ + public readonly embeddings: EmbeddingsOperations; + /** The operation groups for edits */ + public readonly edits: EditsOperations; + /** The operation groups for completions */ + public readonly completions: CompletionsOperations; + /** The operation groups for fineTuning */ + public readonly fineTuning: FineTuningOperations; + /** The operation groups for chat */ + public readonly chat: ChatOperations; + /** The operation groups for audio */ + public readonly audio: AudioOperations; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md index d528f802b2..5eeac5fad9 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md @@ -12,14 +12,10 @@ import { TokenCredential } from '@azure/core-auth'; // @public export interface FooOperationsGetAvatarAsJpegOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public export interface FooOperationsGetAvatarAsPngOptionalParams extends OperationOptions { - // (undocumented) - contentType?: string; } // @public @@ -30,7 +26,7 @@ export interface FooOperationsOperations { // @public export enum KnownVersions { - "V2022-08-30" = "2022-08-30" + "2022-08-30" = "2022-08-30" } // @public (undocumented) diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts index 861a3f759b..fd8a10431a 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts @@ -13,21 +13,26 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _getAvatarAsPngSend( +export function _getAvatarAsJpegSend( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsPngOptionalParams = { requestOptions: {} }, + options: FooOperationsGetAvatarAsJpegOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/avatar") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "image/png", + contentType: "image/jpeg", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: image, }); } -export async function _getAvatarAsPngDeserialize( +export async function _getAvatarAsJpegDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -39,30 +44,35 @@ export async function _getAvatarAsPngDeserialize( } /** A remote procedure call (RPC) operation. */ -export async function getAvatarAsPng( +export async function getAvatarAsJpeg( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsPngOptionalParams = { requestOptions: {} }, + options: FooOperationsGetAvatarAsJpegOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getAvatarAsPngSend(context, image, options); - return _getAvatarAsPngDeserialize(result); + const result = await _getAvatarAsJpegSend(context, image, options); + return _getAvatarAsJpegDeserialize(result); } -export function _getAvatarAsJpegSend( +export function _getAvatarAsPngSend( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsJpegOptionalParams = { requestOptions: {} }, + options: FooOperationsGetAvatarAsPngOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/avatar") .post({ ...operationOptionsToRequestParameters(options), - contentType: (options.contentType as any) ?? "image/jpeg", + contentType: "image/png", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: image, }); } -export async function _getAvatarAsJpegDeserialize( +export async function _getAvatarAsPngDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -74,11 +84,11 @@ export async function _getAvatarAsJpegDeserialize( } /** A remote procedure call (RPC) operation. */ -export async function getAvatarAsJpeg( +export async function getAvatarAsPng( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsJpegOptionalParams = { requestOptions: {} }, + options: FooOperationsGetAvatarAsPngOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getAvatarAsJpegSend(context, image, options); - return _getAvatarAsJpegDeserialize(result); + const result = await _getAvatarAsPngSend(context, image, options); + return _getAvatarAsPngDeserialize(result); } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts index d8a62d530d..5e1123755e 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts @@ -2,8 +2,8 @@ // Licensed under the MIT License. export { - FooOperationsGetAvatarAsPngOptionalParams, FooOperationsGetAvatarAsJpegOptionalParams, + FooOperationsGetAvatarAsPngOptionalParams, } from "./options.js"; export { createWidgetManager, diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/options.ts index a7043fb8fb..8ef35a5960 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/options.ts @@ -4,13 +4,9 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface FooOperationsGetAvatarAsPngOptionalParams - extends OperationOptions { - contentType?: string; -} +export interface FooOperationsGetAvatarAsJpegOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface FooOperationsGetAvatarAsJpegOptionalParams - extends OperationOptions { - contentType?: string; -} +export interface FooOperationsGetAvatarAsPngOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/widgetManagerContext.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/widgetManagerContext.ts index 80b3dfbdf9..efb6eda878 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/widgetManagerContext.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/widgetManagerContext.ts @@ -6,7 +6,11 @@ import { KnownVersions } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { KeyCredential, TokenCredential } from "@azure/core-auth"; -export interface WidgetManagerContext extends Client {} +export interface WidgetManagerContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface WidgetManagerClientOptionalParams extends ClientOptions { @@ -56,5 +60,5 @@ export function createWidgetManager( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as WidgetManagerContext; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts index b321233d9b..0fe429b499 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts @@ -3,38 +3,38 @@ import { WidgetManagerContext } from "../../api/widgetManagerContext.js"; import { - getAvatarAsPng, getAvatarAsJpeg, + getAvatarAsPng, } from "../../api/fooOperations/index.js"; import { - FooOperationsGetAvatarAsPngOptionalParams, FooOperationsGetAvatarAsJpegOptionalParams, + FooOperationsGetAvatarAsPngOptionalParams, } from "../../api/options.js"; /** Interface representing a FooOperations operations. */ export interface FooOperationsOperations { /** A remote procedure call (RPC) operation. */ - getAvatarAsPng: ( + getAvatarAsJpeg: ( image: Uint8Array, - options?: FooOperationsGetAvatarAsPngOptionalParams, + options?: FooOperationsGetAvatarAsJpegOptionalParams, ) => Promise; /** A remote procedure call (RPC) operation. */ - getAvatarAsJpeg: ( + getAvatarAsPng: ( image: Uint8Array, - options?: FooOperationsGetAvatarAsJpegOptionalParams, + options?: FooOperationsGetAvatarAsPngOptionalParams, ) => Promise; } export function getFooOperations(context: WidgetManagerContext) { return { - getAvatarAsPng: ( - image: Uint8Array, - options?: FooOperationsGetAvatarAsPngOptionalParams, - ) => getAvatarAsPng(context, image, options), getAvatarAsJpeg: ( image: Uint8Array, options?: FooOperationsGetAvatarAsJpegOptionalParams, ) => getAvatarAsJpeg(context, image, options), + getAvatarAsPng: ( + image: Uint8Array, + options?: FooOperationsGetAvatarAsPngOptionalParams, + ) => getAvatarAsPng(context, image, options), }; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts index 1d607692c5..dec3753750 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts @@ -4,8 +4,8 @@ export { WidgetManagerClient } from "./widgetManagerClient.js"; export { KnownVersions } from "./models/index.js"; export { - FooOperationsGetAvatarAsPngOptionalParams, FooOperationsGetAvatarAsJpegOptionalParams, + FooOperationsGetAvatarAsPngOptionalParams, WidgetManagerClientOptionalParams, } from "./api/index.js"; export { FooOperationsOperations } from "./classic/index.js"; diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts index af52f2870d..925644a159 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts @@ -4,5 +4,5 @@ /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - "V2022-08-30" = "2022-08-30", + "2022-08-30" = "2022-08-30", } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/widgetManagerClient.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/widgetManagerClient.ts index b3a2a06aca..6ae5b2b9dc 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/widgetManagerClient.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/widgetManagerClient.ts @@ -37,6 +37,6 @@ export class WidgetManagerClient { this.fooOperations = getFooOperationsOperations(this._client); } - /** The operation groups for FooOperations */ + /** The operation groups for fooOperations */ public readonly fooOperations: FooOperationsOperations; } diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts index 01c4c89c3f..865c4d6ba7 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts @@ -24,7 +24,14 @@ export function _listCollectionsSend( ): StreamableMethod { return context .path("/app/collections") - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _listCollectionsDeserialize( diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts index ec4eb1f7da..844be33683 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts @@ -5,7 +5,10 @@ import { logger } from "../logger.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface ParametrizedHostContext extends Client {} +export interface ParametrizedHostContext extends Client { + /** The API version to use for this operation. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface ParametrizedHostClientOptionalParams extends ClientOptions { @@ -56,5 +59,5 @@ export function createParametrizedHost( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as ParametrizedHostContext; } diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts index 16c6763305..fe76fef84e 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts @@ -37,6 +37,6 @@ export class ParametrizedHostClient { this.confidentialLedger = getConfidentialLedgerOperations(this._client); } - /** The operation groups for ConfidentialLedger */ + /** The operation groups for confidentialLedger */ public readonly confidentialLedger: ConfidentialLedgerOperations; } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md index 73f2602824..ee7ac86e36 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md @@ -80,7 +80,7 @@ export interface SchemaOperationsOperations { getSchemaIdByContent: (groupName: string, name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, options?: SchemaOperationsGetSchemaIdByContentOptionalParams) => Promise; listSchemaGroups: (options?: SchemaOperationsListSchemaGroupsOptionalParams) => PagedAsyncIterableIterator; listSchemaVersions: (groupName: string, name: string, options?: SchemaOperationsListSchemaVersionsOptionalParams) => PagedAsyncIterableIterator; - registerSchema: (groupName: string, name: string, contentType: SchemaContentTypeValues, content: Uint8Array, options?: SchemaOperationsRegisterSchemaOptionalParams) => Promise; + registerSchema: (groupName: string, name: string, content: Uint8Array, contentType: SchemaContentTypeValues, options?: SchemaOperationsRegisterSchemaOptionalParams) => Promise; } // @public @@ -98,7 +98,7 @@ export interface SchemaProperties { // @public (undocumented) export class SchemaRegistryClient { - constructor(fullyQualifiedNamespace: string, credential: TokenCredential, options?: SchemaRegistryClientOptionalParams); + constructor(endpointParam: string, credential: TokenCredential, options?: SchemaRegistryClientOptionalParams); readonly pipeline: Pipeline; readonly schemaOperations: SchemaOperationsOperations; } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts index 40c815f457..50953abc14 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts @@ -2,12 +2,12 @@ // Licensed under the MIT License. export { - SchemaOperationsListSchemaGroupsOptionalParams, - SchemaOperationsGetSchemaByIdOptionalParams, - SchemaOperationsListSchemaVersionsOptionalParams, - SchemaOperationsGetSchemaByVersionOptionalParams, - SchemaOperationsGetSchemaIdByContentOptionalParams, SchemaOperationsRegisterSchemaOptionalParams, + SchemaOperationsGetSchemaIdByContentOptionalParams, + SchemaOperationsGetSchemaByVersionOptionalParams, + SchemaOperationsListSchemaVersionsOptionalParams, + SchemaOperationsGetSchemaByIdOptionalParams, + SchemaOperationsListSchemaGroupsOptionalParams, } from "./options.js"; export { createSchemaRegistry, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/options.ts index 0ebd859522..1749b37fe6 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/options.ts @@ -4,25 +4,25 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface SchemaOperationsListSchemaGroupsOptionalParams +export interface SchemaOperationsRegisterSchemaOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface SchemaOperationsGetSchemaByIdOptionalParams +export interface SchemaOperationsGetSchemaIdByContentOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface SchemaOperationsListSchemaVersionsOptionalParams +export interface SchemaOperationsGetSchemaByVersionOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface SchemaOperationsGetSchemaByVersionOptionalParams +export interface SchemaOperationsListSchemaVersionsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface SchemaOperationsGetSchemaIdByContentOptionalParams +export interface SchemaOperationsGetSchemaByIdOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface SchemaOperationsRegisterSchemaOptionalParams +export interface SchemaOperationsListSchemaGroupsOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts index b710d15559..810abe3750 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts @@ -29,119 +29,119 @@ import { createRestError, operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util"; -export function _listSchemaGroupsSend( +export function _registerSchemaSend( context: Client, - options: SchemaOperationsListSchemaGroupsOptionalParams = { + groupName: string, + name: string, + content: Uint8Array, + contentType: SchemaContentTypeValues, + options: SchemaOperationsRegisterSchemaOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/$schemaGroups") - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/$schemaGroups/{groupName}/schemas/{name}", groupName, name) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: contentType, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: content, + }); } -export async function _listSchemaGroupsDeserialize( +export async function _registerSchemaDeserialize( result: PathUncheckedResponse, -): Promise<_PagedSchemaGroup> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedSchemaGroupDeserializer(result.body); + return; } -/** Gets the list of schema groups user is authorized to access. */ -export function listSchemaGroups( +/** Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. */ +export async function registerSchema( context: Client, - options: SchemaOperationsListSchemaGroupsOptionalParams = { + groupName: string, + name: string, + content: Uint8Array, + contentType: SchemaContentTypeValues, + options: SchemaOperationsRegisterSchemaOptionalParams = { requestOptions: {}, }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( +): Promise { + const result = await _registerSchemaSend( context, - () => _listSchemaGroupsSend(context, options), - _listSchemaGroupsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, + groupName, + name, + content, + contentType, + options, ); + return _registerSchemaDeserialize(result); } -export function _getSchemaByIdSend( - context: Client, - id: string, - options: SchemaOperationsGetSchemaByIdOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/$schemaGroups/$schemas/{id}", id) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _getSchemaByIdDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return typeof result.body === "string" - ? stringToUint8Array(result.body, "base64") - : result.body; -} - -/** Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. */ -export async function getSchemaById( - context: Client, - id: string, - options: SchemaOperationsGetSchemaByIdOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSchemaByIdSend(context, id, options); - return _getSchemaByIdDeserialize(result); -} - -export function _listSchemaVersionsSend( +export function _getSchemaIdByContentSend( context: Client, groupName: string, name: string, - options: SchemaOperationsListSchemaVersionsOptionalParams = { + contentType: SchemaContentTypeValues, + schemaContent: Uint8Array, + options: SchemaOperationsGetSchemaIdByContentOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/$schemaGroups/{groupName}/schemas/{name}/versions", groupName, name) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/$schemaGroups/{groupName}/schemas/{name}:get-id", groupName, name) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: contentType, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: schemaContent, + }); } -export async function _listSchemaVersionsDeserialize( +export async function _getSchemaIdByContentDeserialize( result: PathUncheckedResponse, -): Promise<_PagedVersion> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _pagedVersionDeserializer(result.body); + return; } -/** Gets the list of all versions of one schema. */ -export function listSchemaVersions( +/** Gets the ID referencing an existing schema within the specified schema group, as matched by schema content comparison. */ +export async function getSchemaIdByContent( context: Client, groupName: string, name: string, - options: SchemaOperationsListSchemaVersionsOptionalParams = { + contentType: SchemaContentTypeValues, + schemaContent: Uint8Array, + options: SchemaOperationsGetSchemaIdByContentOptionalParams = { requestOptions: {}, }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( +): Promise { + const result = await _getSchemaIdByContentSend( context, - () => _listSchemaVersionsSend(context, groupName, name, options), - _listSchemaVersionsDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, + groupName, + name, + contentType, + schemaContent, + options, ); + return _getSchemaIdByContentDeserialize(result); } export function _getSchemaByVersionSend( @@ -160,7 +160,10 @@ export function _getSchemaByVersionSend( name, schemaVersion, ) - .get({ ...operationOptionsToRequestParameters(options) }); + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { "api-version": context.apiVersion }, + }); } export async function _getSchemaByVersionDeserialize( @@ -171,9 +174,7 @@ export async function _getSchemaByVersionDeserialize( throw createRestError(result); } - return typeof result.body === "string" - ? stringToUint8Array(result.body, "base64") - : result.body; + return result.body; } /** Gets one specific version of one schema. */ @@ -196,106 +197,130 @@ export async function getSchemaByVersion( return _getSchemaByVersionDeserialize(result); } -export function _getSchemaIdByContentSend( +export function _listSchemaVersionsSend( context: Client, groupName: string, name: string, - contentType: SchemaContentTypeValues, - schemaContent: Uint8Array, - options: SchemaOperationsGetSchemaIdByContentOptionalParams = { + options: SchemaOperationsListSchemaVersionsOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/$schemaGroups/{groupName}/schemas/{name}:get-id", groupName, name) - .post({ + .path("/$schemaGroups/{groupName}/schemas/{name}/versions", groupName, name) + .get({ ...operationOptionsToRequestParameters(options), - contentType: contentType, - body: uint8ArrayToString(schemaContent, "base64"), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _getSchemaIdByContentDeserialize( +export async function _listSchemaVersionsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise<_PagedVersion> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _pagedVersionDeserializer(result.body); } -/** Gets the ID referencing an existing schema within the specified schema group, as matched by schema content comparison. */ -export async function getSchemaIdByContent( +/** Gets the list of all versions of one schema. */ +export function listSchemaVersions( context: Client, groupName: string, name: string, - contentType: SchemaContentTypeValues, - schemaContent: Uint8Array, - options: SchemaOperationsGetSchemaIdByContentOptionalParams = { + options: SchemaOperationsListSchemaVersionsOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _getSchemaIdByContentSend( +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - groupName, - name, - contentType, - schemaContent, - options, + () => _listSchemaVersionsSend(context, groupName, name, options), + _listSchemaVersionsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, ); - return _getSchemaIdByContentDeserialize(result); } -export function _registerSchemaSend( +export function _getSchemaByIdSend( context: Client, - groupName: string, - name: string, - contentType: SchemaContentTypeValues, - content: Uint8Array, - options: SchemaOperationsRegisterSchemaOptionalParams = { + id: string, + options: SchemaOperationsGetSchemaByIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/$schemaGroups/$schemas/{id}", id) + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _getSchemaByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return result.body; +} + +/** Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. */ +export async function getSchemaById( + context: Client, + id: string, + options: SchemaOperationsGetSchemaByIdOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSchemaByIdSend(context, id, options); + return _getSchemaByIdDeserialize(result); +} + +export function _listSchemaGroupsSend( + context: Client, + options: SchemaOperationsListSchemaGroupsOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/$schemaGroups/{groupName}/schemas/{name}", groupName, name) - .put({ + .path("/$schemaGroups") + .get({ ...operationOptionsToRequestParameters(options), - contentType: contentType, - body: uint8ArrayToString(content, "base64"), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, }); } -export async function _registerSchemaDeserialize( +export async function _listSchemaGroupsDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise<_PagedSchemaGroup> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _pagedSchemaGroupDeserializer(result.body); } -/** Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. */ -export async function registerSchema( +/** Gets the list of schema groups user is authorized to access. */ +export function listSchemaGroups( context: Client, - groupName: string, - name: string, - contentType: SchemaContentTypeValues, - content: Uint8Array, - options: SchemaOperationsRegisterSchemaOptionalParams = { + options: SchemaOperationsListSchemaGroupsOptionalParams = { requestOptions: {}, }, -): Promise { - const result = await _registerSchemaSend( +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( context, - groupName, - name, - contentType, - content, - options, + () => _listSchemaGroupsSend(context, options), + _listSchemaGroupsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, ); - return _registerSchemaDeserialize(result); } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaRegistryContext.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaRegistryContext.ts index e3990f380e..81ce18cfbc 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaRegistryContext.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaRegistryContext.ts @@ -7,7 +7,11 @@ import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; /** SchemaRegistryClient is a client for registering and retrieving schemas from the Azure Schema Registry service. */ -export interface SchemaRegistryContext extends Client {} +export interface SchemaRegistryContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownServiceApiVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface SchemaRegistryClientOptionalParams extends ClientOptions { @@ -18,12 +22,12 @@ export interface SchemaRegistryClientOptionalParams extends ClientOptions { /** SchemaRegistryClient is a client for registering and retrieving schemas from the Azure Schema Registry service. */ export function createSchemaRegistry( - fullyQualifiedNamespace: string, + endpointParam: string, credential: TokenCredential, options: SchemaRegistryClientOptionalParams = {}, ): SchemaRegistryContext { const endpointUrl = - options.endpoint ?? options.baseUrl ?? `${fullyQualifiedNamespace}`; + options.endpoint ?? options.baseUrl ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-schema-registry/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions @@ -57,5 +61,5 @@ export function createSchemaRegistry( return next(req); }, }); - return clientContext; + return { ...clientContext, apiVersion } as SchemaRegistryContext; } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts index 75322c6473..bf3ee8e35c 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts @@ -3,12 +3,12 @@ import { SchemaRegistryContext } from "../../api/schemaRegistryContext.js"; import { - listSchemaGroups, - getSchemaById, - listSchemaVersions, - getSchemaByVersion, - getSchemaIdByContent, registerSchema, + getSchemaIdByContent, + getSchemaByVersion, + listSchemaVersions, + getSchemaById, + listSchemaGroups, } from "../../api/schemaOperations/index.js"; import { SchemaGroup, @@ -17,38 +17,24 @@ import { } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { - SchemaOperationsListSchemaGroupsOptionalParams, - SchemaOperationsGetSchemaByIdOptionalParams, - SchemaOperationsListSchemaVersionsOptionalParams, - SchemaOperationsGetSchemaByVersionOptionalParams, - SchemaOperationsGetSchemaIdByContentOptionalParams, SchemaOperationsRegisterSchemaOptionalParams, + SchemaOperationsGetSchemaIdByContentOptionalParams, + SchemaOperationsGetSchemaByVersionOptionalParams, + SchemaOperationsListSchemaVersionsOptionalParams, + SchemaOperationsGetSchemaByIdOptionalParams, + SchemaOperationsListSchemaGroupsOptionalParams, } from "../../api/options.js"; /** Interface representing a SchemaOperations operations. */ export interface SchemaOperationsOperations { - /** Gets the list of schema groups user is authorized to access. */ - listSchemaGroups: ( - options?: SchemaOperationsListSchemaGroupsOptionalParams, - ) => PagedAsyncIterableIterator; - /** Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. */ - getSchemaById: ( - id: string, - options?: SchemaOperationsGetSchemaByIdOptionalParams, - ) => Promise; - /** Gets the list of all versions of one schema. */ - listSchemaVersions: ( - groupName: string, - name: string, - options?: SchemaOperationsListSchemaVersionsOptionalParams, - ) => PagedAsyncIterableIterator; - /** Gets one specific version of one schema. */ - getSchemaByVersion: ( + /** Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. */ + registerSchema: ( groupName: string, name: string, - schemaVersion: number, - options?: SchemaOperationsGetSchemaByVersionOptionalParams, - ) => Promise; + content: Uint8Array, + contentType: SchemaContentTypeValues, + options?: SchemaOperationsRegisterSchemaOptionalParams, + ) => Promise; /** Gets the ID referencing an existing schema within the specified schema group, as matched by schema content comparison. */ getSchemaIdByContent: ( groupName: string, @@ -57,36 +43,40 @@ export interface SchemaOperationsOperations { schemaContent: Uint8Array, options?: SchemaOperationsGetSchemaIdByContentOptionalParams, ) => Promise; - /** Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. */ - registerSchema: ( + /** Gets one specific version of one schema. */ + getSchemaByVersion: ( groupName: string, name: string, - contentType: SchemaContentTypeValues, - content: Uint8Array, - options?: SchemaOperationsRegisterSchemaOptionalParams, - ) => Promise; + schemaVersion: number, + options?: SchemaOperationsGetSchemaByVersionOptionalParams, + ) => Promise; + /** Gets the list of all versions of one schema. */ + listSchemaVersions: ( + groupName: string, + name: string, + options?: SchemaOperationsListSchemaVersionsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. */ + getSchemaById: ( + id: string, + options?: SchemaOperationsGetSchemaByIdOptionalParams, + ) => Promise; + /** Gets the list of schema groups user is authorized to access. */ + listSchemaGroups: ( + options?: SchemaOperationsListSchemaGroupsOptionalParams, + ) => PagedAsyncIterableIterator; } export function getSchemaOperations(context: SchemaRegistryContext) { return { - listSchemaGroups: ( - options?: SchemaOperationsListSchemaGroupsOptionalParams, - ) => listSchemaGroups(context, options), - getSchemaById: ( - id: string, - options?: SchemaOperationsGetSchemaByIdOptionalParams, - ) => getSchemaById(context, id, options), - listSchemaVersions: ( - groupName: string, - name: string, - options?: SchemaOperationsListSchemaVersionsOptionalParams, - ) => listSchemaVersions(context, groupName, name, options), - getSchemaByVersion: ( + registerSchema: ( groupName: string, name: string, - schemaVersion: number, - options?: SchemaOperationsGetSchemaByVersionOptionalParams, - ) => getSchemaByVersion(context, groupName, name, schemaVersion, options), + content: Uint8Array, + contentType: SchemaContentTypeValues, + options?: SchemaOperationsRegisterSchemaOptionalParams, + ) => + registerSchema(context, groupName, name, content, contentType, options), getSchemaIdByContent: ( groupName: string, name: string, @@ -102,14 +92,24 @@ export function getSchemaOperations(context: SchemaRegistryContext) { schemaContent, options, ), - registerSchema: ( + getSchemaByVersion: ( groupName: string, name: string, - contentType: SchemaContentTypeValues, - content: Uint8Array, - options?: SchemaOperationsRegisterSchemaOptionalParams, - ) => - registerSchema(context, groupName, name, contentType, content, options), + schemaVersion: number, + options?: SchemaOperationsGetSchemaByVersionOptionalParams, + ) => getSchemaByVersion(context, groupName, name, schemaVersion, options), + listSchemaVersions: ( + groupName: string, + name: string, + options?: SchemaOperationsListSchemaVersionsOptionalParams, + ) => listSchemaVersions(context, groupName, name, options), + getSchemaById: ( + id: string, + options?: SchemaOperationsGetSchemaByIdOptionalParams, + ) => getSchemaById(context, id, options), + listSchemaGroups: ( + options?: SchemaOperationsListSchemaGroupsOptionalParams, + ) => listSchemaGroups(context, options), }; } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts index 660a47371d..0312e63491 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts @@ -19,12 +19,12 @@ export { ContentTypeEnum, } from "./models/index.js"; export { - SchemaOperationsListSchemaGroupsOptionalParams, - SchemaOperationsGetSchemaByIdOptionalParams, - SchemaOperationsListSchemaVersionsOptionalParams, - SchemaOperationsGetSchemaByVersionOptionalParams, - SchemaOperationsGetSchemaIdByContentOptionalParams, SchemaOperationsRegisterSchemaOptionalParams, + SchemaOperationsGetSchemaIdByContentOptionalParams, + SchemaOperationsGetSchemaByVersionOptionalParams, + SchemaOperationsListSchemaVersionsOptionalParams, + SchemaOperationsGetSchemaByIdOptionalParams, + SchemaOperationsListSchemaGroupsOptionalParams, SchemaRegistryClientOptionalParams, } from "./api/index.js"; export { SchemaOperationsOperations } from "./classic/index.js"; diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/schemaRegistryClient.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/schemaRegistryClient.ts index 51a9895f01..acd2227947 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/schemaRegistryClient.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/schemaRegistryClient.ts @@ -22,7 +22,7 @@ export class SchemaRegistryClient { /** SchemaRegistryClient is a client for registering and retrieving schemas from the Azure Schema Registry service. */ constructor( - fullyQualifiedNamespace: string, + endpointParam: string, credential: TokenCredential, options: SchemaRegistryClientOptionalParams = {}, ) { @@ -30,7 +30,7 @@ export class SchemaRegistryClient { const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` : `azsdk-js-client`; - this._client = createSchemaRegistry(fullyQualifiedNamespace, credential, { + this._client = createSchemaRegistry(endpointParam, credential, { ...options, userAgentOptions: { userAgentPrefix }, }); @@ -38,6 +38,6 @@ export class SchemaRegistryClient { this.schemaOperations = getSchemaOperationsOperations(this._client); } - /** The operation groups for SchemaOperations */ + /** The operation groups for schemaOperations */ public readonly schemaOperations: SchemaOperationsOperations; } diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/spread/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/spread/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/a/index.ts b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/a/index.ts index 97e4919687..d4cbdf16a9 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/a/index.ts +++ b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/a/index.ts @@ -19,22 +19,23 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _test1Send( +export function _test4Send( context: Client, - a: string, - b: string, - c: string, - options: ATest1OptionalParams = { requestOptions: {} }, + body: { + prop: string; + }, + options: ATest4OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test1") + .path("/test4") .post({ ...operationOptionsToRequestParameters(options), - body: { a: a, b: b, c: c }, + contentType: "application/json", + body: _test4RequestSerializer(body), }); } -export async function _test1Deserialize( +export async function _test4Deserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -45,31 +46,34 @@ export async function _test1Deserialize( return; } -export async function test1( +export async function test4( context: Client, - a: string, - b: string, - c: string, - options: ATest1OptionalParams = { requestOptions: {} }, + body: { + prop: string; + }, + options: ATest4OptionalParams = { requestOptions: {} }, ): Promise { - const result = await _test1Send(context, a, b, c, options); - return _test1Deserialize(result); + const result = await _test4Send(context, body, options); + return _test4Deserialize(result); } -export function _test2Send( +export function _test3Send( context: Client, - prop: string, - options: ATest2OptionalParams = { requestOptions: {} }, + body: { + prop: string; + }, + options: ATest3OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test2") + .path("/test3") .post({ ...operationOptionsToRequestParameters(options), - body: { prop: prop }, + contentType: "application/json", + body: _test3RequestSerializer(body), }); } -export async function _test2Deserialize( +export async function _test3Deserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -80,31 +84,32 @@ export async function _test2Deserialize( return; } -export async function test2( - context: Client, - prop: string, - options: ATest2OptionalParams = { requestOptions: {} }, -): Promise { - const result = await _test2Send(context, prop, options); - return _test2Deserialize(result); -} - -export function _test3Send( +export async function test3( context: Client, body: { prop: string; }, options: ATest3OptionalParams = { requestOptions: {} }, +): Promise { + const result = await _test3Send(context, body, options); + return _test3Deserialize(result); +} + +export function _test2Send( + context: Client, + prop: string, + options: ATest2OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test3") + .path("/test2") .post({ ...operationOptionsToRequestParameters(options), - body: _test3RequestSerializer(body), + contentType: "application/json", + body: { prop: prop }, }); } -export async function _test3Deserialize( +export async function _test2Deserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -115,33 +120,32 @@ export async function _test3Deserialize( return; } -export async function test3( +export async function test2( context: Client, - body: { - prop: string; - }, - options: ATest3OptionalParams = { requestOptions: {} }, + prop: string, + options: ATest2OptionalParams = { requestOptions: {} }, ): Promise { - const result = await _test3Send(context, body, options); - return _test3Deserialize(result); + const result = await _test2Send(context, prop, options); + return _test2Deserialize(result); } -export function _test4Send( +export function _test1Send( context: Client, - body: { - prop: string; - }, - options: ATest4OptionalParams = { requestOptions: {} }, + a: string, + b: string, + c: string, + options: ATest1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/test4") + .path("/test1") .post({ ...operationOptionsToRequestParameters(options), - body: _test4RequestSerializer(body), + contentType: "application/json", + body: { a: a, b: b, c: c }, }); } -export async function _test4Deserialize( +export async function _test1Deserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -152,13 +156,13 @@ export async function _test4Deserialize( return; } -export async function test4( +export async function test1( context: Client, - body: { - prop: string; - }, - options: ATest4OptionalParams = { requestOptions: {} }, + a: string, + b: string, + c: string, + options: ATest1OptionalParams = { requestOptions: {} }, ): Promise { - const result = await _test4Send(context, body, options); - return _test4Deserialize(result); + const result = await _test1Send(context, a, b, c, options); + return _test1Deserialize(result); } diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/demoServiceContext.ts b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/demoServiceContext.ts index aab8578bd7..206a6d7d53 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/demoServiceContext.ts +++ b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/demoServiceContext.ts @@ -13,6 +13,8 @@ export function createDemoService( endpointParam: string, options: DemoServiceClientOptionalParams = {}, ): DemoServiceContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-spread/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions @@ -23,11 +25,7 @@ export function createDemoService( userAgentOptions: { userAgentPrefix }, loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, }; - const clientContext = getClient( - options.endpoint ?? options.baseUrl ?? String(endpointParam), - undefined, - updatedOptions, - ); + const clientContext = getClient(endpointUrl, undefined, updatedOptions); clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); if (options.apiVersion) { logger.warning( diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/index.ts index a17e02a052..161ce3ac82 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/index.ts @@ -7,8 +7,8 @@ export { DemoServiceClientOptionalParams, } from "./demoServiceContext.js"; export { - ATest1OptionalParams, - ATest2OptionalParams, - ATest3OptionalParams, ATest4OptionalParams, + ATest3OptionalParams, + ATest2OptionalParams, + ATest1OptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/options.ts index fd9fdadb12..1b6c30253a 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/spread/generated/typespec-ts/src/api/options.ts @@ -4,13 +4,13 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface ATest1OptionalParams extends OperationOptions {} +export interface ATest4OptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ATest2OptionalParams extends OperationOptions {} +export interface ATest3OptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ATest3OptionalParams extends OperationOptions {} +export interface ATest2OptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ATest4OptionalParams extends OperationOptions {} +export interface ATest1OptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/src/classic/a/index.ts b/packages/typespec-test/test/spread/generated/typespec-ts/src/classic/a/index.ts index bf9e266999..4ff35f4960 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/src/classic/a/index.ts +++ b/packages/typespec-test/test/spread/generated/typespec-ts/src/classic/a/index.ts @@ -2,55 +2,55 @@ // Licensed under the MIT License. import { DemoServiceContext } from "../../api/demoServiceContext.js"; -import { test1, test2, test3, test4 } from "../../api/a/index.js"; +import { test4, test3, test2, test1 } from "../../api/a/index.js"; import { - ATest1OptionalParams, - ATest2OptionalParams, - ATest3OptionalParams, ATest4OptionalParams, + ATest3OptionalParams, + ATest2OptionalParams, + ATest1OptionalParams, } from "../../api/options.js"; /** Interface representing a A operations. */ export interface AOperations { - test1: ( - a: string, - b: string, - c: string, - options?: ATest1OptionalParams, - ) => Promise; - test2: (prop: string, options?: ATest2OptionalParams) => Promise; - test3: ( + test4: ( body: { prop: string; }, - options?: ATest3OptionalParams, + options?: ATest4OptionalParams, ) => Promise; - test4: ( + test3: ( body: { prop: string; }, - options?: ATest4OptionalParams, + options?: ATest3OptionalParams, + ) => Promise; + test2: (prop: string, options?: ATest2OptionalParams) => Promise; + test1: ( + a: string, + b: string, + c: string, + options?: ATest1OptionalParams, ) => Promise; } export function getA(context: DemoServiceContext) { return { - test1: (a: string, b: string, c: string, options?: ATest1OptionalParams) => - test1(context, a, b, c, options), - test2: (prop: string, options?: ATest2OptionalParams) => - test2(context, prop, options), - test3: ( - body: { - prop: string; - }, - options?: ATest3OptionalParams, - ) => test3(context, body, options), test4: ( body: { prop: string; }, options?: ATest4OptionalParams, ) => test4(context, body, options), + test3: ( + body: { + prop: string; + }, + options?: ATest3OptionalParams, + ) => test3(context, body, options), + test2: (prop: string, options?: ATest2OptionalParams) => + test2(context, prop, options), + test1: (a: string, b: string, c: string, options?: ATest1OptionalParams) => + test1(context, a, b, c, options), }; } diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/src/demoServiceClient.ts b/packages/typespec-test/test/spread/generated/typespec-ts/src/demoServiceClient.ts index 2465ae3633..b7281c3bb4 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/src/demoServiceClient.ts +++ b/packages/typespec-test/test/spread/generated/typespec-ts/src/demoServiceClient.ts @@ -32,6 +32,6 @@ export class DemoServiceClient { this.a = getAOperations(this._client); } - /** The operation groups for A */ + /** The operation groups for a */ public readonly a: AOperations; } diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/spread/generated/typespec-ts/src/index.ts index c2ef03828c..bd937a353c 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/spread/generated/typespec-ts/src/index.ts @@ -4,9 +4,9 @@ export { DemoServiceClient } from "./demoServiceClient.js"; export { DemoServiceClientOptionalParams, - ATest1OptionalParams, - ATest2OptionalParams, - ATest3OptionalParams, ATest4OptionalParams, + ATest3OptionalParams, + ATest2OptionalParams, + ATest1OptionalParams, } from "./api/index.js"; export { AOperations } from "./classic/index.js"; diff --git a/packages/typespec-test/test/todo_non_branded/generated/openapi/openapi.json b/packages/typespec-test/test/todo_non_branded/generated/openapi/openapi.json index e749bb9762..eac5b5010a 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/openapi/openapi.json +++ b/packages/typespec-test/test/todo_non_branded/generated/openapi/openapi.json @@ -6,40 +6,6 @@ }, "tags": [], "paths": { - "/forgot-password": { - "post": { - "operationId": "Users_forgotPassword", - "description": "Sends a reset token to the user's email address", - "parameters": [], - "responses": { - "200": { - "description": "The request has succeeded." - }, - "404": { - "description": "The server cannot find the requested resource." - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "email": { - "type": "string", - "description": "The user's email address" - } - }, - "required": [ - "email" - ] - } - } - } - } - } - }, "/items": { "get": { "operationId": "TodoItems_list", @@ -61,11 +27,31 @@ } } } + }, + "4XX": { + "description": "Something is wrong with you.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard4XXResponse" + } + } + } + }, + "5XX": { + "description": "Something is wrong with me.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard5XXResponse" + } + } + } } } }, "post": { - "operationId": "TodoItems_createJson_TodoItems_createForm", + "operationId": "TodoItems_create", "parameters": [], "responses": { "200": { @@ -87,6 +73,26 @@ } } } + }, + "4XX": { + "description": "Something is wrong with you.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard4XXResponse" + } + } + } + }, + "5XX": { + "description": "Something is wrong with me.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard5XXResponse" + } + } + } } }, "requestBody": { @@ -97,40 +103,12 @@ "type": "object", "properties": { "item": { - "$ref": "#/components/schemas/TodoItem" - }, - "attachments": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TodoUrlAttachment" - } - } - }, - "required": [ - "item", - "attachments" - ] - } - }, - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "item": { - "$ref": "#/components/schemas/TodoItem" + "$ref": "#/components/schemas/TodoItemCreate" }, "attachments": { "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/TodoUrlAttachment" - }, - { - "type": "string", - "format": "byte" - } - ] + "$ref": "#/components/schemas/TodoAttachment" } } }, @@ -153,7 +131,8 @@ "required": true, "schema": { "type": "integer", - "format": "int64" + "format": "int64", + "readOnly": true } } ], @@ -169,7 +148,14 @@ } }, "404": { - "description": "The server cannot find the requested resource." + "description": "The server cannot find the requested resource.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TodoItems.NotFoundErrorResponse" + } + } + } } } }, @@ -182,7 +168,8 @@ "required": true, "schema": { "type": "integer", - "format": "int64" + "format": "int64", + "readOnly": true } } ], @@ -203,12 +190,7 @@ "content": { "application/merge-patch+json": { "schema": { - "type": "object", - "properties": { - "patch": { - "$ref": "#/components/schemas/TodoItems.TodoItemPatch" - } - } + "$ref": "#/components/schemas/TodoItems.TodoItemPatch" } } } @@ -223,16 +205,44 @@ "required": true, "schema": { "type": "integer", - "format": "int64" + "format": "int64", + "readOnly": true } } ], "responses": { - "200": { - "description": "The request has succeeded." + "204": { + "description": "There is no content to send for this request, but the headers may be useful." }, "404": { - "description": "The server cannot find the requested resource." + "description": "The server cannot find the requested resource.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TodoItems.NotFoundErrorResponse" + } + } + } + }, + "4XX": { + "description": "Something is wrong with you.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard4XXResponse" + } + } + } + }, + "5XX": { + "description": "Something is wrong with me.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard5XXResponse" + } + } + } } } } @@ -247,7 +257,8 @@ "required": true, "schema": { "type": "integer", - "format": "int64" + "format": "int64", + "readOnly": true } } ], @@ -257,21 +268,56 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TodoAttachment" + "type": "object", + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TodoAttachment" + } + } } } } } }, "404": { - "description": "The server cannot find the requested resource." + "description": "The server cannot find the requested resource.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TodoItems.NotFoundErrorResponse" + } + } + } + }, + "4XX": { + "description": "Something is wrong with you.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard4XXResponse" + } + } + } + }, + "5XX": { + "description": "Something is wrong with me.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard5XXResponse" + } + } + } } } }, "post": { - "operationId": "Attachments_createUrlAttachment_Attachments_createFileAttachment", + "operationId": "Attachments_createAttachment", "parameters": [ { "name": "itemId", @@ -279,62 +325,44 @@ "required": true, "schema": { "type": "integer", - "format": "int64" + "format": "int64", + "readOnly": true } } ], "responses": { - "200": { - "description": "The request has succeeded." + "204": { + "description": "There is no content to send for this request, but the headers may be useful." }, "404": { - "description": "The server cannot find the requested resource." - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "contents": { - "$ref": "#/components/schemas/TodoUrlAttachment" - } - }, - "required": [ - "contents" - ] + "description": "The server cannot find the requested resource.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TodoItems.NotFoundErrorResponse" + } } - }, - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "contents": { - "type": "string", - "format": "binary" - } - }, - "required": [ - "contents" - ] + } + }, + "4XX": { + "description": "Something is wrong with you.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard4XXResponse" + } } } - } - } - } - }, - "/login": { - "post": { - "operationId": "Users_login", - "parameters": [], - "responses": { - "200": { - "description": "The request has succeeded." }, - "401": { - "description": "Access is unauthorized." + "5XX": { + "description": "Something is wrong with me.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard5XXResponse" + } + } + } } }, "requestBody": { @@ -342,63 +370,13 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "username": { - "type": "string", - "maxLength": 50, - "description": "The user's username" - }, - "password": { - "type": "string", - "description": "The user's password, provided when creating a user\nbut is otherwise not visible (and hashed by the backend)" - } - }, - "required": [ - "username", - "password" - ] + "$ref": "#/components/schemas/TodoAttachment" } } } } } }, - "/logout": { - "get": { - "operationId": "Users_logout", - "parameters": [], - "responses": { - "200": { - "description": "The request has succeeded." - } - } - } - }, - "/reset-password": { - "get": { - "operationId": "Users_resetPassword", - "parameters": [ - { - "name": "resetToken", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "explode": false - } - ], - "responses": { - "200": { - "description": "The request has succeeded." - }, - "404": { - "description": "The server cannot find the requested resource." - } - } - } - }, "/users": { "post": { "operationId": "Users_create", @@ -433,63 +411,50 @@ } } } - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "user": { - "$ref": "#/components/schemas/User" - } - }, - "required": [ - "user" - ] + }, + "4XX": { + "description": "Something is wrong with you.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Standard4XXResponse" + } } } - } - } - } - }, - "/validate": { - "get": { - "operationId": "Users_validate", - "parameters": [ - { - "name": "token", - "in": "query", - "required": true, - "schema": { - "type": "string" - }, - "explode": false - } - ], - "responses": { - "200": { - "description": "The request has succeeded." }, - "422": { - "description": "The user is invalid (e.g. forgot to enter email address)", + "5XX": { + "description": "Something is wrong with me.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Users.InvalidUserResponse" + "$ref": "#/components/schemas/Standard5XXResponse" } } } } - } + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "security": [ + {} + ] } } }, "security": [ { "BearerAuth": [] + }, + { + "ApiKeyAuth": [] } ], "components": { @@ -497,7 +462,7 @@ "TodoItems.PaginationControls.limit": { "name": "limit", "in": "query", - "required": true, + "required": false, "description": "The limit to the number of items", "schema": { "type": "integer", @@ -509,7 +474,7 @@ "TodoItems.PaginationControls.offset": { "name": "offset", "in": "query", - "required": true, + "required": false, "description": "The offset to start paginating at", "schema": { "type": "integer", @@ -520,7 +485,7 @@ } }, "schemas": { - "Error": { + "ApiError": { "type": "object", "required": [ "code", @@ -533,10 +498,29 @@ }, "message": { "type": "string", - "description": "A human readable message" + "description": "A human readable message", + "x-ms-primary-error-message": true } } }, + "Standard4XXResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ApiError" + } + ], + "description": "Something is wrong with you." + }, + "Standard5XXResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ApiError" + } + ], + "description": "Something is wrong with me." + }, "TodoAttachment": { "anyOf": [ { @@ -550,17 +534,11 @@ "TodoFileAttachment": { "type": "object", "required": [ - "todoItemId", "filename", "mediaType", - "url" + "contents" ], "properties": { - "todoItemId": { - "type": "integer", - "format": "int64", - "description": "The todo item this is attached to" - }, "filename": { "type": "string", "maxLength": 255, @@ -570,10 +548,10 @@ "type": "string", "description": "The media type of the attachment" }, - "url": { + "contents": { "type": "string", - "format": "uri", - "description": "The url where the attachment can be downloaded from" + "format": "byte", + "description": "The contents of the file" } } }, @@ -583,19 +561,16 @@ "id", "title", "createdBy", - "ownedBy", - "description", "status", "createdAt", - "updatedAt", - "completedAt", - "labels" + "updatedAt" ], "properties": { "id": { "type": "integer", "format": "int64", - "description": "The item's unique id" + "description": "The item's unique id", + "readOnly": true }, "title": { "type": "string", @@ -608,7 +583,7 @@ "description": "User that created the todo", "readOnly": true }, - "ownedBy": { + "assignedTo": { "type": "integer", "format": "int64", "description": "User that the todo is assigned to", @@ -646,10 +621,46 @@ "readOnly": true }, "labels": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TodoLabel" - } + "$ref": "#/components/schemas/TodoLabels" + } + } + }, + "TodoItemCreate": { + "type": "object", + "required": [ + "title", + "status" + ], + "properties": { + "title": { + "type": "string", + "maxLength": 255, + "description": "The item's title" + }, + "assignedTo": { + "type": "integer", + "format": "int64", + "description": "User that the todo is assigned to", + "readOnly": true + }, + "description": { + "type": "string", + "description": "A longer description of the todo item in markdown format" + }, + "status": { + "type": "string", + "enum": [ + "NotStarted", + "InProgress", + "Completed" + ], + "description": "The status of the todo item" + }, + "labels": { + "$ref": "#/components/schemas/TodoLabels" + }, + "_dummy": { + "type": "string" } } }, @@ -657,10 +668,24 @@ "type": "object", "allOf": [ { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/ApiError" } ] }, + "TodoItems.NotFoundErrorResponse": { + "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "type": "string", + "enum": [ + "not-found" + ] + } + } + }, "TodoItems.TodoItemPatch": { "type": "object", "properties": { @@ -669,15 +694,17 @@ "maxLength": 255, "description": "The item's title" }, - "ownedBy": { + "assignedTo": { "type": "integer", "format": "int64", "description": "User that the todo is assigned to", - "readOnly": true + "readOnly": true, + "nullable": true }, "description": { "type": "string", - "description": "A longer description of the todo item in markdown format" + "description": "A longer description of the todo item in markdown format", + "nullable": true }, "status": { "type": "string", @@ -694,7 +721,8 @@ "type": "object", "required": [ "items", - "pagination" + "pageSize", + "totalSize" ], "properties": { "items": { @@ -704,52 +732,56 @@ }, "description": "The items in the page" }, - "pagination": { - "type": "object", - "properties": { - "pageSize": { - "type": "integer", - "format": "int32", - "description": "The number of items returned in this page" - }, - "totalSize": { - "type": "integer", - "format": "int32", - "description": "The total number of items" - }, - "limit": { - "type": "integer", - "format": "int32", - "description": "The limit to the number of items", - "default": 50 - }, - "offset": { - "type": "integer", - "format": "int32", - "description": "The offset to start paginating at", - "default": 0 - }, - "prevLink": { - "type": "string", - "format": "uri", - "description": "A link to the previous page, if it exists" - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "A link to the next page, if it exists" - } - }, - "required": [ - "pageSize", - "totalSize", - "limit", - "offset" - ] + "pageSize": { + "type": "integer", + "format": "int32", + "description": "The number of items returned in this page" + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of items" + }, + "limit": { + "type": "integer", + "format": "int32", + "description": "The limit to the number of items", + "default": 50 + }, + "offset": { + "type": "integer", + "format": "int32", + "description": "The offset to start paginating at", + "default": 0 + }, + "prevLink": { + "type": "string", + "format": "uri", + "description": "A link to the previous page, if it exists" + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "A link to the next page, if it exists" } } }, - "TodoLabel": { + "TodoLabelRecord": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "color": { + "type": "string", + "pattern": "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$" + } + } + }, + "TodoLabels": { "anyOf": [ { "type": "string" @@ -771,20 +803,6 @@ } ] }, - "TodoLabelRecord": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "color": { - "type": "string" - } - } - }, "TodoUrlAttachment": { "type": "object", "required": [ @@ -813,6 +831,7 @@ "properties": { "username": { "type": "string", + "minLength": 2, "maxLength": 50, "description": "The user's username" }, @@ -828,9 +847,20 @@ }, "Users.InvalidUserResponse": { "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "type": "string", + "enum": [ + "invalid-user" + ] + } + }, "allOf": [ { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/ApiError" } ], "description": "The user is invalid (e.g. forgot to enter email address)" @@ -852,6 +882,7 @@ }, "username": { "type": "string", + "minLength": 2, "maxLength": 50, "description": "The user's username" }, @@ -867,9 +898,20 @@ }, "Users.UserExistsResponse": { "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "type": "string", + "enum": [ + "user-exists" + ] + } + }, "allOf": [ { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/ApiError" } ], "description": "The user already exists" @@ -879,6 +921,11 @@ "BearerAuth": { "type": "http", "scheme": "bearer" + }, + "ApiKeyAuth": { + "type": "apiKey", + "in": "cookie", + "name": "session-id" } } } diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/README.md b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/README.md index 806c22047c..93044c2e75 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/README.md @@ -1,4 +1,4 @@ -# Todo REST client library for JavaScript +# Todo client library for JavaScript @@ -14,7 +14,7 @@ Key links: ### Install the `@notabrand/todo-non-branded` package -Install the Todo REST client library for JavaScript with `npm`: +Install the Todo client library for JavaScript with `npm`: ```bash npm install @notabrand/todo-non-branded diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json index f673672761..37245a51f3 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json @@ -10,7 +10,12 @@ "tshy": { "exports": { "./package.json": "./package.json", - ".": "./src/index.ts" + ".": "./src/index.ts", + "./models": "./src/models/index.ts", + "./api": "./src/api/index.ts", + "./api/todoItems/attachments": "./src/api/todoItems/attachments/index.ts", + "./api/todoItems": "./src/api/todoItems/index.ts", + "./api/users": "./src/api/users/index.ts" }, "dialects": [ "esm", @@ -42,7 +47,7 @@ }, "dependencies": { "tslib": "^2.6.2", - "@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2" + "@typespec/ts-http-runtime": "0.1.0" }, "exports": { "./package.json": "./package.json", @@ -63,6 +68,96 @@ "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/todoItems/attachments": { + "browser": { + "types": "./dist/browser/api/todoItems/attachments/index.d.ts", + "default": "./dist/browser/api/todoItems/attachments/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/todoItems/attachments/index.d.ts", + "default": "./dist/react-native/api/todoItems/attachments/index.js" + }, + "import": { + "types": "./dist/esm/api/todoItems/attachments/index.d.ts", + "default": "./dist/esm/api/todoItems/attachments/index.js" + }, + "require": { + "types": "./dist/commonjs/api/todoItems/attachments/index.d.ts", + "default": "./dist/commonjs/api/todoItems/attachments/index.js" + } + }, + "./api/todoItems": { + "browser": { + "types": "./dist/browser/api/todoItems/index.d.ts", + "default": "./dist/browser/api/todoItems/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/todoItems/index.d.ts", + "default": "./dist/react-native/api/todoItems/index.js" + }, + "import": { + "types": "./dist/esm/api/todoItems/index.d.ts", + "default": "./dist/esm/api/todoItems/index.js" + }, + "require": { + "types": "./dist/commonjs/api/todoItems/index.d.ts", + "default": "./dist/commonjs/api/todoItems/index.js" + } + }, + "./api/users": { + "browser": { + "types": "./dist/browser/api/users/index.d.ts", + "default": "./dist/browser/api/users/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/users/index.d.ts", + "default": "./dist/react-native/api/users/index.js" + }, + "import": { + "types": "./dist/esm/api/users/index.d.ts", + "default": "./dist/esm/api/users/index.js" + }, + "require": { + "types": "./dist/commonjs/api/users/index.d.ts", + "default": "./dist/commonjs/api/users/index.js" + } } }, "main": "./dist/commonjs/index.js", diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md index 732e2ce5ac..8b6dc60f76 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md @@ -4,366 +4,170 @@ ```ts -import { Client } from '@typespec/ts-http-runtime'; import { ClientOptions } from '@typespec/ts-http-runtime'; -import { HttpResponse } from '@typespec/ts-http-runtime'; import { KeyCredential } from '@typespec/ts-http-runtime'; -import { RequestParameters } from '@typespec/ts-http-runtime'; -import { StreamableMethod } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; // @public -function createClient(endpointParam: string, credentials: KeyCredential, options?: TodoClientOptions): TodoClient; -export default createClient; - -// @public (undocumented) -export interface ErrorModelOutput { - code: string; - message: string; -} +export type ContinuablePage = TPage & { + continuationToken?: string; +}; -// @public (undocumented) -export interface InvalidTodoItemOutput extends ErrorModelOutput { +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export interface InvalidUserResponseOutput extends ErrorModelOutput { +export interface PageSettings { + continuationToken?: string; } -// @public (undocumented) -export interface Routes { - (path: "/users"): UsersCreate; - (path: "/validate"): UsersValidate; - (path: "/login"): UsersLogin; - (path: "/logout"): UsersLogout; - (path: "/forgot-password"): UsersForgotPassword; - (path: "/reset-password"): UsersResetPassword; - (path: "/items"): TodoItemsList; - (path: "/items/{id}", id: number): TodoItemsGet; - (path: "/items/{itemId}/attachments", itemId: number): TodoItemsAttachmentsList; +// @public +export interface PageTodoAttachment { + // (undocumented) + items: TodoAttachment[]; } // @public -export type TodoAttachmentOutput = TodoFileAttachmentOutput | TodoUrlAttachmentOutput; +export type TodoAttachment = TodoFileAttachment | TodoUrlAttachment; // @public (undocumented) -export type TodoClient = Client & { - path: Routes; -}; +export class TodoClient { + constructor(endpointParam: string, credential: KeyCredential, options?: TodoClientOptionalParams); + readonly pipeline: Pipeline; + readonly todoItems: TodoItemsOperations; + readonly users: UsersOperations; +} // @public -export interface TodoClientOptions extends ClientOptions { +export interface TodoClientOptionalParams extends ClientOptions { } -// @public (undocumented) -export interface TodoFileAttachmentOutput { +// @public +export interface TodoFileAttachment { + contents: Uint8Array; filename: string; mediaType: string; - todoItemId: number; - url: string; } -// @public (undocumented) +// @public export interface TodoItem { - description: string; - id: number; - // (undocumented) - labels: TodoLabel[]; - ownedBy: number; - status: "NotStarted" | "InProgress" | "Completed"; - title: string; -} - -// @public (undocumented) -export interface TodoItemOutput { - readonly completedAt: string; - readonly createdAt: string; + assignedTo?: number; + readonly completedAt?: Date; + readonly createdAt: Date; readonly createdBy: number; - description: string; - id: number; + description?: string; + // (undocumented) + dummy?: string; + readonly id: number; // (undocumented) - labels: TodoLabelOutput[]; - ownedBy: number; + labels?: TodoLabels; status: "NotStarted" | "InProgress" | "Completed"; title: string; - readonly updatedAt: string; + readonly updatedAt: Date; } -// @public (undocumented) +// @public export interface TodoItemPatch { - description?: string; - ownedBy?: number; + assignedTo?: number | null; + description?: string | null; status?: "NotStarted" | "InProgress" | "Completed"; title?: string; } // @public -export interface TodoItemsAttachmentsCreateFileAttachment200Response extends HttpResponse { - // (undocumented) - status: "200"; -} - -// @public -export interface TodoItemsAttachmentsCreateFileAttachment404Response extends HttpResponse { - // (undocumented) - status: "404"; -} - -// @public (undocumented) -export interface TodoItemsAttachmentsCreateFileAttachmentBodyParam { - // (undocumented) - body: FormData | Array<{ - name: "contents"; - body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; - filename?: string; - contentType?: string; - }>; -} - -// @public (undocumented) -export interface TodoItemsAttachmentsCreateFileAttachmentMediaTypesParam { - // (undocumented) - contentType: "multipart/form-data"; -} - -// @public (undocumented) -export type TodoItemsAttachmentsCreateFileAttachmentParameters = TodoItemsAttachmentsCreateFileAttachmentMediaTypesParam & TodoItemsAttachmentsCreateFileAttachmentBodyParam & RequestParameters; - -// @public -export interface TodoItemsAttachmentsCreateUrlAttachment200Response extends HttpResponse { - // (undocumented) - status: "200"; -} - -// @public -export interface TodoItemsAttachmentsCreateUrlAttachment404Response extends HttpResponse { - // (undocumented) - status: "404"; -} - -// @public (undocumented) -export interface TodoItemsAttachmentsCreateUrlAttachmentBodyParam { - // (undocumented) - body: { - contents: TodoUrlAttachment; - }; -} - -// @public (undocumented) -export interface TodoItemsAttachmentsCreateUrlAttachmentMediaTypesParam { - // (undocumented) - contentType: "application/json"; -} - -// @public (undocumented) -export type TodoItemsAttachmentsCreateUrlAttachmentParameters = TodoItemsAttachmentsCreateUrlAttachmentMediaTypesParam & TodoItemsAttachmentsCreateUrlAttachmentBodyParam & RequestParameters; - -// @public (undocumented) -export interface TodoItemsAttachmentsList { - // (undocumented) - get(options?: TodoItemsAttachmentsListParameters): StreamableMethod; - // (undocumented) - post(options: TodoItemsAttachmentsCreateUrlAttachmentParameters): StreamableMethod; - // (undocumented) - post(options: TodoItemsAttachmentsCreateFileAttachmentParameters): StreamableMethod; -} - -// @public -export interface TodoItemsAttachmentsList200Response extends HttpResponse { - // (undocumented) - body: TodoAttachmentOutput[]; - // (undocumented) - status: "200"; -} - -// @public -export interface TodoItemsAttachmentsList404Response extends HttpResponse { - // (undocumented) - status: "404"; +export interface TodoItemsAttachmentsCreateAttachmentOptionalParams extends OperationOptions { } -// @public (undocumented) -export type TodoItemsAttachmentsListParameters = RequestParameters; - // @public -export interface TodoItemsCreateForm200Response extends HttpResponse { - // (undocumented) - body: TodoItemOutput; - // (undocumented) - status: "200"; +export interface TodoItemsAttachmentsListOptionalParams extends OperationOptions { } // @public -export interface TodoItemsCreateForm422Response extends HttpResponse { +export interface TodoItemsAttachmentsOperations { // (undocumented) - body: InvalidTodoItemOutput; + createAttachment: (itemId: number, contents: TodoAttachment, options?: TodoItemsAttachmentsCreateAttachmentOptionalParams) => Promise; // (undocumented) - status: "422"; + list: (itemId: number, options?: TodoItemsAttachmentsListOptionalParams) => PagedAsyncIterableIterator; } -// @public (undocumented) -export interface TodoItemsCreateFormBodyParam { - // (undocumented) - body: FormData | Array<{ - name: "item"; - body: TodoItem; - } | { - name: "attachments"; - body: TodoUrlAttachment | string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; - filename?: string; - contentType?: string; - }>; -} - -// @public (undocumented) -export interface TodoItemsCreateFormMediaTypesParam { - // (undocumented) - contentType: "multipart/form-data"; -} - -// @public (undocumented) -export type TodoItemsCreateFormParameters = TodoItemsCreateFormMediaTypesParam & TodoItemsCreateFormBodyParam & RequestParameters; - // @public -export interface TodoItemsCreateJson200Response extends HttpResponse { +export interface TodoItemsCreateOptionalParams extends OperationOptions { // (undocumented) - body: TodoItemOutput; - // (undocumented) - status: "200"; + attachments?: TodoAttachment[]; } // @public -export interface TodoItemsCreateJson422Response extends HttpResponse { - // (undocumented) - body: InvalidTodoItemOutput; - // (undocumented) - status: "422"; -} - -// @public (undocumented) -export interface TodoItemsCreateJsonBodyParam { - // (undocumented) - body: { - item: TodoItem; - attachments: Array; - }; +export interface TodoItemsDeleteOptionalParams extends OperationOptions { } -// @public (undocumented) -export interface TodoItemsCreateJsonMediaTypesParam { - // (undocumented) - contentType: "application/json"; -} - -// @public (undocumented) -export type TodoItemsCreateJsonParameters = TodoItemsCreateJsonMediaTypesParam & TodoItemsCreateJsonBodyParam & RequestParameters; - // @public -export interface TodoItemsDelete200Response extends HttpResponse { - // (undocumented) - status: "200"; +export interface TodoItemsGetOptionalParams extends OperationOptions { } // @public -export interface TodoItemsDelete404Response extends HttpResponse { - // (undocumented) - status: "404"; -} - -// @public (undocumented) -export type TodoItemsDeleteParameters = RequestParameters; - -// @public (undocumented) -export interface TodoItemsGet { - // (undocumented) - delete(options?: TodoItemsDeleteParameters): StreamableMethod; - // (undocumented) - get(options?: TodoItemsGetParameters): StreamableMethod; - // (undocumented) - patch(options: TodoItemsUpdateParameters): StreamableMethod; +export interface TodoItemsListOptionalParams extends OperationOptions { + limit?: number; + offset?: number; } // @public -export interface TodoItemsGet200Response extends HttpResponse { - // (undocumented) - body: TodoItemOutput; +export interface TodoItemsOperations { // (undocumented) - status: "200"; -} - -// @public -export interface TodoItemsGet404Response extends HttpResponse { + attachments: TodoItemsAttachmentsOperations; // (undocumented) - status: "404"; -} - -// @public (undocumented) -export type TodoItemsGetParameters = RequestParameters; - -// @public (undocumented) -export interface TodoItemsList { - // (undocumented) - get(options: TodoItemsListParameters): StreamableMethod; - // (undocumented) - post(options: TodoItemsCreateJsonParameters): StreamableMethod; - // (undocumented) - post(options: TodoItemsCreateFormParameters): StreamableMethod; -} - -// @public -export interface TodoItemsList200Response extends HttpResponse { - // (undocumented) - body: TodoPageOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export type TodoItemsListParameters = TodoItemsListQueryParam & RequestParameters; - -// @public (undocumented) -export interface TodoItemsListQueryParam { + create: (item: TodoItem, options?: TodoItemsCreateOptionalParams) => Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; + }>; + delete: (id: number, options?: TodoItemsDeleteOptionalParams) => Promise; + // (undocumented) + get: (id: number, options?: TodoItemsGetOptionalParams) => Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; + }>; // (undocumented) - queryParameters: TodoItemsListQueryParamProperties; -} - -// @public (undocumented) -export interface TodoItemsListQueryParamProperties { - limit: number; - offset: number; + list: (options?: TodoItemsListOptionalParams) => PagedAsyncIterableIterator; + // (undocumented) + update: (id: number, patch: TodoItemPatch, options?: TodoItemsUpdateOptionalParams) => Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; + }>; } // @public -export interface TodoItemsUpdate200Response extends HttpResponse { - // (undocumented) - body: TodoItemOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TodoItemsUpdateBodyParam { - // (undocumented) - body: { - patch: TodoItemPatch; - }; -} - -// @public (undocumented) -export interface TodoItemsUpdateMediaTypesParam { - // (undocumented) - contentType: "application/merge-patch+json"; +export interface TodoItemsUpdateOptionalParams extends OperationOptions { } -// @public (undocumented) -export type TodoItemsUpdateParameters = TodoItemsUpdateMediaTypesParam & TodoItemsUpdateBodyParam & RequestParameters; - // @public -export type TodoLabel = string | string[] | TodoLabelRecord | Array; - -// @public -export type TodoLabelOutput = string | string[] | TodoLabelRecordOutput | Array; - -// @public (undocumented) export interface TodoLabelRecord { // (undocumented) color?: string; @@ -371,238 +175,45 @@ export interface TodoLabelRecord { name: string; } -// @public (undocumented) -export interface TodoLabelRecordOutput { - // (undocumented) - color?: string; - // (undocumented) - name: string; -} +// @public +export type TodoLabels = string | string[] | TodoLabelRecord | TodoLabelRecord[]; -// @public (undocumented) -export interface TodoPageOutput { - items: Array; - // (undocumented) - pagination: { - pageSize: number; - totalSize: number; - prevLink?: string; - nextLink?: string; - }; +// @public +export interface TodoPage { + items: TodoItem[]; + nextLink?: string; + pageSize: number; + prevLink?: string; + totalSize: number; } -// @public (undocumented) +// @public export interface TodoUrlAttachment { description: string; url: string; } -// @public (undocumented) -export interface TodoUrlAttachmentOutput { - description: string; - url: string; -} - -// @public (undocumented) +// @public export interface User { - email: string; - password: string; - username: string; -} - -// @public (undocumented) -export interface UserCreatedResponseOutput { email: string; readonly id: number; password: string; - token: string; username: string; } // @public -export interface UserExistsResponseOutput extends ErrorModelOutput { -} - -// @public (undocumented) -export interface UsersCreate { - // (undocumented) - post(options: UsersCreateParameters): StreamableMethod; -} - -// @public -export interface UsersCreate200Response extends HttpResponse { - // (undocumented) - body: UserCreatedResponseOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface UsersCreate409Response extends HttpResponse { - // (undocumented) - body: UserExistsResponseOutput; - // (undocumented) - status: "409"; -} - -// @public -export interface UsersCreate422Response extends HttpResponse { - // (undocumented) - body: InvalidUserResponseOutput; - // (undocumented) - status: "422"; -} - -// @public (undocumented) -export interface UsersCreateBodyParam { - // (undocumented) - body: { - user: User; - }; -} - -// @public (undocumented) -export type UsersCreateParameters = UsersCreateBodyParam & RequestParameters; - -// @public (undocumented) -export interface UsersForgotPassword { - post(options: UsersForgotPasswordParameters): StreamableMethod; -} - -// @public -export interface UsersForgotPassword200Response extends HttpResponse { - // (undocumented) - status: "200"; -} - -// @public -export interface UsersForgotPassword404Response extends HttpResponse { - // (undocumented) - status: "404"; -} - -// @public (undocumented) -export interface UsersForgotPasswordBodyParam { - // (undocumented) - body: { - email: string; - }; -} - -// @public (undocumented) -export type UsersForgotPasswordParameters = UsersForgotPasswordBodyParam & RequestParameters; - -// @public (undocumented) -export interface UsersLogin { - // (undocumented) - post(options: UsersLoginParameters): StreamableMethod; -} - -// @public -export interface UsersLogin200Response extends HttpResponse { - // (undocumented) - status: "200"; +export interface UsersCreateOptionalParams extends OperationOptions { } // @public -export interface UsersLogin401Response extends HttpResponse { +export interface UsersOperations { // (undocumented) - status: "401"; -} - -// @public (undocumented) -export interface UsersLoginBodyParam { - // (undocumented) - body: { + create: (user: User, options?: UsersCreateOptionalParams) => Promise<{ + id: number; username: string; - password: string; - }; -} - -// @public (undocumented) -export type UsersLoginParameters = UsersLoginBodyParam & RequestParameters; - -// @public (undocumented) -export interface UsersLogout { - // (undocumented) - get(options?: UsersLogoutParameters): StreamableMethod; -} - -// @public -export interface UsersLogout200Response extends HttpResponse { - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export type UsersLogoutParameters = RequestParameters; - -// @public (undocumented) -export interface UsersResetPassword { - // (undocumented) - get(options: UsersResetPasswordParameters): StreamableMethod; -} - -// @public -export interface UsersResetPassword200Response extends HttpResponse { - // (undocumented) - status: "200"; -} - -// @public -export interface UsersResetPassword404Response extends HttpResponse { - // (undocumented) - status: "404"; -} - -// @public (undocumented) -export type UsersResetPasswordParameters = UsersResetPasswordQueryParam & RequestParameters; - -// @public (undocumented) -export interface UsersResetPasswordQueryParam { - // (undocumented) - queryParameters: UsersResetPasswordQueryParamProperties; -} - -// @public (undocumented) -export interface UsersResetPasswordQueryParamProperties { - // (undocumented) - resetToken: string; -} - -// @public (undocumented) -export interface UsersValidate { - // (undocumented) - get(options: UsersValidateParameters): StreamableMethod; -} - -// @public -export interface UsersValidate200Response extends HttpResponse { - // (undocumented) - status: "200"; -} - -// @public -export interface UsersValidate422Response extends HttpResponse { - // (undocumented) - body: InvalidUserResponseOutput; - // (undocumented) - status: "422"; -} - -// @public (undocumented) -export type UsersValidateParameters = UsersValidateQueryParam & RequestParameters; - -// @public (undocumented) -export interface UsersValidateQueryParam { - // (undocumented) - queryParameters: UsersValidateQueryParamProperties; -} - -// @public (undocumented) -export interface UsersValidateQueryParamProperties { - // (undocumented) - token: string; + email: string; + token: string; + }>; } // (No @packageDocumentation comment for this package) diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/index.ts new file mode 100644 index 0000000000..3054d820a9 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/index.ts @@ -0,0 +1,17 @@ +// Licensed under the MIT License. + +export { + TodoItemsAttachmentsCreateAttachmentOptionalParams, + TodoItemsAttachmentsListOptionalParams, + TodoItemsDeleteOptionalParams, + TodoItemsUpdateOptionalParams, + TodoItemsGetOptionalParams, + TodoItemsCreateOptionalParams, + TodoItemsListOptionalParams, + UsersCreateOptionalParams, +} from "./options.js"; +export { + createTodo, + TodoContext, + TodoClientOptionalParams, +} from "./todoContext.js"; diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/options.ts new file mode 100644 index 0000000000..a3c2012467 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/options.ts @@ -0,0 +1,37 @@ +// Licensed under the MIT License. + +import { TodoAttachment } from "../models/models.js"; +import { OperationOptions } from "@typespec/ts-http-runtime"; + +/** Optional parameters. */ +export interface TodoItemsAttachmentsCreateAttachmentOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TodoItemsAttachmentsListOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TodoItemsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TodoItemsUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TodoItemsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TodoItemsCreateOptionalParams extends OperationOptions { + attachments?: TodoAttachment[]; +} + +/** Optional parameters. */ +export interface TodoItemsListOptionalParams extends OperationOptions { + /** The limit to the number of items */ + limit?: number; + /** The offset to start paginating at */ + offset?: number; +} + +/** Optional parameters. */ +export interface UsersCreateOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoContext.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoContext.ts new file mode 100644 index 0000000000..068b4d2649 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoContext.ts @@ -0,0 +1,49 @@ +// Licensed under the MIT License. + +import { + Client, + ClientOptions, + getClient, + KeyCredential, + isKeyCredential, +} from "@typespec/ts-http-runtime"; + +export interface TodoContext extends Client {} + +/** Optional parameters for the client. */ +export interface TodoClientOptionalParams extends ClientOptions {} + +export function createTodo( + endpointParam: string, + credential: KeyCredential, + options: TodoClientOptionalParams = {}, +): TodoContext { + const endpointUrl = options.endpoint ?? String(endpointParam); + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-todo-non-branded/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + }; + const clientContext = getClient(endpointUrl, undefined, updatedOptions); + + if (isKeyCredential(credential)) { + clientContext.pipeline.addPolicy({ + name: "customKeyCredentialPolicy", + sendRequest(request, next) { + request.headers.set("Authorization", "Bearer " + credential.key); + return next(request); + }, + }); + } + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + console.warn( + "This client does not support client api-version, please change it at the operation level", + ); + } + return clientContext; +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/attachments/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/attachments/index.ts new file mode 100644 index 0000000000..aaf4b51cb8 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/attachments/index.ts @@ -0,0 +1,113 @@ +// Licensed under the MIT License. + +import { + TodoContext as Client, + TodoItemsAttachmentsCreateAttachmentOptionalParams, + TodoItemsAttachmentsListOptionalParams, +} from "../../index.js"; +import { + TodoAttachment, + todoAttachmentSerializer, + PageTodoAttachment, + pageTodoAttachmentDeserializer, +} from "../../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _createAttachmentSend( + context: Client, + itemId: number, + contents: TodoAttachment, + options: TodoItemsAttachmentsCreateAttachmentOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path("/items/{itemId}/attachments", itemId) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: todoAttachmentSerializer(contents), + }); +} + +export async function _createAttachmentDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +export async function createAttachment( + context: Client, + itemId: number, + contents: TodoAttachment, + options: TodoItemsAttachmentsCreateAttachmentOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _createAttachmentSend( + context, + itemId, + contents, + options, + ); + return _createAttachmentDeserialize(result); +} + +export function _listSend( + context: Client, + itemId: number, + options: TodoItemsAttachmentsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/items/{itemId}/attachments", itemId) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return pageTodoAttachmentDeserializer(result.body); +} + +export function list( + context: Client, + itemId: number, + options: TodoItemsAttachmentsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, itemId, options), + _listDeserialize, + ["200"], + { itemName: "items" }, + ); +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/index.ts new file mode 100644 index 0000000000..45fa0a95df --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/todoItems/index.ts @@ -0,0 +1,297 @@ +// Licensed under the MIT License. + +import { + TodoContext as Client, + TodoItemsCreateOptionalParams, + TodoItemsDeleteOptionalParams, + TodoItemsGetOptionalParams, + TodoItemsListOptionalParams, + TodoItemsUpdateOptionalParams, +} from "../index.js"; +import { + TodoPage, + todoPageDeserializer, + TodoItem, + todoItemSerializer, + TodoLabels, + todoAttachmentArraySerializer, + _createResponseDeserializer, + _getResponseDeserializer, + TodoItemPatch, + todoItemPatchSerializer, + _updateResponseDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _$deleteSend( + context: Client, + id: number, + options: TodoItemsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/items/{id}", id) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( + context: Client, + id: number, + options: TodoItemsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, id, options); + return _$deleteDeserialize(result); +} + +export function _updateSend( + context: Client, + id: number, + patch: TodoItemPatch, + options: TodoItemsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/items/{id}", id) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: todoItemPatchSerializer(patch), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; +}> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _updateResponseDeserializer(result.body); +} + +export async function update( + context: Client, + id: number, + patch: TodoItemPatch, + options: TodoItemsUpdateOptionalParams = { requestOptions: {} }, +): Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; +}> { + const result = await _updateSend(context, id, patch, options); + return _updateDeserialize(result); +} + +export function _getSend( + context: Client, + id: number, + options: TodoItemsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/items/{id}", id) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; +}> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _getResponseDeserializer(result.body); +} + +export async function get( + context: Client, + id: number, + options: TodoItemsGetOptionalParams = { requestOptions: {} }, +): Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; +}> { + const result = await _getSend(context, id, options); + return _getDeserialize(result); +} + +export function _createSend( + context: Client, + item: TodoItem, + options: TodoItemsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/items") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: { + item: todoItemSerializer(item), + attachments: !options?.attachments + ? options?.attachments + : todoAttachmentArraySerializer(options?.attachments), + }, + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; +}> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _createResponseDeserializer(result.body); +} + +export async function create( + context: Client, + item: TodoItem, + options: TodoItemsCreateOptionalParams = { requestOptions: {} }, +): Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; +}> { + const result = await _createSend(context, item, options); + return _createDeserialize(result); +} + +export function _listSend( + context: Client, + options: TodoItemsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/items") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { limit: options?.limit, offset: options?.offset }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return todoPageDeserializer(result.body); +} + +export function list( + context: Client, + options: TodoItemsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "items" }, + ); +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/users/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/users/index.ts new file mode 100644 index 0000000000..d6ec7d21f1 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/api/users/index.ts @@ -0,0 +1,62 @@ +// Licensed under the MIT License. + +import { TodoContext as Client, UsersCreateOptionalParams } from "../index.js"; +import { + User, + userSerializer, + _createResponse1Deserializer, +} from "../../models/models.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@typespec/ts-http-runtime"; + +export function _createSend( + context: Client, + user: User, + options: UsersCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/users") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: userSerializer(user), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise<{ + id: number; + username: string; + email: string; + token: string; +}> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _createResponse1Deserializer(result.body); +} + +export async function create( + context: Client, + user: User, + options: UsersCreateOptionalParams = { requestOptions: {} }, +): Promise<{ + id: number; + username: string; + email: string; + token: string; +}> { + const result = await _createSend(context, user, options); + return _createDeserialize(result); +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/index.ts new file mode 100644 index 0000000000..56b66687ea --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/index.ts @@ -0,0 +1,5 @@ +// Licensed under the MIT License. + +export { TodoItemsOperations } from "./todoItems/index.js"; +export { UsersOperations } from "./users/index.js"; +export { TodoItemsAttachmentsOperations } from "./todoItems/attachments/index.js"; diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/attachments/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/attachments/index.ts new file mode 100644 index 0000000000..3c44fd9152 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/attachments/index.ts @@ -0,0 +1,46 @@ +// Licensed under the MIT License. + +import { + TodoItemsAttachmentsCreateAttachmentOptionalParams, + TodoItemsAttachmentsListOptionalParams, +} from "../../../api/options.js"; +import { TodoContext } from "../../../api/todoContext.js"; +import { + createAttachment, + list, +} from "../../../api/todoItems/attachments/index.js"; +import { TodoAttachment } from "../../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../../static-helpers/pagingHelpers.js"; + +/** Interface representing a TodoItemsAttachments operations. */ +export interface TodoItemsAttachmentsOperations { + createAttachment: ( + itemId: number, + contents: TodoAttachment, + options?: TodoItemsAttachmentsCreateAttachmentOptionalParams, + ) => Promise; + list: ( + itemId: number, + options?: TodoItemsAttachmentsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getTodoItemsAttachments(context: TodoContext) { + return { + createAttachment: ( + itemId: number, + contents: TodoAttachment, + options?: TodoItemsAttachmentsCreateAttachmentOptionalParams, + ) => createAttachment(context, itemId, contents, options), + list: (itemId: number, options?: TodoItemsAttachmentsListOptionalParams) => + list(context, itemId, options), + }; +} + +export function getTodoItemsAttachmentsOperations( + context: TodoContext, +): TodoItemsAttachmentsOperations { + return { + ...getTodoItemsAttachments(context), + }; +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/index.ts new file mode 100644 index 0000000000..c87b3ff30f --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/todoItems/index.ts @@ -0,0 +1,112 @@ +// Licensed under the MIT License. + +import { + TodoItemsDeleteOptionalParams, + TodoItemsUpdateOptionalParams, + TodoItemsGetOptionalParams, + TodoItemsCreateOptionalParams, + TodoItemsListOptionalParams, +} from "../../api/options.js"; +import { TodoContext } from "../../api/todoContext.js"; +import { + $delete, + update, + get, + create, + list, +} from "../../api/todoItems/index.js"; +import { TodoItem, TodoLabels, TodoItemPatch } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + TodoItemsAttachmentsOperations, + getTodoItemsAttachmentsOperations, +} from "./attachments/index.js"; + +/** Interface representing a TodoItems operations. */ +export interface TodoItemsOperations { + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + id: number, + options?: TodoItemsDeleteOptionalParams, + ) => Promise; + update: ( + id: number, + patch: TodoItemPatch, + options?: TodoItemsUpdateOptionalParams, + ) => Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; + }>; + get: ( + id: number, + options?: TodoItemsGetOptionalParams, + ) => Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; + }>; + create: ( + item: TodoItem, + options?: TodoItemsCreateOptionalParams, + ) => Promise<{ + id: number; + title: string; + createdBy: number; + assignedTo?: number; + description?: string; + status: "NotStarted" | "InProgress" | "Completed"; + createdAt: Date; + updatedAt: Date; + completedAt?: Date; + labels?: TodoLabels; + }>; + list: ( + options?: TodoItemsListOptionalParams, + ) => PagedAsyncIterableIterator; + attachments: TodoItemsAttachmentsOperations; +} + +export function getTodoItems(context: TodoContext) { + return { + delete: (id: number, options?: TodoItemsDeleteOptionalParams) => + $delete(context, id, options), + update: ( + id: number, + patch: TodoItemPatch, + options?: TodoItemsUpdateOptionalParams, + ) => update(context, id, patch, options), + get: (id: number, options?: TodoItemsGetOptionalParams) => + get(context, id, options), + create: (item: TodoItem, options?: TodoItemsCreateOptionalParams) => + create(context, item, options), + list: (options?: TodoItemsListOptionalParams) => list(context, options), + }; +} + +export function getTodoItemsOperations( + context: TodoContext, +): TodoItemsOperations { + return { + ...getTodoItems(context), + attachments: getTodoItemsAttachmentsOperations(context), + }; +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/users/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/users/index.ts new file mode 100644 index 0000000000..36c6ab6f07 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/classic/users/index.ts @@ -0,0 +1,32 @@ +// Licensed under the MIT License. + +import { UsersCreateOptionalParams } from "../../api/options.js"; +import { TodoContext } from "../../api/todoContext.js"; +import { create } from "../../api/users/index.js"; +import { User } from "../../models/models.js"; + +/** Interface representing a Users operations. */ +export interface UsersOperations { + create: ( + user: User, + options?: UsersCreateOptionalParams, + ) => Promise<{ + id: number; + username: string; + email: string; + token: string; + }>; +} + +export function getUsers(context: TodoContext) { + return { + create: (user: User, options?: UsersCreateOptionalParams) => + create(context, user, options), + }; +} + +export function getUsersOperations(context: TodoContext): UsersOperations { + return { + ...getUsers(context), + }; +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/helpers/serializerHelpers.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/helpers/serializerHelpers.ts new file mode 100644 index 0000000000..b968162a34 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/helpers/serializerHelpers.ts @@ -0,0 +1,39 @@ +// Licensed under the MIT License. + +export function serializeRecord< + T extends string | number | boolean | Date | null, + R, +>(item: Record): Record; +export function serializeRecord( + item: Record, + serializer: (item: T) => R, +): Record; +export function serializeRecord( + item: Record, + serializer?: (item: T) => R, +): Record { + return Object.keys(item).reduce( + (acc, key) => { + if (isSupportedRecordType(item[key])) { + acc[key] = item[key] as any; + } else if (serializer) { + const value = item[key]; + if (value !== undefined) { + acc[key] = serializer(value); + } + } else { + console.warn(`Don't know how to serialize ${item[key]}`); + acc[key] = item[key] as any; + } + return acc; + }, + {} as Record, + ); +} + +function isSupportedRecordType(t: any) { + return ( + ["number", "string", "boolean", "null"].includes(typeof t) || + t instanceof Date + ); +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/index.ts index b7675261df..2819fab8c4 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/index.ts @@ -1,12 +1,38 @@ // Licensed under the MIT License. -import TodoClient from "./todoClient.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; -export * from "./todoClient.js"; -export * from "./parameters.js"; -export * from "./responses.js"; -export * from "./clientDefinitions.js"; -export * from "./models.js"; -export * from "./outputModels.js"; - -export default TodoClient; +export { TodoClient } from "./todoClient.js"; +export { + TodoPage, + TodoItem, + TodoLabels, + TodoLabelRecord, + TodoFileAttachment, + TodoUrlAttachment, + TodoAttachment, + TodoItemPatch, + PageTodoAttachment, + User, +} from "./models/index.js"; +export { + TodoItemsAttachmentsCreateAttachmentOptionalParams, + TodoItemsAttachmentsListOptionalParams, + TodoItemsDeleteOptionalParams, + TodoItemsUpdateOptionalParams, + TodoItemsGetOptionalParams, + TodoItemsCreateOptionalParams, + TodoItemsListOptionalParams, + UsersCreateOptionalParams, + TodoClientOptionalParams, +} from "./api/index.js"; +export { + TodoItemsOperations, + UsersOperations, + TodoItemsAttachmentsOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/index.ts new file mode 100644 index 0000000000..1dfe6e9cdf --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/index.ts @@ -0,0 +1,14 @@ +// Licensed under the MIT License. + +export { + TodoPage, + TodoItem, + TodoLabels, + TodoLabelRecord, + TodoFileAttachment, + TodoUrlAttachment, + TodoAttachment, + TodoItemPatch, + PageTodoAttachment, + User, +} from "./models.js"; diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/models.ts new file mode 100644 index 0000000000..70396054d5 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/models/models.ts @@ -0,0 +1,424 @@ +// Licensed under the MIT License. + +import { + uint8ArrayToString, + stringToUint8Array, +} from "@typespec/ts-http-runtime"; + +/** model interface TodoPage */ +export interface TodoPage { + /** The items in the page */ + items: TodoItem[]; + /** The number of items returned in this page */ + pageSize: number; + /** The total number of items */ + totalSize: number; + /** A link to the previous page, if it exists */ + prevLink?: string; + /** A link to the next page, if it exists */ + nextLink?: string; +} + +export function todoPageDeserializer(item: any): TodoPage { + return { + items: todoItemArrayDeserializer(item["items"]), + pageSize: item["pageSize"], + totalSize: item["totalSize"], + prevLink: item["prevLink"], + nextLink: item["nextLink"], + }; +} + +export function todoItemArraySerializer(result: Array): any[] { + return result.map((item) => { + return todoItemSerializer(item); + }); +} + +export function todoItemArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return todoItemDeserializer(item); + }); +} + +/** model interface TodoItem */ +export interface TodoItem { + /** The item's unique id */ + readonly id: number; + /** The item's title */ + title: string; + /** User that created the todo */ + readonly createdBy: number; + /** User that the todo is assigned to */ + assignedTo?: number; + /** A longer description of the todo item in markdown format */ + description?: string; + /** The status of the todo item */ + status: "NotStarted" | "InProgress" | "Completed"; + /** When the todo item was created. */ + readonly createdAt: Date; + /** When the todo item was last updated */ + readonly updatedAt: Date; + /** When the todo item was makred as completed */ + readonly completedAt?: Date; + labels?: TodoLabels; + dummy?: string; +} + +export function todoItemSerializer(item: TodoItem): any { + return { + title: item["title"], + assignedTo: item["assignedTo"], + description: item["description"], + status: item["status"], + labels: !item["labels"] + ? item["labels"] + : todoLabelsSerializer(item["labels"]), + _dummy: item["dummy"], + }; +} + +export function todoItemDeserializer(item: any): TodoItem { + return { + id: item["id"], + title: item["title"], + createdBy: item["createdBy"], + assignedTo: item["assignedTo"], + description: item["description"], + status: item["status"], + createdAt: new Date(item["createdAt"]), + updatedAt: new Date(item["updatedAt"]), + completedAt: !item["completedAt"] + ? item["completedAt"] + : new Date(item["completedAt"]), + labels: !item["labels"] + ? item["labels"] + : todoLabelsDeserializer(item["labels"]), + dummy: item["_dummy"], + }; +} + +/** Alias for TodoLabels */ +export type TodoLabels = + | string + | string[] + | TodoLabelRecord + | TodoLabelRecord[]; + +export function todoLabelsSerializer(item: TodoLabels): any { + return item; +} + +export function todoLabelsDeserializer(item: any): TodoLabels { + return item; +} + +/** model interface TodoLabelRecord */ +export interface TodoLabelRecord { + name: string; + color?: string; +} + +export function todoLabelRecordSerializer(item: TodoLabelRecord): any { + return { name: item["name"], color: item["color"] }; +} + +export function todoLabelRecordDeserializer(item: any): TodoLabelRecord { + return { + name: item["name"], + color: item["color"], + }; +} + +export function todoLabelRecordArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return todoLabelRecordSerializer(item); + }); +} + +export function todoLabelRecordArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return todoLabelRecordDeserializer(item); + }); +} + +/** model interface TodoFileAttachment */ +export interface TodoFileAttachment { + /** The file name of the attachment */ + filename: string; + /** The media type of the attachment */ + mediaType: string; + /** The contents of the file */ + contents: Uint8Array; +} + +export function todoFileAttachmentSerializer(item: TodoFileAttachment): any { + return { + filename: item["filename"], + mediaType: item["mediaType"], + contents: uint8ArrayToString(item["contents"], "base64"), + }; +} + +export function todoFileAttachmentDeserializer(item: any): TodoFileAttachment { + return { + filename: item["filename"], + mediaType: item["mediaType"], + contents: + typeof item["contents"] === "string" + ? stringToUint8Array(item["contents"], "base64") + : item["contents"], + }; +} + +/** model interface TodoUrlAttachment */ +export interface TodoUrlAttachment { + /** A description of the URL */ + description: string; + /** The url */ + url: string; +} + +export function todoUrlAttachmentSerializer(item: TodoUrlAttachment): any { + return { description: item["description"], url: item["url"] }; +} + +export function todoUrlAttachmentDeserializer(item: any): TodoUrlAttachment { + return { + description: item["description"], + url: item["url"], + }; +} + +export function todoAttachmentArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return todoAttachmentSerializer(item); + }); +} + +export function todoAttachmentArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return todoAttachmentDeserializer(item); + }); +} + +/** Alias for TodoAttachment */ +export type TodoAttachment = TodoFileAttachment | TodoUrlAttachment; + +export function todoAttachmentSerializer(item: TodoAttachment): any { + return item; +} + +export function todoAttachmentDeserializer(item: any): TodoAttachment { + return item; +} + +/** model interface _CreateResponse */ +export interface _CreateResponse { + /** The item's unique id */ + readonly id: number; + /** The item's title */ + title: string; + /** User that created the todo */ + readonly createdBy: number; + /** User that the todo is assigned to */ + assignedTo?: number; + /** A longer description of the todo item in markdown format */ + description?: string; + /** The status of the todo item */ + status: "NotStarted" | "InProgress" | "Completed"; + /** When the todo item was created. */ + readonly createdAt: Date; + /** When the todo item was last updated */ + readonly updatedAt: Date; + /** When the todo item was makred as completed */ + readonly completedAt?: Date; + labels?: TodoLabels; +} + +export function _createResponseDeserializer(item: any): _CreateResponse { + return { + id: item["id"], + title: item["title"], + createdBy: item["createdBy"], + assignedTo: item["assignedTo"], + description: item["description"], + status: item["status"], + createdAt: new Date(item["createdAt"]), + updatedAt: new Date(item["updatedAt"]), + completedAt: !item["completedAt"] + ? item["completedAt"] + : new Date(item["completedAt"]), + labels: !item["labels"] + ? item["labels"] + : todoLabelsDeserializer(item["labels"]), + }; +} + +/** model interface _GetResponse */ +export interface _GetResponse { + /** The item's unique id */ + readonly id: number; + /** The item's title */ + title: string; + /** User that created the todo */ + readonly createdBy: number; + /** User that the todo is assigned to */ + assignedTo?: number; + /** A longer description of the todo item in markdown format */ + description?: string; + /** The status of the todo item */ + status: "NotStarted" | "InProgress" | "Completed"; + /** When the todo item was created. */ + readonly createdAt: Date; + /** When the todo item was last updated */ + readonly updatedAt: Date; + /** When the todo item was makred as completed */ + readonly completedAt?: Date; + labels?: TodoLabels; +} + +export function _getResponseDeserializer(item: any): _GetResponse { + return { + id: item["id"], + title: item["title"], + createdBy: item["createdBy"], + assignedTo: item["assignedTo"], + description: item["description"], + status: item["status"], + createdAt: new Date(item["createdAt"]), + updatedAt: new Date(item["updatedAt"]), + completedAt: !item["completedAt"] + ? item["completedAt"] + : new Date(item["completedAt"]), + labels: !item["labels"] + ? item["labels"] + : todoLabelsDeserializer(item["labels"]), + }; +} + +/** model interface TodoItemPatch */ +export interface TodoItemPatch { + /** The item's title */ + title?: string; + /** User that the todo is assigned to */ + assignedTo?: number | null; + /** A longer description of the todo item in markdown format */ + description?: string | null; + /** The status of the todo item */ + status?: "NotStarted" | "InProgress" | "Completed"; +} + +export function todoItemPatchSerializer(item: TodoItemPatch): any { + return { + title: item["title"], + assignedTo: item["assignedTo"], + description: item["description"], + status: item["status"], + }; +} + +/** model interface _UpdateResponse */ +export interface _UpdateResponse { + /** The item's unique id */ + readonly id: number; + /** The item's title */ + title: string; + /** User that created the todo */ + readonly createdBy: number; + /** User that the todo is assigned to */ + assignedTo?: number; + /** A longer description of the todo item in markdown format */ + description?: string; + /** The status of the todo item */ + status: "NotStarted" | "InProgress" | "Completed"; + /** When the todo item was created. */ + readonly createdAt: Date; + /** When the todo item was last updated */ + readonly updatedAt: Date; + /** When the todo item was makred as completed */ + readonly completedAt?: Date; + labels?: TodoLabels; +} + +export function _updateResponseDeserializer(item: any): _UpdateResponse { + return { + id: item["id"], + title: item["title"], + createdBy: item["createdBy"], + assignedTo: item["assignedTo"], + description: item["description"], + status: item["status"], + createdAt: new Date(item["createdAt"]), + updatedAt: new Date(item["updatedAt"]), + completedAt: !item["completedAt"] + ? item["completedAt"] + : new Date(item["completedAt"]), + labels: !item["labels"] + ? item["labels"] + : todoLabelsDeserializer(item["labels"]), + }; +} + +/** model interface PageTodoAttachment */ +export interface PageTodoAttachment { + items: TodoAttachment[]; +} + +export function pageTodoAttachmentDeserializer(item: any): PageTodoAttachment { + return { + items: todoAttachmentArrayDeserializer(item["items"]), + }; +} + +/** model interface User */ +export interface User { + /** An autogenerated unique id for the user */ + readonly id: number; + /** The user's username */ + username: string; + /** The user's email address */ + email: string; + /** + * The user's password, provided when creating a user + * but is otherwise not visible (and hashed by the backend) + */ + password: string; +} + +export function userSerializer(item: User): any { + return { + username: item["username"], + email: item["email"], + password: item["password"], + }; +} + +/** model interface _CreateResponse1 */ +export interface _CreateResponse1 { + /** An autogenerated unique id for the user */ + readonly id: number; + /** The user's username */ + username: string; + /** The user's email address */ + email: string; + /** The token to use to construct the validate email address url */ + token: string; +} + +export function _createResponse1Deserializer(item: any): _CreateResponse1 { + return { + id: item["id"], + username: item["username"], + email: item["email"], + token: item["token"], + }; +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/static-helpers/pagingHelpers.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/static-helpers/pagingHelpers.ts new file mode 100644 index 0000000000..39c2ece980 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,273 @@ +// Licensed under the MIT License. + +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@typespec/ts-http-runtime"; +import { RestError } from "@typespec/ts-http-runtime"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: ( + pageLink?: string, + ) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator( + pagedResult, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if ( + typeof nextLink !== "string" && + typeof nextLink !== "undefined" && + nextLink !== null + ) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest( + response: PathUncheckedResponse, + expectedStatuses: string[], +): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/todoClient.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/todoClient.ts index a57163ccc9..3ea8460958 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/todoClient.ts +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/todoClient.ts @@ -1,45 +1,44 @@ // Licensed under the MIT License. -import { getClient, ClientOptions } from "@typespec/ts-http-runtime"; -import { KeyCredential } from "@typespec/ts-http-runtime"; -import { TodoClient } from "./clientDefinitions.js"; +import { + getTodoItemsOperations, + TodoItemsOperations, +} from "./classic/todoItems/index.js"; +import { getUsersOperations, UsersOperations } from "./classic/users/index.js"; +import { + createTodo, + TodoContext, + TodoClientOptionalParams, +} from "./api/index.js"; +import { Pipeline, KeyCredential } from "@typespec/ts-http-runtime"; -/** The optional parameters for the client */ -export interface TodoClientOptions extends ClientOptions {} +export { TodoClientOptionalParams } from "./api/todoContext.js"; -/** - * Initialize a new instance of `TodoClient` - * @param endpointParam - The parameter endpointParam - * @param credentials - uniquely identify client credential - * @param options - the parameter for all optional parameters - */ -export default function createClient( - endpointParam: string, - credentials: KeyCredential, - options: TodoClientOptions = {}, -): TodoClient { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`; - const userAgentInfo = `azsdk-js-todo-non-branded-rest/1.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - }; - const client = getClient(endpointUrl, options) as TodoClient; +export class TodoClient { + private _client: TodoContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + constructor( + endpointParam: string, + credential: KeyCredential, + options: TodoClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createTodo(endpointParam, credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.todoItems = getTodoItemsOperations(this._client); + this.users = getUsersOperations(this._client); + } - client.pipeline.addPolicy({ - name: "customKeyCredentialPolicy", - async sendRequest(request, next) { - request.headers.set("Authorization", "Bearer " + credentials.key); - return next(request); - }, - }); - return client; + /** The operation groups for todoItems */ + public readonly todoItems: TodoItemsOperations; + /** The operation groups for users */ + public readonly users: UsersOperations; } diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/tsconfig.json b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/tsconfig.json index 4b2846c48c..031889db45 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/tsconfig.json +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/tsconfig.json @@ -17,8 +17,7 @@ "forceConsistentCasingInFileNames": true, "moduleResolution": "NodeNext", "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "paths": { "@notabrand/todo-non-branded": ["./src/index"] } + "esModuleInterop": true }, - "include": ["src/**/*.ts", "samples-dev/**/*.ts"] + "include": ["src/**/*.ts"] } diff --git a/packages/typespec-test/test/todo_non_branded/spec/main.tsp b/packages/typespec-test/test/todo_non_branded/spec/main.tsp index 1dd9dbc43e..fee9e1bdbe 100644 --- a/packages/typespec-test/test/todo_non_branded/spec/main.tsp +++ b/packages/typespec-test/test/todo_non_branded/spec/main.tsp @@ -1,15 +1,19 @@ import "@typespec/http"; import "@typespec/rest"; import "@typespec/openapi3"; - +import "@typespec/openapi"; +import "@typespec/json-schema"; using Http; +using JsonSchema; @service({ title: "Todo App", }) -@useAuth(BearerAuth) +@useAuth(BearerAuth | ApiKeyAuth) +@jsonSchema namespace Todo; +@jsonSchema model User { /** An autogenerated unique id for the user */ @key @@ -17,11 +21,12 @@ model User { id: safeint; /** The user's username */ + @minLength(2) @maxLength(50) username: string; /** The user's email address */ - //@format("email") + // @format("email") - crashes emitters for now email: string; /** @@ -30,11 +35,15 @@ model User { */ @visibility("create") password: string; + + /** Whether the user is validated. Never visible to the API. */ + @visibility("none") validated: boolean; } +@jsonSchema model TodoItem { /** The item's unique id */ - @key id: safeint; + @visibility("read") @key id: safeint; /** The item's title */ @maxLength(255) @@ -44,10 +53,10 @@ model TodoItem { @visibility("read") createdBy: User.id; /** User that the todo is assigned to */ - ownedBy: User.id; + assignedTo?: User.id; /** A longer description of the todo item in markdown format */ - description: string; + description?: string; /** The status of the todo item */ status: "NotStarted" | "InProgress" | "Completed"; @@ -59,24 +68,30 @@ model TodoItem { @visibility("read") updatedAt: utcDateTime; /** When the todo item was makred as completed */ - @visibility("read") completedAt: utcDateTime; + @visibility("read") completedAt?: utcDateTime; // Want the read form to be normalized to TodoLabelRecord[], but can't // https://github.com/microsoft/typespec/issues/2926 - labels: TodoLabel[]; + labels?: TodoLabels; + + // hack to get a different schema for create + // (fastify glue doesn't support readonly) + @visibility("create") _dummy?: string; } -union TodoLabel { +@jsonSchema +union TodoLabels { string, string[], TodoLabelRecord, TodoLabelRecord[], } +@jsonSchema model TodoLabelRecord { name: string; - //@format("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$") + @pattern("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$") color?: string; } @@ -85,6 +100,7 @@ union TodoAttachment { url: TodoUrlAttachment, } +@jsonSchema model TodoUrlAttachment { /** A description of the URL */ description: string; @@ -93,10 +109,8 @@ model TodoUrlAttachment { url: url; } +@jsonSchema model TodoFileAttachment { - /** The todo item this is attached to */ - todoItemId: TodoItem.id; - /** The file name of the attachment */ @maxLength(255) filename: string; @@ -104,19 +118,45 @@ model TodoFileAttachment { /** The media type of the attachment */ mediaType: string; - /** The url where the attachment can be downloaded from */ - url: url; + /** The contents of the file */ + contents: bytes; } +@jsonSchema @error -model Error { +model ApiError { /** A machine readable error code */ code: string; /** A human readable message */ + // https://github.com/microsoft/OpenAPI/blob/main/extensions/x-ms-primary-error-message.md + @OpenAPI.extension("x-ms-primary-error-message", true) message: string; } +/** + * Something is wrong with you. + */ +model Standard4XXResponse extends ApiError { + @minValue(400) + @maxValue(499) + @statusCode + statusCode: int32; +} + +/** + * Something is wrong with me. + */ +model Standard5XXResponse extends ApiError { + @minValue(500) + @maxValue(599) + @statusCode + statusCode: int32; +} + +alias WithStandardErrors = T | Standard4XXResponse | Standard5XXResponse; + +@useAuth(NoAuth) namespace Users { // would prefer to extend // https://github.com/microsoft/typespec/issues/2922 @@ -130,76 +170,53 @@ namespace Users { } /** The user already exists */ - model UserExistsResponse extends Error { + model UserExistsResponse extends ApiError { ...ConflictResponse; + code: "user-exists"; } /** The user is invalid (e.g. forgot to enter email address) */ - model InvalidUserResponse extends Error { + model InvalidUserResponse extends ApiError { @statusCode statusCode: 422; + code: "invalid-user"; } @route("/users") @post op create( - user: User, - ): { @bodyRoot _ : UserCreatedResponse; } | UserExistsResponse | InvalidUserResponse; - - @route("validate") - @get - op validate(@query token: string): OkResponse | InvalidUserResponse; - - @route("login") - @post - op login( - username: User.username, - password: User.password, - ): OkResponse | UnauthorizedResponse; - - @route("logout") - @get - op logout(): OkResponse; - - /** Sends a reset token to the user's email address */ - @route("forgot-password") - @post - op forgotPassword(email: User.email): OkResponse | NotFoundResponse; - - @route("reset-password") - @get - op resetPassword(@query resetToken: string): OkResponse | NotFoundResponse; + @body user: User, + ): WithStandardErrors; } @route("items") namespace TodoItems { model PaginationControls { /** The limit to the number of items */ - @query limit: int32 = 50; + @query limit?: int32 = 50; /** The offset to start paginating at */ - @query offset: int32 = 0; + @query offset?: int32 = 0; } model TodoPage { /** The items in the page */ - @pageItems - items: TodoItem[]; + @pageItems items: TodoItem[]; - pagination: { - /** The number of items returned in this page */ - pageSize: int32; + /** The number of items returned in this page */ + pageSize: int32; - /** The total number of items */ - totalSize: int32; + /** The total number of items */ + totalSize: int32; - ...PaginationControls; + ...PaginationControls; - /** A link to the previous page, if it exists */ - prevLink?: url; + /** A link to the previous page, if it exists */ + @prevLink + prevLink?: url; - /** A link to the next page, if it exists */ - nextLink?: url; - }; + /** A link to the next page, if it exists */ + @nextLink + nextLink?: url; } // deeply annoying that I have to copy/paste this... @@ -208,68 +225,59 @@ namespace TodoItems { title?: TodoItem.title; /** User that the todo is assigned to */ - ownedBy?: TodoItem.ownedBy; + assignedTo?: TodoItem.assignedTo | null; /** A longer description of the todo item in markdown format */ - description?: TodoItem.description; + description?: TodoItem.description | null; /** The status of the todo item */ status?: "NotStarted" | "InProgress" | "Completed"; } - model InvalidTodoItem extends Error { + model InvalidTodoItem extends ApiError { @statusCode statusCode: 422; } - @list op list(...PaginationControls): TodoPage; + @error + model NotFoundErrorResponse { + @statusCode statusCode: 404; + code: "not-found"; + } - @sharedRoute - @post - op createJson( - @header contentType: "application/json", - item: TodoItem, - attachments: TodoUrlAttachment[], - ): TodoItem | InvalidTodoItem; + model Page { + @pageItems items: T[]; + } + + @list op list(...PaginationControls): WithStandardErrors; - @sharedRoute @post - op createForm( - @header contentType: "multipart/form-data", + op create( + @header contentType: "application/json", item: TodoItem, - attachments?: (TodoUrlAttachment | bytes)[], - ): TodoItem | InvalidTodoItem; + attachments?: TodoAttachment[], + ): WithStandardErrors; - @get op get(@path id: TodoItem.id): TodoItem | NotFoundResponse; + @get op get(@path id: TodoItem.id): TodoItem | NotFoundErrorResponse; @patch op update( @header contentType: "application/merge-patch+json", @path id: TodoItem.id, - patch: TodoItemPatch, + @body patch: TodoItemPatch, ): TodoItem; - @delete op delete(@path id: TodoItem.id): OkResponse | NotFoundResponse; + @delete op delete( + @path id: TodoItem.id, + ): WithStandardErrors; @route("{itemId}/attachments") namespace Attachments { - op list( - @path itemId: TodoItem.id, - ): TodoAttachment[] | NotFoundResponse; - - @sharedRoute - @post - op createUrlAttachment( - @header contentType: "application/json", + @list op list( @path itemId: TodoItem.id, - contents: TodoUrlAttachment, - ): OkResponse | NotFoundResponse; + ): WithStandardErrors | NotFoundErrorResponse>; @sharedRoute @post - op createFileAttachment( - @header contentType: "multipart/form-data", + op createAttachment( @path itemId: TodoItem.id, - contents: bytes, - ): OkResponse | NotFoundResponse; - - // disabled: https://github.com/microsoft/typespec/issues/2925 - // @delete op delete(@path itemId: TodoItem.id): OkResponse | NotFoundResponse; + @body contents: TodoAttachment, + ): WithStandardErrors; } -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/todo_non_branded/tsp-output/@typespec/openapi3/openapi.yaml b/packages/typespec-test/test/todo_non_branded/tsp-output/@typespec/openapi3/openapi.yaml new file mode 100644 index 0000000000..3720d6ffe8 --- /dev/null +++ b/packages/typespec-test/test/todo_non_branded/tsp-output/@typespec/openapi3/openapi.yaml @@ -0,0 +1,595 @@ +openapi: 3.0.0 +info: + title: Todo App + version: 0.0.0 +tags: [] +paths: + /items: + get: + operationId: TodoItems_list + parameters: + - $ref: '#/components/parameters/TodoItems.PaginationControls.limit' + - $ref: '#/components/parameters/TodoItems.PaginationControls.offset' + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/TodoItems.TodoPage' + 4XX: + description: Something is wrong with you. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard4XXResponse' + 5XX: + description: Something is wrong with me. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard5XXResponse' + post: + operationId: TodoItems_create + parameters: [] + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/TodoItem' + '422': + description: Client error + content: + application/json: + schema: + $ref: '#/components/schemas/TodoItems.InvalidTodoItem' + 4XX: + description: Something is wrong with you. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard4XXResponse' + 5XX: + description: Something is wrong with me. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard5XXResponse' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + item: + $ref: '#/components/schemas/TodoItemCreate' + attachments: + type: array + items: + $ref: '#/components/schemas/TodoAttachment' + required: + - item + /items/{id}: + get: + operationId: TodoItems_get + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: int64 + readOnly: true + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/TodoItem' + '404': + description: The server cannot find the requested resource. + patch: + operationId: TodoItems_update + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: int64 + readOnly: true + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/TodoItem' + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/TodoItems.TodoItemPatch' + delete: + operationId: TodoItems_delete + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: int64 + readOnly: true + responses: + '204': + description: There is no content to send for this request, but the headers may be useful. + '404': + description: The server cannot find the requested resource. + 4XX: + description: Something is wrong with you. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard4XXResponse' + 5XX: + description: Something is wrong with me. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard5XXResponse' + /items/{itemId}/attachments: + get: + operationId: Attachments_list + parameters: + - name: itemId + in: path + required: true + schema: + type: integer + format: int64 + readOnly: true + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + type: object + required: + - items + properties: + items: + type: array + items: + $ref: '#/components/schemas/TodoAttachment' + '404': + description: The server cannot find the requested resource. + 4XX: + description: Something is wrong with you. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard4XXResponse' + 5XX: + description: Something is wrong with me. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard5XXResponse' + post: + operationId: Attachments_createAttachment + parameters: + - name: itemId + in: path + required: true + schema: + type: integer + format: int64 + readOnly: true + responses: + '204': + description: There is no content to send for this request, but the headers may be useful. + '404': + description: The server cannot find the requested resource. + 4XX: + description: Something is wrong with you. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard4XXResponse' + 5XX: + description: Something is wrong with me. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard5XXResponse' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TodoAttachment' + /users: + post: + operationId: Users_create + parameters: [] + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/Users.UserCreatedResponse' + '409': + description: The user already exists + content: + application/json: + schema: + $ref: '#/components/schemas/Users.UserExistsResponse' + '422': + description: The user is invalid (e.g. forgot to enter email address) + content: + application/json: + schema: + $ref: '#/components/schemas/Users.InvalidUserResponse' + 4XX: + description: Something is wrong with you. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard4XXResponse' + 5XX: + description: Something is wrong with me. + content: + application/json: + schema: + $ref: '#/components/schemas/Standard5XXResponse' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + security: + - {} +security: + - BearerAuth: [] + - ApiKeyAuth: [] +components: + parameters: + TodoItems.PaginationControls.limit: + name: limit + in: query + required: false + description: The limit to the number of items + schema: + type: integer + format: int32 + default: 50 + explode: false + TodoItems.PaginationControls.offset: + name: offset + in: query + required: false + description: The offset to start paginating at + schema: + type: integer + format: int32 + default: 0 + explode: false + schemas: + ApiError: + type: object + required: + - code + - message + properties: + code: + type: string + description: A machine readable error code + message: + type: string + description: A human readable message + x-ms-primary-error-message: true + Standard4XXResponse: + type: object + allOf: + - $ref: '#/components/schemas/ApiError' + description: Something is wrong with you. + Standard5XXResponse: + type: object + allOf: + - $ref: '#/components/schemas/ApiError' + description: Something is wrong with me. + TodoAttachment: + anyOf: + - $ref: '#/components/schemas/TodoFileAttachment' + - $ref: '#/components/schemas/TodoUrlAttachment' + TodoFileAttachment: + type: object + required: + - filename + - mediaType + - contents + properties: + filename: + type: string + maxLength: 255 + description: The file name of the attachment + mediaType: + type: string + description: The media type of the attachment + contents: + type: string + format: byte + description: The contents of the file + TodoItem: + type: object + required: + - id + - title + - createdBy + - status + - createdAt + - updatedAt + properties: + id: + type: integer + format: int64 + description: The item's unique id + readOnly: true + title: + type: string + maxLength: 255 + description: The item's title + createdBy: + type: integer + format: int64 + description: User that created the todo + readOnly: true + assignedTo: + type: integer + format: int64 + description: User that the todo is assigned to + readOnly: true + description: + type: string + description: A longer description of the todo item in markdown format + status: + type: string + enum: + - NotStarted + - InProgress + - Completed + description: The status of the todo item + createdAt: + type: string + format: date-time + description: When the todo item was created. + readOnly: true + updatedAt: + type: string + format: date-time + description: When the todo item was last updated + readOnly: true + completedAt: + type: string + format: date-time + description: When the todo item was makred as completed + readOnly: true + labels: + $ref: '#/components/schemas/TodoLabels' + TodoItemCreate: + type: object + required: + - title + - status + properties: + title: + type: string + maxLength: 255 + description: The item's title + assignedTo: + type: integer + format: int64 + description: User that the todo is assigned to + readOnly: true + description: + type: string + description: A longer description of the todo item in markdown format + status: + type: string + enum: + - NotStarted + - InProgress + - Completed + description: The status of the todo item + labels: + $ref: '#/components/schemas/TodoLabels' + _dummy: + type: string + TodoItems.InvalidTodoItem: + type: object + allOf: + - $ref: '#/components/schemas/ApiError' + TodoItems.TodoItemPatch: + type: object + properties: + title: + type: string + maxLength: 255 + description: The item's title + assignedTo: + type: integer + format: int64 + description: User that the todo is assigned to + readOnly: true + nullable: true + description: + type: string + description: A longer description of the todo item in markdown format + nullable: true + status: + type: string + enum: + - NotStarted + - InProgress + - Completed + description: The status of the todo item + TodoItems.TodoPage: + type: object + required: + - items + - pagination + properties: + items: + type: array + items: + $ref: '#/components/schemas/TodoItem' + description: The items in the page + pagination: + type: object + properties: + pageSize: + type: integer + format: int32 + description: The number of items returned in this page + totalSize: + type: integer + format: int32 + description: The total number of items + limit: + type: integer + format: int32 + description: The limit to the number of items + default: 50 + offset: + type: integer + format: int32 + description: The offset to start paginating at + default: 0 + prevLink: + type: string + format: uri + description: A link to the previous page, if it exists + nextLink: + type: string + format: uri + description: A link to the next page, if it exists + required: + - pageSize + - totalSize + TodoLabelRecord: + type: object + required: + - name + properties: + name: + type: string + color: + type: string + pattern: ^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$ + TodoLabels: + anyOf: + - type: string + - type: array + items: + type: string + - $ref: '#/components/schemas/TodoLabelRecord' + - type: array + items: + $ref: '#/components/schemas/TodoLabelRecord' + TodoUrlAttachment: + type: object + required: + - description + - url + properties: + description: + type: string + description: A description of the URL + url: + type: string + format: uri + description: The url + User: + type: object + required: + - username + - email + - password + properties: + username: + type: string + minLength: 2 + maxLength: 50 + description: The user's username + email: + type: string + description: The user's email address + password: + type: string + description: |- + The user's password, provided when creating a user + but is otherwise not visible (and hashed by the backend) + Users.InvalidUserResponse: + type: object + required: + - code + properties: + code: + type: string + enum: + - invalid-user + allOf: + - $ref: '#/components/schemas/ApiError' + description: The user is invalid (e.g. forgot to enter email address) + Users.UserCreatedResponse: + type: object + required: + - id + - username + - email + - token + properties: + id: + type: integer + format: int64 + description: An autogenerated unique id for the user + readOnly: true + username: + type: string + minLength: 2 + maxLength: 50 + description: The user's username + email: + type: string + description: The user's email address + token: + type: string + description: The token to use to construct the validate email address url + Users.UserExistsResponse: + type: object + required: + - code + properties: + code: + type: string + enum: + - user-exists + allOf: + - $ref: '#/components/schemas/ApiError' + description: The user already exists + securitySchemes: + BearerAuth: + type: http + scheme: bearer + ApiKeyAuth: + type: apiKey + in: cookie + name: session-id diff --git a/packages/typespec-test/test/todo_non_branded/tspconfig.yaml b/packages/typespec-test/test/todo_non_branded/tspconfig.yaml index 9309d43416..a02fe83506 100644 --- a/packages/typespec-test/test/todo_non_branded/tspconfig.yaml +++ b/packages/typespec-test/test/todo_non_branded/tspconfig.yaml @@ -3,7 +3,7 @@ emit: - "@typespec/openapi3" options: "@azure-tools/typespec-ts": - isModularLibrary: false + isModularLibrary: true generateMetadata: true azureSdkForJs: false generateSample: true diff --git a/packages/typespec-test/test/translator/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/translator/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/translator/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/translator/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/eslint.config.mjs index 113bdc3eaf..ac1c3c967e 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/eslint.config.mjs +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/eslint.config.mjs @@ -1,7 +1,6 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default [ - ...azsdkEslint.configs.recommended, +export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -14,4 +13,4 @@ export default [ "tsdoc/syntax": "warn" } } -]; +]); diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json index cdb86990a4..489d121b32 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json @@ -13,8 +13,8 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/widgets": "./src/api/widgets/index.ts", - "./api/budgets": "./src/api/budgets/index.ts" + "./api/budgets": "./src/api/budgets/index.ts", + "./api/widgets": "./src/api/widgets/index.ts" }, "dialects": [ "esm", @@ -144,24 +144,6 @@ "default": "./dist/commonjs/api/index.js" } }, - "./api/widgets": { - "browser": { - "types": "./dist/browser/api/widgets/index.d.ts", - "default": "./dist/browser/api/widgets/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/widgets/index.d.ts", - "default": "./dist/react-native/api/widgets/index.js" - }, - "import": { - "types": "./dist/esm/api/widgets/index.d.ts", - "default": "./dist/esm/api/widgets/index.js" - }, - "require": { - "types": "./dist/commonjs/api/widgets/index.d.ts", - "default": "./dist/commonjs/api/widgets/index.js" - } - }, "./api/budgets": { "browser": { "types": "./dist/browser/api/budgets/index.d.ts", @@ -179,6 +161,24 @@ "types": "./dist/commonjs/api/budgets/index.d.ts", "default": "./dist/commonjs/api/budgets/index.js" } + }, + "./api/widgets": { + "browser": { + "types": "./dist/browser/api/widgets/index.d.ts", + "default": "./dist/browser/api/widgets/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/widgets/index.d.ts", + "default": "./dist/react-native/api/widgets/index.js" + }, + "import": { + "types": "./dist/esm/api/widgets/index.d.ts", + "default": "./dist/esm/api/widgets/index.js" + }, + "require": { + "types": "./dist/commonjs/api/widgets/index.d.ts", + "default": "./dist/commonjs/api/widgets/index.js" + } } }, "main": "./dist/commonjs/index.js", diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md index 27928a9505..2c61b4933b 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md @@ -21,7 +21,6 @@ export interface AnalyzeResult { // @public export interface BudgetsCreateOrReplaceOptionalParams extends OperationOptions { - apiVersion?: string; updateIntervalInMs?: number; } @@ -37,7 +36,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { - "V1.0.0" = "1.0.0" + "1.0.0" = "1.0.0" } // @public @@ -88,7 +87,6 @@ export interface WidgetsAnalyzeWidgetOptionalParams extends OperationOptions { // @public export interface WidgetsCreateOrReplaceOptionalParams extends OperationOptions { - apiVersion?: string; updateIntervalInMs?: number; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts index ea721ea5b0..57cbbfff35 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts @@ -25,7 +25,12 @@ export function _createOrReplaceSend( .path("/budgets/widgets/createOrReplace/users/{name}", name) .put({ ...operationOptionsToRequestParameters(options), - queryParameters: { "api-version": options?.apiVersion ?? "1.0.0" }, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, body: userSerializer(resource), }); } @@ -33,7 +38,7 @@ export function _createOrReplaceSend( export async function _createOrReplaceDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200", "201"]; + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -51,7 +56,7 @@ export function createOrReplace( return getLongRunningPoller( context, _createOrReplaceDeserialize, - ["200", "201"], + ["201", "200"], { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts index 7322ab36e0..7dc382b13d 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts @@ -2,16 +2,16 @@ // Licensed under the MIT License. export { - WidgetsListWidgetsOptionalParams, - WidgetsListWidgetsPagesOptionalParams, - WidgetsQueryWidgetsPagesOptionalParams, - WidgetsGetWidgetOptionalParams, - WidgetsCreateWidgetOptionalParams, - WidgetsCreateOrReplaceOptionalParams, - WidgetsUpdateWidgetOptionalParams, - WidgetsDeleteWidgetOptionalParams, - WidgetsAnalyzeWidgetOptionalParams, BudgetsCreateOrReplaceOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsListWidgetsOptionalParams, } from "./options.js"; export { createWidgetService, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/options.ts index dd32ad23e3..c97e0cf593 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/options.ts @@ -4,53 +4,49 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface WidgetsListWidgetsOptionalParams extends OperationOptions { - optionalHeader?: string; - nullableOptionalHeader?: string | null; - optionalDateHeader?: Date; - nullableDateHeader?: Date | null; +export interface BudgetsCreateOrReplaceOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; } /** Optional parameters. */ -export interface WidgetsListWidgetsPagesOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface WidgetsQueryWidgetsPagesOptionalParams - extends OperationOptions {} +export interface WidgetsAnalyzeWidgetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface WidgetsGetWidgetOptionalParams extends OperationOptions {} +export interface WidgetsDeleteWidgetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface WidgetsCreateWidgetOptionalParams extends OperationOptions {} +export interface WidgetsUpdateWidgetOptionalParams extends OperationOptions { + /** The weight of the widget. This is an int32, but must be greater than zero. */ + weight?: number; + /** The color of the widget. */ + color?: "red" | "blue"; +} /** Optional parameters. */ export interface WidgetsCreateOrReplaceOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; - /** The API version to use for this operation. */ - apiVersion?: string; } /** Optional parameters. */ -export interface WidgetsUpdateWidgetOptionalParams extends OperationOptions { - /** The weight of the widget. This is an int32, but must be greater than zero. */ - weight?: number; - /** The color of the widget. */ - color?: "red" | "blue"; -} +export interface WidgetsCreateWidgetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface WidgetsDeleteWidgetOptionalParams extends OperationOptions {} +export interface WidgetsGetWidgetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface WidgetsAnalyzeWidgetOptionalParams extends OperationOptions {} +export interface WidgetsQueryWidgetsPagesOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface BudgetsCreateOrReplaceOptionalParams extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** The API version to use for this operation. */ - apiVersion?: string; +export interface WidgetsListWidgetsPagesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface WidgetsListWidgetsOptionalParams extends OperationOptions { + optionalHeader?: string; + nullableOptionalHeader?: string | null; + optionalDateHeader?: Date; + nullableDateHeader?: Date | null; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgetServiceContext.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgetServiceContext.ts index 612a105381..2843b360f6 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgetServiceContext.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgetServiceContext.ts @@ -6,7 +6,11 @@ import { KnownVersions } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { KeyCredential, isKeyCredential } from "@azure/core-auth"; -export interface WidgetServiceContext extends Client {} +export interface WidgetServiceContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; +} /** Optional parameters for the client. */ export interface WidgetServiceClientOptionalParams extends ClientOptions { @@ -20,6 +24,8 @@ export function createWidgetService( credential: KeyCredential, options: WidgetServiceClientOptionalParams = {}, ): WidgetServiceContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-widget_dpg/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions @@ -30,11 +36,7 @@ export function createWidgetService( userAgentOptions: { userAgentPrefix }, loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, }; - const clientContext = getClient( - options.endpoint ?? options.baseUrl ?? String(endpointParam), - undefined, - updatedOptions, - ); + const clientContext = getClient(endpointUrl, undefined, updatedOptions); if (isKeyCredential(credential)) { clientContext.pipeline.addPolicy({ @@ -46,10 +48,21 @@ export function createWidgetService( }); } clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - if (options.apiVersion) { - logger.warning( - "This client does not support client api-version, please change it at the operation level", - ); - } - return clientContext; + const apiVersion = options.apiVersion ?? "1.0.0"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { ...clientContext, apiVersion } as WidgetServiceContext; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts index 6d91eb21c7..768d13c245 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts @@ -40,199 +40,175 @@ import { import { uint8ArrayToString } from "@azure/core-util"; import { PollerLike, OperationState } from "@azure/core-lro"; -export function _listWidgetsSend( +export function _analyzeWidgetSend( context: Client, - requiredHeader: string, - bytesHeader: Uint8Array, - value: Uint8Array, - csvArrayHeader: Uint8Array[], - utcDateHeader: Date, - options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, + id: string, + options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/widgets").get({ - ...operationOptionsToRequestParameters(options), - headers: { - "required-header": requiredHeader, - ...(options?.optionalHeader !== undefined - ? { "optional-header": options?.optionalHeader } - : {}), - ...(options?.nullableOptionalHeader !== undefined && - options?.nullableOptionalHeader !== null - ? { "nullable-optional-header": options?.nullableOptionalHeader } - : {}), - "bytes-header": uint8ArrayToString(bytesHeader, "base64"), - value: uint8ArrayToString(value, "base64"), - "csv-array-header": buildCsvCollection( - csvArrayHeader.map((p: any) => { - return uint8ArrayToString(p, "base64url"); - }), - ), - "utc-date-header": utcDateHeader.toUTCString(), - ...(options?.optionalDateHeader !== undefined - ? { - "optional-date-header": !options?.optionalDateHeader - ? options?.optionalDateHeader - : options?.optionalDateHeader.toUTCString(), - } - : {}), - ...(options?.nullableDateHeader !== undefined && - options?.nullableDateHeader !== null - ? { - "nullable-date-header": !options?.nullableDateHeader - ? options?.nullableDateHeader - : options?.nullableDateHeader.toUTCString(), - } - : {}), - }, - }); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/widgets/{id}/analyze", id) + .post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _listWidgetsDeserialize( +export async function _analyzeWidgetDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return widgetArrayDeserializer(result.body); + return analyzeResultDeserializer(result.body); } -/** - * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets. - * - * It does not accept any options or parameters. - */ -export async function listWidgets( +/** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */ +export async function analyzeWidget( context: Client, - requiredHeader: string, - bytesHeader: Uint8Array, - value: Uint8Array, - csvArrayHeader: Uint8Array[], - utcDateHeader: Date, - options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listWidgetsSend( - context, - requiredHeader, - bytesHeader, - value, - csvArrayHeader, - utcDateHeader, - options, - ); - return _listWidgetsDeserialize(result); + id: string, + options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _analyzeWidgetSend(context, id, options); + return _analyzeWidgetDeserialize(result); } -export function _listWidgetsPagesSend( +export function _deleteWidgetSend( context: Client, - page: number, - pageSize: number, - options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, + id: string, + options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path("/widgets/widgets/pages") - .get({ + .path("/widgets/{id}", id) + .delete({ ...operationOptionsToRequestParameters(options), - queryParameters: { page: page, pageSize: pageSize }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _listWidgetsPagesDeserialize( +export async function _deleteWidgetDeserialize( result: PathUncheckedResponse, -): Promise<_ListWidgetsPagesResults> { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _listWidgetsPagesResultsDeserializer(result.body); + return; } -export function listWidgetsPages( +/** Delete a widget by ID. */ +export async function deleteWidget( context: Client, - page: number, - pageSize: number, - options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listWidgetsPagesSend(context, page, pageSize, options), - _listWidgetsPagesDeserialize, - ["200"], - { itemName: "results", nextLinkName: "odata.nextLink" }, - ); + id: string, + options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteWidgetSend(context, id, options); + return _deleteWidgetDeserialize(result); } -export function _queryWidgetsPagesSend( +export function _updateWidgetSend( context: Client, - page: number, - pageSize: number, - options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, + id: string, + options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path("/widgets/widgets/pages") - .post({ + .path("/widgets/{id}", id) + .patch({ ...operationOptionsToRequestParameters(options), - queryParameters: { page: page, pageSize: pageSize }, + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: { weight: options?.weight, color: options?.color }, }); } -export async function _queryWidgetsPagesDeserialize( +export async function _updateWidgetDeserialize( result: PathUncheckedResponse, -): Promise<_ListWidgetsPagesResults> { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return _listWidgetsPagesResultsDeserializer(result.body); + return widgetDeserializer(result.body); } -export function queryWidgetsPages( +/** + * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields + * are optional and will be updated within the widget if provided. + */ +export async function updateWidget( context: Client, - page: number, - pageSize: number, - options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _queryWidgetsPagesSend(context, page, pageSize, options), - _queryWidgetsPagesDeserialize, - ["200"], - { itemName: "results", nextLinkName: "odata.nextLink" }, - ); + id: string, + options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateWidgetSend(context, id, options); + return _updateWidgetDeserialize(result); } -export function _getWidgetSend( +export function _createOrReplaceSend( context: Client, - id: string, - options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, + name: string, + resource: User, + options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/widgets/{id}", id) - .get({ ...operationOptionsToRequestParameters(options) }); + .path("/widgets/widgets/createOrReplace/users/{name}", name) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: userSerializer(resource), + }); } -export async function _getWidgetDeserialize( +export async function _createOrReplaceDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; +): Promise { + const expectedStatuses = ["201", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return widgetDeserializer(result.body); + return userDeserializer(result.body); } -/** Get a widget by ID. */ -export async function getWidget( +/** Long-running resource create or replace operation template. */ +export function createOrReplace( context: Client, - id: string, - options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getWidgetSend(context, id, options); - return _getWidgetDeserialize(result); + name: string, + resource: User, + options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, +): PollerLike, User> { + return getLongRunningPoller( + context, + _createOrReplaceDeserialize, + ["201", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrReplaceSend(context, name, resource, options), + resourceLocationConfig: "original-uri", + }, + ) as PollerLike, User>; } export function _createWidgetSend( @@ -241,10 +217,16 @@ export function _createWidgetSend( color: "red" | "blue", options: WidgetsCreateWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context .path("/widgets") .post({ ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, body: { weight: weight, color: color }, }); } @@ -276,148 +258,217 @@ export async function createWidget( return _createWidgetDeserialize(result); } -export function _createOrReplaceSend( +export function _getWidgetSend( context: Client, - name: string, - resource: User, - options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, + id: string, + options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path("/widgets/widgets/createOrReplace/users/{name}", name) - .put({ + .path("/widgets/{id}", id) + .get({ ...operationOptionsToRequestParameters(options), - queryParameters: { "api-version": options?.apiVersion ?? "1.0.0" }, - body: userSerializer(resource), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } -export async function _createOrReplaceDeserialize( +export async function _getWidgetDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; +): Promise { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return userDeserializer(result.body); + return widgetDeserializer(result.body); } -/** Long-running resource create or replace operation template. */ -export function createOrReplace( +/** Get a widget by ID. */ +export async function getWidget( context: Client, - name: string, - resource: User, - options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, -): PollerLike, User> { - return getLongRunningPoller( - context, - _createOrReplaceDeserialize, - ["200", "201"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _createOrReplaceSend(context, name, resource, options), - resourceLocationConfig: "original-uri", - }, - ) as PollerLike, User>; + id: string, + options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getWidgetSend(context, id, options); + return _getWidgetDeserialize(result); } -export function _updateWidgetSend( +export function _queryWidgetsPagesSend( context: Client, - id: string, - options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, + page: number, + pageSize: number, + options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path("/widgets/{id}", id) - .patch({ + .path("/widgets/widgets/pages") + .post({ ...operationOptionsToRequestParameters(options), - body: { weight: options?.weight, color: options?.color }, + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { page: page, pageSize: pageSize }, }); } -export async function _updateWidgetDeserialize( +export async function _queryWidgetsPagesDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise<_ListWidgetsPagesResults> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return widgetDeserializer(result.body); + return _listWidgetsPagesResultsDeserializer(result.body); } -/** - * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields - * are optional and will be updated within the widget if provided. - */ -export async function updateWidget( +export function queryWidgetsPages( context: Client, - id: string, - options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _updateWidgetSend(context, id, options); - return _updateWidgetDeserialize(result); + page: number, + pageSize: number, + options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _queryWidgetsPagesSend(context, page, pageSize, options), + _queryWidgetsPagesDeserialize, + ["200"], + { itemName: "results", nextLinkName: "odata.nextLink" }, + ); } -export function _deleteWidgetSend( +export function _listWidgetsPagesSend( context: Client, - id: string, - options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, + page: number, + pageSize: number, + options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, ): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context - .path("/widgets/{id}", id) - .delete({ ...operationOptionsToRequestParameters(options) }); + .path("/widgets/widgets/pages") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { page: page, pageSize: pageSize }, + }); } -export async function _deleteWidgetDeserialize( +export async function _listWidgetsPagesDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["204"]; +): Promise<_ListWidgetsPagesResults> { + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return; + return _listWidgetsPagesResultsDeserializer(result.body); } -/** Delete a widget by ID. */ -export async function deleteWidget( +export function listWidgetsPages( context: Client, - id: string, - options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteWidgetSend(context, id, options); - return _deleteWidgetDeserialize(result); + page: number, + pageSize: number, + options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listWidgetsPagesSend(context, page, pageSize, options), + _listWidgetsPagesDeserialize, + ["200"], + { itemName: "results", nextLinkName: "odata.nextLink" }, + ); } -export function _analyzeWidgetSend( +export function _listWidgetsSend( context: Client, - id: string, - options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, + requiredHeader: string, + bytesHeader: Uint8Array, + value: Uint8Array, + csvArrayHeader: Uint8Array[], + utcDateHeader: Date, + options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context - .path("/widgets/{id}/analyze", id) - .post({ ...operationOptionsToRequestParameters(options) }); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context.path("/widgets").get({ + ...operationOptionsToRequestParameters(options), + headers: { + "required-header": requiredHeader, + ...(options?.optionalHeader !== undefined + ? { "optional-header": options?.optionalHeader } + : {}), + ...(options?.nullableOptionalHeader !== undefined && + options?.nullableOptionalHeader !== null + ? { "nullable-optional-header": options?.nullableOptionalHeader } + : {}), + "bytes-header": uint8ArrayToString(bytesHeader, "base64"), + value: uint8ArrayToString(value, "base64"), + "csv-array-header": buildCsvCollection( + csvArrayHeader.map((p: any) => { + return uint8ArrayToString(p, "base64url"); + }), + ), + "utc-date-header": utcDateHeader.toUTCString(), + ...(options?.optionalDateHeader !== undefined + ? { + "optional-date-header": !options?.optionalDateHeader + ? options?.optionalDateHeader + : options?.optionalDateHeader.toUTCString(), + } + : {}), + ...(options?.nullableDateHeader !== undefined && + options?.nullableDateHeader !== null + ? { + "nullable-date-header": !options?.nullableDateHeader + ? options?.nullableDateHeader + : options?.nullableDateHeader.toUTCString(), + } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); } -export async function _analyzeWidgetDeserialize( +export async function _listWidgetsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return analyzeResultDeserializer(result.body); + return widgetArrayDeserializer(result.body); } -/** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */ -export async function analyzeWidget( +/** + * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets. + * + * It does not accept any options or parameters. + */ +export async function listWidgets( context: Client, - id: string, - options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _analyzeWidgetSend(context, id, options); - return _analyzeWidgetDeserialize(result); + requiredHeader: string, + bytesHeader: Uint8Array, + value: Uint8Array, + csvArrayHeader: Uint8Array[], + utcDateHeader: Date, + options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listWidgetsSend( + context, + requiredHeader, + bytesHeader, + value, + csvArrayHeader, + utcDateHeader, + options, + ); + return _listWidgetsDeserialize(result); } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts index 2279c56f25..fcdcddc78a 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts @@ -2,27 +2,27 @@ // Licensed under the MIT License. import { - WidgetsListWidgetsOptionalParams, - WidgetsListWidgetsPagesOptionalParams, - WidgetsQueryWidgetsPagesOptionalParams, - WidgetsGetWidgetOptionalParams, - WidgetsCreateWidgetOptionalParams, - WidgetsCreateOrReplaceOptionalParams, - WidgetsUpdateWidgetOptionalParams, - WidgetsDeleteWidgetOptionalParams, WidgetsAnalyzeWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsListWidgetsOptionalParams, } from "../../api/options.js"; import { WidgetServiceContext } from "../../api/widgetServiceContext.js"; import { - listWidgets, - listWidgetsPages, - queryWidgetsPages, - getWidget, - createWidget, - createOrReplace, - updateWidget, - deleteWidget, analyzeWidget, + deleteWidget, + updateWidget, + createOrReplace, + createWidget, + getWidget, + queryWidgetsPages, + listWidgetsPages, + listWidgets, } from "../../api/widgets/index.js"; import { User, Widget, AnalyzeResult } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; @@ -30,34 +30,30 @@ import { PollerLike, OperationState } from "@azure/core-lro"; /** Interface representing a Widgets operations. */ export interface WidgetsOperations { + /** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */ + analyzeWidget: ( + id: string, + options?: WidgetsAnalyzeWidgetOptionalParams, + ) => Promise; + /** Delete a widget by ID. */ + deleteWidget: ( + id: string, + options?: WidgetsDeleteWidgetOptionalParams, + ) => Promise; /** - * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets. - * - * It does not accept any options or parameters. + * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields + * are optional and will be updated within the widget if provided. */ - listWidgets: ( - requiredHeader: string, - bytesHeader: Uint8Array, - value: Uint8Array, - csvArrayHeader: Uint8Array[], - utcDateHeader: Date, - options?: WidgetsListWidgetsOptionalParams, - ) => Promise; - listWidgetsPages: ( - page: number, - pageSize: number, - options?: WidgetsListWidgetsPagesOptionalParams, - ) => PagedAsyncIterableIterator; - queryWidgetsPages: ( - page: number, - pageSize: number, - options?: WidgetsQueryWidgetsPagesOptionalParams, - ) => PagedAsyncIterableIterator; - /** Get a widget by ID. */ - getWidget: ( + updateWidget: ( id: string, - options?: WidgetsGetWidgetOptionalParams, + options?: WidgetsUpdateWidgetOptionalParams, ) => Promise; + /** Long-running resource create or replace operation template. */ + createOrReplace: ( + name: string, + resource: User, + options?: WidgetsCreateOrReplaceOptionalParams, + ) => PollerLike, User>; /** * Create a new widget. * @@ -69,34 +65,66 @@ export interface WidgetsOperations { color: "red" | "blue", options?: WidgetsCreateWidgetOptionalParams, ) => Promise; - /** Long-running resource create or replace operation template. */ - createOrReplace: ( - name: string, - resource: User, - options?: WidgetsCreateOrReplaceOptionalParams, - ) => PollerLike, User>; - /** - * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields - * are optional and will be updated within the widget if provided. - */ - updateWidget: ( + /** Get a widget by ID. */ + getWidget: ( id: string, - options?: WidgetsUpdateWidgetOptionalParams, + options?: WidgetsGetWidgetOptionalParams, ) => Promise; - /** Delete a widget by ID. */ - deleteWidget: ( - id: string, - options?: WidgetsDeleteWidgetOptionalParams, - ) => Promise; - /** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */ - analyzeWidget: ( - id: string, - options?: WidgetsAnalyzeWidgetOptionalParams, - ) => Promise; + queryWidgetsPages: ( + page: number, + pageSize: number, + options?: WidgetsQueryWidgetsPagesOptionalParams, + ) => PagedAsyncIterableIterator; + listWidgetsPages: ( + page: number, + pageSize: number, + options?: WidgetsListWidgetsPagesOptionalParams, + ) => PagedAsyncIterableIterator; + /** + * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets. + * + * It does not accept any options or parameters. + */ + listWidgets: ( + requiredHeader: string, + bytesHeader: Uint8Array, + value: Uint8Array, + csvArrayHeader: Uint8Array[], + utcDateHeader: Date, + options?: WidgetsListWidgetsOptionalParams, + ) => Promise; } export function getWidgets(context: WidgetServiceContext) { return { + analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptionalParams) => + analyzeWidget(context, id, options), + deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptionalParams) => + deleteWidget(context, id, options), + updateWidget: (id: string, options?: WidgetsUpdateWidgetOptionalParams) => + updateWidget(context, id, options), + createOrReplace: ( + name: string, + resource: User, + options?: WidgetsCreateOrReplaceOptionalParams, + ) => createOrReplace(context, name, resource, options), + createWidget: ( + weight: number, + color: "red" | "blue", + options?: WidgetsCreateWidgetOptionalParams, + ) => createWidget(context, weight, color, options), + getWidget: (id: string, options?: WidgetsGetWidgetOptionalParams) => + getWidget(context, id, options), + queryWidgetsPages: ( + page: number, + pageSize: number, + options?: WidgetsQueryWidgetsPagesOptionalParams, + ) => queryWidgetsPages(context, page, pageSize, options), + listWidgetsPages: ( + page: number, + pageSize: number, + options?: WidgetsListWidgetsPagesOptionalParams, + ) => listWidgetsPages(context, page, pageSize, options), listWidgets: ( requiredHeader: string, bytesHeader: Uint8Array, @@ -114,34 +142,6 @@ export function getWidgets(context: WidgetServiceContext) { utcDateHeader, options, ), - listWidgetsPages: ( - page: number, - pageSize: number, - options?: WidgetsListWidgetsPagesOptionalParams, - ) => listWidgetsPages(context, page, pageSize, options), - queryWidgetsPages: ( - page: number, - pageSize: number, - options?: WidgetsQueryWidgetsPagesOptionalParams, - ) => queryWidgetsPages(context, page, pageSize, options), - getWidget: (id: string, options?: WidgetsGetWidgetOptionalParams) => - getWidget(context, id, options), - createWidget: ( - weight: number, - color: "red" | "blue", - options?: WidgetsCreateWidgetOptionalParams, - ) => createWidget(context, weight, color, options), - createOrReplace: ( - name: string, - resource: User, - options?: WidgetsCreateOrReplaceOptionalParams, - ) => createOrReplace(context, name, resource, options), - updateWidget: (id: string, options?: WidgetsUpdateWidgetOptionalParams) => - updateWidget(context, id, options), - deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptionalParams) => - deleteWidget(context, id, options), - analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptionalParams) => - analyzeWidget(context, id, options), }; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts index aea9c394f9..8a937aec7e 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts @@ -17,16 +17,16 @@ export { KnownVersions, } from "./models/index.js"; export { - WidgetsListWidgetsOptionalParams, - WidgetsListWidgetsPagesOptionalParams, - WidgetsQueryWidgetsPagesOptionalParams, - WidgetsGetWidgetOptionalParams, - WidgetsCreateWidgetOptionalParams, - WidgetsCreateOrReplaceOptionalParams, - WidgetsUpdateWidgetOptionalParams, - WidgetsDeleteWidgetOptionalParams, - WidgetsAnalyzeWidgetOptionalParams, BudgetsCreateOrReplaceOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsListWidgetsOptionalParams, WidgetServiceClientOptionalParams, } from "./api/index.js"; export { BudgetsOperations, WidgetsOperations } from "./classic/index.js"; diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts index 894805a8e7..b5bb89bee6 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts @@ -97,5 +97,5 @@ export function nonReferencedModelDeserializer(item: any): NonReferencedModel { /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - "V1.0.0" = "1.0.0", + "1.0.0" = "1.0.0", } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts index c2c96cb208..b2173b8a55 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts @@ -2,8 +2,8 @@ // Licensed under the MIT License. import { WidgetServiceClient } from "./widgetServiceClient.js"; -import { _createOrReplaceDeserialize } from "./api/widgets/index.js"; -import { _createOrReplaceDeserialize as _createOrReplaceDeserializeBudgets } from "./api/budgets/index.js"; +import { _createOrReplaceDeserialize } from "./api/budgets/index.js"; +import { _createOrReplaceDeserialize as _createOrReplaceDeserializeWidgets } from "./api/widgets/index.js"; import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; import { OperationOptions, @@ -82,13 +82,13 @@ interface DeserializationHelper { } const deserializeMap: Record = { - "PUT /widgets/widgets/createOrReplace/users/{name}": { + "PUT /budgets/widgets/createOrReplace/users/{name}": { deserializer: _createOrReplaceDeserialize, - expectedStatuses: ["200", "201"], + expectedStatuses: ["201", "200"], }, - "PUT /budgets/widgets/createOrReplace/users/{name}": { - deserializer: _createOrReplaceDeserializeBudgets, - expectedStatuses: ["200", "201"], + "PUT /widgets/widgets/createOrReplace/users/{name}": { + deserializer: _createOrReplaceDeserializeWidgets, + expectedStatuses: ["201", "200"], }, }; diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/widgetServiceClient.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/widgetServiceClient.ts index db2aa3f371..d50863d698 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/widgetServiceClient.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/widgetServiceClient.ts @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - getWidgetsOperations, - WidgetsOperations, -} from "./classic/widgets/index.js"; import { getBudgetsOperations, BudgetsOperations, } from "./classic/budgets/index.js"; +import { + getWidgetsOperations, + WidgetsOperations, +} from "./classic/widgets/index.js"; import { createWidgetService, WidgetServiceContext, @@ -38,12 +38,12 @@ export class WidgetServiceClient { userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; - this.widgets = getWidgetsOperations(this._client); this.budgets = getBudgetsOperations(this._client); + this.widgets = getWidgetsOperations(this._client); } - /** The operation groups for Widgets */ - public readonly widgets: WidgetsOperations; - /** The operation groups for Budgets */ + /** The operation groups for budgets */ public readonly budgets: BudgetsOperations; + /** The operation groups for widgets */ + public readonly widgets: WidgetsOperations; } diff --git a/packages/typespec-test/test/widget_dpg/spec/main.tsp b/packages/typespec-test/test/widget_dpg/spec/main.tsp index 2afb658195..baf916cecd 100644 --- a/packages/typespec-test/test/widget_dpg/spec/main.tsp +++ b/packages/typespec-test/test/widget_dpg/spec/main.tsp @@ -78,7 +78,7 @@ model ListWidgetsPagesResults { @items results: Widget[]; @doc("The URL to get the next set of results.") - @Azure.Core.nextLink + @TypeSpec.nextLink `odata.nextLink`?: string; } From cab369463be81631a3dcd8e58b2e6b41f51b3b55 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:24:03 +0800 Subject: [PATCH 77/91] update tsp --- .../test/ai/generated/typespec-ts/LICENSE | 2 +- .../test/ai/generated/typespec-ts/README.md | 24 +- .../ai/generated/typespec-ts/package.json | 21 +- .../typespec-ts/review/ai-client.api.md | 412 +++-- .../{azureAIClient.ts => aiProjectClient.ts} | 23 +- .../typespec-ts/src/api/agents/index.ts | 138 +- ...{azureAIContext.ts => aiProjectContext.ts} | 14 +- .../typespec-ts/src/api/connections/index.ts | 119 +- .../typespec-ts/src/api/evaluations/index.ts | 49 +- .../ai/generated/typespec-ts/src/api/index.ts | 18 +- .../generated/typespec-ts/src/api/options.ts | 61 +- .../typespec-ts/src/api/telemetry/index.ts | 59 + .../typespec-ts/src/classic/agents/index.ts | 21 +- .../src/classic/connections/index.ts | 64 +- .../src/classic/evaluations/index.ts | 40 +- .../typespec-ts/src/classic/index.ts | 1 + .../src/classic/telemetry/index.ts | 33 + .../ai/generated/typespec-ts/src/index.ts | 69 +- .../generated/typespec-ts/src/models/index.ts | 54 +- .../typespec-ts/src/models/models.ts | 1497 ++++++++++++----- .../test/ai/spec/agents/client.tsp | 19 +- .../test/ai/spec/agents/common/models.tsp | 37 +- .../test/ai/spec/agents/files/models.tsp | 10 +- .../test/ai/spec/agents/files/routes.tsp | 8 +- .../test/ai/spec/agents/messages/models.tsp | 19 +- .../test/ai/spec/agents/messages/routes.tsp | 4 +- .../test/ai/spec/agents/models.tsp | 4 +- .../test/ai/spec/agents/routes.tsp | 4 +- .../test/ai/spec/agents/run_steps/models.tsp | 10 +- .../test/ai/spec/agents/run_steps/routes.tsp | 18 +- .../test/ai/spec/agents/runs/models.tsp | 27 +- .../test/ai/spec/agents/runs/routes.tsp | 11 +- .../test/ai/spec/agents/streaming/events.tsp | 7 +- .../test/ai/spec/agents/threads/models.tsp | 4 +- .../test/ai/spec/agents/threads/routes.tsp | 4 +- .../test/ai/spec/agents/tools/models.tsp | 258 ++- .../ai/spec/agents/tools/tool_resources.tsp | 82 +- .../spec/agents/vector_stores/common/main.tsp | 58 +- .../vector_stores/file_batches/models.tsp | 4 +- .../vector_stores/file_batches/routes.tsp | 13 +- .../agents/vector_stores/files/models.tsp | 21 +- .../agents/vector_stores/files/routes.tsp | 11 +- .../ai/spec/agents/vector_stores/main.tsp | 2 +- .../ai/spec/agents/vector_stores/models.tsp | 8 +- .../ai/spec/agents/vector_stores/routes.tsp | 4 +- .../typespec-test/test/ai/spec/client.tsp | 3 +- .../test/ai/spec/connections/client.tsp | 33 +- .../test/ai/spec/connections/model.tsp | 82 +- .../test/ai/spec/connections/routes.tsp | 24 +- .../test/ai/spec/evaluations/client.tsp | 2 +- .../test/ai/spec/evaluations/model.tsp | 61 +- .../test/ai/spec/evaluations/routes.tsp | 21 +- packages/typespec-test/test/ai/spec/main.tsp | 9 +- .../test/ai/spec/telemetry/client.tsp | 7 + .../test/ai/spec/telemetry/model.tsp | 33 + .../test/ai/spec/telemetry/routes.tsp | 29 + 56 files changed, 2575 insertions(+), 1095 deletions(-) rename packages/typespec-test/test/ai/generated/typespec-ts/src/{azureAIClient.ts => aiProjectClient.ts} (75%) rename packages/typespec-test/test/ai/generated/typespec-ts/src/api/{azureAIContext.ts => aiProjectContext.ts} (89%) create mode 100644 packages/typespec-test/test/ai/generated/typespec-ts/src/api/telemetry/index.ts create mode 100644 packages/typespec-test/test/ai/generated/typespec-ts/src/classic/telemetry/index.ts create mode 100644 packages/typespec-test/test/ai/spec/telemetry/client.tsp create mode 100644 packages/typespec-test/test/ai/spec/telemetry/model.tsp create mode 100644 packages/typespec-test/test/ai/spec/telemetry/routes.tsp diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/LICENSE b/packages/typespec-test/test/ai/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/ai/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/README.md b/packages/typespec-test/test/ai/generated/typespec-ts/README.md index 12e1346c3d..fc9ad25444 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/ai/generated/typespec-ts/README.md @@ -1,6 +1,6 @@ -# Azure Client client library for JavaScript +# Azure Projects client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Client client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Projects client. @@ -24,16 +24,16 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/ai-client` package -Install the Azure Client client library for JavaScript with `npm`: +Install the Azure Projects client library for JavaScript with `npm`: ```bash npm install @azure/ai-client ``` -### Create and authenticate a `ClientClient` +### Create and authenticate a `ProjectsClient` -To create a client object to access the Azure Client API, you will need the `endpoint` of your Azure Client resource and a `credential`. The Azure Client client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure Client resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure Projects API, you will need the `endpoint` of your Azure Projects resource and a `credential`. The Azure Projects client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Projects resource in the [Azure Portal][azure_portal]. You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). @@ -43,22 +43,22 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure Client** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +You will also need to **register a new AAD application and grant access to Azure Projects** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript -const { ClientClient } = require("@azure/ai-client"); +const { ProjectsClient } = require("@azure/ai-client"); const { DefaultAzureCredential } = require("@azure/identity"); // For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. -const client = new ClientClient("", new DefaultAzureCredential()); +const client = new ProjectsClient("", new DefaultAzureCredential()); // For client-side applications running in the browser, use this code instead: // const credential = new InteractiveBrowserCredential({ // tenantId: "", // clientId: "" // }); -// const client = new ClientClient("", credential); +// const client = new ProjectsClient("", credential); ``` @@ -67,9 +67,9 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### ClientClient +### ProjectsClient -`ClientClient` is the primary interface for developers using the Azure Client client library. Explore the methods on this client object to understand the different features of the Azure Client service that you can access. +`ProjectsClient` is the primary interface for developers using the Azure Projects client library. Explore the methods on this client object to understand the different features of the Azure Projects service that you can access. ## Troubleshooting diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/package.json b/packages/typespec-test/test/ai/generated/typespec-ts/package.json index 91fc31367a..899cfebe55 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/ai/generated/typespec-ts/package.json @@ -1,7 +1,7 @@ { "name": "@azure/ai-client", "version": "1.0.0-beta.1", - "description": "A generated SDK for ClientClient.", + "description": "A generated SDK for ProjectsClient.", "engines": { "node": ">=18.0.0" }, @@ -14,6 +14,7 @@ "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", "./api/evaluations": "./src/api/evaluations/index.ts", + "./api/telemetry": "./src/api/telemetry/index.ts", "./api/connections": "./src/api/connections/index.ts", "./api/agents": "./src/api/agents/index.ts" }, @@ -145,6 +146,24 @@ "default": "./dist/commonjs/api/evaluations/index.js" } }, + "./api/telemetry": { + "browser": { + "types": "./dist/browser/api/telemetry/index.d.ts", + "default": "./dist/browser/api/telemetry/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/telemetry/index.d.ts", + "default": "./dist/react-native/api/telemetry/index.js" + }, + "import": { + "types": "./dist/esm/api/telemetry/index.d.ts", + "default": "./dist/esm/api/telemetry/index.js" + }, + "require": { + "types": "./dist/commonjs/api/telemetry/index.d.ts", + "default": "./dist/commonjs/api/telemetry/index.js" + } + }, "./api/connections": { "browser": { "types": "./dist/browser/api/connections/index.d.ts", diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md index 54365dac32..49cd599121 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md +++ b/packages/typespec-test/test/ai/generated/typespec-ts/review/ai-client.api.md @@ -35,14 +35,14 @@ export interface AgentDeletionStatus { // @public export interface AgentsApiResponseFormat { - type?: ApiResponseFormat; + type?: ResponseFormat; } // @public export type AgentsApiResponseFormatMode = "auto" | "none"; // @public -export type AgentsApiResponseFormatOption = string | AgentsApiResponseFormatMode | AgentsApiResponseFormat; +export type AgentsApiResponseFormatOption = string | AgentsApiResponseFormatMode | AgentsApiResponseFormat | ResponseFormatJsonSchemaType; // @public export type AgentsApiToolChoiceOption = string | AgentsApiToolChoiceOptionMode | AgentsNamedToolChoice; @@ -80,12 +80,14 @@ export interface AgentsCreateMessageOptionalParams extends OperationOptions { // @public export interface AgentsCreateRunOptionalParams extends OperationOptions { additionalInstructions?: string | null; - additionalMessages?: ThreadMessage[] | null; + additionalMessages?: ThreadMessageOptions[] | null; + include?: RunAdditionalFieldList[]; instructions?: string | null; maxCompletionTokens?: number | null; maxPromptTokens?: number | null; metadata?: Record | null; model?: string | null; + parallelToolCalls?: boolean; responseFormat?: AgentsApiResponseFormatOption | null; stream?: boolean; temperature?: number | null; @@ -102,6 +104,7 @@ export interface AgentsCreateThreadAndRunOptionalParams extends OperationOptions maxPromptTokens?: number | null; metadata?: Record | null; model?: string | null; + parallelToolCalls?: boolean; responseFormat?: AgentsApiResponseFormatOption | null; stream?: boolean; temperature?: number | null; @@ -123,11 +126,15 @@ export interface AgentsCreateThreadOptionalParams extends OperationOptions { // @public export interface AgentsCreateVectorStoreFileBatchOptionalParams extends OperationOptions { chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; + dataSources?: VectorStoreDataSource[]; + fileIds?: string[]; } // @public export interface AgentsCreateVectorStoreFileOptionalParams extends OperationOptions { chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; + dataSources?: VectorStoreDataSource[]; + fileId?: string; } // @public @@ -137,6 +144,7 @@ export interface AgentsCreateVectorStoreOptionalParams extends OperationOptions fileIds?: string[]; metadata?: Record | null; name?: string; + storeConfiguration?: VectorStoreConfiguration; } // @public @@ -181,6 +189,7 @@ export interface AgentsGetRunOptionalParams extends OperationOptions { // @public export interface AgentsGetRunStepOptionalParams extends OperationOptions { + include?: RunAdditionalFieldList[]; } // @public @@ -233,6 +242,7 @@ export interface AgentsListRunsOptionalParams extends OperationOptions { export interface AgentsListRunStepsOptionalParams extends OperationOptions { after?: string; before?: string; + include?: RunAdditionalFieldList[]; limit?: number; order?: ListSortOrder; } @@ -277,7 +287,7 @@ export interface AgentsNamedToolChoice { } // @public -export type AgentsNamedToolChoiceType = "function" | "code_interpreter" | "file_search" | "bing_grounding" | "microsoft_fabric" | "sharepoint" | "azure_ai_search"; +export type AgentsNamedToolChoiceType = "function" | "code_interpreter" | "file_search" | "bing_grounding" | "fabric_aiskill" | "sharepoint_grounding" | "azure_ai_search"; // @public export interface AgentsOperations { @@ -289,8 +299,8 @@ export interface AgentsOperations { createThread: (options?: AgentsCreateThreadOptionalParams) => Promise; createThreadAndRun: (assistantId: string, options?: AgentsCreateThreadAndRunOptionalParams) => Promise; createVectorStore: (options?: AgentsCreateVectorStoreOptionalParams) => Promise; - createVectorStoreFile: (vectorStoreId: string, fileId: string, options?: AgentsCreateVectorStoreFileOptionalParams) => Promise; - createVectorStoreFileBatch: (vectorStoreId: string, fileIds: string[], options?: AgentsCreateVectorStoreFileBatchOptionalParams) => Promise; + createVectorStoreFile: (vectorStoreId: string, options?: AgentsCreateVectorStoreFileOptionalParams) => Promise; + createVectorStoreFileBatch: (vectorStoreId: string, options?: AgentsCreateVectorStoreFileBatchOptionalParams) => Promise; deleteAgent: (assistantId: string, options?: AgentsDeleteAgentOptionalParams) => Promise; deleteFile: (fileId: string, options?: AgentsDeleteFileOptionalParams) => Promise; deleteThread: (threadId: string, options?: AgentsDeleteThreadOptionalParams) => Promise; @@ -298,7 +308,7 @@ export interface AgentsOperations { deleteVectorStoreFile: (vectorStoreId: string, fileId: string, options?: AgentsDeleteVectorStoreFileOptionalParams) => Promise; getAgent: (assistantId: string, options?: AgentsGetAgentOptionalParams) => Promise; getFile: (fileId: string, options?: AgentsGetFileOptionalParams) => Promise; - getFileContent: (fileId: string, options?: AgentsGetFileContentOptionalParams) => Promise; + getFileContent: (fileId: string, options?: AgentsGetFileContentOptionalParams) => Promise; getMessage: (threadId: string, messageId: string, options?: AgentsGetMessageOptionalParams) => Promise; getRun: (threadId: string, runId: string, options?: AgentsGetRunOptionalParams) => Promise; getRunStep: (threadId: string, runId: string, stepId: string, options?: AgentsGetRunStepOptionalParams) => Promise; @@ -382,11 +392,29 @@ export interface AgentThreadCreationOptions { toolResources?: ToolResources | null; } +// @public (undocumented) +export class AIProjectClient { + constructor(endpointParam: string, subscriptionId: string, resourceGroupName: string, projectName: string, credential: TokenCredential, options?: AIProjectClientOptionalParams); + readonly agents: AgentsOperations; + readonly connections: ConnectionsOperations; + readonly evaluations: EvaluationsOperations; + readonly pipeline: Pipeline; + readonly telemetry: TelemetryOperations; +} + +// @public +export interface AIProjectClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + // @public -export type ApiResponseFormat = "text" | "json_object"; +export interface AppInsightsProperties { + connectionString: string; +} // @public -export interface AppInsightsConfiguration extends InputData { +export interface ApplicationInsightsConfiguration extends InputData { + connectionString?: string; query: string; resourceId: string; serviceName: string; @@ -397,20 +425,6 @@ export interface AppInsightsConfiguration extends InputData { // @public export type AuthenticationType = "ApiKey" | "AAD" | "SAS"; -// @public (undocumented) -export class AzureAIClient { - constructor(endpointParam: string, subscriptionId: string, resourceGroupName: string, projectName: string, credential: TokenCredential, options?: AzureAIClientOptionalParams); - readonly agents: AgentsOperations; - readonly connections: ConnectionsOperations; - readonly evaluations: EvaluationsOperations; - readonly pipeline: Pipeline; -} - -// @public -export interface AzureAIClientOptionalParams extends ClientOptions { - apiVersion?: string; -} - // @public export interface AzureAISearchResource { indexList?: IndexResource[]; @@ -422,97 +436,76 @@ export interface AzureAISearchToolDefinition extends ToolDefinition { } // @public -export interface BingGroundingToolDefinition extends ToolDefinition { - type: "bing_grounding"; +export interface AzureFunctionBinding { + storageQueue: AzureFunctionStorageQueue; + type: "storage_queue"; } // @public -export interface CodeInterpreterToolDefinition extends ToolDefinition { - type: "code_interpreter"; +export interface AzureFunctionDefinition { + function: FunctionDefinition; + inputBinding: AzureFunctionBinding; + outputBinding: AzureFunctionBinding; } // @public -export interface CodeInterpreterToolResource { - fileIds?: string[]; +export interface AzureFunctionStorageQueue { + queueName: string; + storageServiceEndpoint: string; } // @public -export interface ConnectionListResource { - connectionList?: ConnectionResource[]; +export interface AzureFunctionToolDefinition extends ToolDefinition { + azureFunction: AzureFunctionDefinition; + type: "azure_function"; } // @public -export interface ConnectionProperties { - authType: AuthenticationType; +export interface BingGroundingToolDefinition extends ToolDefinition { + bingGrounding: ToolConnectionList; + type: "bing_grounding"; } // @public -export interface ConnectionPropertiesAADAuth extends ConnectionProperties { - authType: "AAD"; - category: ConnectionType; - target: string; +export interface CodeInterpreterToolDefinition extends ToolDefinition { + type: "code_interpreter"; } // @public -export interface ConnectionPropertiesApiKeyAuth extends ConnectionProperties { - authType: "ApiKey"; - category: ConnectionType; - credentials: CredentialsApiKeyAuth; - target: string; +export interface CodeInterpreterToolResource { + dataSources?: VectorStoreDataSource[]; + fileIds?: string[]; } // @public -export interface ConnectionPropertiesSASAuth extends ConnectionProperties { - authType: "SAS"; - category: ConnectionType; - credentials: CredentialsSASAuth; - target: string; +export interface ConnectionsGetConnectionOptionalParams extends OperationOptions { } // @public -export type ConnectionPropertiesUnion = ConnectionPropertiesApiKeyAuth | ConnectionPropertiesAADAuth | ConnectionPropertiesSASAuth | ConnectionProperties; - -// @public -export interface ConnectionResource { - connectionId: string; +export interface ConnectionsGetConnectionWithSecretsOptionalParams extends OperationOptions { } // @public -export interface ConnectionsGetOptionalParams extends OperationOptions { +export interface ConnectionsGetWorkspaceOptionalParams extends OperationOptions { } // @public -export interface ConnectionsListOptionalParams extends OperationOptions { +export interface ConnectionsListConnectionsOptionalParams extends OperationOptions { category?: ConnectionType; includeAll?: boolean; target?: string; } -// @public -export interface ConnectionsListResponse { - value: ConnectionsListSecretsResponse[]; -} - -// @public -export interface ConnectionsListSecretsOptionalParams extends OperationOptions { -} - -// @public -export interface ConnectionsListSecretsResponse { - id: string; - name: string; - properties: ConnectionPropertiesUnion; -} - // @public export interface ConnectionsOperations { - get: (connectionName: string, options?: ConnectionsGetOptionalParams) => Promise; - list: (options?: ConnectionsListOptionalParams) => Promise; - listSecrets: (connectionName: string, ignored: string, options?: ConnectionsListSecretsOptionalParams) => Promise; + getConnection: (connectionName: string, options?: ConnectionsGetConnectionOptionalParams) => Promise; + getConnectionWithSecrets: (connectionName: string, ignored: string, options?: ConnectionsGetConnectionWithSecretsOptionalParams) => Promise; + getWorkspace: (options?: ConnectionsGetWorkspaceOptionalParams) => Promise; + listConnections: (options?: ConnectionsListConnectionsOptionalParams) => Promise; } // @public -export type ConnectionType = "AzureOpenAI" | "Serverless" | "AzureBlob" | "AIServices"; +export type ConnectionType = "AzureOpenAI" | "Serverless" | "AzureBlob" | "AIServices" | "CognitiveSearch"; // @public export type ContinuablePage = TPage & { @@ -564,14 +557,13 @@ export interface Evaluation { // @public export interface EvaluationSchedule { - data: InputDataUnion; + data: ApplicationInsightsConfiguration; description?: string; - displayName?: string; evaluators: Record; - readonly id: string; + readonly isEnabled?: string; + readonly name: string; properties?: Record; - readonly provisioningStatus?: string; - samplingStrategy: SamplingStrategy; + readonly provisioningState?: string; readonly systemData?: SystemData; tags?: Record; trigger: TriggerUnion; @@ -587,8 +579,7 @@ export interface EvaluationsCreateOrReplaceScheduleOptionalParams extends Operat } // @public -export interface EvaluationsDeleteScheduleOptionalParams extends OperationOptions { - clientRequestId?: string; +export interface EvaluationsDisableScheduleOptionalParams extends OperationOptions { } // @public @@ -620,10 +611,10 @@ export interface EvaluationsListScheduleOptionalParams extends OperationOptions // @public export interface EvaluationsOperations { create: (evaluation: Evaluation, options?: EvaluationsCreateOptionalParams) => Promise; - createOrReplaceSchedule: (id: string, resource: EvaluationSchedule, options?: EvaluationsCreateOrReplaceScheduleOptionalParams) => Promise; - deleteSchedule: (id: string, options?: EvaluationsDeleteScheduleOptionalParams) => Promise; + createOrReplaceSchedule: (name: string, resource: EvaluationSchedule, options?: EvaluationsCreateOrReplaceScheduleOptionalParams) => Promise; + disableSchedule: (name: string, options?: EvaluationsDisableScheduleOptionalParams) => Promise; get: (id: string, options?: EvaluationsGetOptionalParams) => Promise; - getSchedule: (id: string, options?: EvaluationsGetScheduleOptionalParams) => Promise; + getSchedule: (name: string, options?: EvaluationsGetScheduleOptionalParams) => Promise; list: (options?: EvaluationsListOptionalParams) => PagedAsyncIterableIterator; listSchedule: (options?: EvaluationsListScheduleOptionalParams) => PagedAsyncIterableIterator; update: (id: string, resource: Evaluation, options?: EvaluationsUpdateOptionalParams) => Promise; @@ -641,11 +632,6 @@ export interface EvaluatorConfiguration { initParams?: Record; } -// @public -export interface FileContentResponse { - content: Uint8Array; -} - // @public export interface FileDeletionStatus { deleted: boolean; @@ -662,6 +648,18 @@ export interface FileListResponse { // @public export type FilePurpose = "fine-tune" | "fine-tune-results" | "assistants" | "assistants_output" | "batch" | "batch_output" | "vision"; +// @public +export interface FileSearchRankingOptions { + ranker: string; + scoreThreshold: number; +} + +// @public +export interface FileSearchToolCallContent { + text: string; + type: "text"; +} + // @public export interface FileSearchToolDefinition extends ToolDefinition { fileSearch?: FileSearchToolDefinitionDetails; @@ -671,11 +669,13 @@ export interface FileSearchToolDefinition extends ToolDefinition { // @public export interface FileSearchToolDefinitionDetails { maxNumResults?: number; + rankingOptions?: FileSearchRankingOptions; } // @public export interface FileSearchToolResource { vectorStoreIds?: string[]; + vectorStores?: VectorStoreConfigurations[]; } // @public @@ -703,7 +703,33 @@ export interface FunctionToolDefinition extends ToolDefinition { } // @public -export type IncompleteRunDetails = "max_completion_tokens" | "max_prompt_tokens"; +export interface GetAppInsightsResponse { + id: string; + name: string; + properties: AppInsightsProperties; +} + +// @public +export interface GetConnectionResponse { + id: string; + name: string; + properties: InternalConnectionPropertiesUnion; +} + +// @public +export interface GetWorkspaceResponse { + id: string; + name: string; + properties: WorkspaceProperties; +} + +// @public +export type IncompleteDetailsReason = "max_completion_tokens" | "max_prompt_tokens"; + +// @public +export interface IncompleteRunDetails { + reason: IncompleteDetailsReason; +} // @public export interface IndexResource { @@ -717,11 +743,43 @@ export interface InputData { } // @public -export type InputDataUnion = AppInsightsConfiguration | Dataset | InputData; +export type InputDataUnion = ApplicationInsightsConfiguration | Dataset | InputData; + +// @public +export interface InternalConnectionProperties { + authType: AuthenticationType; + category: ConnectionType; + target: string; +} + +// @public +export interface InternalConnectionPropertiesAADAuth extends InternalConnectionProperties { + authType: "AAD"; +} + +// @public +export interface InternalConnectionPropertiesApiKeyAuth extends InternalConnectionProperties { + authType: "ApiKey"; + credentials: CredentialsApiKeyAuth; +} + +// @public +export interface InternalConnectionPropertiesSASAuth extends InternalConnectionProperties { + authType: "SAS"; + credentials: CredentialsSASAuth; +} + +// @public +export type InternalConnectionPropertiesUnion = InternalConnectionPropertiesApiKeyAuth | InternalConnectionPropertiesAADAuth | InternalConnectionPropertiesSASAuth | InternalConnectionProperties; // @public export enum KnownVersions { - "2024-07-01-preview" = "2024-07-01-preview" + "V2024-07-01-Preview" = "2024-07-01-preview" +} + +// @public +export interface ListConnectionsResponse { + value: GetConnectionResponse[]; } // @public @@ -729,7 +787,8 @@ export type ListSortOrder = "asc" | "desc"; // @public export interface MessageAttachment { - fileId: string; + dataSource?: VectorStoreDataSource; + fileId?: string; tools: MessageAttachmentToolDefinition[]; } @@ -905,7 +964,8 @@ export interface MessageTextFilePathDetails { // @public export interface MicrosoftFabricToolDefinition extends ToolDefinition { - type: "microsoft_fabric"; + fabricAiskill: ToolConnectionList; + type: "fabric_aiskill"; } // @public @@ -974,6 +1034,58 @@ export interface OpenAIPageableListOfVectorStoreFile { object: "list"; } +// @public +export interface OpenApiAnonymousAuthDetails extends OpenApiAuthDetails { + type: "anonymous"; +} + +// @public +export interface OpenApiAuthDetails { + type: OpenApiAuthType; +} + +// @public +export type OpenApiAuthDetailsUnion = OpenApiAnonymousAuthDetails | OpenApiConnectionAuthDetails | OpenApiManagedAuthDetails | OpenApiAuthDetails; + +// @public +export type OpenApiAuthType = "anonymous" | "connection" | "managed_identity"; + +// @public +export interface OpenApiConnectionAuthDetails extends OpenApiAuthDetails { + securityScheme: OpenApiConnectionSecurityScheme; + type: "connection"; +} + +// @public +export interface OpenApiConnectionSecurityScheme { + connectionId: string; +} + +// @public +export interface OpenApiFunctionDefinition { + auth: OpenApiAuthDetailsUnion; + description?: string; + name: string; + spec: any; +} + +// @public +export interface OpenApiManagedAuthDetails extends OpenApiAuthDetails { + securityScheme: OpenApiManagedSecurityScheme; + type: "managed_identity"; +} + +// @public +export interface OpenApiManagedSecurityScheme { + audience: string; +} + +// @public +export interface OpenApiToolDefinition extends ToolDefinition { + openapi: OpenApiFunctionDefinition; + type: "openapi"; +} + // @public export interface PagedAsyncIterableIterator { [Symbol.asyncIterator](): PagedAsyncIterableIterator; @@ -990,15 +1102,15 @@ export interface PageSettings { export interface RecurrenceSchedule { hours: number[]; minutes: number[]; - monthDays: number[]; - weekDays: WeekDays[]; + monthDays?: number[]; + weekDays?: WeekDays[]; } // @public export interface RecurrenceTrigger extends Trigger { frequency: Frequency; interval: number; - schedule: RecurrenceSchedule; + schedule?: RecurrenceSchedule; // (undocumented) readonly type: "Recurrence"; } @@ -1032,6 +1144,25 @@ export interface RequiredToolCall { // @public export type RequiredToolCallUnion = RequiredFunctionToolCall | RequiredToolCall; +// @public +export type ResponseFormat = "text" | "json_object"; + +// @public +export interface ResponseFormatJsonSchema { + description?: string; + name: string; + schema: any; +} + +// @public +export interface ResponseFormatJsonSchemaType { + jsonSchema: ResponseFormatJsonSchema; + type: "json_schema"; +} + +// @public +export type RunAdditionalFieldList = "step_details.tool_calls[*].file_search.results[*].content"; + // @public export interface RunCompletionUsage { completionTokens: number; @@ -1247,10 +1378,25 @@ export type RunStepErrorCode = "server_error" | "rate_limit_exceeded"; // @public export interface RunStepFileSearchToolCall extends RunStepToolCall { - fileSearch: Record; + fileSearch: RunStepFileSearchToolCallResults; + id: string; type: "file_search"; } +// @public +export interface RunStepFileSearchToolCallResult { + content?: FileSearchToolCallContent[]; + fileId: string; + fileName: string; + score: number; +} + +// @public +export interface RunStepFileSearchToolCallResults { + rankingOptions?: FileSearchRankingOptions; + results: RunStepFileSearchToolCallResult[]; +} + // @public export interface RunStepFunctionToolCall extends RunStepToolCall { function: RunStepFunctionToolCallDetails; @@ -1278,13 +1424,13 @@ export interface RunStepMessageCreationReference { // @public export interface RunStepMicrosoftFabricToolCall extends RunStepToolCall { microsoftFabric: Record; - type: "microsoft_fabric"; + type: "fabric_aiskill"; } // @public export interface RunStepSharepointToolCall extends RunStepToolCall { sharePoint: Record; - type: "sharepoint"; + type: "sharepoint_grounding"; } // @public @@ -1312,16 +1458,12 @@ export type RunStepToolCallUnion = RunStepCodeInterpreterToolCall | RunStepFileS export type RunStepType = "message_creation" | "tool_calls"; // @public -export type RunStreamEvent = "thread.run.created" | "thread.run.queued" | "thread.run.in_progress" | "thread.run.requires_action" | "thread.run.completed" | "thread.run.failed" | "thread.run.cancelling" | "thread.run.cancelled" | "thread.run.expired"; - -// @public -export interface SamplingStrategy { - rate: number; -} +export type RunStreamEvent = "thread.run.created" | "thread.run.queued" | "thread.run.in_progress" | "thread.run.requires_action" | "thread.run.completed" | "thread.run.incomplete" | "thread.run.failed" | "thread.run.cancelling" | "thread.run.cancelled" | "thread.run.expired"; // @public export interface SharepointToolDefinition extends ToolDefinition { - type: "sharepoint"; + sharepointGrounding: ToolConnectionList; + type: "sharepoint_grounding"; } // @public @@ -1343,6 +1485,15 @@ export interface SystemData { readonly lastModifiedAt?: Date; } +// @public +export interface TelemetryGetAppInsightsOptionalParams extends OperationOptions { +} + +// @public +export interface TelemetryOperations { + getAppInsights: (appInsightsResourceUrl: string, options?: TelemetryGetAppInsightsOptionalParams) => Promise; +} + // @public export interface ThreadDeletionStatus { deleted: boolean; @@ -1393,7 +1544,7 @@ export interface ThreadRun { metadata: Record | null; model: string; object: "thread.run"; - parallelToolCalls?: boolean; + parallelToolCalls: boolean; requiredAction?: RequiredActionUnion | null; responseFormat: AgentsApiResponseFormatOption | null; startedAt: Date | null; @@ -1411,13 +1562,23 @@ export interface ThreadRun { // @public export type ThreadStreamEvent = "thread.created"; +// @public +export interface ToolConnection { + connectionId: string; +} + +// @public +export interface ToolConnectionList { + connectionList?: ToolConnection[]; +} + // @public export interface ToolDefinition { type: string; } // @public -export type ToolDefinitionUnion = CodeInterpreterToolDefinition | FileSearchToolDefinition | FunctionToolDefinition | BingGroundingToolDefinition | MicrosoftFabricToolDefinition | SharepointToolDefinition | AzureAISearchToolDefinition | ToolDefinition; +export type ToolDefinitionUnion = CodeInterpreterToolDefinition | FileSearchToolDefinition | FunctionToolDefinition | BingGroundingToolDefinition | MicrosoftFabricToolDefinition | SharepointToolDefinition | AzureAISearchToolDefinition | OpenApiToolDefinition | AzureFunctionToolDefinition | ToolDefinition; // @public export interface ToolOutput { @@ -1428,11 +1589,8 @@ export interface ToolOutput { // @public export interface ToolResources { azureAISearch?: AzureAISearchResource; - bingGrounding?: ConnectionListResource; codeInterpreter?: CodeInterpreterToolResource; fileSearch?: FileSearchToolResource; - microsoftFabric?: ConnectionListResource; - sharePoint?: ConnectionListResource; } // @public @@ -1465,11 +1623,8 @@ export interface UpdateFileSearchToolResourceOptions { // @public export interface UpdateToolResourcesOptions { azureAISearch?: AzureAISearchResource; - bingGrounding?: ConnectionListResource; codeInterpreter?: UpdateCodeInterpreterToolResourceOptions; fileSearch?: UpdateFileSearchToolResourceOptions; - microsoftFabric?: ConnectionListResource; - sharePoint?: ConnectionListResource; } // @public @@ -1519,6 +1674,26 @@ export type VectorStoreChunkingStrategyResponseType = "other" | "static"; // @public export type VectorStoreChunkingStrategyResponseUnion = VectorStoreAutoChunkingStrategyResponse | VectorStoreStaticChunkingStrategyResponse | VectorStoreChunkingStrategyResponse; +// @public +export interface VectorStoreConfiguration { + dataSources: VectorStoreDataSource[]; +} + +// @public +export interface VectorStoreConfigurations { + storeConfiguration: VectorStoreConfiguration; + storeName: string; +} + +// @public +export interface VectorStoreDataSource { + assetIdentifier: string; + assetType: VectorStoreDataSourceAssetType; +} + +// @public +export type VectorStoreDataSourceAssetType = "uri_asset" | "id_asset"; + // @public export interface VectorStoreDeletionStatus { deleted: boolean; @@ -1583,7 +1758,7 @@ export interface VectorStoreFileError { } // @public -export type VectorStoreFileErrorCode = "internal_error" | "file_not_found" | "parsing_error" | "unhandled_mime_type"; +export type VectorStoreFileErrorCode = "server_error" | "invalid_file" | "unsupported_file"; // @public export type VectorStoreFileStatus = "in_progress" | "completed" | "failed" | "cancelled"; @@ -1615,6 +1790,11 @@ export type VectorStoreStatus = "expired" | "in_progress" | "completed"; // @public export type WeekDays = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; +// @public +export interface WorkspaceProperties { + applicationInsights: string; +} + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/azureAIClient.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/aiProjectClient.ts similarity index 75% rename from packages/typespec-test/test/ai/generated/typespec-ts/src/azureAIClient.ts rename to packages/typespec-test/test/ai/generated/typespec-ts/src/aiProjectClient.ts index 420bb83754..874374de65 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/azureAIClient.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/aiProjectClient.ts @@ -5,6 +5,10 @@ import { getEvaluationsOperations, EvaluationsOperations, } from "./classic/evaluations/index.js"; +import { + getTelemetryOperations, + TelemetryOperations, +} from "./classic/telemetry/index.js"; import { getConnectionsOperations, ConnectionsOperations, @@ -14,17 +18,17 @@ import { AgentsOperations, } from "./classic/agents/index.js"; import { - createAzureAI, - AzureAIContext, - AzureAIClientOptionalParams, + createAIProject, + AIProjectContext, + AIProjectClientOptionalParams, } from "./api/index.js"; import { Pipeline } from "@azure/core-rest-pipeline"; import { TokenCredential } from "@azure/core-auth"; -export { AzureAIClientOptionalParams } from "./api/azureAIContext.js"; +export { AIProjectClientOptionalParams } from "./api/aiProjectContext.js"; -export class AzureAIClient { - private _client: AzureAIContext; +export class AIProjectClient { + private _client: AIProjectContext; /** The pipeline used by this client to make requests */ public readonly pipeline: Pipeline; @@ -34,13 +38,13 @@ export class AzureAIClient { resourceGroupName: string, projectName: string, credential: TokenCredential, - options: AzureAIClientOptionalParams = {}, + options: AIProjectClientOptionalParams = {}, ) { const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` : `azsdk-js-client`; - this._client = createAzureAI( + this._client = createAIProject( endpointParam, subscriptionId, resourceGroupName, @@ -50,12 +54,15 @@ export class AzureAIClient { ); this.pipeline = this._client.pipeline; this.evaluations = getEvaluationsOperations(this._client); + this.telemetry = getTelemetryOperations(this._client); this.connections = getConnectionsOperations(this._client); this.agents = getAgentsOperations(this._client); } /** The operation groups for evaluations */ public readonly evaluations: EvaluationsOperations; + /** The operation groups for telemetry */ + public readonly telemetry: TelemetryOperations; /** The operation groups for connections */ public readonly connections: ConnectionsOperations; /** The operation groups for agents */ diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts index fa6e25d463..d9b93e53ec 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/agents/index.ts @@ -42,10 +42,12 @@ import { AgentsUpdateRunOptionalParams, AgentsUpdateThreadOptionalParams, AgentsUploadFileOptionalParams, - AzureAIContext as Client, + AIProjectContext as Client, } from "../index.js"; import { toolResourcesSerializer, + vectorStoreDataSourceArraySerializer, + vectorStoreConfigurationSerializer, toolDefinitionUnionArraySerializer, agentsApiResponseFormatOptionSerializer, Agent, @@ -65,7 +67,6 @@ import { threadMessageDeserializer, OpenAIPageableListOfThreadMessage, openAIPageableListOfThreadMessageDeserializer, - threadMessageArraySerializer, truncationObjectSerializer, agentsApiToolChoiceOptionSerializer, ThreadRun, @@ -87,8 +88,6 @@ import { FilePurpose, FileDeletionStatus, fileDeletionStatusDeserializer, - FileContentResponse, - fileContentResponseDeserializer, OpenAIPageableListOfVectorStore, openAIPageableListOfVectorStoreDeserializer, VectorStore, @@ -112,7 +111,7 @@ import { createRestError, operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -import { uint8ArrayToString } from "@azure/core-util"; +import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util"; export function _listVectorStoreFileBatchFilesSend( context: Client, @@ -279,7 +278,6 @@ export async function getVectorStoreFileBatch( export function _createVectorStoreFileBatchSend( context: Client, vectorStoreId: string, - fileIds: string[], options: AgentsCreateVectorStoreFileBatchOptionalParams = { requestOptions: {}, }, @@ -295,9 +293,14 @@ export function _createVectorStoreFileBatchSend( }, queryParameters: { "api-version": context.apiVersion }, body: { - file_ids: fileIds.map((p: any) => { - return p; - }), + file_ids: !options?.fileIds + ? options?.fileIds + : options?.fileIds.map((p: any) => { + return p; + }), + data_sources: !options?.dataSources + ? options?.dataSources + : vectorStoreDataSourceArraySerializer(options?.dataSources), chunking_strategy: !options?.chunkingStrategy ? options?.chunkingStrategy : vectorStoreChunkingStrategyRequestUnionSerializer( @@ -322,7 +325,6 @@ export async function _createVectorStoreFileBatchDeserialize( export async function createVectorStoreFileBatch( context: Client, vectorStoreId: string, - fileIds: string[], options: AgentsCreateVectorStoreFileBatchOptionalParams = { requestOptions: {}, }, @@ -330,7 +332,6 @@ export async function createVectorStoreFileBatch( const result = await _createVectorStoreFileBatchSend( context, vectorStoreId, - fileIds, options, ); return _createVectorStoreFileBatchDeserialize(result); @@ -440,7 +441,6 @@ export async function getVectorStoreFile( export function _createVectorStoreFileSend( context: Client, vectorStoreId: string, - fileId: string, options: AgentsCreateVectorStoreFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context @@ -454,7 +454,10 @@ export function _createVectorStoreFileSend( }, queryParameters: { "api-version": context.apiVersion }, body: { - file_id: fileId, + file_id: options?.fileId, + data_sources: !options?.dataSources + ? options?.dataSources + : vectorStoreDataSourceArraySerializer(options?.dataSources), chunking_strategy: !options?.chunkingStrategy ? options?.chunkingStrategy : vectorStoreChunkingStrategyRequestUnionSerializer( @@ -479,13 +482,11 @@ export async function _createVectorStoreFileDeserialize( export async function createVectorStoreFile( context: Client, vectorStoreId: string, - fileId: string, options: AgentsCreateVectorStoreFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createVectorStoreFileSend( context, vectorStoreId, - fileId, options, ); return _createVectorStoreFileDeserialize(result); @@ -678,6 +679,9 @@ export function _createVectorStoreSend( return p; }), name: options?.name, + configuration: !options?.storeConfiguration + ? options?.storeConfiguration + : vectorStoreConfigurationSerializer(options?.storeConfiguration), expires_after: !options?.expiresAfter ? options?.expiresAfter : vectorStoreExpirationPolicySerializer(options?.expiresAfter), @@ -772,21 +776,23 @@ export function _getFileContentSend( export async function _getFileContentDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return fileContentResponseDeserializer(result.body); + return typeof result.body === "string" + ? stringToUint8Array(result.body, "base64") + : result.body; } -/** Returns information about a specific file. Does not retrieve file content. */ +/** Retrieves the raw content of a specific file. */ export async function getFileContent( context: Client, fileId: string, options: AgentsGetFileContentOptionalParams = { requestOptions: {} }, -): Promise { +): Promise { const result = await _getFileContentSend(context, fileId, options); return _getFileContentDeserialize(result); } @@ -968,6 +974,11 @@ export function _listRunStepsSend( }, queryParameters: { "api-version": context.apiVersion, + "include[]": !options?.include + ? options?.include + : options?.include.map((p: any) => { + return p; + }), limit: options?.limit, order: options?.order, after: options?.after, @@ -1018,7 +1029,14 @@ export function _getRunStepSend( accept: "application/json", ...options.requestOptions?.headers, }, - queryParameters: { "api-version": context.apiVersion }, + queryParameters: { + "api-version": context.apiVersion, + "include[]": !options?.include + ? options?.include + : options?.include.map((p: any) => { + return p; + }), + }, }); } @@ -1093,6 +1111,7 @@ export function _createThreadAndRunSend( response_format: !options?.responseFormat ? options?.responseFormat : agentsApiResponseFormatOptionSerializer(options?.responseFormat), + parallel_tool_calls: options?.parallelToolCalls, metadata: options?.metadata, }, }); @@ -1348,44 +1367,47 @@ export function _createRunSend( assistantId: string, options: AgentsCreateRunOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context - .path("/threads/{threadId}/runs", threadId) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: { - assistant_id: assistantId, - model: options?.model, - instructions: options?.instructions, - additional_instructions: options?.additionalInstructions, - additional_messages: !options?.additionalMessages - ? options?.additionalMessages - : threadMessageArraySerializer(options?.additionalMessages), - tools: !options?.tools - ? options?.tools - : toolDefinitionUnionArraySerializer(options?.tools), - stream: options?.stream, - temperature: options?.temperature, - top_p: options?.topP, - max_prompt_tokens: options?.maxPromptTokens, - max_completion_tokens: options?.maxCompletionTokens, - truncation_strategy: !options?.truncationStrategy - ? options?.truncationStrategy - : truncationObjectSerializer(options?.truncationStrategy), - tool_choice: !options?.toolChoice - ? options?.toolChoice - : agentsApiToolChoiceOptionSerializer(options?.toolChoice), - response_format: !options?.responseFormat - ? options?.responseFormat - : agentsApiResponseFormatOptionSerializer(options?.responseFormat), - metadata: options?.metadata, - }, - }); + return context.path("/threads/{threadId}/runs", threadId).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + queryParameters: { + "api-version": context.apiVersion, + "include[]": !options?.include + ? options?.include + : options?.include.map((p: any) => { + return p; + }), + }, + body: { + assistant_id: assistantId, + model: options?.model, + instructions: options?.instructions, + additional_instructions: options?.additionalInstructions, + additional_messages: !options?.additionalMessages + ? options?.additionalMessages + : threadMessageOptionsArraySerializer(options?.additionalMessages), + tools: !options?.tools + ? options?.tools + : toolDefinitionUnionArraySerializer(options?.tools), + stream: options?.stream, + temperature: options?.temperature, + top_p: options?.topP, + max_prompt_tokens: options?.maxPromptTokens, + max_completion_tokens: options?.maxCompletionTokens, + truncation_strategy: !options?.truncationStrategy + ? options?.truncationStrategy + : truncationObjectSerializer(options?.truncationStrategy), + tool_choice: !options?.toolChoice + ? options?.toolChoice + : agentsApiToolChoiceOptionSerializer(options?.toolChoice), + response_format: !options?.responseFormat + ? options?.responseFormat + : agentsApiResponseFormatOptionSerializer(options?.responseFormat), + parallel_tool_calls: options?.parallelToolCalls, + metadata: options?.metadata, + }, + }); } export async function _createRunDeserialize( diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/azureAIContext.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/aiProjectContext.ts similarity index 89% rename from packages/typespec-test/test/ai/generated/typespec-ts/src/api/azureAIContext.ts rename to packages/typespec-test/test/ai/generated/typespec-ts/src/api/aiProjectContext.ts index f963473440..d2b624b74f 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/azureAIContext.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/aiProjectContext.ts @@ -6,12 +6,12 @@ import { KnownVersions } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface AzureAIContext extends Client { +export interface AIProjectContext extends Client { /** The Azure subscription ID. */ subscriptionId: string; /** The name of the Azure Resource Group. */ resourceGroupName: string; - /** The Azure AI Studio project name. */ + /** The Azure AI Foundry project name. */ projectName: string; /** The API version to use for this operation. */ /** Known values of {@link KnownVersions} that the service accepts. */ @@ -19,20 +19,20 @@ export interface AzureAIContext extends Client { } /** Optional parameters for the client. */ -export interface AzureAIClientOptionalParams extends ClientOptions { +export interface AIProjectClientOptionalParams extends ClientOptions { /** The API version to use for this operation. */ /** Known values of {@link KnownVersions} that the service accepts. */ apiVersion?: string; } -export function createAzureAI( +export function createAIProject( endpointParam: string, subscriptionId: string, resourceGroupName: string, projectName: string, credential: TokenCredential, - options: AzureAIClientOptionalParams = {}, -): AzureAIContext { + options: AIProjectClientOptionalParams = {}, +): AIProjectContext { const endpointUrl = options.endpoint ?? options.baseUrl ?? @@ -76,5 +76,5 @@ export function createAzureAI( resourceGroupName, projectName, apiVersion, - } as AzureAIContext; + } as AIProjectContext; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts index 3db0b95d89..433c28a4c7 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/connections/index.ts @@ -2,16 +2,19 @@ // Licensed under the MIT License. import { - AzureAIContext as Client, - ConnectionsGetOptionalParams, - ConnectionsListOptionalParams, - ConnectionsListSecretsOptionalParams, + AIProjectContext as Client, + ConnectionsGetConnectionOptionalParams, + ConnectionsGetConnectionWithSecretsOptionalParams, + ConnectionsGetWorkspaceOptionalParams, + ConnectionsListConnectionsOptionalParams, } from "../index.js"; import { - ConnectionsListResponse, - connectionsListResponseDeserializer, - ConnectionsListSecretsResponse, - connectionsListSecretsResponseDeserializer, + GetWorkspaceResponse, + getWorkspaceResponseDeserializer, + ListConnectionsResponse, + listConnectionsResponseDeserializer, + GetConnectionResponse, + getConnectionResponseDeserializer, } from "../../models/models.js"; import { StreamableMethod, @@ -20,11 +23,13 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _listSecretsSend( +export function _getConnectionWithSecretsSend( context: Client, connectionName: string, ignored: string, - options: ConnectionsListSecretsOptionalParams = { requestOptions: {} }, + options: ConnectionsGetConnectionWithSecretsOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path("/connections/{connectionName}/listsecrets", connectionName) @@ -40,37 +45,39 @@ export function _listSecretsSend( }); } -export async function _listSecretsDeserialize( +export async function _getConnectionWithSecretsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return connectionsListSecretsResponseDeserializer(result.body); + return getConnectionResponseDeserializer(result.body); } /** Get the details of a single connection, including credentials (if available). */ -export async function listSecrets( +export async function getConnectionWithSecrets( context: Client, connectionName: string, ignored: string, - options: ConnectionsListSecretsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSecretsSend( + options: ConnectionsGetConnectionWithSecretsOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getConnectionWithSecretsSend( context, connectionName, ignored, options, ); - return _listSecretsDeserialize(result); + return _getConnectionWithSecretsDeserialize(result); } -export function _getSend( +export function _getConnectionSend( context: Client, connectionName: string, - options: ConnectionsGetOptionalParams = { requestOptions: {} }, + options: ConnectionsGetConnectionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/connections/{connectionName}", connectionName) @@ -84,30 +91,30 @@ export function _getSend( }); } -export async function _getDeserialize( +export async function _getConnectionDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return connectionsListSecretsResponseDeserializer(result.body); + return getConnectionResponseDeserializer(result.body); } /** Get the details of a single connection, without credentials. */ -export async function get( +export async function getConnection( context: Client, connectionName: string, - options: ConnectionsGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSend(context, connectionName, options); - return _getDeserialize(result); + options: ConnectionsGetConnectionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getConnectionSend(context, connectionName, options); + return _getConnectionDeserialize(result); } -export function _listSend( +export function _listConnectionsSend( context: Client, - options: ConnectionsListOptionalParams = { requestOptions: {} }, + options: ConnectionsListConnectionsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/connections") @@ -126,22 +133,58 @@ export function _listSend( }); } -export async function _listDeserialize( +export async function _listConnectionsDeserialize( result: PathUncheckedResponse, -): Promise { +): Promise { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return connectionsListResponseDeserializer(result.body); + return listConnectionsResponseDeserializer(result.body); } /** List the details of all the connections (not including their credentials) */ -export async function list( +export async function listConnections( context: Client, - options: ConnectionsListOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _listSend(context, options); - return _listDeserialize(result); + options: ConnectionsListConnectionsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listConnectionsSend(context, options); + return _listConnectionsDeserialize(result); +} + +export function _getWorkspaceSend( + context: Client, + options: ConnectionsGetWorkspaceOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _getWorkspaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return getWorkspaceResponseDeserializer(result.body); +} + +/** Gets the properties of the specified machine learning workspace. */ +export async function getWorkspace( + context: Client, + options: ConnectionsGetWorkspaceOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getWorkspaceSend(context, options); + return _getWorkspaceDeserialize(result); } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts index 3039efc37c..7244561891 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/evaluations/index.ts @@ -2,10 +2,10 @@ // Licensed under the MIT License. import { - AzureAIContext as Client, + AIProjectContext as Client, EvaluationsCreateOptionalParams, EvaluationsCreateOrReplaceScheduleOptionalParams, - EvaluationsDeleteScheduleOptionalParams, + EvaluationsDisableScheduleOptionalParams, EvaluationsGetOptionalParams, EvaluationsGetScheduleOptionalParams, EvaluationsListOptionalParams, @@ -35,27 +35,24 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _deleteScheduleSend( +export function _disableScheduleSend( context: Client, - id: string, - options: EvaluationsDeleteScheduleOptionalParams = { requestOptions: {} }, + name: string, + options: EvaluationsDisableScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/evaluations/schedules/{id}", id) - .delete({ + .path("/evaluations/schedules/{name}/disable", name) + .patch({ ...operationOptionsToRequestParameters(options), headers: { - ...(options?.clientRequestId !== undefined - ? { "x-ms-client-request-id": options?.clientRequestId } - : {}), accept: "application/json", ...options.requestOptions?.headers, }, - queryParameters: { "api-version": context.apiVersion }, + queryParameters: { apiVersion: context.apiVersion }, }); } -export async function _deleteScheduleDeserialize( +export async function _disableScheduleDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -66,14 +63,14 @@ export async function _deleteScheduleDeserialize( return; } -/** Resource delete operation template. */ -export async function deleteSchedule( +/** Disable the evaluation schedule. */ +export async function disableSchedule( context: Client, - id: string, - options: EvaluationsDeleteScheduleOptionalParams = { requestOptions: {} }, + name: string, + options: EvaluationsDisableScheduleOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteScheduleSend(context, id, options); - return _deleteScheduleDeserialize(result); + const result = await _disableScheduleSend(context, name, options); + return _disableScheduleDeserialize(result); } export function _listScheduleSend( @@ -127,14 +124,14 @@ export function listSchedule( export function _createOrReplaceScheduleSend( context: Client, - id: string, + name: string, resource: EvaluationSchedule, options: EvaluationsCreateOrReplaceScheduleOptionalParams = { requestOptions: {}, }, ): StreamableMethod { return context - .path("/evaluations/schedules/{id}", id) + .path("/evaluations/schedules/{name}", name) .put({ ...operationOptionsToRequestParameters(options), contentType: "application/json", @@ -164,7 +161,7 @@ export async function _createOrReplaceScheduleDeserialize( /** Create or replace operation template. */ export async function createOrReplaceSchedule( context: Client, - id: string, + name: string, resource: EvaluationSchedule, options: EvaluationsCreateOrReplaceScheduleOptionalParams = { requestOptions: {}, @@ -172,7 +169,7 @@ export async function createOrReplaceSchedule( ): Promise { const result = await _createOrReplaceScheduleSend( context, - id, + name, resource, options, ); @@ -181,11 +178,11 @@ export async function createOrReplaceSchedule( export function _getScheduleSend( context: Client, - id: string, + name: string, options: EvaluationsGetScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context - .path("/evaluations/schedules/{id}", id) + .path("/evaluations/schedules/{name}", name) .get({ ...operationOptionsToRequestParameters(options), headers: { @@ -213,10 +210,10 @@ export async function _getScheduleDeserialize( /** Resource read operation template. */ export async function getSchedule( context: Client, - id: string, + name: string, options: EvaluationsGetScheduleOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getScheduleSend(context, id, options); + const result = await _getScheduleSend(context, name, options); return _getScheduleDeserialize(result); } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts index ee27dc77f0..5cadd0ac7e 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/index.ts @@ -2,12 +2,12 @@ // Licensed under the MIT License. export { - createAzureAI, - AzureAIContext, - AzureAIClientOptionalParams, -} from "./azureAIContext.js"; + createAIProject, + AIProjectContext, + AIProjectClientOptionalParams, +} from "./aiProjectContext.js"; export { - EvaluationsDeleteScheduleOptionalParams, + EvaluationsDisableScheduleOptionalParams, EvaluationsListScheduleOptionalParams, EvaluationsCreateOrReplaceScheduleOptionalParams, EvaluationsGetScheduleOptionalParams, @@ -15,9 +15,11 @@ export { EvaluationsListOptionalParams, EvaluationsCreateOptionalParams, EvaluationsGetOptionalParams, - ConnectionsListSecretsOptionalParams, - ConnectionsGetOptionalParams, - ConnectionsListOptionalParams, + TelemetryGetAppInsightsOptionalParams, + ConnectionsGetConnectionWithSecretsOptionalParams, + ConnectionsGetConnectionOptionalParams, + ConnectionsListConnectionsOptionalParams, + ConnectionsGetWorkspaceOptionalParams, AgentsListVectorStoreFileBatchFilesOptionalParams, AgentsCancelVectorStoreFileBatchOptionalParams, AgentsGetVectorStoreFileBatchOptionalParams, diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts index 3d864d1f2b..89407a0caf 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/options.ts @@ -5,10 +5,11 @@ import { ConnectionType, ToolDefinitionUnion, ToolResources, + VectorStoreDataSource, + VectorStoreConfiguration, AgentsApiResponseFormatOption, ThreadMessageOptions, MessageAttachment, - ThreadMessage, TruncationObject, AgentsApiToolChoiceOption, UpdateToolResourcesOptions, @@ -17,16 +18,14 @@ import { VectorStoreExpirationPolicy, VectorStoreChunkingStrategyRequestUnion, ListSortOrder, + RunAdditionalFieldList, VectorStoreFileStatusFilter, } from "../models/models.js"; import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface EvaluationsDeleteScheduleOptionalParams - extends OperationOptions { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - clientRequestId?: string; -} +export interface EvaluationsDisableScheduleOptionalParams + extends OperationOptions {} /** Optional parameters. */ export interface EvaluationsListScheduleOptionalParams @@ -82,14 +81,20 @@ export interface EvaluationsGetOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface ConnectionsListSecretsOptionalParams +export interface TelemetryGetAppInsightsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface ConnectionsGetOptionalParams extends OperationOptions {} +export interface ConnectionsGetConnectionWithSecretsOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface ConnectionsListOptionalParams extends OperationOptions { +export interface ConnectionsGetConnectionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface ConnectionsListConnectionsOptionalParams + extends OperationOptions { /** Category of the workspace connection. */ category?: ConnectionType; /** Indicates whether to list datastores. Service default: do not list datastores. */ @@ -98,6 +103,10 @@ export interface ConnectionsListOptionalParams extends OperationOptions { target?: string; } +/** Optional parameters. */ +export interface ConnectionsGetWorkspaceOptionalParams + extends OperationOptions {} + /** Optional parameters. */ export interface AgentsListVectorStoreFileBatchFilesOptionalParams extends OperationOptions { @@ -124,6 +133,10 @@ export interface AgentsGetVectorStoreFileBatchOptionalParams /** Optional parameters. */ export interface AgentsCreateVectorStoreFileBatchOptionalParams extends OperationOptions { + /** List of file identifiers. */ + fileIds?: string[]; + /** List of Azure assets. */ + dataSources?: VectorStoreDataSource[]; /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; } @@ -139,6 +152,10 @@ export interface AgentsGetVectorStoreFileOptionalParams /** Optional parameters. */ export interface AgentsCreateVectorStoreFileOptionalParams extends OperationOptions { + /** Identifier of the file. */ + fileId?: string; + /** Azure asset ID. */ + dataSources?: VectorStoreDataSource[]; /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ chunkingStrategy?: VectorStoreChunkingStrategyRequestUnion; } @@ -183,6 +200,8 @@ export interface AgentsCreateVectorStoreOptionalParams fileIds?: string[]; /** The name of the vector store. */ name?: string; + /** The vector store configuration, used when vector store is created from Azure asset URIs. */ + storeConfiguration?: VectorStoreConfiguration; /** Details on when this vector store expires */ expiresAfter?: VectorStoreExpirationPolicy; /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. */ @@ -226,6 +245,11 @@ export interface AgentsListFilesOptionalParams extends OperationOptions { /** Optional parameters. */ export interface AgentsListRunStepsOptionalParams extends OperationOptions { + /** + * A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + */ + include?: RunAdditionalFieldList[]; /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ limit?: number; /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */ @@ -237,7 +261,13 @@ export interface AgentsListRunStepsOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface AgentsGetRunStepOptionalParams extends OperationOptions {} +export interface AgentsGetRunStepOptionalParams extends OperationOptions { + /** + * A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + */ + include?: RunAdditionalFieldList[]; +} /** Optional parameters. */ export interface AgentsCreateThreadAndRunOptionalParams @@ -288,6 +318,8 @@ export interface AgentsCreateThreadAndRunOptionalParams toolChoice?: AgentsApiToolChoiceOption | null; /** Specifies the format that the model must output. */ responseFormat?: AgentsApiResponseFormatOption | null; + /** If `true` functions will run in parallel during tool use. */ + parallelToolCalls?: boolean; /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ metadata?: Record | null; } @@ -325,6 +357,11 @@ export interface AgentsListRunsOptionalParams extends OperationOptions { /** Optional parameters. */ export interface AgentsCreateRunOptionalParams extends OperationOptions { + /** + * A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + */ + include?: RunAdditionalFieldList[]; /** The overridden model name that the agent should use to run the thread. */ model?: string | null; /** The overridden system instructions that the agent should use to run the thread. */ @@ -335,7 +372,7 @@ export interface AgentsCreateRunOptionalParams extends OperationOptions { */ additionalInstructions?: string | null; /** Adds additional messages to the thread before creating the run. */ - additionalMessages?: ThreadMessage[] | null; + additionalMessages?: ThreadMessageOptions[] | null; /** The overridden list of enabled tools that the agent should use to run the thread. */ tools?: ToolDefinitionUnion[] | null; /** @@ -374,6 +411,8 @@ export interface AgentsCreateRunOptionalParams extends OperationOptions { toolChoice?: AgentsApiToolChoiceOption | null; /** Specifies the format that the model must output. */ responseFormat?: AgentsApiResponseFormatOption | null; + /** If `true` functions will run in parallel during tool use. */ + parallelToolCalls?: boolean; /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ metadata?: Record | null; } diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/api/telemetry/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/telemetry/index.ts new file mode 100644 index 0000000000..8abc7ea772 --- /dev/null +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/api/telemetry/index.ts @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + AIProjectContext as Client, + TelemetryGetAppInsightsOptionalParams, +} from "../index.js"; +import { + GetAppInsightsResponse, + getAppInsightsResponseDeserializer, +} from "../../models/models.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _getAppInsightsSend( + context: Client, + appInsightsResourceUrl: string, + options: TelemetryGetAppInsightsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/{appInsightsResourceUrl}", appInsightsResourceUrl) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _getAppInsightsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return getAppInsightsResponseDeserializer(result.body); +} + +/** Gets the properties of the specified Application Insights resource */ +export async function getAppInsights( + context: Client, + appInsightsResourceUrl: string, + options: TelemetryGetAppInsightsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getAppInsightsSend( + context, + appInsightsResourceUrl, + options, + ); + return _getAppInsightsDeserialize(result); +} diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts index 0cc3827383..28e679e692 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/agents/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AzureAIContext } from "../../api/azureAIContext.js"; +import { AIProjectContext } from "../../api/aiProjectContext.js"; import { listVectorStoreFileBatchFiles, cancelVectorStoreFileBatch, @@ -62,7 +62,6 @@ import { OpenAIFile, FilePurpose, FileDeletionStatus, - FileContentResponse, OpenAIPageableListOfVectorStore, VectorStore, VectorStoreDeletionStatus, @@ -137,7 +136,6 @@ export interface AgentsOperations { /** Create a vector store file batch. */ createVectorStoreFileBatch: ( vectorStoreId: string, - fileIds: string[], options?: AgentsCreateVectorStoreFileBatchOptionalParams, ) => Promise; /** @@ -158,7 +156,6 @@ export interface AgentsOperations { /** Create a vector store file by attaching a file to a vector store. */ createVectorStoreFile: ( vectorStoreId: string, - fileId: string, options?: AgentsCreateVectorStoreFileOptionalParams, ) => Promise; /** Returns a list of vector store files. */ @@ -189,11 +186,11 @@ export interface AgentsOperations { listVectorStores: ( options?: AgentsListVectorStoresOptionalParams, ) => Promise; - /** Returns information about a specific file. Does not retrieve file content. */ + /** Retrieves the raw content of a specific file. */ getFileContent: ( fileId: string, options?: AgentsGetFileContentOptionalParams, - ) => Promise; + ) => Promise; /** Returns information about a specific file. Does not retrieve file content. */ getFile: ( fileId: string, @@ -337,7 +334,7 @@ export interface AgentsOperations { ) => Promise; } -export function getAgents(context: AzureAIContext) { +export function getAgents(context: AIProjectContext) { return { listVectorStoreFileBatchFiles: ( vectorStoreId: string, @@ -357,9 +354,8 @@ export function getAgents(context: AzureAIContext) { ) => getVectorStoreFileBatch(context, vectorStoreId, batchId, options), createVectorStoreFileBatch: ( vectorStoreId: string, - fileIds: string[], options?: AgentsCreateVectorStoreFileBatchOptionalParams, - ) => createVectorStoreFileBatch(context, vectorStoreId, fileIds, options), + ) => createVectorStoreFileBatch(context, vectorStoreId, options), deleteVectorStoreFile: ( vectorStoreId: string, fileId: string, @@ -372,9 +368,8 @@ export function getAgents(context: AzureAIContext) { ) => getVectorStoreFile(context, vectorStoreId, fileId, options), createVectorStoreFile: ( vectorStoreId: string, - fileId: string, options?: AgentsCreateVectorStoreFileOptionalParams, - ) => createVectorStoreFile(context, vectorStoreId, fileId, options), + ) => createVectorStoreFile(context, vectorStoreId, options), listVectorStoreFiles: ( vectorStoreId: string, options?: AgentsListVectorStoreFilesOptionalParams, @@ -502,7 +497,9 @@ export function getAgents(context: AzureAIContext) { }; } -export function getAgentsOperations(context: AzureAIContext): AgentsOperations { +export function getAgentsOperations( + context: AIProjectContext, +): AgentsOperations { return { ...getAgents(context), }; diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts index 75ceca3621..4ccade27ee 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/connections/index.ts @@ -1,52 +1,68 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AzureAIContext } from "../../api/azureAIContext.js"; -import { listSecrets, get, list } from "../../api/connections/index.js"; +import { AIProjectContext } from "../../api/aiProjectContext.js"; import { - ConnectionsListSecretsOptionalParams, - ConnectionsGetOptionalParams, - ConnectionsListOptionalParams, + getConnectionWithSecrets, + getConnection, + listConnections, + getWorkspace, +} from "../../api/connections/index.js"; +import { + ConnectionsGetConnectionWithSecretsOptionalParams, + ConnectionsGetConnectionOptionalParams, + ConnectionsListConnectionsOptionalParams, + ConnectionsGetWorkspaceOptionalParams, } from "../../api/options.js"; import { - ConnectionsListResponse, - ConnectionsListSecretsResponse, + GetWorkspaceResponse, + ListConnectionsResponse, + GetConnectionResponse, } from "../../models/models.js"; /** Interface representing a Connections operations. */ export interface ConnectionsOperations { /** Get the details of a single connection, including credentials (if available). */ - listSecrets: ( + getConnectionWithSecrets: ( connectionName: string, ignored: string, - options?: ConnectionsListSecretsOptionalParams, - ) => Promise; + options?: ConnectionsGetConnectionWithSecretsOptionalParams, + ) => Promise; /** Get the details of a single connection, without credentials. */ - get: ( + getConnection: ( connectionName: string, - options?: ConnectionsGetOptionalParams, - ) => Promise; + options?: ConnectionsGetConnectionOptionalParams, + ) => Promise; /** List the details of all the connections (not including their credentials) */ - list: ( - options?: ConnectionsListOptionalParams, - ) => Promise; + listConnections: ( + options?: ConnectionsListConnectionsOptionalParams, + ) => Promise; + /** Gets the properties of the specified machine learning workspace. */ + getWorkspace: ( + options?: ConnectionsGetWorkspaceOptionalParams, + ) => Promise; } -export function getConnections(context: AzureAIContext) { +export function getConnections(context: AIProjectContext) { return { - listSecrets: ( + getConnectionWithSecrets: ( connectionName: string, ignored: string, - options?: ConnectionsListSecretsOptionalParams, - ) => listSecrets(context, connectionName, ignored, options), - get: (connectionName: string, options?: ConnectionsGetOptionalParams) => - get(context, connectionName, options), - list: (options?: ConnectionsListOptionalParams) => list(context, options), + options?: ConnectionsGetConnectionWithSecretsOptionalParams, + ) => getConnectionWithSecrets(context, connectionName, ignored, options), + getConnection: ( + connectionName: string, + options?: ConnectionsGetConnectionOptionalParams, + ) => getConnection(context, connectionName, options), + listConnections: (options?: ConnectionsListConnectionsOptionalParams) => + listConnections(context, options), + getWorkspace: (options?: ConnectionsGetWorkspaceOptionalParams) => + getWorkspace(context, options), }; } export function getConnectionsOperations( - context: AzureAIContext, + context: AIProjectContext, ): ConnectionsOperations { return { ...getConnections(context), diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts index def0c46ecd..882cec7c08 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/evaluations/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AzureAIContext } from "../../api/azureAIContext.js"; +import { AIProjectContext } from "../../api/aiProjectContext.js"; import { - deleteSchedule, + disableSchedule, listSchedule, createOrReplaceSchedule, getSchedule, @@ -13,7 +13,7 @@ import { get, } from "../../api/evaluations/index.js"; import { - EvaluationsDeleteScheduleOptionalParams, + EvaluationsDisableScheduleOptionalParams, EvaluationsListScheduleOptionalParams, EvaluationsCreateOrReplaceScheduleOptionalParams, EvaluationsGetScheduleOptionalParams, @@ -27,10 +27,10 @@ import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.j /** Interface representing a Evaluations operations. */ export interface EvaluationsOperations { - /** Resource delete operation template. */ - deleteSchedule: ( - id: string, - options?: EvaluationsDeleteScheduleOptionalParams, + /** Disable the evaluation schedule. */ + disableSchedule: ( + name: string, + options?: EvaluationsDisableScheduleOptionalParams, ) => Promise; /** Resource list operation template. */ listSchedule: ( @@ -38,13 +38,13 @@ export interface EvaluationsOperations { ) => PagedAsyncIterableIterator; /** Create or replace operation template. */ createOrReplaceSchedule: ( - id: string, + name: string, resource: EvaluationSchedule, options?: EvaluationsCreateOrReplaceScheduleOptionalParams, ) => Promise; /** Resource read operation template. */ getSchedule: ( - id: string, + name: string, options?: EvaluationsGetScheduleOptionalParams, ) => Promise; /** Resource update operation template. */ @@ -69,21 +69,23 @@ export interface EvaluationsOperations { ) => Promise; } -export function getEvaluations(context: AzureAIContext) { +export function getEvaluations(context: AIProjectContext) { return { - deleteSchedule: ( - id: string, - options?: EvaluationsDeleteScheduleOptionalParams, - ) => deleteSchedule(context, id, options), + disableSchedule: ( + name: string, + options?: EvaluationsDisableScheduleOptionalParams, + ) => disableSchedule(context, name, options), listSchedule: (options?: EvaluationsListScheduleOptionalParams) => listSchedule(context, options), createOrReplaceSchedule: ( - id: string, + name: string, resource: EvaluationSchedule, options?: EvaluationsCreateOrReplaceScheduleOptionalParams, - ) => createOrReplaceSchedule(context, id, resource, options), - getSchedule: (id: string, options?: EvaluationsGetScheduleOptionalParams) => - getSchedule(context, id, options), + ) => createOrReplaceSchedule(context, name, resource, options), + getSchedule: ( + name: string, + options?: EvaluationsGetScheduleOptionalParams, + ) => getSchedule(context, name, options), update: ( id: string, resource: Evaluation, @@ -100,7 +102,7 @@ export function getEvaluations(context: AzureAIContext) { } export function getEvaluationsOperations( - context: AzureAIContext, + context: AIProjectContext, ): EvaluationsOperations { return { ...getEvaluations(context), diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/index.ts index 13d37ce70a..b757a2bc94 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/index.ts @@ -4,3 +4,4 @@ export { AgentsOperations } from "./agents/index.js"; export { ConnectionsOperations } from "./connections/index.js"; export { EvaluationsOperations } from "./evaluations/index.js"; +export { TelemetryOperations } from "./telemetry/index.js"; diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/telemetry/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/telemetry/index.ts new file mode 100644 index 0000000000..757459bd7f --- /dev/null +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/classic/telemetry/index.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AIProjectContext } from "../../api/aiProjectContext.js"; +import { TelemetryGetAppInsightsOptionalParams } from "../../api/options.js"; +import { getAppInsights } from "../../api/telemetry/index.js"; +import { GetAppInsightsResponse } from "../../models/models.js"; + +/** Interface representing a Telemetry operations. */ +export interface TelemetryOperations { + /** Gets the properties of the specified Application Insights resource */ + getAppInsights: ( + appInsightsResourceUrl: string, + options?: TelemetryGetAppInsightsOptionalParams, + ) => Promise; +} + +export function getTelemetry(context: AIProjectContext) { + return { + getAppInsights: ( + appInsightsResourceUrl: string, + options?: TelemetryGetAppInsightsOptionalParams, + ) => getAppInsights(context, appInsightsResourceUrl, options), + }; +} + +export function getTelemetryOperations( + context: AIProjectContext, +): TelemetryOperations { + return { + ...getTelemetry(context), + }; +} diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts index 7873ee29db..3118b69b95 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/index.ts @@ -7,12 +7,12 @@ import { PagedAsyncIterableIterator, } from "./static-helpers/pagingHelpers.js"; -export { AzureAIClient } from "./azureAIClient.js"; +export { AIProjectClient } from "./aiProjectClient.js"; export { Evaluation, InputData, InputDataUnion, - AppInsightsConfiguration, + ApplicationInsightsConfiguration, Dataset, SystemData, EvaluatorConfiguration, @@ -24,38 +24,62 @@ export { RecurrenceSchedule, WeekDays, CronTrigger, - SamplingStrategy, - ConnectionsListResponse, - ConnectionsListSecretsResponse, - ConnectionProperties, - ConnectionPropertiesUnion, + GetAppInsightsResponse, + AppInsightsProperties, + GetWorkspaceResponse, + WorkspaceProperties, + ListConnectionsResponse, + GetConnectionResponse, + InternalConnectionProperties, + InternalConnectionPropertiesUnion, AuthenticationType, - ConnectionPropertiesApiKeyAuth, ConnectionType, + InternalConnectionPropertiesApiKeyAuth, CredentialsApiKeyAuth, - ConnectionPropertiesAADAuth, - ConnectionPropertiesSASAuth, + InternalConnectionPropertiesAADAuth, + InternalConnectionPropertiesSASAuth, CredentialsSASAuth, ToolDefinition, ToolDefinitionUnion, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, + FileSearchRankingOptions, FunctionToolDefinition, FunctionDefinition, BingGroundingToolDefinition, + ToolConnectionList, + ToolConnection, MicrosoftFabricToolDefinition, SharepointToolDefinition, AzureAISearchToolDefinition, + OpenApiToolDefinition, + OpenApiFunctionDefinition, + OpenApiAuthDetails, + OpenApiAuthDetailsUnion, + OpenApiAuthType, + OpenApiAnonymousAuthDetails, + OpenApiConnectionAuthDetails, + OpenApiConnectionSecurityScheme, + OpenApiManagedAuthDetails, + OpenApiManagedSecurityScheme, + AzureFunctionToolDefinition, + AzureFunctionDefinition, + AzureFunctionBinding, + AzureFunctionStorageQueue, ToolResources, CodeInterpreterToolResource, + VectorStoreDataSource, + VectorStoreDataSourceAssetType, FileSearchToolResource, - ConnectionListResource, - ConnectionResource, + VectorStoreConfigurations, + VectorStoreConfiguration, AzureAISearchResource, IndexResource, AgentsApiResponseFormat, - ApiResponseFormat, + ResponseFormat, + ResponseFormatJsonSchemaType, + ResponseFormatJsonSchema, AgentsApiResponseFormatOption, AgentsApiResponseFormatMode, Agent, @@ -103,6 +127,7 @@ export { RequiredFunctionToolCallDetails, RunError, IncompleteRunDetails, + IncompleteDetailsReason, RunCompletionUsage, UpdateToolResourcesOptions, UpdateCodeInterpreterToolResourceOptions, @@ -128,6 +153,9 @@ export { RunStepCodeInterpreterImageOutput, RunStepCodeInterpreterImageReference, RunStepFileSearchToolCall, + RunStepFileSearchToolCallResults, + RunStepFileSearchToolCallResult, + FileSearchToolCallContent, RunStepBingGroundingToolCall, RunStepAzureAISearchToolCall, RunStepSharepointToolCall, @@ -143,7 +171,6 @@ export { FilePurpose, FileState, FileDeletionStatus, - FileContentResponse, OpenAIPageableListOfVectorStore, VectorStore, VectorStoreFileCount, @@ -211,12 +238,13 @@ export { DoneEvent, AgentStreamEvent, ListSortOrder, + RunAdditionalFieldList, VectorStoreFileStatusFilter, KnownVersions, } from "./models/index.js"; export { - AzureAIClientOptionalParams, - EvaluationsDeleteScheduleOptionalParams, + AIProjectClientOptionalParams, + EvaluationsDisableScheduleOptionalParams, EvaluationsListScheduleOptionalParams, EvaluationsCreateOrReplaceScheduleOptionalParams, EvaluationsGetScheduleOptionalParams, @@ -224,9 +252,11 @@ export { EvaluationsListOptionalParams, EvaluationsCreateOptionalParams, EvaluationsGetOptionalParams, - ConnectionsListSecretsOptionalParams, - ConnectionsGetOptionalParams, - ConnectionsListOptionalParams, + TelemetryGetAppInsightsOptionalParams, + ConnectionsGetConnectionWithSecretsOptionalParams, + ConnectionsGetConnectionOptionalParams, + ConnectionsListConnectionsOptionalParams, + ConnectionsGetWorkspaceOptionalParams, AgentsListVectorStoreFileBatchFilesOptionalParams, AgentsCancelVectorStoreFileBatchOptionalParams, AgentsGetVectorStoreFileBatchOptionalParams, @@ -272,5 +302,6 @@ export { AgentsOperations, ConnectionsOperations, EvaluationsOperations, + TelemetryOperations, } from "./classic/index.js"; export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/index.ts index ea6262c0d6..b82ccd308a 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/index.ts @@ -5,7 +5,7 @@ export { Evaluation, InputData, InputDataUnion, - AppInsightsConfiguration, + ApplicationInsightsConfiguration, Dataset, SystemData, EvaluatorConfiguration, @@ -17,38 +17,62 @@ export { RecurrenceSchedule, WeekDays, CronTrigger, - SamplingStrategy, - ConnectionsListResponse, - ConnectionsListSecretsResponse, - ConnectionProperties, - ConnectionPropertiesUnion, + GetAppInsightsResponse, + AppInsightsProperties, + GetWorkspaceResponse, + WorkspaceProperties, + ListConnectionsResponse, + GetConnectionResponse, + InternalConnectionProperties, + InternalConnectionPropertiesUnion, AuthenticationType, - ConnectionPropertiesApiKeyAuth, ConnectionType, + InternalConnectionPropertiesApiKeyAuth, CredentialsApiKeyAuth, - ConnectionPropertiesAADAuth, - ConnectionPropertiesSASAuth, + InternalConnectionPropertiesAADAuth, + InternalConnectionPropertiesSASAuth, CredentialsSASAuth, ToolDefinition, ToolDefinitionUnion, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, + FileSearchRankingOptions, FunctionToolDefinition, FunctionDefinition, BingGroundingToolDefinition, + ToolConnectionList, + ToolConnection, MicrosoftFabricToolDefinition, SharepointToolDefinition, AzureAISearchToolDefinition, + OpenApiToolDefinition, + OpenApiFunctionDefinition, + OpenApiAuthDetails, + OpenApiAuthDetailsUnion, + OpenApiAuthType, + OpenApiAnonymousAuthDetails, + OpenApiConnectionAuthDetails, + OpenApiConnectionSecurityScheme, + OpenApiManagedAuthDetails, + OpenApiManagedSecurityScheme, + AzureFunctionToolDefinition, + AzureFunctionDefinition, + AzureFunctionBinding, + AzureFunctionStorageQueue, ToolResources, CodeInterpreterToolResource, + VectorStoreDataSource, + VectorStoreDataSourceAssetType, FileSearchToolResource, - ConnectionListResource, - ConnectionResource, + VectorStoreConfigurations, + VectorStoreConfiguration, AzureAISearchResource, IndexResource, AgentsApiResponseFormat, - ApiResponseFormat, + ResponseFormat, + ResponseFormatJsonSchemaType, + ResponseFormatJsonSchema, AgentsApiResponseFormatOption, AgentsApiResponseFormatMode, Agent, @@ -96,6 +120,7 @@ export { RequiredFunctionToolCallDetails, RunError, IncompleteRunDetails, + IncompleteDetailsReason, RunCompletionUsage, UpdateToolResourcesOptions, UpdateCodeInterpreterToolResourceOptions, @@ -121,6 +146,9 @@ export { RunStepCodeInterpreterImageOutput, RunStepCodeInterpreterImageReference, RunStepFileSearchToolCall, + RunStepFileSearchToolCallResults, + RunStepFileSearchToolCallResult, + FileSearchToolCallContent, RunStepBingGroundingToolCall, RunStepAzureAISearchToolCall, RunStepSharepointToolCall, @@ -136,7 +164,6 @@ export { FilePurpose, FileState, FileDeletionStatus, - FileContentResponse, OpenAIPageableListOfVectorStore, VectorStore, VectorStoreFileCount, @@ -204,6 +231,7 @@ export { DoneEvent, AgentStreamEvent, ListSortOrder, + RunAdditionalFieldList, VectorStoreFileStatusFilter, KnownVersions, } from "./models.js"; diff --git a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts index 3e63658359..23e344aefc 100644 --- a/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/ai/generated/typespec-ts/src/models/models.ts @@ -1,15 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { stringToUint8Array } from "@azure/core-util"; - /** Evaluation Definition */ export interface Evaluation { /** Identifier of the evaluation. */ readonly id: string; /** Data for evaluation. */ data: InputDataUnion; - /** Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique. */ + /** Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. */ displayName?: string; /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ description?: string; @@ -70,13 +68,16 @@ export function inputDataDeserializer(item: any): InputData { } /** Alias for InputDataUnion */ -export type InputDataUnion = AppInsightsConfiguration | Dataset | InputData; +export type InputDataUnion = + | ApplicationInsightsConfiguration + | Dataset + | InputData; export function inputDataUnionSerializer(item: InputDataUnion): any { switch (item.type) { case "app_insights": - return appInsightsConfigurationSerializer( - item as AppInsightsConfiguration, + return applicationInsightsConfigurationSerializer( + item as ApplicationInsightsConfiguration, ); case "dataset": @@ -90,8 +91,8 @@ export function inputDataUnionSerializer(item: InputDataUnion): any { export function inputDataUnionDeserializer(item: any): InputDataUnion { switch (item.type) { case "app_insights": - return appInsightsConfigurationDeserializer( - item as AppInsightsConfiguration, + return applicationInsightsConfigurationDeserializer( + item as ApplicationInsightsConfiguration, ); case "dataset": @@ -102,35 +103,39 @@ export function inputDataUnionDeserializer(item: any): InputDataUnion { } } -/** Data Source for Application Insight. */ -export interface AppInsightsConfiguration extends InputData { +/** Data Source for Application Insights. */ +export interface ApplicationInsightsConfiguration extends InputData { readonly type: "app_insights"; - /** LogAnalytic Workspace resourceID associated with AppInsights */ + /** LogAnalytic Workspace resourceID associated with ApplicationInsights */ resourceId: string; /** Query to fetch the data. */ query: string; /** Service name. */ serviceName: string; + /** Connection String to connect to ApplicationInsights. */ + connectionString?: string; } -export function appInsightsConfigurationSerializer( - item: AppInsightsConfiguration, +export function applicationInsightsConfigurationSerializer( + item: ApplicationInsightsConfiguration, ): any { return { resourceId: item["resourceId"], query: item["query"], serviceName: item["serviceName"], + connectionString: item["connectionString"], }; } -export function appInsightsConfigurationDeserializer( +export function applicationInsightsConfigurationDeserializer( item: any, -): AppInsightsConfiguration { +): ApplicationInsightsConfiguration { return { type: item["type"], resourceId: item["resourceId"], query: item["query"], serviceName: item["serviceName"], + connectionString: item["connectionString"], }; } @@ -260,58 +265,53 @@ export function evaluationArrayDeserializer(result: Array): any[] { /** Evaluation Schedule Definition */ export interface EvaluationSchedule { - /** Identifier of the evaluation. */ - readonly id: string; + /** Name of the schedule, which also serves as the unique identifier for the evaluation */ + readonly name: string; /** Data for evaluation. */ - data: InputDataUnion; - /** Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique. */ - displayName?: string; + data: ApplicationInsightsConfiguration; /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ description?: string; /** Metadata containing createdBy and modifiedBy information. */ readonly systemData?: SystemData; - /** Status of the evaluation. It is set by service and is read-only. */ - readonly provisioningStatus?: string; + /** Provisioning State of the evaluation. It is set by service and is read-only. */ + readonly provisioningState?: string; /** Evaluation's tags. Unlike properties, tags are fully mutable. */ tags?: Record; /** Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. */ properties?: Record; + /** Enabled status of the evaluation. It is set by service and is read-only. */ + readonly isEnabled?: string; /** Evaluators to be used for the evaluation. */ evaluators: Record; /** Trigger for the evaluation. */ trigger: TriggerUnion; - /** Sampling strategy for the evaluation. */ - samplingStrategy: SamplingStrategy; } export function evaluationScheduleSerializer(item: EvaluationSchedule): any { return { - data: inputDataUnionSerializer(item["data"]), - displayName: item["displayName"], + data: applicationInsightsConfigurationSerializer(item["data"]), description: item["description"], tags: item["tags"], properties: item["properties"], evaluators: evaluatorConfigurationRecordSerializer(item["evaluators"]), trigger: triggerUnionSerializer(item["trigger"]), - samplingStrategy: samplingStrategySerializer(item["samplingStrategy"]), }; } export function evaluationScheduleDeserializer(item: any): EvaluationSchedule { return { - id: item["id"], - data: inputDataUnionDeserializer(item["data"]), - displayName: item["displayName"], + name: item["name"], + data: applicationInsightsConfigurationDeserializer(item["data"]), description: item["description"], systemData: !item["systemData"] ? item["systemData"] : systemDataDeserializer(item["systemData"]), - provisioningStatus: item["provisioningStatus"], + provisioningState: item["provisioningState"], tags: item["tags"], properties: item["properties"], + isEnabled: item["isEnabled"], evaluators: evaluatorConfigurationRecordDeserializer(item["evaluators"]), trigger: triggerUnionDeserializer(item["trigger"]), - samplingStrategy: samplingStrategyDeserializer(item["samplingStrategy"]), }; } @@ -369,14 +369,16 @@ export interface RecurrenceTrigger extends Trigger { /** Specifies schedule interval in conjunction with frequency */ interval: number; /** The recurrence schedule. */ - schedule: RecurrenceSchedule; + schedule?: RecurrenceSchedule; } export function recurrenceTriggerSerializer(item: RecurrenceTrigger): any { return { frequency: item["frequency"], interval: item["interval"], - schedule: recurrenceScheduleSerializer(item["schedule"]), + schedule: !item["schedule"] + ? item["schedule"] + : recurrenceScheduleSerializer(item["schedule"]), }; } @@ -385,7 +387,9 @@ export function recurrenceTriggerDeserializer(item: any): RecurrenceTrigger { type: item["type"], frequency: item["frequency"], interval: item["interval"], - schedule: recurrenceScheduleDeserializer(item["schedule"]), + schedule: !item["schedule"] + ? item["schedule"] + : recurrenceScheduleDeserializer(item["schedule"]), }; } @@ -399,9 +403,9 @@ export interface RecurrenceSchedule { /** List of minutes for the schedule. */ minutes: number[]; /** List of days for the schedule. */ - weekDays: WeekDays[]; + weekDays?: WeekDays[]; /** List of month days for the schedule */ - monthDays: number[]; + monthDays?: number[]; } export function recurrenceScheduleSerializer(item: RecurrenceSchedule): any { @@ -412,12 +416,16 @@ export function recurrenceScheduleSerializer(item: RecurrenceSchedule): any { minutes: item["minutes"].map((p: any) => { return p; }), - weekDays: item["weekDays"].map((p: any) => { - return p; - }), - monthDays: item["monthDays"].map((p: any) => { - return p; - }), + weekDays: !item["weekDays"] + ? item["weekDays"] + : item["weekDays"].map((p: any) => { + return p; + }), + monthDays: !item["monthDays"] + ? item["monthDays"] + : item["monthDays"].map((p: any) => { + return p; + }), }; } @@ -429,12 +437,16 @@ export function recurrenceScheduleDeserializer(item: any): RecurrenceSchedule { minutes: item["minutes"].map((p: any) => { return p; }), - weekDays: item["weekDays"].map((p: any) => { - return p; - }), - monthDays: item["monthDays"].map((p: any) => { - return p; - }), + weekDays: !item["weekDays"] + ? item["weekDays"] + : item["weekDays"].map((p: any) => { + return p; + }), + monthDays: !item["monthDays"] + ? item["monthDays"] + : item["monthDays"].map((p: any) => { + return p; + }), }; } @@ -466,22 +478,6 @@ export function cronTriggerDeserializer(item: any): CronTrigger { }; } -/** SamplingStrategy Definition */ -export interface SamplingStrategy { - /** Sampling rate */ - rate: number; -} - -export function samplingStrategySerializer(item: SamplingStrategy): any { - return { rate: item["rate"] }; -} - -export function samplingStrategyDeserializer(item: any): SamplingStrategy { - return { - rate: item["rate"], - }; -} - /** Paged collection of EvaluationSchedule items */ export interface _PagedEvaluationSchedule { /** The EvaluationSchedule items on this page */ @@ -515,127 +511,200 @@ export function evaluationScheduleArrayDeserializer( }); } +/** Response from getting properties of the Application Insights resource */ +export interface GetAppInsightsResponse { + /** A unique identifier for the resource */ + id: string; + /** The name of the resource */ + name: string; + /** The properties of the resource */ + properties: AppInsightsProperties; +} + +export function getAppInsightsResponseDeserializer( + item: any, +): GetAppInsightsResponse { + return { + id: item["id"], + name: item["name"], + properties: appInsightsPropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of the Application Insights resource */ +export interface AppInsightsProperties { + /** Authentication type of the connection target */ + connectionString: string; +} + +export function appInsightsPropertiesDeserializer( + item: any, +): AppInsightsProperties { + return { + connectionString: item["ConnectionString"], + }; +} + +/** Response from the Workspace - Get operation */ +export interface GetWorkspaceResponse { + /** A unique identifier for the resource */ + id: string; + /** The name of the resource */ + name: string; + /** The properties of the resource */ + properties: WorkspaceProperties; +} + +export function getWorkspaceResponseDeserializer( + item: any, +): GetWorkspaceResponse { + return { + id: item["id"], + name: item["name"], + properties: workspacePropertiesDeserializer(item["properties"]), + }; +} + +/** workspace properties */ +export interface WorkspaceProperties { + /** Authentication type of the connection target */ + applicationInsights: string; +} + +export function workspacePropertiesDeserializer( + item: any, +): WorkspaceProperties { + return { + applicationInsights: item["applicationInsights"], + }; +} + /** Response from the list operation */ -export interface ConnectionsListResponse { +export interface ListConnectionsResponse { /** A list of connection list secrets */ - value: ConnectionsListSecretsResponse[]; + value: GetConnectionResponse[]; } -export function connectionsListResponseDeserializer( +export function listConnectionsResponseDeserializer( item: any, -): ConnectionsListResponse { +): ListConnectionsResponse { return { - value: connectionsListSecretsResponseArrayDeserializer(item["value"]), + value: getConnectionResponseArrayDeserializer(item["value"]), }; } -export function connectionsListSecretsResponseArrayDeserializer( - result: Array, +export function getConnectionResponseArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return connectionsListSecretsResponseDeserializer(item); + return getConnectionResponseDeserializer(item); }); } /** Response from the listSecrets operation */ -export interface ConnectionsListSecretsResponse { +export interface GetConnectionResponse { /** A unique identifier for the connection */ id: string; /** The name of the resource */ name: string; /** The properties of the resource */ - properties: ConnectionPropertiesUnion; + properties: InternalConnectionPropertiesUnion; } -export function connectionsListSecretsResponseDeserializer( +export function getConnectionResponseDeserializer( item: any, -): ConnectionsListSecretsResponse { +): GetConnectionResponse { return { id: item["id"], name: item["name"], - properties: connectionPropertiesUnionDeserializer(item["properties"]), + properties: internalConnectionPropertiesUnionDeserializer( + item["properties"], + ), }; } /** Connection properties */ -export interface ConnectionProperties { +export interface InternalConnectionProperties { /** Authentication type of the connection target */ /** The discriminator possible values: ApiKey, AAD, SAS */ authType: AuthenticationType; + /** Category of the connection */ + category: ConnectionType; + /** The connection URL to be used for this service */ + target: string; } -export function connectionPropertiesDeserializer( +export function internalConnectionPropertiesDeserializer( item: any, -): ConnectionProperties { +): InternalConnectionProperties { return { authType: item["authType"], + category: item["category"], + target: item["target"], }; } -/** Alias for ConnectionPropertiesUnion */ -export type ConnectionPropertiesUnion = - | ConnectionPropertiesApiKeyAuth - | ConnectionPropertiesAADAuth - | ConnectionPropertiesSASAuth - | ConnectionProperties; +/** Alias for InternalConnectionPropertiesUnion */ +export type InternalConnectionPropertiesUnion = + | InternalConnectionPropertiesApiKeyAuth + | InternalConnectionPropertiesAADAuth + | InternalConnectionPropertiesSASAuth + | InternalConnectionProperties; -export function connectionPropertiesUnionDeserializer( +export function internalConnectionPropertiesUnionDeserializer( item: any, -): ConnectionPropertiesUnion { +): InternalConnectionPropertiesUnion { switch (item.authType) { case "ApiKey": - return connectionPropertiesApiKeyAuthDeserializer( - item as ConnectionPropertiesApiKeyAuth, + return internalConnectionPropertiesApiKeyAuthDeserializer( + item as InternalConnectionPropertiesApiKeyAuth, ); case "AAD": - return connectionPropertiesAADAuthDeserializer( - item as ConnectionPropertiesAADAuth, + return internalConnectionPropertiesAADAuthDeserializer( + item as InternalConnectionPropertiesAADAuth, ); case "SAS": - return connectionPropertiesSASAuthDeserializer( - item as ConnectionPropertiesSASAuth, + return internalConnectionPropertiesSASAuthDeserializer( + item as InternalConnectionPropertiesSASAuth, ); default: - return connectionPropertiesDeserializer(item); + return internalConnectionPropertiesDeserializer(item); } } /** Authentication type used by Azure AI service to connect to another service */ export type AuthenticationType = "ApiKey" | "AAD" | "SAS"; +/** The Type (or category) of the connection */ +export type ConnectionType = + | "AzureOpenAI" + | "Serverless" + | "AzureBlob" + | "AIServices" + | "CognitiveSearch"; /** Connection properties for connections with API key authentication */ -export interface ConnectionPropertiesApiKeyAuth extends ConnectionProperties { +export interface InternalConnectionPropertiesApiKeyAuth + extends InternalConnectionProperties { /** Authentication type of the connection target */ authType: "ApiKey"; - /** Category of the connection */ - category: ConnectionType; /** Credentials will only be present for authType=ApiKey */ credentials: CredentialsApiKeyAuth; - /** The connection URL to be used for this service */ - target: string; } -export function connectionPropertiesApiKeyAuthDeserializer( +export function internalConnectionPropertiesApiKeyAuthDeserializer( item: any, -): ConnectionPropertiesApiKeyAuth { +): InternalConnectionPropertiesApiKeyAuth { return { authType: item["authType"], category: item["category"], - credentials: credentialsApiKeyAuthDeserializer(item["credentials"]), target: item["target"], + credentials: credentialsApiKeyAuthDeserializer(item["credentials"]), }; } -/** The Type (or category) of the connection */ -export type ConnectionType = - | "AzureOpenAI" - | "Serverless" - | "AzureBlob" - | "AIServices"; - /** The credentials needed for API key authentication */ export interface CredentialsApiKeyAuth { /** The API key */ @@ -651,18 +720,15 @@ export function credentialsApiKeyAuthDeserializer( } /** Connection properties for connections with AAD authentication (aka `Entra ID passthrough`) */ -export interface ConnectionPropertiesAADAuth extends ConnectionProperties { +export interface InternalConnectionPropertiesAADAuth + extends InternalConnectionProperties { /** Authentication type of the connection target */ authType: "AAD"; - /** Category of the connection */ - category: ConnectionType; - /** The connection URL to be used for this service */ - target: string; } -export function connectionPropertiesAADAuthDeserializer( +export function internalConnectionPropertiesAADAuthDeserializer( item: any, -): ConnectionPropertiesAADAuth { +): InternalConnectionPropertiesAADAuth { return { authType: item["authType"], category: item["category"], @@ -671,25 +737,22 @@ export function connectionPropertiesAADAuthDeserializer( } /** Connection properties for connections with SAS authentication */ -export interface ConnectionPropertiesSASAuth extends ConnectionProperties { +export interface InternalConnectionPropertiesSASAuth + extends InternalConnectionProperties { /** Authentication type of the connection target */ authType: "SAS"; - /** Category of the connection */ - category: ConnectionType; /** Credentials will only be present for authType=ApiKey */ credentials: CredentialsSASAuth; - /** The connection URL to be used for this service */ - target: string; } -export function connectionPropertiesSASAuthDeserializer( +export function internalConnectionPropertiesSASAuthDeserializer( item: any, -): ConnectionPropertiesSASAuth { +): InternalConnectionPropertiesSASAuth { return { authType: item["authType"], category: item["category"], - credentials: credentialsSASAuthDeserializer(item["credentials"]), target: item["target"], + credentials: credentialsSASAuthDeserializer(item["credentials"]), }; } @@ -708,7 +771,7 @@ export function credentialsSASAuthDeserializer(item: any): CredentialsSASAuth { /** An abstract representation of an input tool definition that an agent can use. */ export interface ToolDefinition { /** The object type. */ - /** The discriminator possible values: code_interpreter, file_search, function, bing_grounding, microsoft_fabric, sharepoint, azure_ai_search */ + /** The discriminator possible values: code_interpreter, file_search, function, bing_grounding, fabric_aiskill, sharepoint_grounding, azure_ai_search, openapi, azure_function */ type: string; } @@ -731,6 +794,8 @@ export type ToolDefinitionUnion = | MicrosoftFabricToolDefinition | SharepointToolDefinition | AzureAISearchToolDefinition + | OpenApiToolDefinition + | AzureFunctionToolDefinition | ToolDefinition; export function toolDefinitionUnionSerializer(item: ToolDefinitionUnion): any { @@ -753,12 +818,12 @@ export function toolDefinitionUnionSerializer(item: ToolDefinitionUnion): any { item as BingGroundingToolDefinition, ); - case "microsoft_fabric": + case "fabric_aiskill": return microsoftFabricToolDefinitionSerializer( item as MicrosoftFabricToolDefinition, ); - case "sharepoint": + case "sharepoint_grounding": return sharepointToolDefinitionSerializer( item as SharepointToolDefinition, ); @@ -768,6 +833,14 @@ export function toolDefinitionUnionSerializer(item: ToolDefinitionUnion): any { item as AzureAISearchToolDefinition, ); + case "openapi": + return openApiToolDefinitionSerializer(item as OpenApiToolDefinition); + + case "azure_function": + return azureFunctionToolDefinitionSerializer( + item as AzureFunctionToolDefinition, + ); + default: return toolDefinitionSerializer(item); } @@ -795,12 +868,12 @@ export function toolDefinitionUnionDeserializer( item as BingGroundingToolDefinition, ); - case "microsoft_fabric": + case "fabric_aiskill": return microsoftFabricToolDefinitionDeserializer( item as MicrosoftFabricToolDefinition, ); - case "sharepoint": + case "sharepoint_grounding": return sharepointToolDefinitionDeserializer( item as SharepointToolDefinition, ); @@ -810,6 +883,14 @@ export function toolDefinitionUnionDeserializer( item as AzureAISearchToolDefinition, ); + case "openapi": + return openApiToolDefinitionDeserializer(item as OpenApiToolDefinition); + + case "azure_function": + return azureFunctionToolDefinitionDeserializer( + item as AzureFunctionToolDefinition, + ); + default: return toolDefinitionDeserializer(item); } @@ -873,12 +954,19 @@ export interface FileSearchToolDefinitionDetails { * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. */ maxNumResults?: number; + /** Ranking options for file search. */ + rankingOptions?: FileSearchRankingOptions; } export function fileSearchToolDefinitionDetailsSerializer( item: FileSearchToolDefinitionDetails, ): any { - return { max_num_results: item["maxNumResults"] }; + return { + max_num_results: item["maxNumResults"], + ranking_options: !item["rankingOptions"] + ? item["rankingOptions"] + : fileSearchRankingOptionsSerializer(item["rankingOptions"]), + }; } export function fileSearchToolDefinitionDetailsDeserializer( @@ -886,6 +974,32 @@ export function fileSearchToolDefinitionDetailsDeserializer( ): FileSearchToolDefinitionDetails { return { maxNumResults: item["max_num_results"], + rankingOptions: !item["ranking_options"] + ? item["ranking_options"] + : fileSearchRankingOptionsDeserializer(item["ranking_options"]), + }; +} + +/** Ranking options for file search. */ +export interface FileSearchRankingOptions { + /** File search ranker. */ + ranker: string; + /** Ranker search threshold. */ + scoreThreshold: number; +} + +export function fileSearchRankingOptionsSerializer( + item: FileSearchRankingOptions, +): any { + return { ranker: item["ranker"], score_threshold: item["scoreThreshold"] }; +} + +export function fileSearchRankingOptionsDeserializer( + item: any, +): FileSearchRankingOptions { + return { + ranker: item["ranker"], + scoreThreshold: item["score_threshold"], }; } @@ -945,12 +1059,17 @@ export function functionDefinitionDeserializer(item: any): FunctionDefinition { export interface BingGroundingToolDefinition extends ToolDefinition { /** The object type, which is always 'bing_grounding'. */ type: "bing_grounding"; + /** The list of connections used by the bing grounding tool. */ + bingGrounding: ToolConnectionList; } export function bingGroundingToolDefinitionSerializer( item: BingGroundingToolDefinition, ): any { - return { type: item["type"] }; + return { + type: item["type"], + bing_grounding: toolConnectionListSerializer(item["bingGrounding"]), + }; } export function bingGroundingToolDefinitionDeserializer( @@ -958,19 +1077,82 @@ export function bingGroundingToolDefinitionDeserializer( ): BingGroundingToolDefinition { return { type: item["type"], + bingGrounding: toolConnectionListDeserializer(item["bing_grounding"]), + }; +} + +/** A set of connection resources currently used by either the `bing_grounding`, `fabric_aiskill`, or `sharepoint_grounding` tools. */ +export interface ToolConnectionList { + /** + * The connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + */ + connectionList?: ToolConnection[]; +} + +export function toolConnectionListSerializer(item: ToolConnectionList): any { + return { + connections: !item["connectionList"] + ? item["connectionList"] + : toolConnectionArraySerializer(item["connectionList"]), + }; +} + +export function toolConnectionListDeserializer(item: any): ToolConnectionList { + return { + connectionList: !item["connections"] + ? item["connections"] + : toolConnectionArrayDeserializer(item["connections"]), + }; +} + +export function toolConnectionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return toolConnectionSerializer(item); + }); +} + +export function toolConnectionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return toolConnectionDeserializer(item); + }); +} + +/** A connection resource. */ +export interface ToolConnection { + /** A connection in a ToolConnectionList attached to this tool. */ + connectionId: string; +} + +export function toolConnectionSerializer(item: ToolConnection): any { + return { connection_id: item["connectionId"] }; +} + +export function toolConnectionDeserializer(item: any): ToolConnection { + return { + connectionId: item["connection_id"], }; } /** The input definition information for a Microsoft Fabric tool as used to configure an agent. */ export interface MicrosoftFabricToolDefinition extends ToolDefinition { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; + /** The object type, which is always 'fabric_aiskill'. */ + type: "fabric_aiskill"; + /** The list of connections used by the Microsoft Fabric tool. */ + fabricAiskill: ToolConnectionList; } export function microsoftFabricToolDefinitionSerializer( item: MicrosoftFabricToolDefinition, ): any { - return { type: item["type"] }; + return { + type: item["type"], + fabric_aiskill: toolConnectionListSerializer(item["fabricAiskill"]), + }; } export function microsoftFabricToolDefinitionDeserializer( @@ -978,19 +1160,27 @@ export function microsoftFabricToolDefinitionDeserializer( ): MicrosoftFabricToolDefinition { return { type: item["type"], + fabricAiskill: toolConnectionListDeserializer(item["fabric_aiskill"]), }; } /** The input definition information for a sharepoint tool as used to configure an agent. */ export interface SharepointToolDefinition extends ToolDefinition { - /** The object type, which is always 'sharepoint'. */ - type: "sharepoint"; + /** The object type, which is always 'sharepoint_grounding'. */ + type: "sharepoint_grounding"; + /** The list of connections used by the SharePoint tool. */ + sharepointGrounding: ToolConnectionList; } export function sharepointToolDefinitionSerializer( item: SharepointToolDefinition, ): any { - return { type: item["type"] }; + return { + type: item["type"], + sharepoint_grounding: toolConnectionListSerializer( + item["sharepointGrounding"], + ), + }; } export function sharepointToolDefinitionDeserializer( @@ -998,6 +1188,9 @@ export function sharepointToolDefinitionDeserializer( ): SharepointToolDefinition { return { type: item["type"], + sharepointGrounding: toolConnectionListDeserializer( + item["sharepoint_grounding"], + ), }; } @@ -1021,22 +1214,384 @@ export function azureAISearchToolDefinitionDeserializer( }; } +/** The input definition information for an OpenAPI tool as used to configure an agent. */ +export interface OpenApiToolDefinition extends ToolDefinition { + /** The object type, which is always 'openapi'. */ + type: "openapi"; + /** The openapi function definition. */ + openapi: OpenApiFunctionDefinition; +} + +export function openApiToolDefinitionSerializer( + item: OpenApiToolDefinition, +): any { + return { + type: item["type"], + openapi: openApiFunctionDefinitionSerializer(item["openapi"]), + }; +} + +export function openApiToolDefinitionDeserializer( + item: any, +): OpenApiToolDefinition { + return { + type: item["type"], + openapi: openApiFunctionDefinitionDeserializer(item["openapi"]), + }; +} + +/** The input definition information for an openapi function. */ +export interface OpenApiFunctionDefinition { + /** The name of the function to be called. */ + name: string; + /** A description of what the function does, used by the model to choose when and how to call the function. */ + description?: string; + /** The openapi function shape, described as a JSON Schema object. */ + spec: any; + /** Open API authentication details */ + auth: OpenApiAuthDetailsUnion; +} + +export function openApiFunctionDefinitionSerializer( + item: OpenApiFunctionDefinition, +): any { + return { + name: item["name"], + description: item["description"], + spec: item["spec"], + auth: openApiAuthDetailsUnionSerializer(item["auth"]), + }; +} + +export function openApiFunctionDefinitionDeserializer( + item: any, +): OpenApiFunctionDefinition { + return { + name: item["name"], + description: item["description"], + spec: item["spec"], + auth: openApiAuthDetailsUnionDeserializer(item["auth"]), + }; +} + +/** authentication details for OpenApiFunctionDefinition */ +export interface OpenApiAuthDetails { + /** The type of authentication, must be anonymous/connection/managed_identity */ + /** The discriminator possible values: anonymous, connection, managed_identity */ + type: OpenApiAuthType; +} + +export function openApiAuthDetailsSerializer(item: OpenApiAuthDetails): any { + return { type: item["type"] }; +} + +export function openApiAuthDetailsDeserializer(item: any): OpenApiAuthDetails { + return { + type: item["type"], + }; +} + +/** Alias for OpenApiAuthDetailsUnion */ +export type OpenApiAuthDetailsUnion = + | OpenApiAnonymousAuthDetails + | OpenApiConnectionAuthDetails + | OpenApiManagedAuthDetails + | OpenApiAuthDetails; + +export function openApiAuthDetailsUnionSerializer( + item: OpenApiAuthDetailsUnion, +): any { + switch (item.type) { + case "anonymous": + return openApiAnonymousAuthDetailsSerializer( + item as OpenApiAnonymousAuthDetails, + ); + + case "connection": + return openApiConnectionAuthDetailsSerializer( + item as OpenApiConnectionAuthDetails, + ); + + case "managed_identity": + return openApiManagedAuthDetailsSerializer( + item as OpenApiManagedAuthDetails, + ); + + default: + return openApiAuthDetailsSerializer(item); + } +} + +export function openApiAuthDetailsUnionDeserializer( + item: any, +): OpenApiAuthDetailsUnion { + switch (item.type) { + case "anonymous": + return openApiAnonymousAuthDetailsDeserializer( + item as OpenApiAnonymousAuthDetails, + ); + + case "connection": + return openApiConnectionAuthDetailsDeserializer( + item as OpenApiConnectionAuthDetails, + ); + + case "managed_identity": + return openApiManagedAuthDetailsDeserializer( + item as OpenApiManagedAuthDetails, + ); + + default: + return openApiAuthDetailsDeserializer(item); + } +} + +/** + * Authentication type for OpenApi endpoint. Allowed types are: + * - Anonymous (no authentication required) + * - Connection (requires connection_id to endpoint, as setup in AI Foundry) + * - Managed_Identity (requires audience for identity based auth) + */ +export type OpenApiAuthType = "anonymous" | "connection" | "managed_identity"; + +/** Security details for OpenApi anonymous authentication */ +export interface OpenApiAnonymousAuthDetails extends OpenApiAuthDetails { + /** The object type, which is always 'anonymous'. */ + type: "anonymous"; +} + +export function openApiAnonymousAuthDetailsSerializer( + item: OpenApiAnonymousAuthDetails, +): any { + return { type: item["type"] }; +} + +export function openApiAnonymousAuthDetailsDeserializer( + item: any, +): OpenApiAnonymousAuthDetails { + return { + type: item["type"], + }; +} + +/** Security details for OpenApi connection authentication */ +export interface OpenApiConnectionAuthDetails extends OpenApiAuthDetails { + /** The object type, which is always 'connection'. */ + type: "connection"; + /** Connection auth security details */ + securityScheme: OpenApiConnectionSecurityScheme; +} + +export function openApiConnectionAuthDetailsSerializer( + item: OpenApiConnectionAuthDetails, +): any { + return { + type: item["type"], + security_scheme: openApiConnectionSecuritySchemeSerializer( + item["securityScheme"], + ), + }; +} + +export function openApiConnectionAuthDetailsDeserializer( + item: any, +): OpenApiConnectionAuthDetails { + return { + type: item["type"], + securityScheme: openApiConnectionSecuritySchemeDeserializer( + item["security_scheme"], + ), + }; +} + +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiConnectionSecurityScheme { + /** Connection id for Connection auth type */ + connectionId: string; +} + +export function openApiConnectionSecuritySchemeSerializer( + item: OpenApiConnectionSecurityScheme, +): any { + return { connection_id: item["connectionId"] }; +} + +export function openApiConnectionSecuritySchemeDeserializer( + item: any, +): OpenApiConnectionSecurityScheme { + return { + connectionId: item["connection_id"], + }; +} + +/** Security details for OpenApi managed_identity authentication */ +export interface OpenApiManagedAuthDetails extends OpenApiAuthDetails { + /** The object type, which is always 'managed_identity'. */ + type: "managed_identity"; + /** Connection auth security details */ + securityScheme: OpenApiManagedSecurityScheme; +} + +export function openApiManagedAuthDetailsSerializer( + item: OpenApiManagedAuthDetails, +): any { + return { + type: item["type"], + security_scheme: openApiManagedSecuritySchemeSerializer( + item["securityScheme"], + ), + }; +} + +export function openApiManagedAuthDetailsDeserializer( + item: any, +): OpenApiManagedAuthDetails { + return { + type: item["type"], + securityScheme: openApiManagedSecuritySchemeDeserializer( + item["security_scheme"], + ), + }; +} + +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiManagedSecurityScheme { + /** Authentication scope for managed_identity auth type */ + audience: string; +} + +export function openApiManagedSecuritySchemeSerializer( + item: OpenApiManagedSecurityScheme, +): any { + return { audience: item["audience"] }; +} + +export function openApiManagedSecuritySchemeDeserializer( + item: any, +): OpenApiManagedSecurityScheme { + return { + audience: item["audience"], + }; +} + +/** The input definition information for a azure function tool as used to configure an agent. */ +export interface AzureFunctionToolDefinition extends ToolDefinition { + /** The object type, which is always 'azure_function'. */ + type: "azure_function"; + /** The definition of the concrete function that the function tool should call. */ + azureFunction: AzureFunctionDefinition; +} + +export function azureFunctionToolDefinitionSerializer( + item: AzureFunctionToolDefinition, +): any { + return { + type: item["type"], + azure_function: azureFunctionDefinitionSerializer(item["azureFunction"]), + }; +} + +export function azureFunctionToolDefinitionDeserializer( + item: any, +): AzureFunctionToolDefinition { + return { + type: item["type"], + azureFunction: azureFunctionDefinitionDeserializer(item["azure_function"]), + }; +} + +/** The definition of Azure function. */ +export interface AzureFunctionDefinition { + /** The definition of azure function and its parameters. */ + function: FunctionDefinition; + /** Input storage queue. The queue storage trigger runs a function as messages are added to it. */ + inputBinding: AzureFunctionBinding; + /** Output storage queue. The function writes output to this queue when the input items are processed. */ + outputBinding: AzureFunctionBinding; +} + +export function azureFunctionDefinitionSerializer( + item: AzureFunctionDefinition, +): any { + return { + function: functionDefinitionSerializer(item["function"]), + input_binding: azureFunctionBindingSerializer(item["inputBinding"]), + output_binding: azureFunctionBindingSerializer(item["outputBinding"]), + }; +} + +export function azureFunctionDefinitionDeserializer( + item: any, +): AzureFunctionDefinition { + return { + function: functionDefinitionDeserializer(item["function"]), + inputBinding: azureFunctionBindingDeserializer(item["input_binding"]), + outputBinding: azureFunctionBindingDeserializer(item["output_binding"]), + }; +} + +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionBinding { + /** The type of binding, which is always 'storage_queue'. */ + type: "storage_queue"; + /** Storage queue. */ + storageQueue: AzureFunctionStorageQueue; +} + +export function azureFunctionBindingSerializer( + item: AzureFunctionBinding, +): any { + return { + type: item["type"], + storage_queue: azureFunctionStorageQueueSerializer(item["storageQueue"]), + }; +} + +export function azureFunctionBindingDeserializer( + item: any, +): AzureFunctionBinding { + return { + type: item["type"], + storageQueue: azureFunctionStorageQueueDeserializer(item["storage_queue"]), + }; +} + +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionStorageQueue { + /** URI to the Azure Storage Queue service allowing you to manipulate a queue. */ + storageServiceEndpoint: string; + /** The name of an Azure function storage queue. */ + queueName: string; +} + +export function azureFunctionStorageQueueSerializer( + item: AzureFunctionStorageQueue, +): any { + return { + queue_service_endpoint: item["storageServiceEndpoint"], + queue_name: item["queueName"], + }; +} + +export function azureFunctionStorageQueueDeserializer( + item: any, +): AzureFunctionStorageQueue { + return { + storageServiceEndpoint: item["queue_service_endpoint"], + queueName: item["queue_name"], + }; +} + /** * A set of resources that are used by the agent's tools. The resources are specific to the type of * tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` * tool requires a list of vector store IDs. */ export interface ToolResources { - /** Resources to be used by the `code_interpreter tool` consisting of file IDs. */ + /** Resources to be used by the `code_interpreter` tool consisting of file IDs. */ codeInterpreter?: CodeInterpreterToolResource; /** Resources to be used by the `file_search` tool consisting of vector store IDs. */ fileSearch?: FileSearchToolResource; - /** Resources to be used by the `bing_grounding` tool consisting of connection IDs. */ - bingGrounding?: ConnectionListResource; - /** Resources to be used by the `microsoft_fabric` tool consisting of connection IDs. */ - microsoftFabric?: ConnectionListResource; - /** Resources to be used by the `sharepoint` tool consisting of connection IDs. */ - sharePoint?: ConnectionListResource; /** Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ azureAISearch?: AzureAISearchResource; } @@ -1049,15 +1604,6 @@ export function toolResourcesSerializer(item: ToolResources): any { file_search: !item["fileSearch"] ? item["fileSearch"] : fileSearchToolResourceSerializer(item["fileSearch"]), - bing_grounding: !item["bingGrounding"] - ? item["bingGrounding"] - : connectionListResourceSerializer(item["bingGrounding"]), - microsoft_fabric: !item["microsoftFabric"] - ? item["microsoftFabric"] - : connectionListResourceSerializer(item["microsoftFabric"]), - sharepoint: !item["sharePoint"] - ? item["sharePoint"] - : connectionListResourceSerializer(item["sharePoint"]), azure_ai_search: !item["azureAISearch"] ? item["azureAISearch"] : azureAISearchResourceSerializer(item["azureAISearch"]), @@ -1072,15 +1618,6 @@ export function toolResourcesDeserializer(item: any): ToolResources { fileSearch: !item["file_search"] ? item["file_search"] : fileSearchToolResourceDeserializer(item["file_search"]), - bingGrounding: !item["bing_grounding"] - ? item["bing_grounding"] - : connectionListResourceDeserializer(item["bing_grounding"]), - microsoftFabric: !item["microsoft_fabric"] - ? item["microsoft_fabric"] - : connectionListResourceDeserializer(item["microsoft_fabric"]), - sharePoint: !item["sharepoint"] - ? item["sharepoint"] - : connectionListResourceDeserializer(item["sharepoint"]), azureAISearch: !item["azure_ai_search"] ? item["azure_ai_search"] : azureAISearchResourceDeserializer(item["azure_ai_search"]), @@ -1094,32 +1631,88 @@ export interface CodeInterpreterToolResource { * associated with the tool. */ fileIds?: string[]; + /** The data sources to be used. This option is mutually exclusive with the `fileIds` property. */ + dataSources?: VectorStoreDataSource[]; +} + +export function codeInterpreterToolResourceSerializer( + item: CodeInterpreterToolResource, +): any { + return { + file_ids: !item["fileIds"] + ? item["fileIds"] + : item["fileIds"].map((p: any) => { + return p; + }), + data_sources: !item["dataSources"] + ? item["dataSources"] + : vectorStoreDataSourceArraySerializer(item["dataSources"]), + }; +} + +export function codeInterpreterToolResourceDeserializer( + item: any, +): CodeInterpreterToolResource { + return { + fileIds: !item["file_ids"] + ? item["file_ids"] + : item["file_ids"].map((p: any) => { + return p; + }), + dataSources: !item["data_sources"] + ? item["data_sources"] + : vectorStoreDataSourceArrayDeserializer(item["data_sources"]), + }; +} + +export function vectorStoreDataSourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return vectorStoreDataSourceSerializer(item); + }); +} + +export function vectorStoreDataSourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return vectorStoreDataSourceDeserializer(item); + }); +} + +/** + * The structure, containing Azure asset URI path and the asset type of the file used as a data source + * for the enterprise file search. + */ +export interface VectorStoreDataSource { + /** Asset URI. */ + assetIdentifier: string; + /** The asset type */ + assetType: VectorStoreDataSourceAssetType; } -export function codeInterpreterToolResourceSerializer( - item: CodeInterpreterToolResource, +export function vectorStoreDataSourceSerializer( + item: VectorStoreDataSource, ): any { - return { - file_ids: !item["fileIds"] - ? item["fileIds"] - : item["fileIds"].map((p: any) => { - return p; - }), - }; + return { uri: item["assetIdentifier"], type: item["assetType"] }; } -export function codeInterpreterToolResourceDeserializer( +export function vectorStoreDataSourceDeserializer( item: any, -): CodeInterpreterToolResource { +): VectorStoreDataSource { return { - fileIds: !item["file_ids"] - ? item["file_ids"] - : item["file_ids"].map((p: any) => { - return p; - }), + assetIdentifier: item["uri"], + assetType: item["type"], }; } +/** + * Type of vector storage asset. Asset type may be a uri_asset, in this case it should contain asset URI ID, + * in the case of id_asset it should contain the data ID. + */ +export type VectorStoreDataSourceAssetType = "uri_asset" | "id_asset"; + /** A set of resources that are used by the `file_search` tool. */ export interface FileSearchToolResource { /** @@ -1127,6 +1720,12 @@ export interface FileSearchToolResource { * store attached to the agent. */ vectorStoreIds?: string[]; + /** + * The list of vector store configuration objects from Azure. + * This list is limited to one element. + * The only element of this list contains the list of azure asset IDs used by the search tool. + */ + vectorStores?: VectorStoreConfigurations[]; } export function fileSearchToolResourceSerializer( @@ -1138,6 +1737,9 @@ export function fileSearchToolResourceSerializer( : item["vectorStoreIds"].map((p: any) => { return p; }), + vector_stores: !item["vectorStores"] + ? item["vectorStores"] + : vectorStoreConfigurationsArraySerializer(item["vectorStores"]), }; } @@ -1150,67 +1752,80 @@ export function fileSearchToolResourceDeserializer( : item["vector_store_ids"].map((p: any) => { return p; }), + vectorStores: !item["vector_stores"] + ? item["vector_stores"] + : vectorStoreConfigurationsArrayDeserializer(item["vector_stores"]), }; } -/** A set of connection resources currently used by either the `bing_grounding`, `microsoft_fabric`, or `sharepoint` tools. */ -export interface ConnectionListResource { - /** - * The connections attached to this agent. There can be a maximum of 1 connection - * resource attached to the agent. - */ - connectionList?: ConnectionResource[]; +export function vectorStoreConfigurationsArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return vectorStoreConfigurationsSerializer(item); + }); +} + +export function vectorStoreConfigurationsArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return vectorStoreConfigurationsDeserializer(item); + }); +} + +/** The structure, containing the list of vector storage configurations i.e. the list of azure asset IDs. */ +export interface VectorStoreConfigurations { + /** Name */ + storeName: string; + /** Configurations */ + storeConfiguration: VectorStoreConfiguration; } -export function connectionListResourceSerializer( - item: ConnectionListResource, +export function vectorStoreConfigurationsSerializer( + item: VectorStoreConfigurations, ): any { return { - connections: !item["connectionList"] - ? item["connectionList"] - : connectionResourceArraySerializer(item["connectionList"]), + name: item["storeName"], + configuration: vectorStoreConfigurationSerializer( + item["storeConfiguration"], + ), }; } -export function connectionListResourceDeserializer( +export function vectorStoreConfigurationsDeserializer( item: any, -): ConnectionListResource { +): VectorStoreConfigurations { return { - connectionList: !item["connections"] - ? item["connections"] - : connectionResourceArrayDeserializer(item["connections"]), + storeName: item["name"], + storeConfiguration: vectorStoreConfigurationDeserializer( + item["configuration"], + ), }; } -export function connectionResourceArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return connectionResourceSerializer(item); - }); -} - -export function connectionResourceArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return connectionResourceDeserializer(item); - }); -} - -/** A connection resource. */ -export interface ConnectionResource { - /** A connection in a ConnectionListResource attached to this agent. */ - connectionId: string; +/** + * Vector storage configuration is the list of data sources, used when multiple + * files can be used for the enterprise file search. + */ +export interface VectorStoreConfiguration { + /** Data sources */ + dataSources: VectorStoreDataSource[]; } -export function connectionResourceSerializer(item: ConnectionResource): any { - return { connection_id: item["connectionId"] }; +export function vectorStoreConfigurationSerializer( + item: VectorStoreConfiguration, +): any { + return { + data_sources: vectorStoreDataSourceArraySerializer(item["dataSources"]), + }; } -export function connectionResourceDeserializer(item: any): ConnectionResource { +export function vectorStoreConfigurationDeserializer( + item: any, +): VectorStoreConfiguration { return { - connectionId: item["connection_id"], + dataSources: vectorStoreDataSourceArrayDeserializer(item["data_sources"]), }; } @@ -1287,7 +1902,7 @@ export function indexResourceDeserializer(item: any): IndexResource { */ export interface AgentsApiResponseFormat { /** Must be one of `text` or `json_object`. */ - type?: ApiResponseFormat; + type?: ResponseFormat; } export function agentsApiResponseFormatSerializer( @@ -1305,7 +1920,63 @@ export function agentsApiResponseFormatDeserializer( } /** Possible API response formats. */ -export type ApiResponseFormat = "text" | "json_object"; +export type ResponseFormat = "text" | "json_object"; + +/** The type of response format being defined: `json_schema` */ +export interface ResponseFormatJsonSchemaType { + /** Type */ + type: "json_schema"; + /** The JSON schema, describing response format. */ + jsonSchema: ResponseFormatJsonSchema; +} + +export function responseFormatJsonSchemaTypeSerializer( + item: ResponseFormatJsonSchemaType, +): any { + return { + type: item["type"], + json_schema: responseFormatJsonSchemaSerializer(item["jsonSchema"]), + }; +} + +export function responseFormatJsonSchemaTypeDeserializer( + item: any, +): ResponseFormatJsonSchemaType { + return { + type: item["type"], + jsonSchema: responseFormatJsonSchemaDeserializer(item["json_schema"]), + }; +} + +/** A description of what the response format is for, used by the model to determine how to respond in the format. */ +export interface ResponseFormatJsonSchema { + /** A description of what the response format is for, used by the model to determine how to respond in the format. */ + description?: string; + /** The name of a schema. */ + name: string; + /** The JSON schema object, describing the response format. */ + schema: any; +} + +export function responseFormatJsonSchemaSerializer( + item: ResponseFormatJsonSchema, +): any { + return { + description: item["description"], + name: item["name"], + schema: item["schema"], + }; +} + +export function responseFormatJsonSchemaDeserializer( + item: any, +): ResponseFormatJsonSchema { + return { + description: item["description"], + name: item["name"], + schema: item["schema"], + }; +} export function toolDefinitionUnionArraySerializer( result: Array, @@ -1327,7 +1998,8 @@ export function toolDefinitionUnionArrayDeserializer( export type AgentsApiResponseFormatOption = | string | AgentsApiResponseFormatMode - | AgentsApiResponseFormat; + | AgentsApiResponseFormat + | ResponseFormatJsonSchemaType; export function agentsApiResponseFormatOptionSerializer( item: AgentsApiResponseFormatOption, @@ -1463,9 +2135,11 @@ export function agentDeletionStatusDeserializer( export interface ThreadMessageOptions { /** * The role of the entity that is creating the message. Allowed values include: - * - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the agent. Use this value to insert messages from the agent into - * the conversation. + * - `user`: Indicates the message is sent by an actual user and should be used in most + * cases to represent user-generated messages. + * - `assistant`: Indicates the message is generated by the agent. Use this value to insert + * messages from the agent into the + * conversation. */ role: MessageRole; /** @@ -1514,7 +2188,9 @@ export function messageAttachmentArrayDeserializer( /** This describes to which tools a file has been attached. */ export interface MessageAttachment { /** The ID of the file to attach to the message. */ - fileId: string; + fileId?: string; + /** Azure asset ID. */ + dataSource?: VectorStoreDataSource; /** The tools to add to this file. */ tools: MessageAttachmentToolDefinition[]; } @@ -1522,6 +2198,9 @@ export interface MessageAttachment { export function messageAttachmentSerializer(item: MessageAttachment): any { return { file_id: item["fileId"], + data_source: !item["dataSource"] + ? item["dataSource"] + : vectorStoreDataSourceSerializer(item["dataSource"]), tools: messageAttachmentToolDefinitionArraySerializer(item["tools"]), }; } @@ -1529,6 +2208,9 @@ export function messageAttachmentSerializer(item: MessageAttachment): any { export function messageAttachmentDeserializer(item: any): MessageAttachment { return { fileId: item["file_id"], + dataSource: !item["data_source"] + ? item["data_source"] + : vectorStoreDataSourceDeserializer(item["data_source"]), tools: messageAttachmentToolDefinitionArrayDeserializer(item["tools"]), }; } @@ -1673,33 +2355,6 @@ export interface ThreadMessage { metadata: Record | null; } -export function threadMessageSerializer(item: ThreadMessage): any { - return { - id: item["id"], - object: item["object"], - created_at: (item["createdAt"].getTime() / 1000) | 0, - thread_id: item["threadId"], - status: item["status"], - incomplete_details: !item["incompleteDetails"] - ? item["incompleteDetails"] - : messageIncompleteDetailsSerializer(item["incompleteDetails"]), - completed_at: !item["completedAt"] - ? item["completedAt"] - : (item["completedAt"].getTime() / 1000) | 0, - incomplete_at: !item["incompleteAt"] - ? item["incompleteAt"] - : (item["incompleteAt"].getTime() / 1000) | 0, - role: item["role"], - content: messageContentUnionArraySerializer(item["content"]), - assistant_id: item["assistantId"], - run_id: item["runId"], - attachments: !item["attachments"] - ? item["attachments"] - : messageAttachmentArraySerializer(item["attachments"]), - metadata: item["metadata"], - }; -} - export function threadMessageDeserializer(item: any): ThreadMessage { return { id: item["id"], @@ -1736,12 +2391,6 @@ export interface MessageIncompleteDetails { reason: MessageIncompleteDetailsReason; } -export function messageIncompleteDetailsSerializer( - item: MessageIncompleteDetails, -): any { - return { reason: item["reason"] }; -} - export function messageIncompleteDetailsDeserializer( item: any, ): MessageIncompleteDetails { @@ -1758,14 +2407,6 @@ export type MessageIncompleteDetailsReason = | "run_failed" | "run_expired"; -export function messageContentUnionArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return messageContentUnionSerializer(item); - }); -} - export function messageContentUnionArrayDeserializer( result: Array, ): any[] { @@ -1781,10 +2422,6 @@ export interface MessageContent { type: string; } -export function messageContentSerializer(item: MessageContent): any { - return { type: item["type"] }; -} - export function messageContentDeserializer(item: any): MessageContent { return { type: item["type"], @@ -1797,19 +2434,6 @@ export type MessageContentUnion = | MessageImageFileContent | MessageContent; -export function messageContentUnionSerializer(item: MessageContentUnion): any { - switch (item.type) { - case "text": - return messageTextContentSerializer(item as MessageTextContent); - - case "image_file": - return messageImageFileContentSerializer(item as MessageImageFileContent); - - default: - return messageContentSerializer(item); - } -} - export function messageContentUnionDeserializer( item: any, ): MessageContentUnion { @@ -1835,13 +2459,6 @@ export interface MessageTextContent extends MessageContent { text: MessageTextDetails; } -export function messageTextContentSerializer(item: MessageTextContent): any { - return { - type: item["type"], - text: messageTextDetailsSerializer(item["text"]), - }; -} - export function messageTextContentDeserializer(item: any): MessageTextContent { return { type: item["type"], @@ -1857,13 +2474,6 @@ export interface MessageTextDetails { annotations: MessageTextAnnotationUnion[]; } -export function messageTextDetailsSerializer(item: MessageTextDetails): any { - return { - value: item["value"], - annotations: messageTextAnnotationUnionArraySerializer(item["annotations"]), - }; -} - export function messageTextDetailsDeserializer(item: any): MessageTextDetails { return { value: item["value"], @@ -1873,14 +2483,6 @@ export function messageTextDetailsDeserializer(item: any): MessageTextDetails { }; } -export function messageTextAnnotationUnionArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return messageTextAnnotationUnionSerializer(item); - }); -} - export function messageTextAnnotationUnionArrayDeserializer( result: Array, ): any[] { @@ -1898,12 +2500,6 @@ export interface MessageTextAnnotation { text: string; } -export function messageTextAnnotationSerializer( - item: MessageTextAnnotation, -): any { - return { type: item["type"], text: item["text"] }; -} - export function messageTextAnnotationDeserializer( item: any, ): MessageTextAnnotation { @@ -1919,25 +2515,6 @@ export type MessageTextAnnotationUnion = | MessageTextFilePathAnnotation | MessageTextAnnotation; -export function messageTextAnnotationUnionSerializer( - item: MessageTextAnnotationUnion, -): any { - switch (item.type) { - case "file_citation": - return messageTextFileCitationAnnotationSerializer( - item as MessageTextFileCitationAnnotation, - ); - - case "file_path": - return messageTextFilePathAnnotationSerializer( - item as MessageTextFilePathAnnotation, - ); - - default: - return messageTextAnnotationSerializer(item); - } -} - export function messageTextAnnotationUnionDeserializer( item: any, ): MessageTextAnnotationUnion { @@ -1973,20 +2550,6 @@ export interface MessageTextFileCitationAnnotation endIndex?: number; } -export function messageTextFileCitationAnnotationSerializer( - item: MessageTextFileCitationAnnotation, -): any { - return { - type: item["type"], - text: item["text"], - file_citation: messageTextFileCitationDetailsSerializer( - item["fileCitation"], - ), - start_index: item["startIndex"], - end_index: item["endIndex"], - }; -} - export function messageTextFileCitationAnnotationDeserializer( item: any, ): MessageTextFileCitationAnnotation { @@ -2009,12 +2572,6 @@ export interface MessageTextFileCitationDetails { quote: string; } -export function messageTextFileCitationDetailsSerializer( - item: MessageTextFileCitationDetails, -): any { - return { file_id: item["fileId"], quote: item["quote"] }; -} - export function messageTextFileCitationDetailsDeserializer( item: any, ): MessageTextFileCitationDetails { @@ -2036,18 +2593,6 @@ export interface MessageTextFilePathAnnotation extends MessageTextAnnotation { endIndex?: number; } -export function messageTextFilePathAnnotationSerializer( - item: MessageTextFilePathAnnotation, -): any { - return { - type: item["type"], - text: item["text"], - file_path: messageTextFilePathDetailsSerializer(item["filePath"]), - start_index: item["startIndex"], - end_index: item["endIndex"], - }; -} - export function messageTextFilePathAnnotationDeserializer( item: any, ): MessageTextFilePathAnnotation { @@ -2066,12 +2611,6 @@ export interface MessageTextFilePathDetails { fileId: string; } -export function messageTextFilePathDetailsSerializer( - item: MessageTextFilePathDetails, -): any { - return { file_id: item["fileId"] }; -} - export function messageTextFilePathDetailsDeserializer( item: any, ): MessageTextFilePathDetails { @@ -2088,15 +2627,6 @@ export interface MessageImageFileContent extends MessageContent { imageFile: MessageImageFileDetails; } -export function messageImageFileContentSerializer( - item: MessageImageFileContent, -): any { - return { - type: item["type"], - image_file: messageImageFileDetailsSerializer(item["imageFile"]), - }; -} - export function messageImageFileContentDeserializer( item: any, ): MessageImageFileContent { @@ -2112,12 +2642,6 @@ export interface MessageImageFileDetails { fileId: string; } -export function messageImageFileDetailsSerializer( - item: MessageImageFileDetails, -): any { - return { file_id: item["fileId"] }; -} - export function messageImageFileDetailsDeserializer( item: any, ): MessageImageFileDetails { @@ -2152,14 +2676,6 @@ export function openAIPageableListOfThreadMessageDeserializer( }; } -export function threadMessageArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return threadMessageSerializer(item); - }); -} - export function threadMessageArrayDeserializer( result: Array, ): any[] { @@ -2233,8 +2749,8 @@ export type AgentsNamedToolChoiceType = | "code_interpreter" | "file_search" | "bing_grounding" - | "microsoft_fabric" - | "sharepoint" + | "fabric_aiskill" + | "sharepoint_grounding" | "azure_ai_search"; /** The function name that will be used, if using the `function` tool */ @@ -2331,7 +2847,7 @@ export interface ThreadRun { /** Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis */ toolResources?: UpdateToolResourcesOptions | null; /** Determines if tools can be executed in parallel within the run. */ - parallelToolCalls?: boolean; + parallelToolCalls: boolean; } export function threadRunDeserializer(item: any): ThreadRun { @@ -2366,7 +2882,9 @@ export function threadRunDeserializer(item: any): ThreadRun { failedAt: !item["failed_at"] ? item["failed_at"] : new Date(item["failed_at"] * 1000), - incompleteDetails: item["incomplete_details"], + incompleteDetails: !item["incomplete_details"] + ? item["incomplete_details"] + : incompleteRunDetailsDeserializer(item["incomplete_details"]), usage: !item["usage"] ? item["usage"] : runCompletionUsageDeserializer(item["usage"]), @@ -2387,7 +2905,7 @@ export function threadRunDeserializer(item: any): ThreadRun { toolResources: !item["tool_resources"] ? item["tool_resources"] : updateToolResourcesOptionsDeserializer(item["tool_resources"]), - parallelToolCalls: item["parallelToolCalls"], + parallelToolCalls: item["parallel_tool_calls"], }; } @@ -2473,7 +2991,7 @@ export function requiredToolCallUnionArrayDeserializer( }); } -/** An abstract representation a a tool invocation needed by the model to continue a run. */ +/** An abstract representation of a tool invocation needed by the model to continue a run. */ export interface RequiredToolCall { /** The object type for the required tool call. */ /** The discriminator possible values: function */ @@ -2556,8 +3074,22 @@ export function runErrorDeserializer(item: any): RunError { }; } +/** Details on why the run is incomplete. Will be `null` if the run is not incomplete. */ +export interface IncompleteRunDetails { + /** The reason why the run is incomplete. This indicates which specific token limit was reached during the run. */ + reason: IncompleteDetailsReason; +} + +export function incompleteRunDetailsDeserializer( + item: any, +): IncompleteRunDetails { + return { + reason: item["reason"], + }; +} + /** The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. */ -export type IncompleteRunDetails = +export type IncompleteDetailsReason = | "max_completion_tokens" | "max_prompt_tokens"; @@ -2592,12 +3124,6 @@ export interface UpdateToolResourcesOptions { codeInterpreter?: UpdateCodeInterpreterToolResourceOptions; /** Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. */ fileSearch?: UpdateFileSearchToolResourceOptions; - /** Overrides the list of connections to be used by the `bing_grounding` tool consisting of connection IDs. */ - bingGrounding?: ConnectionListResource; - /** Overrides the list of connections to be used by the `microsoft_fabric` tool consisting of connection IDs. */ - microsoftFabric?: ConnectionListResource; - /** Overrides the list of connections to be used by the `sharepoint` tool consisting of connection IDs. */ - sharePoint?: ConnectionListResource; /** Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ azureAISearch?: AzureAISearchResource; } @@ -2614,15 +3140,6 @@ export function updateToolResourcesOptionsSerializer( file_search: !item["fileSearch"] ? item["fileSearch"] : updateFileSearchToolResourceOptionsSerializer(item["fileSearch"]), - bing_grounding: !item["bingGrounding"] - ? item["bingGrounding"] - : connectionListResourceSerializer(item["bingGrounding"]), - microsoft_fabric: !item["microsoftFabric"] - ? item["microsoftFabric"] - : connectionListResourceSerializer(item["microsoftFabric"]), - sharepoint: !item["sharePoint"] - ? item["sharePoint"] - : connectionListResourceSerializer(item["sharePoint"]), azure_ai_search: !item["azureAISearch"] ? item["azureAISearch"] : azureAISearchResourceSerializer(item["azureAISearch"]), @@ -2641,15 +3158,6 @@ export function updateToolResourcesOptionsDeserializer( fileSearch: !item["file_search"] ? item["file_search"] : updateFileSearchToolResourceOptionsDeserializer(item["file_search"]), - bingGrounding: !item["bing_grounding"] - ? item["bing_grounding"] - : connectionListResourceDeserializer(item["bing_grounding"]), - microsoftFabric: !item["microsoft_fabric"] - ? item["microsoft_fabric"] - : connectionListResourceDeserializer(item["microsoft_fabric"]), - sharePoint: !item["sharepoint"] - ? item["sharepoint"] - : connectionListResourceDeserializer(item["sharepoint"]), azureAISearch: !item["azure_ai_search"] ? item["azure_ai_search"] : azureAISearchResourceDeserializer(item["azure_ai_search"]), @@ -2970,7 +3478,7 @@ export function runStepToolCallUnionArrayDeserializer( /** An abstract representation of a detailed tool call as recorded within a run step for an existing run. */ export interface RunStepToolCall { /** The object type. */ - /** The discriminator possible values: code_interpreter, file_search, bing_grounding, azure_ai_search, sharepoint, microsoft_fabric, function */ + /** The discriminator possible values: code_interpreter, file_search, bing_grounding, azure_ai_search, sharepoint_grounding, fabric_aiskill, function */ type: string; /** The ID of the tool call. This ID must be referenced when you submit tool outputs. */ id: string; @@ -3018,12 +3526,12 @@ export function runStepToolCallUnionDeserializer( item as RunStepAzureAISearchToolCall, ); - case "sharepoint": + case "sharepoint_grounding": return runStepSharepointToolCallDeserializer( item as RunStepSharepointToolCall, ); - case "microsoft_fabric": + case "fabric_aiskill": return runStepMicrosoftFabricToolCallDeserializer( item as RunStepMicrosoftFabricToolCall, ); @@ -3185,8 +3693,10 @@ export function runStepCodeInterpreterImageReferenceDeserializer( export interface RunStepFileSearchToolCall extends RunStepToolCall { /** The object type, which is always 'file_search'. */ type: "file_search"; - /** Reserved for future use. */ - fileSearch: Record; + /** The ID of the tool call. This ID must be referenced when you submit tool outputs. */ + id: string; + /** For now, this is always going to be an empty object. */ + fileSearch: RunStepFileSearchToolCallResults; } export function runStepFileSearchToolCallDeserializer( @@ -3195,7 +3705,86 @@ export function runStepFileSearchToolCallDeserializer( return { type: item["type"], id: item["id"], - fileSearch: item["file_search"], + fileSearch: runStepFileSearchToolCallResultsDeserializer( + item["file_search"], + ), + }; +} + +/** The results of the file search. */ +export interface RunStepFileSearchToolCallResults { + /** Ranking options for file search. */ + rankingOptions?: FileSearchRankingOptions; + /** The array of a file search results */ + results: RunStepFileSearchToolCallResult[]; +} + +export function runStepFileSearchToolCallResultsDeserializer( + item: any, +): RunStepFileSearchToolCallResults { + return { + rankingOptions: !item["ranking_options"] + ? item["ranking_options"] + : fileSearchRankingOptionsDeserializer(item["ranking_options"]), + results: runStepFileSearchToolCallResultArrayDeserializer(item["results"]), + }; +} + +export function runStepFileSearchToolCallResultArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return runStepFileSearchToolCallResultDeserializer(item); + }); +} + +/** File search tool call result. */ +export interface RunStepFileSearchToolCallResult { + /** The ID of the file that result was found in. */ + fileId: string; + /** The name of the file that result was found in. */ + fileName: string; + /** The score of the result. All values must be a floating point number between 0 and 1. */ + score: number; + /** The content of the result that was found. The content is only included if requested via the include query parameter. */ + content?: FileSearchToolCallContent[]; +} + +export function runStepFileSearchToolCallResultDeserializer( + item: any, +): RunStepFileSearchToolCallResult { + return { + fileId: item["file_id"], + fileName: item["file_name"], + score: item["score"], + content: !item["content"] + ? item["content"] + : fileSearchToolCallContentArrayDeserializer(item["content"]), + }; +} + +export function fileSearchToolCallContentArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return fileSearchToolCallContentDeserializer(item); + }); +} + +/** The file search result content object. */ +export interface FileSearchToolCallContent { + /** The type of the content. */ + type: "text"; + /** The text content of the file. */ + text: string; +} + +export function fileSearchToolCallContentDeserializer( + item: any, +): FileSearchToolCallContent { + return { + type: item["type"], + text: item["text"], }; } @@ -3246,8 +3835,8 @@ export function runStepAzureAISearchToolCallDeserializer( * executed SharePoint actions. */ export interface RunStepSharepointToolCall extends RunStepToolCall { - /** The object type, which is always 'sharepoint'. */ - type: "sharepoint"; + /** The object type, which is always 'sharepoint_grounding'. */ + type: "sharepoint_grounding"; /** Reserved for future use. */ sharePoint: Record; } @@ -3258,7 +3847,7 @@ export function runStepSharepointToolCallDeserializer( return { type: item["type"], id: item["id"], - sharePoint: item["sharepoint"], + sharePoint: item["sharepoint_grounding"], }; } @@ -3267,8 +3856,8 @@ export function runStepSharepointToolCallDeserializer( * executed Microsoft Fabric operations. */ export interface RunStepMicrosoftFabricToolCall extends RunStepToolCall { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; + /** The object type, which is always 'fabric_aiskill'. */ + type: "fabric_aiskill"; /** Reserved for future use. */ microsoftFabric: Record; } @@ -3279,7 +3868,7 @@ export function runStepMicrosoftFabricToolCallDeserializer( return { type: item["type"], id: item["id"], - microsoftFabric: item["microsoft_fabric"], + microsoftFabric: item["fabric_aiskill"], }; } @@ -3485,23 +4074,6 @@ export function fileDeletionStatusDeserializer(item: any): FileDeletionStatus { }; } -/** A response from a file get content operation. */ -export interface FileContentResponse { - /** The content of the file, in bytes. */ - content: Uint8Array; -} - -export function fileContentResponseDeserializer( - item: any, -): FileContentResponse { - return { - content: - typeof item["content"] === "string" - ? stringToUint8Array(item["content"], "base64") - : item["content"], - }; -} - /** The response data for a requested list of items. */ export interface OpenAIPageableListOfVectorStore { /** The object type, which is always list. */ @@ -3717,7 +4289,7 @@ export interface VectorStoreStaticChunkingStrategyOptions { maxChunkSizeTokens: number; /** * The number of tokens that overlap between chunks. The default value is 400. - * Note that the overlap must not exceed half of max_chunk_size_tokens. * + * Note that the overlap must not exceed half of max_chunk_size_tokens. */ chunkOverlapTokens: number; } @@ -3841,7 +4413,7 @@ export type VectorStoreFileStatus = | "failed" | "cancelled"; -/** Details on the error that may have ocurred while processing a file for this vector store */ +/** Details on the error that may have occurred while processing a file for this vector store */ export interface VectorStoreFileError { /** One of `server_error` or `rate_limit_exceeded`. */ code: VectorStoreFileErrorCode; @@ -3860,10 +4432,9 @@ export function vectorStoreFileErrorDeserializer( /** Error code variants for vector store file processing */ export type VectorStoreFileErrorCode = - | "internal_error" - | "file_not_found" - | "parsing_error" - | "unhandled_mime_type"; + | "server_error" + | "invalid_file" + | "unsupported_file"; /** An abstract representation of a vector store chunking strategy configuration. */ export interface VectorStoreChunkingStrategyResponse { @@ -4713,6 +5284,7 @@ export type RunStreamEvent = | "thread.run.in_progress" | "thread.run.requires_action" | "thread.run.completed" + | "thread.run.incomplete" | "thread.run.failed" | "thread.run.cancelling" | "thread.run.cancelled" @@ -4755,6 +5327,9 @@ export function agentStreamEventDeserializer(item: any): AgentStreamEvent { /** The available sorting options when requesting a list of response objects. */ export type ListSortOrder = "asc" | "desc"; +/** A list of additional fields to include in the response. */ +export type RunAdditionalFieldList = + "step_details.tool_calls[*].file_search.results[*].content"; /** Query parameter filter for vector store file retrieval endpoint */ export type VectorStoreFileStatusFilter = | "in_progress" @@ -4765,5 +5340,5 @@ export type VectorStoreFileStatusFilter = /** Azure AI API versions */ export enum KnownVersions { /** Azure AI API version 2024-07-01-preview. */ - "2024-07-01-preview" = "2024-07-01-preview", + "V2024-07-01-Preview" = "2024-07-01-preview", } diff --git a/packages/typespec-test/test/ai/spec/agents/client.tsp b/packages/typespec-test/test/ai/spec/agents/client.tsp index 30b395e099..2680d6c552 100644 --- a/packages/typespec-test/test/ai/spec/agents/client.tsp +++ b/packages/typespec-test/test/ai/spec/agents/client.tsp @@ -2,7 +2,7 @@ import "@azure-tools/typespec-client-generator-core"; using Azure.ClientGenerator.Core; -namespace Azure.AI.Client.Agents { +namespace Azure.AI.Projects.Agents { // Trivial response value containers should treat these containers as internal details and instead surface a shimmed // operation that exposes the underlying data directly. @@clientName(AgentDeletionStatus, "InternalAgentDeletionStatus", "csharp"); @@ -38,6 +38,18 @@ namespace Azure.AI.Client.Agents { @@clientName(FunctionDefinition, "InternalFunctionDefinition", "csharp"); @@clientName(FunctionToolDefinition.function, "InternalFunction", "csharp"); + // Make AzureFunctionDefinition internal in C#. + @@access(AzureFunctionDefinition, Access.internal); + @@clientName(AzureFunctionDefinition, + "InternalAzureFunctionDefinition", + "csharp" + ); + @@clientName(AzureFunctionToolDefinition.azureFunction, + "InternalAzureFunction", + "csharp" + ); + @@access(AzureFunctionBinding, Access.public); + // SubmitToolOutputsAction: include .tool_calls directly rather than via an intermediate .details. @@access(SubmitToolOutputsDetails, Access.internal); @@ -220,6 +232,9 @@ namespace Azure.AI.Client.Agents { @@usage(FilePurpose, Usage.input | Usage.output); @@usage(ListSortOrder, Usage.input | Usage.output); + // Make getFileContent internal method in Python (override with get_file_content_stream) + @@access(getFileContent, Access.internal, "python"); + // Additional, language-specific idiomatic renames @@clientName(OpenAIFile, "OpenAIFile", "csharp"); @@ -272,4 +287,4 @@ namespace Azure.AI.Client.Agents { //); //@@clientName(createRun::parameters.body, "createRunOptions", "java"); //@@clientName(createMessage::parameters.body, "threadMessageOptions", "java"); -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/common/models.tsp b/packages/typespec-test/test/ai/spec/agents/common/models.tsp index 724dc5349e..b11c48f7b0 100644 --- a/packages/typespec-test/test/ai/spec/agents/common/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/common/models.tsp @@ -4,7 +4,7 @@ import "@typespec/versioning"; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; @doc("The possible values for roles attributed to messages in a thread.") union MessageRole { @@ -111,6 +111,9 @@ union AgentsApiResponseFormatOption { /** Sets the format of the output of the model when a ToolCall is returned. */ AgentsApiResponseFormat, + + /** Using `json_schema` format will provide a description of what the response format is for. */ + ResponseFormatJsonSchemaType, } /** Represents the mode in which the model will handle the return format of a tool call. */ @@ -130,11 +133,12 @@ union AgentsApiResponseFormatMode { */ model AgentsApiResponseFormat { /** Must be one of `text` or `json_object`. */ - type?: ApiResponseFormat = ApiResponseFormat.text; + type?: ResponseFormat = ResponseFormat.text; } /** Possible API response formats. */ -union ApiResponseFormat { +#suppress "@azure-tools/typespec-autorest/union-unsupported" "OpenAPI v2 support deferred" +union ResponseFormat { string, /** `text` format should be used for requests involving any sort of ToolCall. */ @@ -143,3 +147,30 @@ union ApiResponseFormat { /** Using `json_object` format will limit the usage of ToolCall to only functions. */ jsonObject: "json_object", } + +/** + * The type of response format being defined: `json_schema` + */ +model ResponseFormatJsonSchemaType { + /** Type */ + type: "json_schema"; + + /** The JSON schema, describing response format. */ + @encodedName("application/json", "json_schema") + jsonSchema: ResponseFormatJsonSchema; +} + +/** + * A description of what the response format is for, used by the model to determine how to respond in the format. + */ +#suppress "@azure-tools/typespec-azure-core/no-unknown" "JSON schema takes an arbitrary json" +model ResponseFormatJsonSchema { + /** A description of what the response format is for, used by the model to determine how to respond in the format. */ + description?: string; + + /** The name of a schema. */ + name: string; + + /** The JSON schema object, describing the response format. */ + schema: unknown; +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/files/models.tsp b/packages/typespec-test/test/ai/spec/agents/files/models.tsp index 5ad9bdda35..fb89240004 100644 --- a/packages/typespec-test/test/ai/spec/agents/files/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/files/models.tsp @@ -1,6 +1,6 @@ import "@typespec/versioning"; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; using TypeSpec.Versioning; @@ -118,10 +118,4 @@ model FileDeletionStatus { @doc("The object type, which is always 'file'.") object: "file"; -} - -@doc("A response from a file get content operation.") -model FileContentResponse { - @doc("The content of the file, in bytes.") - content: bytes; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/files/routes.tsp b/packages/typespec-test/test/ai/spec/agents/files/routes.tsp index f567c9757b..51341000a1 100644 --- a/packages/typespec-test/test/ai/spec/agents/files/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/files/routes.tsp @@ -9,7 +9,7 @@ using TypeSpec.Http; using TypeSpec.Versioning; using Azure.ClientGenerator.Core; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Gets a list of previously uploaded files. @@ -110,7 +110,7 @@ op getFile is Azure.Core.Foundations.Operation< #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" @get @route("/files/{fileId}/content") -@doc("Returns information about a specific file. Does not retrieve file content.") +@doc("Retrieves the raw content of a specific file.") op getFileContent is Azure.Core.Foundations.Operation< { @doc("The ID of the file to retrieve.") @@ -118,5 +118,5 @@ op getFileContent is Azure.Core.Foundations.Operation< @encodedName("application/json", "file_id") fileId: string; }, - FileContentResponse ->; + bytes +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/messages/models.tsp b/packages/typespec-test/test/ai/spec/agents/messages/models.tsp index 711db1a717..8e8bae9ba8 100644 --- a/packages/typespec-test/test/ai/spec/agents/messages/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/messages/models.tsp @@ -2,7 +2,7 @@ import "../tools/models.tsp"; import "@typespec/versioning"; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; using TypeSpec.Versioning; @@ -10,9 +10,11 @@ using TypeSpec.Versioning; model ThreadMessageOptions { /** * The role of the entity that is creating the message. Allowed values include: - * - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the agent. Use this value to insert messages from the agent into - * the conversation. + * - `user`: Indicates the message is sent by an actual user and should be used in most + * cases to represent user-generated messages. + * - `assistant`: Indicates the message is generated by the agent. Use this value to insert + * messages from the agent into the + * conversation. */ role: MessageRole; @@ -92,7 +94,12 @@ model ThreadMessage { model MessageAttachment { /** The ID of the file to attach to the message. */ @encodedName("application/json", "file_id") - fileId: string; + fileId?: string; + + /** The data source to be used. This option is mutually exclusive with fileId. */ + @doc("Azure asset ID.") + @encodedName("application/json", "data_source") + dataSource?: VectorStoreDataSource; /** The tools to add to this file. */ tools: MessageAttachmentToolDefinition[]; @@ -415,4 +422,4 @@ model MessageDeltaTextUrlCitationDetails { /** The title of the URL. */ title?: string; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/messages/routes.tsp b/packages/typespec-test/test/ai/spec/agents/messages/routes.tsp index a239ae9c3e..639f802d54 100644 --- a/packages/typespec-test/test/ai/spec/agents/messages/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/messages/routes.tsp @@ -12,7 +12,7 @@ using TypeSpec.Versioning; using Azure.Core; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Creates a new message on a specified thread. @@ -116,4 +116,4 @@ op updateMessage is Azure.Core.Foundations.Operation< ...OptionalNullableMetadata; }, ThreadMessage ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/models.tsp b/packages/typespec-test/test/ai/spec/agents/models.tsp index 0ea33e4a68..e458794c87 100644 --- a/packages/typespec-test/test/ai/spec/agents/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/models.tsp @@ -7,7 +7,7 @@ import "../main.tsp"; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; @doc("Represents an agent that can call the model and use tools.") model Agent { @@ -201,4 +201,4 @@ model AgentDeletionStatus { @doc("The object type, which is always 'assistant.deleted'.") object: "assistant.deleted"; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/routes.tsp b/packages/typespec-test/test/ai/spec/agents/routes.tsp index 73c17c7db2..f08ca307da 100644 --- a/packages/typespec-test/test/ai/spec/agents/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/routes.tsp @@ -11,7 +11,7 @@ using Azure.Core; using Azure.Core.Traits; using Azure.Core.Foundations; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Creates a new agent. @@ -108,4 +108,4 @@ op deleteAgent is Azure.Core.Foundations.Operation< assistantId: string; }, AgentDeletionStatus ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/run_steps/models.tsp b/packages/typespec-test/test/ai/spec/agents/run_steps/models.tsp index 55235e3030..f4027714f5 100644 --- a/packages/typespec-test/test/ai/spec/agents/run_steps/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/run_steps/models.tsp @@ -2,7 +2,7 @@ import "@typespec/versioning"; import "../tools/models.tsp"; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; using TypeSpec.Versioning; @@ -341,3 +341,11 @@ model RunStepDeltaCodeInterpreterImageOutputObject { @encodedName("application/json", "file_id") fileId?: string; } + +/** A list of additional fields to include in the response. */ +union RunAdditionalFieldList { + string, + + /** File search result content. */ + FileSearchContents: "step_details.tool_calls[*].file_search.results[*].content", +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/run_steps/routes.tsp b/packages/typespec-test/test/ai/spec/agents/run_steps/routes.tsp index cc7470fed7..5f85fc3f7b 100644 --- a/packages/typespec-test/test/ai/spec/agents/run_steps/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/run_steps/routes.tsp @@ -9,7 +9,7 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Gets a single run step from a thread run. @@ -38,6 +38,13 @@ op getRunStep is Azure.Core.Foundations.Operation< @doc("Identifier of the run step.") @path stepId: string; + + @doc(""" + A list of additional fields to include in the response. + Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + """) + @query("include[]") + include?: RunAdditionalFieldList[]; }, RunStep >; @@ -65,7 +72,14 @@ op listRunSteps is Azure.Core.Foundations.Operation< @path runId: string; + @doc(""" + A list of additional fields to include in the response. + Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + """) + @query("include[]") + include?: RunAdditionalFieldList[]; + ...OpenAIListRequestOptions; }, OpenAIPageableListOf ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/runs/models.tsp b/packages/typespec-test/test/ai/spec/agents/runs/models.tsp index 46fe8332f6..6da0e9f5fb 100644 --- a/packages/typespec-test/test/ai/spec/agents/runs/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/runs/models.tsp @@ -4,7 +4,7 @@ import "../common/models.tsp"; import "../threads/models.tsp"; import "../tools/models.tsp"; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; using TypeSpec.Versioning; using Azure.ClientGenerator.Core; @@ -143,11 +143,20 @@ model ThreadRun { toolResources?: UpdateToolResourcesOptions | null; @doc("Determines if tools can be executed in parallel within the run.") - parallelToolCalls?: boolean; + @encodedName("application/json", "parallel_tool_calls") + parallelToolCalls: boolean; +} + +/** + * Details on why the run is incomplete. Will be `null` if the run is not incomplete. + */ +model IncompleteRunDetails { + @doc("The reason why the run is incomplete. This indicates which specific token limit was reached during the run.") + reason: IncompleteDetailsReason; } /** The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. */ -union IncompleteRunDetails { +union IncompleteDetailsReason { string, /** Maximum completion tokens exceeded */ @@ -199,7 +208,7 @@ model CreateRunOptions { /** Adds additional messages to the thread before creating the run. */ #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @encodedName("application/json", "additional_messages") - additionalMessages?: ThreadMessage[] | null; + additionalMessages?: ThreadMessageOptions[] | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("The overridden list of enabled tools that the agent should use to run the thread.") @@ -268,6 +277,10 @@ model CreateRunOptions { @encodedName("application/json", "response_format") responseFormat?: AgentsApiResponseFormatOption | null; + /** If `true` functions will run in parallel during tool use. */ + @encodedName("application/json", "parallel_tool_calls") + parallelToolCalls?: boolean; + ...OptionalNullableMetadata; } @@ -427,6 +440,10 @@ model CreateAndRunThreadOptions { @encodedName("application/json", "response_format") responseFormat?: AgentsApiResponseFormatOption | null; + /** If `true` functions will run in parallel during tool use. */ + @encodedName("application/json", "parallel_tool_calls") + parallelToolCalls?: boolean; + ...OptionalNullableMetadata; } @@ -462,4 +479,4 @@ union TruncationStrategy { /** The thread will truncate to the `lastMessages` count of recent messages. */ lastMessages: "last_messages", -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/runs/routes.tsp b/packages/typespec-test/test/ai/spec/agents/runs/routes.tsp index 9bebe44c29..138589a85f 100644 --- a/packages/typespec-test/test/ai/spec/agents/runs/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/runs/routes.tsp @@ -10,7 +10,7 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Creates and starts a new run of the specified thread using the specified agent. @@ -32,6 +32,13 @@ op createRun is Azure.Core.Foundations.Operation< @path threadId: string; + @doc(""" + A list of additional fields to include in the response. + Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + """) + @query("include[]") + include?: RunAdditionalFieldList[]; + /** * The details used when creating a new run of an agent thread. */ @@ -195,4 +202,4 @@ op createThreadAndRun is Azure.Core.Foundations.Operation< ...CreateAndRunThreadOptions; }, ThreadRun ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/streaming/events.tsp b/packages/typespec-test/test/ai/spec/agents/streaming/events.tsp index f48f4e7d60..60bf3df4ed 100644 --- a/packages/typespec-test/test/ai/spec/agents/streaming/events.tsp +++ b/packages/typespec-test/test/ai/spec/agents/streaming/events.tsp @@ -2,7 +2,7 @@ import "@typespec/versioning"; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; @doc(""" Each event in a server-sent events stream has an `event` and `data` property: @@ -60,6 +60,9 @@ union RunStreamEvent { /** Event sent when a run is completed. The data of this event is of type ThreadRun */ ThreadRunCompleted: "thread.run.completed", + /** Event sent when a run ends incomplete. The data of this event is of type ThreadRun */ + ThreadRunIncomplete: "thread.run.incomplete", + /** Event sent when a run fails. The data of this event is of type ThreadRun */ ThreadRunFailed: "thread.run.failed", @@ -133,4 +136,4 @@ union DoneEvent { /** Event sent when the stream is done. */ Done: "done", -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/threads/models.tsp b/packages/typespec-test/test/ai/spec/agents/threads/models.tsp index aeac312b03..2117c9227a 100644 --- a/packages/typespec-test/test/ai/spec/agents/threads/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/threads/models.tsp @@ -7,7 +7,7 @@ import "../messages/models.tsp"; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; @doc("Information about a single thread associated with an agent.") model AgentThread { @@ -75,4 +75,4 @@ model ThreadDeletionStatus { @doc("The object type, which is always 'thread.deleted'.") object: "thread.deleted"; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/threads/routes.tsp b/packages/typespec-test/test/ai/spec/agents/threads/routes.tsp index 4107e17ca7..1eba195ea6 100644 --- a/packages/typespec-test/test/ai/spec/agents/threads/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/threads/routes.tsp @@ -7,7 +7,7 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Creates a new thread. Threads contain messages and can be run by agents. @@ -92,4 +92,4 @@ op deleteThread is Azure.Core.Foundations.Operation< threadId: string; }, ThreadDeletionStatus ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/tools/models.tsp b/packages/typespec-test/test/ai/spec/agents/tools/models.tsp index 8d391ea37f..622f68a421 100644 --- a/packages/typespec-test/test/ai/spec/agents/tools/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/tools/models.tsp @@ -4,7 +4,7 @@ import "@typespec/versioning"; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; // // Tool inputs -- definitions used before model evaluation to configure agents, threads, and messages @@ -51,18 +51,27 @@ model FunctionToolDefinition extends ToolDefinition { model BingGroundingToolDefinition extends ToolDefinition { @doc("The object type, which is always 'bing_grounding'.") type: "bing_grounding"; + + @doc("The list of connections used by the bing grounding tool.") + bing_grounding: ToolConnectionList; } @doc("The input definition information for a Microsoft Fabric tool as used to configure an agent.") model MicrosoftFabricToolDefinition extends ToolDefinition { - @doc("The object type, which is always 'microsoft_fabric'.") - type: "microsoft_fabric"; + @doc("The object type, which is always 'fabric_aiskill'.") + type: "fabric_aiskill"; + + @doc("The list of connections used by the Microsoft Fabric tool.") + fabric_aiskill: ToolConnectionList; } @doc("The input definition information for a sharepoint tool as used to configure an agent.") model SharepointToolDefinition extends ToolDefinition { - @doc("The object type, which is always 'sharepoint'.") - type: "sharepoint"; + @doc("The object type, which is always 'sharepoint_grounding'.") + type: "sharepoint_grounding"; + + @doc("The list of connections used by the SharePoint tool.") + sharepoint_grounding: ToolConnectionList; } @doc("The input definition information for an Azure AI search tool as used to configure an agent.") @@ -71,6 +80,15 @@ model AzureAISearchToolDefinition extends ToolDefinition { type: "azure_ai_search"; } +@doc("The input definition information for an OpenAPI tool as used to configure an agent.") +model OpenApiToolDefinition extends ToolDefinition { + @doc("The object type, which is always 'openapi'.") + type: "openapi"; + + @doc("The openapi function definition.") + openapi: OpenApiFunctionDefinition; +} + // Definition details: File Search /** @@ -86,6 +104,34 @@ model FileSearchToolDefinitionDetails { @minValue(1) @maxValue(50) maxNumResults?: int32; + + /** + * Ranking options for file search. + */ + @encodedName("application/json", "ranking_options") + rankingOptions?: FileSearchRankingOptions; +} + +@doc("The input definition information for a azure function tool as used to configure an agent.") +model AzureFunctionToolDefinition extends ToolDefinition { + @doc("The object type, which is always 'azure_function'.") + type: "azure_function"; + + @doc("The definition of the concrete function that the function tool should call.") + @encodedName("application/json", "azure_function") + azureFunction: AzureFunctionDefinition; +} + +/** + * Ranking options for file search. + */ +model FileSearchRankingOptions { + @doc("File search ranker.") + ranker: string; + + @doc("Ranker search threshold.") + @encodedName("application/json", "score_threshold") + scoreThreshold: float32; } // Definition details: Functions @@ -103,13 +149,101 @@ model FunctionDefinition { parameters: unknown; } +@doc("The definition of Azure function.") +model AzureFunctionDefinition { + @doc("The definition of azure function and its parameters.") + function: FunctionDefinition; + + @doc("Input storage queue. The queue storage trigger runs a function as messages are added to it.") + @encodedName("application/json", "input_binding") + inputBinding: AzureFunctionBinding; + + @doc("Output storage queue. The function writes output to this queue when the input items are processed.") + @encodedName("application/json", "output_binding") + outputBinding: AzureFunctionBinding; +} + +// Definition details: OpenAPI + +@doc("The input definition information for an openapi function.") +model OpenApiFunctionDefinition { + @doc("The name of the function to be called.") + name: string; + + @doc("A description of what the function does, used by the model to choose when and how to call the function.") + description?: string; + + #suppress "@azure-tools/typespec-azure-core/no-unknown" "External API shape takes an arbitrary json" + @doc("The openapi function shape, described as a JSON Schema object.") + spec: unknown; + + @doc("Open API authentication details") + auth: OpenApiAuthDetails; +} + +@doc(""" + Authentication type for OpenApi endpoint. Allowed types are: + - Anonymous (no authentication required) + - Connection (requires connection_id to endpoint, as setup in AI Foundry) + - Managed_Identity (requires audience for identity based auth) + """) +union OpenApiAuthType { + anonymous: "anonymous", + connection: "connection", + managedIdentity: "managed_identity", + string, +} + +@doc("authentication details for OpenApiFunctionDefinition") +@discriminator("type") +model OpenApiAuthDetails { + @doc("The type of authentication, must be anonymous/connection/managed_identity") + type: OpenApiAuthType; +} + +@doc("Security details for OpenApi anonymous authentication") +model OpenApiAnonymousAuthDetails extends OpenApiAuthDetails { + @doc("The object type, which is always 'anonymous'.") + type: OpenApiAuthType.anonymous; +} + +@doc("Security details for OpenApi connection authentication") +model OpenApiConnectionAuthDetails extends OpenApiAuthDetails { + @doc("The object type, which is always 'connection'.") + type: OpenApiAuthType.connection; + + @doc("Connection auth security details") + security_scheme: OpenApiConnectionSecurityScheme; +} + +@doc("Security details for OpenApi managed_identity authentication") +model OpenApiManagedAuthDetails extends OpenApiAuthDetails { + @doc("The object type, which is always 'managed_identity'.") + type: OpenApiAuthType.managedIdentity; + + @doc("Connection auth security details") + security_scheme: OpenApiManagedSecurityScheme; +} + +@doc("Security scheme for OpenApi managed_identity authentication") +model OpenApiManagedSecurityScheme { + @doc("Authentication scope for managed_identity auth type") + audience: string; +} + +@doc("Security scheme for OpenApi managed_identity authentication") +model OpenApiConnectionSecurityScheme { + @doc("Connection id for Connection auth type") + connection_id: string; +} + // // Required tool calls -- provided on a run and represent tools that need outputs submitted for the run to continue // @discriminator("type") @doc(""" - An abstract representation a a tool invocation needed by the model to continue a run. + An abstract representation of a tool invocation needed by the model to continue a run. """) model RequiredToolCall { #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "Existing" @@ -174,9 +308,52 @@ model RunStepFileSearchToolCall extends RunStepToolCall { @doc("The object type, which is always 'file_search'.") type: "file_search"; - @doc("Reserved for future use.") + @doc("The ID of the tool call. This ID must be referenced when you submit tool outputs.") + id: string; + + @doc("For now, this is always going to be an empty object.") @encodedName("application/json", "file_search") - fileSearch: Record; + fileSearch: RunStepFileSearchToolCallResults; +} + +@doc("The results of the file search.") +model RunStepFileSearchToolCallResults { + @doc("Ranking options for file search.") + @encodedName("application/json", "ranking_options") + rankingOptions?: FileSearchRankingOptions; + + @doc("The array of a file search results") + results: RunStepFileSearchToolCallResult[]; +} + +@doc(""" + File search tool call result. + """) +model RunStepFileSearchToolCallResult { + @doc("The ID of the file that result was found in.") + @encodedName("application/json", "file_id") + fileId: string; + + @doc("The name of the file that result was found in.") + @encodedName("application/json", "file_name") + fileName: string; + + @doc("The score of the result. All values must be a floating point number between 0 and 1.") + @minValue(0) + @maxValue(1) + score: float32; + + @doc("The content of the result that was found. The content is only included if requested via the include query parameter.") + content?: FileSearchToolCallContent[]; +} + +@doc("The file search result content object.") +model FileSearchToolCallContent { + @doc("The type of the content.") + type: "text"; + + @doc("The text content of the file.") + text: string; } @doc(""" @@ -210,11 +387,11 @@ model RunStepAzureAISearchToolCall extends RunStepToolCall { executed SharePoint actions. """) model RunStepSharepointToolCall extends RunStepToolCall { - @doc("The object type, which is always 'sharepoint'.") - type: "sharepoint"; + @doc("The object type, which is always 'sharepoint_grounding'.") + type: "sharepoint_grounding"; @doc("Reserved for future use.") - @encodedName("application/json", "sharepoint") + @encodedName("application/json", "sharepoint_grounding") sharePoint: Record; } @@ -223,11 +400,11 @@ model RunStepSharepointToolCall extends RunStepToolCall { executed Microsoft Fabric operations. """) model RunStepMicrosoftFabricToolCall extends RunStepToolCall { - @doc("The object type, which is always 'microsoft_fabric'.") - type: "microsoft_fabric"; + @doc("The object type, which is always 'fabric_aiskill'.") + type: "fabric_aiskill"; @doc("Reserved for future use.") - @encodedName("application/json", "microsoft_fabric") + @encodedName("application/json", "fabric_aiskill") microsoftFabric: Record; } @@ -371,11 +548,11 @@ union AgentsNamedToolChoiceType { /** Tool type `bing_grounding` */ bingGrounding: "bing_grounding", - /** Tool type `microsoft_fabric` */ - microsoftFabric: "microsoft_fabric", + /** Tool type `fabric_aiskill` */ + microsoftFabric: "fabric_aiskill", - /** Tool type `sharepoint` */ - sharepoint: "sharepoint", + /** Tool type `sharepoint_grounding` */ + sharepoint: "sharepoint_grounding", /** Tool type `azure_ai_search` */ azureAISearch: "azure_ai_search", @@ -386,3 +563,48 @@ model FunctionName { /** The name of the function to call */ name: string; } + +/** + * A set of connection resources currently used by either the `bing_grounding`, `fabric_aiskill`, or `sharepoint_grounding` tools. + */ +model ToolConnectionList { + /** + * The connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + */ + @maxItems(1) + @encodedName("application/json", "connections") + connectionList?: ToolConnection[]; +} + +/** + * A connection resource. + */ +model ToolConnection { + /** + * A connection in a ToolConnectionList attached to this tool. + */ + @encodedName("application/json", "connection_id") + connectionId: string; +} + +@doc("The structure for keeping storage queue name and URI.") +model AzureFunctionBinding { + @doc("The type of binding, which is always 'storage_queue'.") + type: "storage_queue"; + + @doc("Storage queue.") + @encodedName("application/json", "storage_queue") + storageQueue: AzureFunctionStorageQueue; +} + +@doc("The structure for keeping storage queue name and URI.") +model AzureFunctionStorageQueue { + @doc("URI to the Azure Storage Queue service allowing you to manipulate a queue.") + @encodedName("application/json", "queue_service_endpoint") + storageServiceEndpoint: string; + + @doc("The name of an Azure function storage queue.") + @encodedName("application/json", "queue_name") + queueName: string; +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/tools/tool_resources.tsp b/packages/typespec-test/test/ai/spec/agents/tools/tool_resources.tsp index a69235d487..3975958dd2 100644 --- a/packages/typespec-test/test/ai/spec/agents/tools/tool_resources.tsp +++ b/packages/typespec-test/test/ai/spec/agents/tools/tool_resources.tsp @@ -6,7 +6,7 @@ import "../vector_stores/common/main.tsp"; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; // // Response objects @@ -18,7 +18,7 @@ namespace Azure.AI.Client.Agents; * tool requires a list of vector store IDs. */ model ToolResources { - /** Resources to be used by the `code_interpreter tool` consisting of file IDs. */ + /** Resources to be used by the `code_interpreter` tool consisting of file IDs. */ @encodedName("application/json", "code_interpreter") codeInterpreter?: CodeInterpreterToolResource; @@ -26,18 +26,6 @@ model ToolResources { @encodedName("application/json", "file_search") fileSearch?: FileSearchToolResource; - /** Resources to be used by the `bing_grounding` tool consisting of connection IDs. */ - @encodedName("application/json", "bing_grounding") - bingGrounding?: ConnectionListResource; - - /** Resources to be used by the `microsoft_fabric` tool consisting of connection IDs. */ - @encodedName("application/json", "microsoft_fabric") - microsoftFabric?: ConnectionListResource; - - /** Resources to be used by the `sharepoint` tool consisting of connection IDs. */ - @encodedName("application/json", "sharepoint") - sharePoint?: ConnectionListResource; - /** Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ @encodedName("application/json", "azure_ai_search") azureAISearch?: AzureAISearchResource; @@ -54,6 +42,11 @@ model CodeInterpreterToolResource { @encodedName("application/json", "file_ids") @maxItems(20) fileIds?: string[] = #[]; + + /** The data sources to be used. This option is mutually exclusive with the `fileIds` property. */ + @maxItems(20) + @encodedName("application/json", "data_sources") + dataSources?: VectorStoreDataSource[]; } /** @@ -67,30 +60,15 @@ model FileSearchToolResource { @maxItems(1) @encodedName("application/json", "vector_store_ids") vectorStoreIds?: string[]; -} -/** - * A set of connection resources currently used by either the `bing_grounding`, `microsoft_fabric`, or `sharepoint` tools. - */ -model ConnectionListResource { /** - * The connections attached to this agent. There can be a maximum of 1 connection - * resource attached to the agent. + * The list of vector store configuration objects from Azure. + * This list is limited to one element. + * The only element of this list contains the list of azure asset IDs used by the search tool. */ @maxItems(1) - @encodedName("application/json", "connections") - connectionList?: ConnectionResource[]; -} - -/** - * A connection resource. - */ -model ConnectionResource { - /** - * A connection in a ConnectionListResource attached to this agent. - */ - @encodedName("application/json", "connection_id") - connectionId: string; + @encodedName("application/json", "vector_stores") + vectorStores?: VectorStoreConfigurations[]; } /** @@ -144,25 +122,11 @@ model CreateToolResourcesOptions { @encodedName("application/json", "file_search") fileSearch?: CreateFileSearchToolResourceOptions; - /** A list of connections to be used by the `bing_grounding` tool consisting of connection IDs. */ - @encodedName("application/json", "bing_grounding") - bingGrounding?: ConnectionListResourceOptions; - - /** A list of connections to be used by the `microsoft_fabric` tool consisting of connection IDs. */ - @encodedName("application/json", "microsoft_fabric") - microsoftFabric?: ConnectionListResourceOptions; - - /** A list of connections to be used by the `sharepoint` tool consisting of connection IDs. */ - @encodedName("application/json", "sharepoint") - sharePoint?: ConnectionListResourceOptions; - /** Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ @encodedName("application/json", "azure_ai_search") azureAISearch?: AzureAISearchToolResourceOptions; } -alias ConnectionListResourceOptions = ConnectionListResource; - alias AzureAISearchToolResourceOptions = AzureAISearchResource; /** @@ -205,9 +169,11 @@ model CreateFileSearchToolResourceVectorStoreOptions { @encodedName("application/json", "chunking_strategy") chunkingStrategy: VectorStoreChunkingStrategyRequest; - /** Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information - * about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of - * 512 characters long. */ + /** + * Set of up to 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional + * information about the vector store in a structured format. Keys can be a maximum of 64 characters long and + * values can be a maximum of 512 characters long. + */ ...OptionalNullableMetadata; } @@ -232,18 +198,6 @@ model UpdateToolResourcesOptions { @encodedName("application/json", "file_search") fileSearch?: UpdateFileSearchToolResourceOptions; - /** Overrides the list of connections to be used by the `bing_grounding` tool consisting of connection IDs. */ - @encodedName("application/json", "bing_grounding") - bingGrounding?: ConnectionListResourceOptions; - - /** Overrides the list of connections to be used by the `microsoft_fabric` tool consisting of connection IDs. */ - @encodedName("application/json", "microsoft_fabric") - microsoftFabric?: ConnectionListResourceOptions; - - /** Overrides the list of connections to be used by the `sharepoint` tool consisting of connection IDs. */ - @encodedName("application/json", "sharepoint") - sharePoint?: ConnectionListResourceOptions; - /** Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ @encodedName("application/json", "azure_ai_search") azureAISearch?: AzureAISearchToolResourceOptions; @@ -263,4 +217,4 @@ model UpdateFileSearchToolResourceOptions { @maxItems(1) @encodedName("application/json", "vector_store_ids") vectorStoreIds?: string[]; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/common/main.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/common/main.tsp index be22cf6ad3..57fef92e34 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/common/main.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/common/main.tsp @@ -4,7 +4,7 @@ import "@typespec/versioning"; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** Options to configure a vector store static chunking strategy. */ model VectorStoreStaticChunkingStrategyOptions { @@ -16,7 +16,7 @@ model VectorStoreStaticChunkingStrategyOptions { /** * The number of tokens that overlap between chunks. The default value is 400. - * Note that the overlap must not exceed half of max_chunk_size_tokens. * + * Note that the overlap must not exceed half of max_chunk_size_tokens. */ @encodedName("application/json", "chunk_overlap_tokens") chunkOverlapTokens: int32; @@ -87,3 +87,57 @@ model VectorStoreStaticChunkingStrategyResponse /** The options for the static chunking strategy. */ static: VectorStoreStaticChunkingStrategyOptions; } + +/** Type of vector storage asset. Asset type may be a uri_asset, in this case it should contain asset URI ID, + * in the case of id_asset it should contain the data ID. + */ +union VectorStoreDataSourceAssetType { + /** + * Azure URI + */ + uri_asset: "uri_asset", + + /** + * The data ID + */ + id_asset: "id_asset", + + string, +} + +/** + * The structure, containing Azure asset URI path and the asset type of the file used as a data source + * for the enterprise file search. + */ +model VectorStoreDataSource { + /** Asset URI. */ + @encodedName("application/json", "uri") + assetIdentifier: string; + + /** The asset type */ + @encodedName("application/json", "type") + assetType: VectorStoreDataSourceAssetType; +} + +/** + * Vector storage configuration is the list of data sources, used when multiple + * files can be used for the enterprise file search. + */ +model VectorStoreConfiguration { + /** Data sources */ + @encodedName("application/json", "data_sources") + dataSources: VectorStoreDataSource[]; +} + +/** + * The structure, containing the list of vector storage configurations i.e. the list of azure asset IDs. + */ +model VectorStoreConfigurations { + /** Name */ + @encodedName("application/json", "name") + storeName: string; + + /** Configurations */ + @encodedName("application/json", "configuration") + storeConfiguration: VectorStoreConfiguration; +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/models.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/models.tsp index c6ca0b2f9f..6d03ed7016 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/models.tsp @@ -1,4 +1,4 @@ -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; using TypeSpec.Versioning; @@ -42,4 +42,4 @@ model VectorStoreFileBatch { /** Files count grouped by status processed or being processed by this vector store. */ @encodedName("application/json", "file_counts") fileCounts: VectorStoreFileCount; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/routes.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/routes.tsp index 6127bc7a21..958c2ba4ec 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/file_batches/routes.tsp @@ -9,7 +9,7 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Create a vector store file batch. @@ -31,7 +31,14 @@ op createVectorStoreFileBatch is Azure.Core.Foundations.Operation< @maxItems(500) @encodedName("application/json", "file_ids") @doc("List of file identifiers.") - fileIds: string[]; + fileIds?: string[]; + + /** The data sources to be used. This option is mutually exclusive with fileIds. */ + @minItems(1) + @maxItems(500) + @encodedName("application/json", "data_sources") + @doc("List of Azure assets.") + dataSources?: VectorStoreDataSource[]; /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ @encodedName("application/json", "chunking_strategy") @@ -112,4 +119,4 @@ op listVectorStoreFileBatchFiles is Azure.Core.Foundations.Operation< ...OpenAIListRequestOptions; }, OpenAIPageableListOf ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/files/models.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/files/models.tsp index 273f066519..45d2b48a34 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/files/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/files/models.tsp @@ -1,4 +1,4 @@ -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; using TypeSpec.Versioning; @@ -40,20 +40,17 @@ union VectorStoreFileStatus { union VectorStoreFileErrorCode { string, - /** An internal error occurred. */ - internalError: "internal_error", + /** An server error occurred. */ + serverError: "server_error", - /** The file was not found. */ - fileNotFound: "file_not_found", + /** The file is not valid. */ + invalidFile: "invalid_file", - /** The file could not be parsed. */ - parsingError: "parsing_error", - - /** The file has an unhandled mime type. */ - unhandledMimeType: "unhandled_mime_type", + /** The file is of unsupported type. */ + unsupportedFile: "unsupported_file", } -/** Details on the error that may have ocurred while processing a file for this vector store */ +/** Details on the error that may have occurred while processing a file for this vector store */ model VectorStoreFileError { /** One of `server_error` or `rate_limit_exceeded`. */ code: VectorStoreFileErrorCode; @@ -106,4 +103,4 @@ model VectorStoreFileDeletionStatus { /** The object type, which is always 'vector_store.deleted'. */ object: "vector_store.file.deleted"; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/files/routes.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/files/routes.tsp index 28b1bdb897..40281846e9 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/files/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/files/routes.tsp @@ -9,7 +9,7 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Returns a list of vector store files. @@ -52,7 +52,12 @@ op createVectorStoreFile is Azure.Core.Foundations.Operation< /** A File ID that the vector store should use. Useful for tools like `file_search` that can access files. */ @doc("Identifier of the file.") @encodedName("application/json", "file_id") - fileId: string; + fileId?: string; + + /** The data sources to be used. This option is mutually exclusive with fileId. */ + @doc("Azure asset ID.") + @encodedName("application/json", "data_sources") + dataSources?: VectorStoreDataSource[]; /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ @encodedName("application/json", "chunking_strategy") @@ -106,4 +111,4 @@ op deleteVectorStoreFile is Azure.Core.Foundations.Operation< fileId: string; }, VectorStoreFileDeletionStatus ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/main.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/main.tsp index 3f4e265659..1c683b0cf5 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/main.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/main.tsp @@ -3,4 +3,4 @@ import "./routes.tsp"; import "./common/main.tsp"; import "./files/main.tsp"; -import "./file_batches/main.tsp"; +import "./file_batches/main.tsp"; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/models.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/models.tsp index 0832f8ac53..c77a9f389d 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/models.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/models.tsp @@ -1,4 +1,4 @@ -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; using TypeSpec.Versioning; @@ -118,6 +118,10 @@ model VectorStoreOptions { /** The name of the vector store. */ name?: string; + /** The vector store configuration, used when vector store is created from Azure asset URIs. */ + @encodedName("application/json", "configuration") + storeConfiguration?: VectorStoreConfiguration; + /** Details on when this vector store expires */ @encodedName("application/json", "expires_after") expiresAfter?: VectorStoreExpirationPolicy; @@ -154,4 +158,4 @@ model VectorStoreDeletionStatus { /** The object type, which is always 'vector_store.deleted'. */ object: "vector_store.deleted"; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/agents/vector_stores/routes.tsp b/packages/typespec-test/test/ai/spec/agents/vector_stores/routes.tsp index 9d3f9b17d1..ebb4bc2d09 100644 --- a/packages/typespec-test/test/ai/spec/agents/vector_stores/routes.tsp +++ b/packages/typespec-test/test/ai/spec/agents/vector_stores/routes.tsp @@ -9,7 +9,7 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; -namespace Azure.AI.Client.Agents; +namespace Azure.AI.Projects.Agents; /** * Returns a list of vector stores. @@ -102,4 +102,4 @@ op deleteVectorStore is Azure.Core.Foundations.Operation< vectorStoreId: string; }, VectorStoreDeletionStatus ->; +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/client.tsp b/packages/typespec-test/test/ai/spec/client.tsp index efbae06ced..92141f24de 100644 --- a/packages/typespec-test/test/ai/spec/client.tsp +++ b/packages/typespec-test/test/ai/spec/client.tsp @@ -3,7 +3,8 @@ import "./main.tsp"; import "./connections/client.tsp"; import "./agents/client.tsp"; import "./evaluations/client.tsp"; +import "./telemetry/client.tsp"; using Azure.ClientGenerator.Core; -@@clientName(Azure.AI.Client, "AzureAIClient"); +@@clientName(Azure.AI.Projects, "AIProjectClient"); \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/connections/client.tsp b/packages/typespec-test/test/ai/spec/connections/client.tsp index e6e5e48a4a..097efd19a5 100644 --- a/packages/typespec-test/test/ai/spec/connections/client.tsp +++ b/packages/typespec-test/test/ai/spec/connections/client.tsp @@ -2,19 +2,28 @@ import "@azure-tools/typespec-client-generator-core"; using Azure.ClientGenerator.Core; -@@access(Azure.AI.Client.Connections.get, Access.internal); -@@access(Azure.AI.Client.Connections.list, Access.internal); -@@access(Azure.AI.Client.Connections.listSecrets, Access.internal); -@@access(Azure.AI.Client.ConnectionsListSecretsResponse, Access.internal); -@@access(Azure.AI.Client.ConnectionProperties, Access.internal); -@@access(Azure.AI.Client.ConnectionPropertiesApiKeyAuth, Access.internal); -@@access(Azure.AI.Client.ConnectionPropertiesAADAuth, Access.internal); -@@access(Azure.AI.Client.ConnectionPropertiesSASAuth, Access.internal); -@@access(Azure.AI.Client.CredentialsApiKeyAuth, Access.internal); -@@access(Azure.AI.Client.CredentialsSASAuth, Access.internal); +@@access(Azure.AI.Projects.Connections.getWorkspace, Access.internal); +@@access(Azure.AI.Projects.Connections.listConnections, Access.internal); +@@access(Azure.AI.Projects.Connections.getConnection, Access.internal); +@@access(Azure.AI.Projects.Connections.getConnectionWithSecrets, + Access.internal +); +@@access(Azure.AI.Projects.GetConnectionResponse, Access.internal); +@@access(Azure.AI.Projects.InternalConnectionProperties, Access.internal); +@@access(Azure.AI.Projects.InternalConnectionPropertiesApiKeyAuth, + Access.internal +); +@@access(Azure.AI.Projects.InternalConnectionPropertiesAADAuth, + Access.internal +); +@@access(Azure.AI.Projects.InternalConnectionPropertiesSASAuth, + Access.internal +); +@@access(Azure.AI.Projects.CredentialsApiKeyAuth, Access.internal); +@@access(Azure.AI.Projects.CredentialsSASAuth, Access.internal); // The SDK has a hand-written public EndpointProperties class, with two properties of the type below. // Need to explicilty mention them as "public" here, because otherwise they would not be made public // since the auto-generated operations that use them are marked as internal above. -@@access(Azure.AI.Client.AuthenticationType, Access.public); -@@access(Azure.AI.Client.ConnectionType, Access.public); +@@access(Azure.AI.Projects.AuthenticationType, Access.public); +@@access(Azure.AI.Projects.ConnectionType, Access.public); \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/connections/model.tsp b/packages/typespec-test/test/ai/spec/connections/model.tsp index bd7b74587e..4a6fd01c44 100644 --- a/packages/typespec-test/test/ai/spec/connections/model.tsp +++ b/packages/typespec-test/test/ai/spec/connections/model.tsp @@ -12,11 +12,28 @@ using TypeSpec.Versioning; using Azure.Core; using Azure.Core.Traits; -namespace Azure.AI.Client; +namespace Azure.AI.Projects; -@doc("Response from the listSecrets operation") -model ConnectionsListSecretsResponse { +@doc("Response from the Workspace - Get operation") +model GetWorkspaceResponse { + @doc("A unique identifier for the resource") + id: string; + + @doc("The name of the resource") + name: string; + @doc("The properties of the resource") + properties: WorkspaceProperties; +} + +@doc("workspace properties") +model WorkspaceProperties { + @doc("Authentication type of the connection target") + applicationInsights: string; +} + +@doc("Response from the listSecrets operation") +model GetConnectionResponse { @doc("A unique identifier for the connection") id: string; @@ -24,21 +41,27 @@ model ConnectionsListSecretsResponse { name: string; @doc("The properties of the resource") - properties: ConnectionProperties; + properties: InternalConnectionProperties; } @doc("Response from the list operation") -model ConnectionsListResponse { +model ListConnectionsResponse { @doc("A list of connection list secrets") - value: ConnectionsListSecretsResponse[]; + value: GetConnectionResponse[]; } #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" @doc("Connection properties") @discriminator("authType") -model ConnectionProperties { +model InternalConnectionProperties { @doc("Authentication type of the connection target") authType: AuthenticationType; + + @doc("Category of the connection") + category: ConnectionType; + + @doc("The connection URL to be used for this service") + target: string; } #suppress "@azure-tools/typespec-azure-core/no-enum" @@ -47,58 +70,38 @@ enum AuthenticationType { @doc("API Key authentication") apiKey: "ApiKey", - @doc("Entra ID authentication") - AAD: "AAD", + @doc("Entra ID authentication (formerly known as AAD)") + entraId: "AAD", @doc("Shared Access Signature (SAS) authentication") SAS: "SAS", } @doc("Connection properties for connections with API key authentication") -model ConnectionPropertiesApiKeyAuth extends ConnectionProperties { +model InternalConnectionPropertiesApiKeyAuth + extends InternalConnectionProperties { @doc("Authentication type of the connection target") authType: AuthenticationType.apiKey; - @doc("Category of the connection") - category: ConnectionType; - @doc("Credentials will only be present for authType=ApiKey") credentials: CredentialsApiKeyAuth; - - @doc("The connection URL to be used for this service") - target: string; - - //@doc("to do") - //metadata: PropertiesMetadata; } #suppress "@azure-tools/typespec-azure-core/casing-style" @doc("Connection properties for connections with AAD authentication (aka `Entra ID passthrough`)") -model ConnectionPropertiesAADAuth extends ConnectionProperties { +model InternalConnectionPropertiesAADAuth extends InternalConnectionProperties { @doc("Authentication type of the connection target") - authType: AuthenticationType.AAD; - - @doc("Category of the connection") - category: ConnectionType; - - @doc("The connection URL to be used for this service") - target: string; + authType: AuthenticationType.entraId; } #suppress "@azure-tools/typespec-azure-core/casing-style" @doc("Connection properties for connections with SAS authentication") -model ConnectionPropertiesSASAuth extends ConnectionProperties { +model InternalConnectionPropertiesSASAuth extends InternalConnectionProperties { @doc("Authentication type of the connection target") authType: AuthenticationType.SAS; - @doc("Category of the connection") - category: ConnectionType; - @doc("Credentials will only be present for authType=ApiKey") credentials: CredentialsSASAuth; - - @doc("The connection URL to be used for this service") - target: string; } @doc("The credentials needed for API key authentication") @@ -118,17 +121,20 @@ model CredentialsSASAuth { #suppress "@azure-tools/typespec-azure-core/no-enum" @doc("The Type (or category) of the connection") enum ConnectionType { - @doc("Azure OpenAI service") + @doc("Azure OpenAI Service") AzureOpenAI: "AzureOpenAI", //TODO: In Python this results in .AZURE_OPEN_AI. How do I make it .AZURE_OPENAI? - @doc("Serverless API service") + @doc("Serverless API Service") Serverless: "Serverless", @doc("Azure Blob Storage") AzureBlobStorage: "AzureBlob", @doc("Azure AI Services") - AIServices: "AIServices", + AzureAIServices: "AIServices", + + @doc("Azure AI Search") + AzureAISearch: "CognitiveSearch", } /* @@ -168,4 +174,4 @@ union ModelType { @doc("A model capable of taking chat-formatted messages and generate responses") chat_completion: "chat_completion", } -*/ +*/ \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/connections/routes.tsp b/packages/typespec-test/test/ai/spec/connections/routes.tsp index f7ad72e143..1f85d80c82 100644 --- a/packages/typespec-test/test/ai/spec/connections/routes.tsp +++ b/packages/typespec-test/test/ai/spec/connections/routes.tsp @@ -11,7 +11,15 @@ using Azure.Core; using Azure.Core.Traits; using Azure.Core.Foundations; -namespace Azure.AI.Client.Connections; +namespace Azure.AI.Projects.Connections; + +/* + See https://learn.microsoft.com/en-us/rest/api/azureml/workspaces/get?view=rest-azureml-2024-07-01-preview +*/ +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@doc("Gets the properties of the specified machine learning workspace.") +@get +op getWorkspace is Azure.Core.Foundations.Operation<{}, GetWorkspaceResponse>; /* See https://learn.microsoft.com/rest/api/azureml/workspace-connections/list?view=rest-azureml-2024-07-01-preview @@ -21,7 +29,7 @@ namespace Azure.AI.Client.Connections; @doc("List the details of all the connections (not including their credentials)") @route("connections") @get -op list is Azure.Core.Foundations.Operation< +op listConnections is Azure.Core.Foundations.Operation< { @query @doc("Category of the workspace connection.") @@ -35,7 +43,7 @@ op list is Azure.Core.Foundations.Operation< @doc("Target of the workspace connection.") target?: string; }, - ConnectionsListResponse + ListConnectionsResponse >; /* @@ -45,12 +53,12 @@ op list is Azure.Core.Foundations.Operation< @doc("Get the details of a single connection, without credentials.") @route("connections/{connectionName}") @get -op get is Azure.Core.Foundations.Operation< +op getConnection is Azure.Core.Foundations.Operation< { @doc("Connection Name") connectionName: string; }, - ConnectionsListSecretsResponse + GetConnectionResponse >; /* @@ -60,7 +68,7 @@ op get is Azure.Core.Foundations.Operation< @doc("Get the details of a single connection, including credentials (if available).") @route("connections/{connectionName}/listsecrets") @post -op listSecrets is Azure.Core.Foundations.Operation< +op getConnectionWithSecrets is Azure.Core.Foundations.Operation< { @doc("Connection Name") connectionName: string; @@ -68,5 +76,5 @@ op listSecrets is Azure.Core.Foundations.Operation< @doc("The body is ignored. TODO: Can we remove this?") ignored: string; }, - ConnectionsListSecretsResponse ->; + GetConnectionResponse +>; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/evaluations/client.tsp b/packages/typespec-test/test/ai/spec/evaluations/client.tsp index 3ab2f43055..fb478ff7ec 100644 --- a/packages/typespec-test/test/ai/spec/evaluations/client.tsp +++ b/packages/typespec-test/test/ai/spec/evaluations/client.tsp @@ -1,3 +1,3 @@ import "@azure-tools/typespec-client-generator-core"; -using Azure.ClientGenerator.Core; +using Azure.ClientGenerator.Core; \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/evaluations/model.tsp b/packages/typespec-test/test/ai/spec/evaluations/model.tsp index 4503f1833a..1a643ed66d 100644 --- a/packages/typespec-test/test/ai/spec/evaluations/model.tsp +++ b/packages/typespec-test/test/ai/spec/evaluations/model.tsp @@ -12,7 +12,7 @@ using TypeSpec.Versioning; using Azure.Core; using Azure.Core.Traits; -namespace Azure.AI.Client; +namespace Azure.AI.Projects; @doc("Metadata pertaining to creation and last modification of the resource.") model SystemData { @@ -54,12 +54,12 @@ model InputData { type: string; } -@doc("Data Source for Application Insight.") -model AppInsightsConfiguration extends InputData { +@doc("Data Source for Application Insights.") +model ApplicationInsightsConfiguration extends InputData { @visibility("read") type: "app_insights"; - @doc("LogAnalytic Workspace resourceID associated with AppInsights") + @doc("LogAnalytic Workspace resourceID associated with ApplicationInsights") resourceId: string; @doc("Query to fetch the data.") @@ -67,6 +67,9 @@ model AppInsightsConfiguration extends InputData { @doc("Service name.") serviceName: string; + + @doc("Connection String to connect to ApplicationInsights.") + connectionString?: string; } @doc("Dataset as source for evaluation.") @@ -99,7 +102,7 @@ model RecurrenceTrigger extends Trigger { interval: int32; @doc("The recurrence schedule.") - schedule: RecurrenceSchedule; + schedule?: RecurrenceSchedule; } #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "Needed since suggestion is not supported to generate swagger in OpenAPIv2" @@ -126,7 +129,7 @@ model Evaluation { @visibility("read", "create") data: InputData; - @doc("Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique.") + @doc("Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique.") displayName?: string; @doc("Description of the evaluation. It can be used to store additional information about the evaluation and is mutable.") @@ -176,18 +179,6 @@ union WeekDays { string, } -@doc("Recurrence Definition") -model Recurrence { - @doc("The frequency to trigger schedule.") - frequency: Frequency; - - @doc("Specifies schedule interval in conjunction with frequency") - interval: int32; - - @doc("The recurrence schedule.") - schedule: RecurrenceSchedule; -} - @doc("RecurrenceSchedule Definition") model RecurrenceSchedule { @doc("List of hours for the schedule.") @@ -197,35 +188,26 @@ model RecurrenceSchedule { minutes: int32[]; @doc("List of days for the schedule.") - weekDays: WeekDays[]; + weekDays?: WeekDays[]; @doc("List of month days for the schedule") - monthDays: int32[]; -} - -@doc("SamplingStrategy Definition") -model SamplingStrategy { - @doc("Sampling rate") - rate: float32; + monthDays?: int32[]; } @doc("Evaluation Schedule Definition") // NoteNote: I modeled ScheduledEvaluation as a type of Evaluation. But can also be modeled as a separate Schedule entity. We can discuss @resource("schedules") model EvaluationSchedule { - @key("id") + @key("name") @visibility("read") - @doc("Identifier of the evaluation.") + @doc("Name of the schedule, which also serves as the unique identifier for the evaluation") @pattern("^[a-zA-Z0-9][a-zA-Z0-9-_]*$") @maxLength(254) - id: string; + name: string; @doc("Data for evaluation.") @visibility("read", "create") - data: InputData; - - @doc("Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique.") - displayName?: string; + data: ApplicationInsightsConfiguration; @doc("Description of the evaluation. It can be used to store additional information about the evaluation and is mutable.") description?: string; @@ -234,9 +216,9 @@ model EvaluationSchedule { @visibility("read") systemData?: SystemData; - @doc("Status of the evaluation. It is set by service and is read-only.") + @doc("Provisioning State of the evaluation. It is set by service and is read-only.") @visibility("read") - provisioningStatus?: string; + provisioningState?: string; @doc("Evaluation's tags. Unlike properties, tags are fully mutable.") tags?: Record; @@ -245,15 +227,16 @@ model EvaluationSchedule { @visibility("read", "create") properties?: Record; + @doc("Enabled status of the evaluation. It is set by service and is read-only.") + @visibility("read") + isEnabled?: string; + @doc("Evaluators to be used for the evaluation.") @visibility("read", "create") evaluators: Record; @doc("Trigger for the evaluation.") trigger: Trigger; - - @doc("Sampling strategy for the evaluation.") - samplingStrategy: SamplingStrategy; } // Define the response model with status code 201 @@ -267,4 +250,4 @@ model CreatedEvaluationResponse { @body @doc("Evaluation created") evaluation: Evaluation; -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/evaluations/routes.tsp b/packages/typespec-test/test/ai/spec/evaluations/routes.tsp index c286157277..3e77236283 100644 --- a/packages/typespec-test/test/ai/spec/evaluations/routes.tsp +++ b/packages/typespec-test/test/ai/spec/evaluations/routes.tsp @@ -11,8 +11,8 @@ using Azure.Core; using Azure.Core.Traits; using Azure.Core.Foundations; -// namespace Azure.AI.Client.Evaluations; -namespace Azure.AI.Client; +// namespace Azure.AI.Projects.Evaluations; +namespace Azure.AI.Projects; alias ServiceTraits = SupportsClientRequestId & NoRepeatableRequests & @@ -58,5 +58,18 @@ interface Evaluations { ListQueryParametersTrait >; - deleteSchedule is EvaluationsOperations.ResourceDelete; -} + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" + #suppress "@azure-tools/typespec-azure-core/no-response-body" + @route("schedules/{name}/disable") + @patch + @doc("Disable the evaluation schedule.") + disableSchedule( + @query + @doc("The API version to use for this operation.") + apiVersion: string, + + @path + @doc("Name of the evaluation schedule.") + name: string, + ): NoContentResponse | ErrorResponse; +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/main.tsp b/packages/typespec-test/test/ai/spec/main.tsp index 50b5b881f5..0ff5d52986 100644 --- a/packages/typespec-test/test/ai/spec/main.tsp +++ b/packages/typespec-test/test/ai/spec/main.tsp @@ -14,6 +14,7 @@ import "./agents/vector_stores/files/routes.tsp"; import "./agents/vector_stores/file_batches/routes.tsp"; import "./connections/routes.tsp"; import "./evaluations/routes.tsp"; +import "./telemetry/routes.tsp"; using TypeSpec.Http; using TypeSpec.Rest; @@ -42,7 +43,7 @@ namespace Azure.AI { "{endpoint}/agents/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{projectName}", // This URL is for the Agents API. "Azure AI", { - @doc("The Azure AI Studio project endpoint, in the form `https://.api.azureml.ms` or `https://..api.azureml.ms`, where is the Azure region where the project is deployed (e.g. westus) and is the GUID of the Enterprise private link.") + @doc("The Azure AI Foundry project endpoint, in the form `https://.api.azureml.ms` or `https://..api.azureml.ms`, where is the Azure region where the project is deployed (e.g. westus) and is the GUID of the Enterprise private link.") endpoint: string, @doc("The Azure subscription ID.") @@ -51,16 +52,16 @@ namespace Azure.AI { @doc("The name of the Azure Resource Group.") resourceGroupName: string, - @doc("The Azure AI Studio project name.") + @doc("The Azure AI Foundry project name.") projectName: string, } ) @versioned(Versions) -namespace Azure.AI.Client { +namespace Azure.AI.Projects { @doc("Azure AI API versions") enum Versions { @doc("Azure AI API version 2024-07-01-preview.") @useDependency(Azure.Core.Versions.v1_0_Preview_2) `2024-07-01-preview`, } -} +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/telemetry/client.tsp b/packages/typespec-test/test/ai/spec/telemetry/client.tsp new file mode 100644 index 0000000000..ccdcb03b55 --- /dev/null +++ b/packages/typespec-test/test/ai/spec/telemetry/client.tsp @@ -0,0 +1,7 @@ +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; + +@@access(Azure.AI.Projects.Telemetry.getAppInsights, Access.internal); +@@access(Azure.AI.Projects.GetAppInsightsResponse, Access.internal); +@@access(Azure.AI.Projects.AppInsightsProperties, Access.internal); \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/telemetry/model.tsp b/packages/typespec-test/test/ai/spec/telemetry/model.tsp new file mode 100644 index 0000000000..aadecf283f --- /dev/null +++ b/packages/typespec-test/test/ai/spec/telemetry/model.tsp @@ -0,0 +1,33 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-autorest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@typespec/openapi"; +import "@typespec/versioning"; + +using TypeSpec.OpenAPI; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; + +namespace Azure.AI.Projects; + +@doc("Response from getting properties of the Application Insights resource") +model GetAppInsightsResponse { + @doc("A unique identifier for the resource") + id: string; + + @doc("The name of the resource") + name: string; + + @doc("The properties of the resource") + properties: AppInsightsProperties; +} + +@doc("The properties of the Application Insights resource") +model AppInsightsProperties { + @doc("Authentication type of the connection target") + ConnectionString: string; +} \ No newline at end of file diff --git a/packages/typespec-test/test/ai/spec/telemetry/routes.tsp b/packages/typespec-test/test/ai/spec/telemetry/routes.tsp new file mode 100644 index 0000000000..d9fb7e2e7d --- /dev/null +++ b/packages/typespec-test/test/ai/spec/telemetry/routes.tsp @@ -0,0 +1,29 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-autorest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "./model.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; +using Azure.Core.Foundations; + +namespace Azure.AI.Projects.Telemetry; + +/* + See https://learn.microsoft.com/en-us/rest/api/azureml/workspaces/get?view=rest-azureml-2024-07-01-preview +*/ +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@doc("Gets the properties of the specified Application Insights resource") +@route("/{appInsightsResourceUrl}") +@get +op getAppInsights is Azure.Core.Foundations.Operation< + { + @doc("The AppInsights Azure resource Url. It should have the format: '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/microsoft.insights/components/{resourcename}'") + appInsightsResourceUrl: string; + }, + GetAppInsightsResponse +>; \ No newline at end of file From 29aff5a907418a62c9c12a279561edda3ac2615c Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 2 Jan 2025 13:01:36 +0800 Subject: [PATCH 78/91] Fix the duplicated template name issues --- packages/typespec-ts/src/utils/modelUtils.ts | 58 ++++++------ .../test/unit/modelsGenerator.spec.ts | 88 +++++++++++++++++++ .../typespec-ts/test/unit/uriTemplate.spec.ts | 40 ++++++++- 3 files changed, 159 insertions(+), 27 deletions(-) diff --git a/packages/typespec-ts/src/utils/modelUtils.ts b/packages/typespec-ts/src/utils/modelUtils.ts index eea560afa9..5761fe8d82 100644 --- a/packages/typespec-ts/src/utils/modelUtils.ts +++ b/packages/typespec-ts/src/utils/modelUtils.ts @@ -605,8 +605,7 @@ function getSchemaForModel( } const program = dpgContext.program; - const overridedModelName = - getFriendlyName(program, model) ?? getWireName(dpgContext, model); + const friendlyModelName = getFriendlyName(program, model); const fullNamespaceName = getModelNamespaceName(dpgContext, model.namespace!) .map((nsName) => { @@ -615,28 +614,36 @@ function getSchemaForModel( .join("") + model.name; let name = model.name; if ( - !overridedModelName && + !friendlyModelName && model.templateMapper && model.templateMapper.args && - model.templateMapper.args.length > 0 && - getPagedResult(program, model) + model.templateMapper.args.length > 0 ) { - const templateTypes = model.templateMapper.args.filter((it) => - isType(it) - ) as Type[]; - name = - templateTypes - .map((it: Type) => { - switch (it.kind) { - case "Model": - return it.name; - case "String": - return it.value; - default: - return ""; - } - }) - .join("") + "List"; + const isPagedTemplate = getPagedResult(program, model); + const templateTypes = model.templateMapper.args + .filter((it) => isType(it) || it.entityKind === "Indeterminate") + .map((it) => + it.entityKind === "Indeterminate" ? it.type : it + ) as Type[]; + const templateNamePart = templateTypes + .map((it: Type) => { + switch (it.kind) { + case "Model": + return it.name; + case "String": + case "Boolean": + case "Number": + return it.value; + case "Scalar": + return it.name; + default: + return ""; + } + }) + .join(""); + name = isPagedTemplate + ? `${templateNamePart} List` + : `${name} ${templateNamePart}`; } const isMultipartBody = isMediaTypeMultipartFormData(contentTypes ?? []); @@ -645,17 +652,16 @@ function getSchemaForModel( const modelSchema: ObjectSchema = { name: isCoreModel ? name - : overridedModelName !== name - ? overridedModelName - : dpgContext.rlcOptions?.enableModelNamespace + : (friendlyModelName ?? + (dpgContext.rlcOptions?.enableModelNamespace ? fullNamespaceName - : name, + : name)), type: "object", isMultipartBody, description: getDoc(program, model) ?? "", fromCore: isCoreModel }; - // normalized the output name + // normalized the name modelSchema.name = normalizeName( modelSchema.name, NameType.Interface, diff --git a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts index 3a9ca2f89a..9baeb7e914 100644 --- a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts +++ b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts @@ -2894,6 +2894,94 @@ describe("Input/output model type", () => { ` }); }); + + it("should generate template model successfully even without @friendlyName", async () => { + const tspDefinition = ` + model Base { } + + model Templated { + prop: T; + } + + model Foo { + x: Templated; + y: Templated; + z: Templated<"cat">; + h: Templated; + j: Templated<1>; + } + `; + const tspType = "Foo"; + const inputModelName = "Foo"; + await verifyPropertyType(tspType, inputModelName, { + additionalTypeSpecDefinition: tspDefinition, + outputType: `FooOutput`, + additionalInputContent: ` + export interface Foo { + x: TemplatedBase; + y: TemplatedString; + z: TemplatedCat; + h: TemplatedTrue; + j: Templated1; + } + + export interface TemplatedBase { + prop: Base; + } + + export interface Base { + } + + export interface TemplatedString { + prop: string; + } + + export interface TemplatedCat { + prop: "cat"; + } + + export interface TemplatedTrue { + prop: true; + } + + export interface Templated1 { + prop: 1; + } + `, + additionalOutputContent: ` + export interface FooOutput { + x: TemplatedBaseOutput; + y: TemplatedStringOutput; + z: TemplatedCatOutput; + h: TemplatedTrueOutput; + j: Templated1Output; + } + + export interface TemplatedBaseOutput { + prop: BaseOutput; + } + + export interface BaseOutput { + } + + export interface TemplatedStringOutput { + prop: string; + } + + export interface TemplatedCatOutput { + prop: "cat"; + } + + export interface TemplatedTrueOutput { + prop: true; + } + + export interface Templated1Output { + prop: 1; + } + ` + }); + }); }); describe("core error model", () => { diff --git a/packages/typespec-ts/test/unit/uriTemplate.spec.ts b/packages/typespec-ts/test/unit/uriTemplate.spec.ts index aaa011815c..53dcd613aa 100644 --- a/packages/typespec-ts/test/unit/uriTemplate.spec.ts +++ b/packages/typespec-ts/test/unit/uriTemplate.spec.ts @@ -3,7 +3,7 @@ import { emitClientDefinitionFromTypeSpec, emitParameterFromTypeSpec } from "../ import { assertEqualContent } from "../util/testUtil.js"; describe("Client definition generation", () => { - it("should generate method-level parameter", async () => { + it("should generate wrapper object for path allowReserved parameter", async () => { const tsp = ` @route("template/{+param}") op template(param: string): void; @@ -54,4 +54,42 @@ describe("Client definition generation", () => { ` ); }); + + it("should generate wrapper object for query parameter", async () => { + const tsp = ` + @route("template") + op template(@query("include[]") include?: string[]): void; + `; + const parameters = await emitParameterFromTypeSpec( + tsp + ); + assert.ok(parameters); + console.log(parameters?.content!); + await assertEqualContent( + parameters?.content!, + ` + import { RequestParameters } from "@azure-rest/core-client"; + + /** This is the wrapper object for the parameter \`include[]\` with explode set to false and style set to form. */ + export interface TemplateIncludeQueryParam { + /** Value of the parameter */ + value: string[]; + /** Should we explode the value? */ + explode: false; + /** Style of the value */ + style: "form"; + } + + export interface TemplateQueryParamProperties { + "include[]"?: string[] | TemplateIncludeQueryParam; + } + + export interface TemplateQueryParam { + queryParameters?: TemplateQueryParamProperties; + } + + export type TemplateParameters = TemplateQueryParam & RequestParameters; + ` + ); + }); }); From 39fc7637b8c4babe37203bafa7f9d758c6bfad16 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 2 Jan 2025 15:57:27 +0800 Subject: [PATCH 79/91] Update the test cases in smoke testing --- .../typespec-ts/sdk/test/arm-test/LICENSE | 2 +- .../review/arm-networkanalytics.api.md | 8 +- .../sdk/test/arm-test/src/models/models.ts | 24 +-- .../generated/typespec-ts/LICENSE | 2 +- .../review/ai-anomaly-detector.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../authoring/generated/typespec-ts/LICENSE | 2 +- .../typespec-ts/review/authoring.api.md | 10 +- .../generated/typespec-ts/src/outputModels.ts | 2 +- .../generated/typespec-ts/src/responses.ts | 10 +- .../generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/review/batch.api.md | 80 ++++---- .../typespec-ts/src/api/operations.ts | 182 +++++++++--------- .../generated/typespec-ts/src/api/options.ts | 78 ++++---- .../typespec-ts/src/models/models.ts | 32 +-- .../generated/typespec-ts/LICENSE | 2 +- .../review/ai-chat-protocol.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../review/ai-content-safety.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../contoso/generated/typespec-ts/LICENSE | 2 +- .../review/contosowidgetmanager-rest.api.md | 10 +- .../generated/typespec-ts/src/outputModels.ts | 4 +- .../generated/typespec-ts/src/responses.ts | 10 +- .../generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../typespec-ts/review/eventgrid.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../test/faceai/generated/typespec-ts/LICENSE | 2 +- .../typespec-ts/review/ai-face-rest.api.md | 173 ++++++++++------- .../generated/typespec-ts/src/models.ts | 133 +++++++++++++ .../generated/typespec-ts/src/parameters.ts | 63 ++---- .../generated/typespec-ts/LICENSE | 2 +- .../health-insights-radiologyinsights.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../review/hierarchy-generic.api.md | 10 +- .../typespec-ts/src/api/b/c/index.ts | 6 +- .../typespec-ts/src/api/b/e/c/index.ts | 6 +- .../generated/typespec-ts/src/api/b/index.ts | 6 +- .../typespec-ts/src/classic/b/c/index.ts | 6 +- .../typespec-ts/src/classic/b/e/c/index.ts | 6 +- .../typespec-ts/src/classic/b/index.ts | 6 +- .../generated/typespec-ts/src/index.ts | 2 +- .../generated/typespec-ts/src/models/index.ts | 2 +- .../typespec-ts/src/models/models.ts | 12 +- .../loadTest/generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../typespec-ts/review/load-testing.api.md | 126 ++++++------ .../typespec-ts/src/models/models.ts | 126 ++++++------ .../test/openai/generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../typespec-ts/review/openai_modular.api.md | 8 +- .../typespec-ts/src/models/models.ts | 8 +- .../generated/typespec-ts/LICENSE | 2 +- .../review/openai-non-branded.api.md | 24 +-- .../typespec-ts/src/models/models.ts | 96 ++++----- .../generated/typespec-ts/LICENSE | 2 +- .../review/overload_modular.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../test/spread/generated/typespec-ts/LICENSE | 2 +- .../generated/typespec-ts/LICENSE | 2 +- .../translator/generated/typespec-ts/LICENSE | 2 +- .../widget_dpg/generated/typespec-ts/LICENSE | 2 +- .../typespec-ts/review/widget_dpg.api.md | 2 +- .../typespec-ts/src/models/models.ts | 2 +- 72 files changed, 744 insertions(+), 607 deletions(-) diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/LICENSE b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/LICENSE +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md index a58f736b62..5dcccb4d99 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md @@ -365,9 +365,9 @@ export enum KnownManagedServiceIdentityType { // @public export enum KnownOrigin { - "user,system" = "user,system", - system = "system", - user = "user" + System = "system", + User = "user", + UserSystem = "user,system" } // @public @@ -383,7 +383,7 @@ export enum KnownProvisioningState { // @public export enum KnownVersions { - v2023_11_15 = "2023-11-15" + V2023_11_15 = "2023-11-15" } // @public diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts index 3dcc69ebff..523a5715b3 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts @@ -271,7 +271,7 @@ export function dataProductNetworkAclsSerializer( virtualNetworkRule: virtualNetworkRuleArraySerializer( item["virtualNetworkRule"], ), - ipRules: iPRulesArraySerializer(item["ipRules"]), + ipRules: ipRulesArraySerializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -286,7 +286,7 @@ export function dataProductNetworkAclsDeserializer( virtualNetworkRule: virtualNetworkRuleArrayDeserializer( item["virtualNetworkRule"], ), - ipRules: iPRulesArrayDeserializer(item["ipRules"]), + ipRules: ipRulesArrayDeserializer(item["ipRules"]), allowedQueryIpRangeList: item["allowedQueryIpRangeList"].map((p: any) => { return p; }), @@ -332,15 +332,15 @@ export function virtualNetworkRuleDeserializer(item: any): VirtualNetworkRule { }; } -export function iPRulesArraySerializer(result: Array): any[] { +export function ipRulesArraySerializer(result: Array): any[] { return result.map((item) => { - return iPRulesSerializer(item); + return ipRulesSerializer(item); }); } -export function iPRulesArrayDeserializer(result: Array): any[] { +export function ipRulesArrayDeserializer(result: Array): any[] { return result.map((item) => { - return iPRulesDeserializer(item); + return ipRulesDeserializer(item); }); } @@ -352,11 +352,11 @@ export interface IPRules { action: string; } -export function iPRulesSerializer(item: IPRules): any { +export function ipRulesSerializer(item: IPRules): any { return { value: item["value"], action: item["action"] }; } -export function iPRulesDeserializer(item: any): IPRules { +export function ipRulesDeserializer(item: any): IPRules { return { value: item["value"], action: item["action"], @@ -1335,11 +1335,11 @@ export function operationDisplayDeserializer(item: any): OperationDisplay { /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ export enum KnownOrigin { /** Indicates the operation is initiated by a user. */ - user = "user", + User = "user", /** Indicates the operation is initiated by a system. */ - system = "system", + System = "system", /** Indicates the operation is initiated by a user or system. */ - "user,system" = "user,system", + UserSystem = "user,system", } /** @@ -1371,5 +1371,5 @@ export type ActionType = string; /** The available API versions for the Microsoft.NetworkAnalytics RP. */ export enum KnownVersions { /** The 2023-11-15 stable version. */ - v2023_11_15 = "2023-11-15", + V2023_11_15 = "2023-11-15", } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/LICENSE b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index a67df11f8a..d094c5c10a 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -30,7 +30,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { // (undocumented) - v1_1 = "v1.1" + V1_1 = "v1.1" } // @public diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index d6773e2fa2..7d8485fb16 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -1051,5 +1051,5 @@ export function univariateUnivariateChangePointDetectionResultDeserializer( /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - v1_1 = "v1.1", + V1_1 = "v1.1", } diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/LICENSE b/packages/typespec-test/test/authoring/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md b/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md index 7aafe160f5..c2c9cdcca3 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md @@ -114,7 +114,7 @@ export interface Delete202Headers { // @public export interface Delete202Response extends HttpResponse { // (undocumented) - body: OperationStatusOutput; + body: OperationStatusErrorOutput; // (undocumented) headers: RawHttpHeaders & Delete202Headers; // (undocumented) @@ -144,7 +144,7 @@ export interface DeleteDeployment202Headers { // @public export interface DeleteDeployment202Response extends HttpResponse { // (undocumented) - body: OperationStatusOutput; + body: OperationStatusErrorOutput; // (undocumented) headers: RawHttpHeaders & DeleteDeployment202Headers; // (undocumented) @@ -169,7 +169,7 @@ export interface DeleteDeploymentDefaultResponse extends HttpResponse { // @public export interface DeleteDeploymentLogicalResponse extends HttpResponse { // (undocumented) - body: OperationStatusOutput; + body: OperationStatusErrorOutput; // (undocumented) status: "200"; } @@ -180,7 +180,7 @@ export type DeleteDeploymentParameters = RequestParameters; // @public export interface DeleteLogicalResponse extends HttpResponse { // (undocumented) - body: OperationStatusOutput; + body: OperationStatusErrorOutput; // (undocumented) status: "200"; } @@ -730,7 +730,7 @@ export interface ListTrainingConfigVersionsQueryParamProperties { export type OperationStateOutput = string; // @public -export interface OperationStatusOutput { +export interface OperationStatusErrorOutput { error?: ErrorModel; id: string; status: OperationStateOutput; diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts index 899254cb56..74bdb3ca03 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts @@ -33,7 +33,7 @@ export interface ProjectOutput { export interface ProjectSettingsOutput extends Record {} /** Provides status details for long running operations. */ -export interface OperationStatusOutput { +export interface OperationStatusErrorOutput { /** The unique ID of the operation. */ id: string; /** diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts index 6f83968d0f..3a30cdee72 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts @@ -5,7 +5,7 @@ import { RawHttpHeaders } from "@azure/core-rest-pipeline"; import { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; import { ProjectOutput, - OperationStatusOutput, + OperationStatusErrorOutput, PagedProjectOutput, DeploymentOutput, PagedDeploymentOutput, @@ -81,7 +81,7 @@ export interface Delete202Headers { /** The request has been accepted for processing, but processing has not yet completed. */ export interface Delete202Response extends HttpResponse { status: "202"; - body: OperationStatusOutput; + body: OperationStatusErrorOutput; headers: RawHttpHeaders & Delete202Headers; } @@ -99,7 +99,7 @@ export interface DeleteDefaultResponse extends HttpResponse { /** The final response for long-running delete operation */ export interface DeleteLogicalResponse extends HttpResponse { status: "200"; - body: OperationStatusOutput; + body: OperationStatusErrorOutput; } /** The request has succeeded. */ @@ -266,7 +266,7 @@ export interface DeleteDeployment202Headers { /** The request has been accepted for processing, but processing has not yet completed. */ export interface DeleteDeployment202Response extends HttpResponse { status: "202"; - body: OperationStatusOutput; + body: OperationStatusErrorOutput; headers: RawHttpHeaders & DeleteDeployment202Headers; } @@ -284,7 +284,7 @@ export interface DeleteDeploymentDefaultResponse extends HttpResponse { /** The final response for long-running deleteDeployment operation */ export interface DeleteDeploymentLogicalResponse extends HttpResponse { status: "200"; - body: OperationStatusOutput; + body: OperationStatusErrorOutput; } /** The request has succeeded. */ diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/LICENSE b/packages/typespec-test/test/batch_modular/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md index 05bd62b29c..83e1fb5678 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md @@ -987,38 +987,38 @@ export interface GetApplicationOptionalParams extends OperationOptions { // @public export interface GetCertificateOptionalParams extends OperationOptions { - $select?: string[]; clientRequestId?: string; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface GetJobOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; clientRequestId?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface GetJobScheduleOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; clientRequestId?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } @@ -1032,10 +1032,10 @@ export interface GetJobTaskCountsOptionalParams extends OperationOptions { // @public export interface GetNodeExtensionOptionalParams extends OperationOptions { - $select?: string[]; clientRequestId?: string; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } @@ -1062,10 +1062,10 @@ export interface GetNodeFilePropertiesOptionalParams extends OperationOptions { // @public export interface GetNodeOptionalParams extends OperationOptions { - $select?: string[]; clientRequestId?: string; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } @@ -1087,15 +1087,15 @@ export interface GetNodeRemoteLoginSettingsOptionalParams extends OperationOptio // @public export interface GetPoolOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; clientRequestId?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } @@ -1122,15 +1122,15 @@ export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { // @public export interface GetTaskOptionalParams extends OperationOptions { - $expand?: string[]; - $select?: string[]; clientRequestId?: string; + expand?: string[]; ifMatch?: string; ifModifiedSince?: Date; ifNoneMatch?: string; ifUnmodifiedSince?: Date; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } @@ -1395,7 +1395,7 @@ export interface JobStatistics { // @public export enum KnownVersions { - "2023-05-01.17.0" = "2023-05-01.17.0" + "V2023-05-01.17.0" = "2023-05-01.17.0" } // @public @@ -1416,76 +1416,76 @@ export interface ListApplicationsOptionalParams extends OperationOptions { // @public export interface ListCertificatesOptionalParams extends OperationOptions { - $filter?: string; - $select?: string[]; clientRequestId?: string; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobPreparationAndReleaseTaskStatusOptionalParams extends OperationOptions { - $filter?: string; - $select?: string[]; clientRequestId?: string; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobSchedulesOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; clientRequestId?: string; + expand?: string[]; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobsFromScheduleOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; clientRequestId?: string; + expand?: string[]; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListJobsOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; clientRequestId?: string; + expand?: string[]; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListNodeExtensionsOptionalParams extends OperationOptions { - $select?: string[]; clientRequestId?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListNodeFilesOptionalParams extends OperationOptions { - $filter?: string; clientRequestId?: string; + filter?: string; maxresults?: number; ocpDate?: Date; recursive?: boolean; @@ -1495,19 +1495,19 @@ export interface ListNodeFilesOptionalParams extends OperationOptions { // @public export interface ListNodesOptionalParams extends OperationOptions { - $filter?: string; - $select?: string[]; clientRequestId?: string; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListPoolNodeCountsOptionalParams extends OperationOptions { - $filter?: string; clientRequestId?: string; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; @@ -1516,21 +1516,21 @@ export interface ListPoolNodeCountsOptionalParams extends OperationOptions { // @public export interface ListPoolsOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; clientRequestId?: string; + expand?: string[]; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { - $filter?: string; clientRequestId?: string; endtime?: Date; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; @@ -1540,17 +1540,17 @@ export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { // @public export interface ListSubTasksOptionalParams extends OperationOptions { - $select?: string[]; clientRequestId?: string; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } // @public export interface ListSupportedImagesOptionalParams extends OperationOptions { - $filter?: string; clientRequestId?: string; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; @@ -1559,8 +1559,8 @@ export interface ListSupportedImagesOptionalParams extends OperationOptions { // @public export interface ListTaskFilesOptionalParams extends OperationOptions { - $filter?: string; clientRequestId?: string; + filter?: string; maxresults?: number; ocpDate?: Date; recursive?: boolean; @@ -1570,13 +1570,13 @@ export interface ListTaskFilesOptionalParams extends OperationOptions { // @public export interface ListTasksOptionalParams extends OperationOptions { - $expand?: string[]; - $filter?: string; - $select?: string[]; clientRequestId?: string; + expand?: string[]; + filter?: string; maxresults?: number; ocpDate?: Date; returnClientRequestId?: boolean; + select?: string[]; timeOutInSeconds?: number; } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts index f9bfb9bd4b..d8f5ff36fe 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts @@ -226,7 +226,7 @@ export function _listNodeFilesSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, recursive: options?.recursive, }, }); @@ -531,9 +531,9 @@ export function _listNodeExtensionsSend( queryParameters: { maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -603,9 +603,9 @@ export function _getNodeExtensionSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -669,10 +669,10 @@ export function _listNodesSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -1199,9 +1199,9 @@ export function _getNodeSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -1481,7 +1481,7 @@ export function _listTaskFilesSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, recursive: options?.recursive, }, }); @@ -1947,9 +1947,9 @@ export function _listSubTasksSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -2106,14 +2106,14 @@ export function _getTaskSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -2334,15 +2334,15 @@ export function _listTasksSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -2468,15 +2468,15 @@ export function _listJobSchedulesSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -3015,14 +3015,14 @@ export function _getJobScheduleSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -3238,9 +3238,9 @@ export function _getCertificateSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -3449,10 +3449,10 @@ export function _listCertificatesSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -3631,10 +3631,10 @@ export function _listJobPreparationAndReleaseTaskStatusSend( queryParameters: { maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), }, @@ -3706,15 +3706,15 @@ export function _listJobsFromScheduleSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -3774,15 +3774,15 @@ export function _listJobsSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -4344,14 +4344,14 @@ export function _getJobSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -4491,7 +4491,7 @@ export function _listPoolNodeCountsSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, }, }); } @@ -4554,7 +4554,7 @@ export function _listSupportedImagesSend( queryParameters: { maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, + $filter: options?.filter, }, }); } @@ -5236,14 +5236,14 @@ export function _getPoolSend( queryParameters: { "api-version": context.apiVersion, timeOut: options?.timeOutInSeconds, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -5459,15 +5459,15 @@ export function _listPoolsSend( "api-version": context.apiVersion, maxresults: options?.maxresults, timeOut: options?.timeOutInSeconds, - $filter: options?.$filter, - $select: !options?.$select - ? options?.$select - : options?.$select.map((p: any) => { + $filter: options?.filter, + $select: !options?.select + ? options?.select + : options?.select.map((p: any) => { return p; }), - $expand: !options?.$expand - ? options?.$expand - : options?.$expand.map((p: any) => { + $expand: !options?.expand + ? options?.expand + : options?.expand.map((p: any) => { return p; }), }, @@ -5594,7 +5594,7 @@ export function _listPoolUsageMetricsSend( endtime: !options?.endtime ? options?.endtime : options?.endtime.toISOString(), - $filter: options?.$filter, + $filter: options?.filter, }, }); } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts index e3272f4698..42d46c921b 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/options.ts @@ -38,7 +38,7 @@ export interface ListNodeFilesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. */ - $filter?: string; + filter?: string; /** Whether to list children of a directory. */ recursive?: boolean; } @@ -171,7 +171,7 @@ export interface ListNodeExtensionsOptionalParams extends OperationOptions { /** Whether the server should return the client-request-id in the response. */ returnClientRequestId?: boolean; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -195,7 +195,7 @@ export interface GetNodeExtensionOptionalParams extends OperationOptions { */ ocpDate?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -227,9 +227,9 @@ export interface ListNodesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -415,7 +415,7 @@ export interface GetNodeOptionalParams extends OperationOptions { */ ocpDate?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -513,7 +513,7 @@ export interface ListTaskFilesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. */ - $filter?: string; + filter?: string; /** * Whether to list children of the Task directory. This parameter can be used in * combination with the filter parameter to list specific type of files. @@ -736,7 +736,7 @@ export interface ListSubTasksOptionalParams extends OperationOptions { */ ocpDate?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -830,9 +830,9 @@ export interface GetTaskOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -932,11 +932,11 @@ export interface ListTasksOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -990,11 +990,11 @@ export interface ListJobSchedulesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1294,9 +1294,9 @@ export interface GetJobScheduleOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1412,7 +1412,7 @@ export interface GetCertificateOptionalParams extends OperationOptions { */ ocpDate?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1489,9 +1489,9 @@ export interface ListCertificatesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1568,9 +1568,9 @@ export interface ListJobPreparationAndReleaseTaskStatusOptionalParams * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-preparation-and-release-status. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; } /** Optional parameters. */ @@ -1602,11 +1602,11 @@ export interface ListJobsFromScheduleOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1638,11 +1638,11 @@ export interface ListJobsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -1944,9 +1944,9 @@ export interface GetJobOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -2024,7 +2024,7 @@ export interface ListPoolNodeCountsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. */ - $filter?: string; + filter?: string; } /** Optional parameters. */ @@ -2056,7 +2056,7 @@ export interface ListSupportedImagesOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. */ - $filter?: string; + filter?: string; } /** Optional parameters. */ @@ -2400,9 +2400,9 @@ export interface GetPoolOptionalParams extends OperationOptions { */ ifUnmodifiedSince?: Date; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -2526,11 +2526,11 @@ export interface ListPoolsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. */ - $filter?: string; + filter?: string; /** An OData $select clause. */ - $select?: string[]; + select?: string[]; /** An OData $expand clause. */ - $expand?: string[]; + expand?: string[]; } /** Optional parameters. */ @@ -2596,7 +2596,7 @@ export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { * An OData $filter clause. For more information on constructing this filter, see * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. */ - $filter?: string; + filter?: string; } /** Optional parameters. */ diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts index c1035ebe9e..0d5d3d0b6b 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts @@ -1148,10 +1148,10 @@ export function nodeVMExtensionDeserializer(item: any): NodeVMExtension { provisioningState: item["provisioningState"], vmExtension: !item["vmExtension"] ? item["vmExtension"] - : vMExtensionDeserializer(item["vmExtension"]), + : vmExtensionDeserializer(item["vmExtension"]), instanceView: !item["instanceView"] ? item["instanceView"] - : vMExtensionInstanceViewDeserializer(item["instanceView"]), + : vmExtensionInstanceViewDeserializer(item["instanceView"]), }; } @@ -1177,7 +1177,7 @@ export interface VMExtension { provisionAfterExtensions?: string[]; } -export function vMExtensionSerializer(item: VMExtension): any { +export function vmExtensionSerializer(item: VMExtension): any { return { name: item["name"], publisher: item["publisher"], @@ -1195,7 +1195,7 @@ export function vMExtensionSerializer(item: VMExtension): any { }; } -export function vMExtensionDeserializer(item: any): VMExtension { +export function vmExtensionDeserializer(item: any): VMExtension { return { name: item["name"], publisher: item["publisher"], @@ -1223,7 +1223,7 @@ export interface VMExtensionInstanceView { subStatuses?: InstanceViewStatus[]; } -export function vMExtensionInstanceViewDeserializer( +export function vmExtensionInstanceViewDeserializer( item: any, ): VMExtensionInstanceView { return { @@ -3386,8 +3386,8 @@ export function virtualMachineConfigurationSerializer( ), extensions: !item["extensions"] ? item["extensions"] - : vMExtensionArraySerializer(item["extensions"]), - osDisk: !item["osDisk"] ? item["osDisk"] : oSDiskSerializer(item["osDisk"]), + : vmExtensionArraySerializer(item["extensions"]), + osDisk: !item["osDisk"] ? item["osDisk"] : osDiskSerializer(item["osDisk"]), }; } @@ -3419,10 +3419,10 @@ export function virtualMachineConfigurationDeserializer( ), extensions: !item["extensions"] ? item["extensions"] - : vMExtensionArrayDeserializer(item["extensions"]), + : vmExtensionArrayDeserializer(item["extensions"]), osDisk: !item["osDisk"] ? item["osDisk"] - : oSDiskDeserializer(item["osDisk"]), + : osDiskDeserializer(item["osDisk"]), }; } @@ -3622,17 +3622,17 @@ export function nodePlacementConfigurationDeserializer( /** NodePlacementPolicyType enums */ export type NodePlacementPolicyType = "regional" | "zonal"; -export function vMExtensionArraySerializer(result: Array): any[] { +export function vmExtensionArraySerializer(result: Array): any[] { return result.map((item) => { - return vMExtensionSerializer(item); + return vmExtensionSerializer(item); }); } -export function vMExtensionArrayDeserializer( +export function vmExtensionArrayDeserializer( result: Array, ): any[] { return result.map((item) => { - return vMExtensionDeserializer(item); + return vmExtensionDeserializer(item); }); } @@ -3642,7 +3642,7 @@ export interface OSDisk { ephemeralOSDiskSettings?: DiffDiskSettings; } -export function oSDiskSerializer(item: OSDisk): any { +export function osDiskSerializer(item: OSDisk): any { return { ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] @@ -3650,7 +3650,7 @@ export function oSDiskSerializer(item: OSDisk): any { }; } -export function oSDiskDeserializer(item: any): OSDisk { +export function osDiskDeserializer(item: any): OSDisk { return { ephemeralOSDiskSettings: !item["ephemeralOSDiskSettings"] ? item["ephemeralOSDiskSettings"] @@ -6241,5 +6241,5 @@ export function batchApplicationDeserializer(item: any): BatchApplication { /** The Azure Batch service version. */ export enum KnownVersions { /** API Version 2023-05-01.17.0 */ - "2023-05-01.17.0" = "2023-05-01.17.0", + "V2023-05-01.17.0" = "2023-05-01.17.0", } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/LICENSE b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md index 2473225813..b29e03e333 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md @@ -89,7 +89,7 @@ export type FinishReason = "stop" | "length"; // @public export enum KnownAPIVersion { // (undocumented) - v20231001Preview = "2023-10-01-preview" + V20231001Preview = "2023-10-01-preview" } // @public diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts index 2d295dd082..b0fc5be2ac 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts @@ -247,5 +247,5 @@ export function chatChoiceRecordDeserializer(item: any): ChatChoiceRecord { /** Known values of {@link APIVersion} that the service accepts. */ export enum KnownAPIVersion { - v20231001Preview = "2023-10-01-preview", + V20231001Preview = "2023-10-01-preview", } diff --git a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/LICENSE b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/LICENSE b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md index 07e1e23dc7..b50a1fd117 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md @@ -125,7 +125,7 @@ export interface ImageData { // @public export enum KnownVersions { // (undocumented) - v2023_10_01 = "2023-10-01" + V2023_10_01 = "2023-10-01" } // @public diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts index 922664ed1a..cba0b5cd18 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts @@ -361,5 +361,5 @@ export function textAnalyzeSeverityResultDeserializer( /** Known values of {@link Versions} that the service accepts. */ export enum KnownVersions { - v2023_10_01 = "2023-10-01", + V2023_10_01 = "2023-10-01", } diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/LICENSE b/packages/typespec-test/test/contoso/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md b/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md index 9cbb13ea01..b79e32d841 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md @@ -96,7 +96,7 @@ export interface DeleteWidget202Headers { // @public export interface DeleteWidget202Response extends HttpResponse { // (undocumented) - body: OperationStatusOutput; + body: OperationStatusErrorOutput; // (undocumented) headers: RawHttpHeaders & DeleteWidget202Headers; // (undocumented) @@ -121,7 +121,7 @@ export interface DeleteWidgetDefaultResponse extends HttpResponse { // @public export interface DeleteWidgetLogicalResponse extends HttpResponse { // (undocumented) - body: OperationStatusOutput; + body: OperationStatusErrorOutput; // (undocumented) status: "200"; } @@ -194,7 +194,7 @@ export interface GetWidgetOperationStatus { // @public export interface GetWidgetOperationStatus200Response extends HttpResponse { // (undocumented) - body: ResourceOperationStatusOutput; + body: ResourceOperationStatusWidgetWidgetErrorOutput; // (undocumented) status: "200"; } @@ -270,7 +270,7 @@ export type ListWidgetsParameters = RequestParameters; export type OperationStateOutput = string; // @public -export interface OperationStatusOutput { +export interface OperationStatusErrorOutput { error?: ErrorModel; id: string; status: OperationStateOutput; @@ -310,7 +310,7 @@ export interface PagingOptions { } // @public -export interface ResourceOperationStatusOutput { +export interface ResourceOperationStatusWidgetWidgetErrorOutput { error?: ErrorModel; id: string; result?: WidgetOutput; diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts index ebbb280692..bf407e1891 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts @@ -22,7 +22,7 @@ export interface FakedSharedModelOutput { } /** Provides status details for long running operations. */ -export interface ResourceOperationStatusOutput { +export interface ResourceOperationStatusWidgetWidgetErrorOutput { /** The unique ID of the operation. */ id: string; /** @@ -38,7 +38,7 @@ export interface ResourceOperationStatusOutput { } /** Provides status details for long running operations. */ -export interface OperationStatusOutput { +export interface OperationStatusErrorOutput { /** The unique ID of the operation. */ id: string; /** diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts index 9e6bc9c785..7ae7cd2752 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts @@ -5,8 +5,8 @@ import { RawHttpHeaders } from "@azure/core-rest-pipeline"; import { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; import { WidgetOutput, - ResourceOperationStatusOutput, - OperationStatusOutput, + ResourceOperationStatusWidgetWidgetErrorOutput, + OperationStatusErrorOutput, PagedWidgetOutput, } from "./outputModels.js"; @@ -30,7 +30,7 @@ export interface GetWidgetDefaultResponse extends HttpResponse { /** The request has succeeded. */ export interface GetWidgetOperationStatus200Response extends HttpResponse { status: "200"; - body: ResourceOperationStatusOutput; + body: ResourceOperationStatusWidgetWidgetErrorOutput; } export interface GetWidgetOperationStatusDefaultHeaders { @@ -93,7 +93,7 @@ export interface DeleteWidget202Headers { /** The request has been accepted for processing, but processing has not yet completed. */ export interface DeleteWidget202Response extends HttpResponse { status: "202"; - body: OperationStatusOutput; + body: OperationStatusErrorOutput; headers: RawHttpHeaders & DeleteWidget202Headers; } @@ -111,7 +111,7 @@ export interface DeleteWidgetDefaultResponse extends HttpResponse { /** The final response for long-running deleteWidget operation */ export interface DeleteWidgetLogicalResponse extends HttpResponse { status: "200"; - body: OperationStatusOutput; + body: OperationStatusErrorOutput; } /** The request has succeeded. */ diff --git a/packages/typespec-test/test/customWrapper/generated/typespec-ts/LICENSE b/packages/typespec-test/test/customWrapper/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/customWrapper/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/customWrapper/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/LICENSE b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md index 4165dc18d3..887faa76b5 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md @@ -73,7 +73,7 @@ export interface FailedLockToken { // @public export enum KnownServiceApiVersions { // (undocumented) - v2023_06_01_preview = "2023-06-01-preview" + V2023_06_01_Preview = "2023-06-01-preview" } // @public diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts index 7700a165ca..fb516f05e5 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts @@ -258,7 +258,7 @@ export function rejectResultDeserializer(item: any): RejectResult { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - v2023_06_01_preview = "2023-06-01-preview", + V2023_06_01_Preview = "2023-06-01-preview", } export function cloudEventArraySerializer(result: Array): any[] { diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/LICENSE b/packages/typespec-test/test/faceai/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md b/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md index c0f70c23de..1dd2892f58 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md @@ -1061,10 +1061,7 @@ export interface CreatePerson202Response extends HttpResponse { // @public (undocumented) export interface CreatePersonBodyParam { // (undocumented) - body: { - name: string; - userData?: string; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -1842,6 +1839,99 @@ export interface FaceErrorOutput { message: string; } +// @public (undocumented) +export interface FaceErrorResponse { + faceId: string; + faceIds: string[]; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; +} + +// @public (undocumented) +export interface FaceErrorResponse { + faceId: string; + faceListId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; +} + +// @public (undocumented) +export interface FaceErrorResponse { + faceId: string; + largeFaceListId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; +} + +// @public (undocumented) +export interface FaceErrorResponse { + confidenceThreshold?: number; + faceIds: string[]; + maxNumOfCandidatesReturned?: number; + personGroupId: string; +} + +// @public (undocumented) +export interface FaceErrorResponse { + confidenceThreshold?: number; + faceIds: string[]; + largePersonGroupId: string; + maxNumOfCandidatesReturned?: number; +} + +// @public (undocumented) +export interface FaceErrorResponse { + confidenceThreshold?: number; + faceIds: string[]; + maxNumOfCandidatesReturned?: number; + personIds: string[]; +} + +// @public (undocumented) +export interface FaceErrorResponse { + confidenceThreshold?: number; + dynamicPersonGroupId: string; + faceIds: string[]; + maxNumOfCandidatesReturned?: number; +} + +// @public (undocumented) +export interface FaceErrorResponse { + faceId1: string; + faceId2: string; +} + +// @public (undocumented) +export interface FaceErrorResponse { + faceId: string; + personGroupId: string; + personId: string; +} + +// @public (undocumented) +export interface FaceErrorResponse { + faceId: string; + largePersonGroupId: string; + personId: string; +} + +// @public (undocumented) +export interface FaceErrorResponse { + faceId: string; + personId: string; +} + +// @public (undocumented) +export interface FaceErrorResponse { + faceIds: string[]; +} + +// @public (undocumented) +export interface FaceErrorResponse { + name: string; + userData?: string; +} + // @public export interface FaceErrorResponseOutput { error: FaceErrorOutput; @@ -1937,12 +2027,7 @@ export interface FindSimilar200Response extends HttpResponse { // @public (undocumented) export interface FindSimilarBodyParam { // (undocumented) - body: { - faceId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; - faceIds: string[]; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -1971,12 +2056,7 @@ export interface FindSimilarFromFaceList200Response extends HttpResponse { // @public (undocumented) export interface FindSimilarFromFaceListBodyParam { // (undocumented) - body: { - faceId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; - faceListId: string; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -2008,12 +2088,7 @@ export interface FindSimilarFromLargeFaceList200Response extends HttpResponse { // @public (undocumented) export interface FindSimilarFromLargeFaceListBodyParam { // (undocumented) - body: { - faceId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; - largeFaceListId: string; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -3271,9 +3346,7 @@ export interface Group200Response extends HttpResponse { // @public (undocumented) export interface GroupBodyParam { // (undocumented) - body: { - faceIds: string[]; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -3346,12 +3419,7 @@ export interface IdentifyFromDynamicPersonGroup200Response extends HttpResponse // @public (undocumented) export interface IdentifyFromDynamicPersonGroupBodyParam { // (undocumented) - body: { - faceIds: string[]; - dynamicPersonGroupId: string; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -3383,12 +3451,7 @@ export interface IdentifyFromLargePersonGroup200Response extends HttpResponse { // @public (undocumented) export interface IdentifyFromLargePersonGroupBodyParam { // (undocumented) - body: { - faceIds: string[]; - largePersonGroupId: string; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -3420,12 +3483,7 @@ export interface IdentifyFromPersonDirectory200Response extends HttpResponse { // @public (undocumented) export interface IdentifyFromPersonDirectoryBodyParam { // (undocumented) - body: { - faceIds: string[]; - personIds: string[]; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -3465,12 +3523,7 @@ export interface IdentifyFromPersonGroup200Response extends HttpResponse { // @public (undocumented) export interface IdentifyFromPersonGroupBodyParam { // (undocumented) - body: { - faceIds: string[]; - personGroupId: string; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -4767,10 +4820,7 @@ export interface VerifyFaceToFace200Response extends HttpResponse { // @public (undocumented) export interface VerifyFaceToFaceBodyParam { // (undocumented) - body: { - faceId1: string; - faceId2: string; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -4802,11 +4852,7 @@ export interface VerifyFromLargePersonGroup200Response extends HttpResponse { // @public (undocumented) export interface VerifyFromLargePersonGroupBodyParam { // (undocumented) - body: { - faceId: string; - largePersonGroupId: string; - personId: string; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -4838,10 +4884,7 @@ export interface VerifyFromPersonDirectory200Response extends HttpResponse { // @public (undocumented) export interface VerifyFromPersonDirectoryBodyParam { // (undocumented) - body: { - faceId: string; - personId: string; - }; + body: FaceErrorResponse; } // @public (undocumented) @@ -4873,11 +4916,7 @@ export interface VerifyFromPersonGroup200Response extends HttpResponse { // @public (undocumented) export interface VerifyFromPersonGroupBodyParam { // (undocumented) - body: { - faceId: string; - personGroupId: string; - personId: string; - }; + body: FaceErrorResponse; } // @public (undocumented) diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts index e45818722c..242d66d962 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts @@ -1,6 +1,139 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +export interface FaceErrorResponse { + /** faceId of the query face. User needs to call "Detect" first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call. */ + faceId: string; + /** The number of top similar faces returned. The valid range is [1, 1000]. Default value is 20. */ + maxNumOfCandidatesReturned?: number; + /** + * Similar face searching mode. It can be 'matchPerson' or 'matchFace'. Default value is 'matchPerson'. + * + * Possible values: "matchPerson", "matchFace" + */ + mode?: FindSimilarMatchMode; + /** An array of candidate faceIds. All of them are created by "Detect" and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. */ + faceIds: string[]; +} + +export interface FaceErrorResponse { + /** faceId of the query face. User needs to call "Detect" first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call. */ + faceId: string; + /** The number of top similar faces returned. The valid range is [1, 1000]. Default value is 20. */ + maxNumOfCandidatesReturned?: number; + /** + * Similar face searching mode. It can be 'matchPerson' or 'matchFace'. Default value is 'matchPerson'. + * + * Possible values: "matchPerson", "matchFace" + */ + mode?: FindSimilarMatchMode; + /** An existing user-specified unique candidate Face List, created in "Create Face List". Face List contains a set of persistedFaceIds which are persisted and will never expire. */ + faceListId: string; +} + +export interface FaceErrorResponse { + /** faceId of the query face. User needs to call "Detect" first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call. */ + faceId: string; + /** The number of top similar faces returned. The valid range is [1, 1000]. Default value is 20. */ + maxNumOfCandidatesReturned?: number; + /** + * Similar face searching mode. It can be 'matchPerson' or 'matchFace'. Default value is 'matchPerson'. + * + * Possible values: "matchPerson", "matchFace" + */ + mode?: FindSimilarMatchMode; + /** An existing user-specified unique candidate Large Face List, created in "Create Large Face List". Large Face List contains a set of persistedFaceIds which are persisted and will never expire. */ + largeFaceListId: string; +} + +export interface FaceErrorResponse { + /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ + faceIds: string[]; + /** personGroupId of the target Person Group, created by "Create Person Group". Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ + personGroupId: string; + /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ + maxNumOfCandidatesReturned?: number; + /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ + confidenceThreshold?: number; +} + +export interface FaceErrorResponse { + /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ + faceIds: string[]; + /** largePersonGroupId of the target Large Person Group, created by "Create Large Person Group". Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ + largePersonGroupId: string; + /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ + maxNumOfCandidatesReturned?: number; + /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ + confidenceThreshold?: number; +} + +export interface FaceErrorResponse { + /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ + faceIds: string[]; + /** Array of personIds created in Person Directory "Create Person". The valid number of personIds is between [1,30]. */ + personIds: string[]; + /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ + maxNumOfCandidatesReturned?: number; + /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ + confidenceThreshold?: number; +} + +export interface FaceErrorResponse { + /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ + faceIds: string[]; + /** DynamicPersonGroupId of the target PersonDirectory DynamicPersonGroup to match against. */ + dynamicPersonGroupId: string; + /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ + maxNumOfCandidatesReturned?: number; + /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ + confidenceThreshold?: number; +} + +export interface FaceErrorResponse { + /** The faceId of one face, come from "Detect". */ + faceId1: string; + /** The faceId of another face, come from "Detect". */ + faceId2: string; +} + +export interface FaceErrorResponse { + /** The faceId of the face, come from "Detect". */ + faceId: string; + /** Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in "Create Person Group". */ + personGroupId: string; + /** Specify a certain person in Person Group. */ + personId: string; +} + +export interface FaceErrorResponse { + /** The faceId of the face, come from "Detect". */ + faceId: string; + /** Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in "Create Large Person Group". */ + largePersonGroupId: string; + /** Specify a certain person in Large Person Group. */ + personId: string; +} + +export interface FaceErrorResponse { + /** The faceId of the face, come from "Detect". */ + faceId: string; + /** Specify a certain person in PersonDirectory Person. */ + personId: string; +} + +export interface FaceErrorResponse { + /** Array of candidate faceIds created by "Detect". The maximum is 1000 faces. */ + faceIds: string[]; +} + +export interface FaceErrorResponse { + /** User defined name, maximum length is 128. */ + name: string; + /** Optional user defined data. Length should not exceed 16K. */ + userData?: string; +} + /** Request for creating liveness session. */ export interface LivenessSessionCreationContent { /** diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts b/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts index b2ef5bdb1c..36742348ba 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts @@ -6,7 +6,7 @@ import { FaceAttributeType, RecognitionModel, DetectionModel, - FindSimilarMatchMode, + FaceErrorResponse, LivenessSessionCreationContent, LivenessSessionWithVerifyImageCreationContent, } from "./models.js"; @@ -133,118 +133,83 @@ export type DetectParameters = DetectQueryParam & RequestParameters; export interface FindSimilarBodyParam { - body: { - faceId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; - faceIds: string[]; - }; + body: FaceErrorResponse; } export type FindSimilarParameters = FindSimilarBodyParam & RequestParameters; export interface FindSimilarFromFaceListBodyParam { - body: { - faceId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; - faceListId: string; - }; + body: FaceErrorResponse; } export type FindSimilarFromFaceListParameters = FindSimilarFromFaceListBodyParam & RequestParameters; export interface FindSimilarFromLargeFaceListBodyParam { - body: { - faceId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; - largeFaceListId: string; - }; + body: FaceErrorResponse; } export type FindSimilarFromLargeFaceListParameters = FindSimilarFromLargeFaceListBodyParam & RequestParameters; export interface IdentifyFromPersonGroupBodyParam { - body: { - faceIds: string[]; - personGroupId: string; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } export type IdentifyFromPersonGroupParameters = IdentifyFromPersonGroupBodyParam & RequestParameters; export interface IdentifyFromLargePersonGroupBodyParam { - body: { - faceIds: string[]; - largePersonGroupId: string; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } export type IdentifyFromLargePersonGroupParameters = IdentifyFromLargePersonGroupBodyParam & RequestParameters; export interface IdentifyFromPersonDirectoryBodyParam { - body: { - faceIds: string[]; - personIds: string[]; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } export type IdentifyFromPersonDirectoryParameters = IdentifyFromPersonDirectoryBodyParam & RequestParameters; export interface IdentifyFromDynamicPersonGroupBodyParam { - body: { - faceIds: string[]; - dynamicPersonGroupId: string; - maxNumOfCandidatesReturned?: number; - confidenceThreshold?: number; - }; + body: FaceErrorResponse; } export type IdentifyFromDynamicPersonGroupParameters = IdentifyFromDynamicPersonGroupBodyParam & RequestParameters; export interface VerifyFaceToFaceBodyParam { - body: { faceId1: string; faceId2: string }; + body: FaceErrorResponse; } export type VerifyFaceToFaceParameters = VerifyFaceToFaceBodyParam & RequestParameters; export interface VerifyFromPersonGroupBodyParam { - body: { faceId: string; personGroupId: string; personId: string }; + body: FaceErrorResponse; } export type VerifyFromPersonGroupParameters = VerifyFromPersonGroupBodyParam & RequestParameters; export interface VerifyFromLargePersonGroupBodyParam { - body: { faceId: string; largePersonGroupId: string; personId: string }; + body: FaceErrorResponse; } export type VerifyFromLargePersonGroupParameters = VerifyFromLargePersonGroupBodyParam & RequestParameters; export interface VerifyFromPersonDirectoryBodyParam { - body: { faceId: string; personId: string }; + body: FaceErrorResponse; } export type VerifyFromPersonDirectoryParameters = VerifyFromPersonDirectoryBodyParam & RequestParameters; export interface GroupBodyParam { - body: { faceIds: string[] }; + body: FaceErrorResponse; } export type GroupParameters = GroupBodyParam & RequestParameters; @@ -888,7 +853,7 @@ export type UpdateLargePersonGroupPersonFaceParameters = UpdateLargePersonGroupPersonFaceBodyParam & RequestParameters; export interface CreatePersonBodyParam { - body: { name: string; userData?: string }; + body: FaceErrorResponse; } export type CreatePersonParameters = CreatePersonBodyParam & RequestParameters; diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/LICENSE b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md index b69456632a..dcaf3a3f19 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md @@ -219,7 +219,7 @@ export interface InferRadiologyInsightsOptionalParams extends OperationOptions { // @public export enum KnownApiVersion { // (undocumented) - v2023_09_01_Preview = "2023-09-01-preview" + V2023_09_01_Preview = "2023-09-01-preview" } // @public diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts index c35d6172da..bb42c71c95 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models/models.ts @@ -2208,5 +2208,5 @@ export type RepeatabilityResult = "accepted" | "rejected"; /** Known values of {@link ApiVersion} that the service accepts. */ export enum KnownApiVersion { - v2023_09_01_Preview = "2023-09-01-preview", + V2023_09_01_Preview = "2023-09-01-preview", } diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/LICENSE b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/LICENSE b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md index 3f86be7cf8..eb2fa8be93 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md @@ -15,7 +15,7 @@ export interface A { } // @public -export interface Ba { +export interface BA { // (undocumented) prop2: string; } @@ -27,11 +27,11 @@ export interface BCOp1OptionalParams extends OperationOptions { // @public export interface BCOperations { // (undocumented) - op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; + op1: (body: BA, options?: BCOp1OptionalParams) => Promise; } // @public -export interface Bea { +export interface BEA { // (undocumented) prop3: string; } @@ -43,7 +43,7 @@ export interface BECOp1OptionalParams extends OperationOptions { // @public export interface BECOperations { // (undocumented) - op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; + op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; } // @public @@ -63,7 +63,7 @@ export interface BOperations { // (undocumented) e: BEOperations; // (undocumented) - op1: (body: Ba, options?: BOp1OptionalParams) => Promise; + op1: (body: BA, options?: BOp1OptionalParams) => Promise; } // @public diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts index 6b08c7be47..2e2034bbe0 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BCOp1OptionalParams, FooContext as Client } from "../../index.js"; -import { Ba, baSerializer } from "../../../models/models.js"; +import { BA, baSerializer } from "../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,7 +12,7 @@ import { export function _op1Send( context: Client, - body: Ba, + body: BA, options: BCOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context @@ -37,7 +37,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: Ba, + body: BA, options: BCOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts index fb3d4a5208..6dba326e70 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BECOp1OptionalParams, FooContext as Client } from "../../../index.js"; -import { Bea, beaSerializer } from "../../../../models/models.js"; +import { BEA, beaSerializer } from "../../../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,7 +12,7 @@ import { export function _op1Send( context: Client, - body: Bea, + body: BEA, options: BECOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context @@ -37,7 +37,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: Bea, + body: BEA, options: BECOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts index 1a7051ad54..266c631bd4 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { BOp1OptionalParams, FooContext as Client } from "../index.js"; -import { Ba, baSerializer } from "../../models/models.js"; +import { BA, baSerializer } from "../../models/models.js"; import { StreamableMethod, PathUncheckedResponse, @@ -12,7 +12,7 @@ import { export function _op1Send( context: Client, - body: Ba, + body: BA, options: BOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context @@ -37,7 +37,7 @@ export async function _op1Deserialize( export async function op1( context: Client, - body: Ba, + body: BA, options: BOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts index 1f8670ba73..1d20656f74 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../api/fooContext.js"; import { op1 } from "../../../api/b/c/index.js"; -import { Ba } from "../../../models/models.js"; +import { BA } from "../../../models/models.js"; import { BCOp1OptionalParams } from "../../../api/options.js"; /** Interface representing a BC operations. */ export interface BCOperations { - op1: (body: Ba, options?: BCOp1OptionalParams) => Promise; + op1: (body: BA, options?: BCOp1OptionalParams) => Promise; } export function getBC(context: FooContext) { return { - op1: (body: Ba, options?: BCOp1OptionalParams) => + op1: (body: BA, options?: BCOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts index f8ab6c6ed1..7301229b88 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts @@ -3,17 +3,17 @@ import { FooContext } from "../../../../api/fooContext.js"; import { op1 } from "../../../../api/b/e/c/index.js"; -import { Bea } from "../../../../models/models.js"; +import { BEA } from "../../../../models/models.js"; import { BECOp1OptionalParams } from "../../../../api/options.js"; /** Interface representing a BEC operations. */ export interface BECOperations { - op1: (body: Bea, options?: BECOp1OptionalParams) => Promise; + op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; } export function getBEC(context: FooContext) { return { - op1: (body: Bea, options?: BECOp1OptionalParams) => + op1: (body: BEA, options?: BECOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts index 4ae4bcc6d4..a6887a6a2c 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts @@ -3,21 +3,21 @@ import { FooContext } from "../../api/fooContext.js"; import { op1 } from "../../api/b/index.js"; -import { Ba } from "../../models/models.js"; +import { BA } from "../../models/models.js"; import { BOp1OptionalParams } from "../../api/options.js"; import { BCOperations, getBCOperations } from "./c/index.js"; import { BEOperations, getBEOperations } from "./e/index.js"; /** Interface representing a B operations. */ export interface BOperations { - op1: (body: Ba, options?: BOp1OptionalParams) => Promise; + op1: (body: BA, options?: BOp1OptionalParams) => Promise; c: BCOperations; e: BEOperations; } export function getB(context: FooContext) { return { - op1: (body: Ba, options?: BOp1OptionalParams) => + op1: (body: BA, options?: BOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts index 96e5c0c3b1..bcc038db54 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. export { FooClient } from "./fooClient.js"; -export { A, Ba, Bea } from "./models/index.js"; +export { A, BA, BEA } from "./models/index.js"; export { FooClientOptionalParams, DOp1OptionalParams, diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts index 8e00d409af..10352581f8 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export { A, Ba, Bea } from "./models.js"; +export { A, BA, BEA } from "./models.js"; diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts index 6ea4c3b715..b8f9cf5f20 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/models.ts @@ -10,20 +10,20 @@ export function aSerializer(item: A): any { return { prop1: item["prop1"] }; } -/** model interface Ba */ -export interface Ba { +/** model interface BA */ +export interface BA { prop2: string; } -export function baSerializer(item: Ba): any { +export function baSerializer(item: BA): any { return { prop2: item["prop2"] }; } -/** model interface Bea */ -export interface Bea { +/** model interface BEA */ +export interface BEA { prop3: string; } -export function beaSerializer(item: Bea): any { +export function beaSerializer(item: BEA): any { return { prop3: item["prop3"] }; } diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/LICENSE b/packages/typespec-test/test/loadTest/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/LICENSE b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index 5ffc76bdf1..4467c90c1c 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -189,34 +189,34 @@ export enum KnownAggregationType { // @public export enum KnownAPIVersions { - v2022_11_01 = "2022-11-01", - v2023_04_01_preview = "2023-04-01-preview", - v2024_03_01_preview = "2024-03-01-preview", - v2024_05_01_preview = "2024-05-01-preview" + V2022_11_01 = "2022-11-01", + V2023_04_01_Preview = "2023-04-01-preview", + V2024_03_01_Preview = "2024-03-01-preview", + V2024_05_01_Preview = "2024-05-01-preview" } // @public export enum KnownCertificateType { - AKV_CERT_URI = "AKV_CERT_URI" + AKVCERTURI = "AKV_CERT_URI" } // @public export enum KnownFileStatus { - NOT_VALIDATED = "NOT_VALIDATED", - VALIDATION_FAILURE = "VALIDATION_FAILURE", - VALIDATION_INITIATED = "VALIDATION_INITIATED", - VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", - VALIDATION_SUCCESS = "VALIDATION_SUCCESS" + NOTValidated = "NOT_VALIDATED", + ValidationFailure = "VALIDATION_FAILURE", + ValidationInitiated = "VALIDATION_INITIATED", + ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", + ValidationSuccess = "VALIDATION_SUCCESS" } // @public export enum KnownFileType { - ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", - JMX_FILE = "JMX_FILE", - TEST_SCRIPT = "TEST_SCRIPT", - URL_TEST_CONFIG = "URL_TEST_CONFIG", - USER_PROPERTIES = "USER_PROPERTIES", - ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS" + AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", + JMXFILE = "JMX_FILE", + TESTSCRIPT = "TEST_SCRIPT", + URLTESTCONFIG = "URL_TEST_CONFIG", + USERProperties = "USER_PROPERTIES", + ZIPPEDArtifacts = "ZIPPED_ARTIFACTS" } // @public @@ -233,49 +233,49 @@ export enum KnownMetricUnit { // @public export enum KnownPFAction { - "continue" = "continue", - stop = "stop" + Continue = "continue", + Stop = "stop" } // @public export enum KnownPFAgFunc { - "p99.9" = "p99.9", - "p99.99" = "p99.99", - avg = "avg", - count = "count", - max = "max", - min = "min", - p50 = "p50", - p75 = "p75", - p90 = "p90", - p95 = "p95", - p96 = "p96", - p97 = "p97", - p98 = "p98", - p99 = "p99", - percentage = "percentage" + "P99.9" = "p99.9", + "P99.99" = "p99.99", + Avg = "avg", + Count = "count", + Max = "max", + Min = "min", + P50 = "p50", + P75 = "p75", + P90 = "p90", + P95 = "p95", + P96 = "p96", + P97 = "p97", + P98 = "p98", + P99 = "p99", + Percentage = "percentage" } // @public export enum KnownPFMetrics { - error = "error", - latency = "latency", - requests = "requests", - requests_per_sec = "requests_per_sec", - response_time_ms = "response_time_ms" + Error = "error", + Latency = "latency", + Requests = "requests", + RequestsPerSec = "requests_per_sec", + ResponseTimeMs = "response_time_ms" } // @public export enum KnownPFResult { - failed = "failed", - passed = "passed", - undetermined = "undetermined" + Failed = "failed", + Passed = "passed", + Undetermined = "undetermined" } // @public export enum KnownPFTestResult { FAILED = "FAILED", - NOT_APPLICABLE = "NOT_APPLICABLE", + NOTApplicable = "NOT_APPLICABLE", PASSED = "PASSED" } @@ -298,28 +298,28 @@ export enum KnownResourceKind { // @public export enum KnownSecretType { - AKV_SECRET_URI = "AKV_SECRET_URI", - SECRET_VALUE = "SECRET_VALUE" + AKVSECRETURI = "AKV_SECRET_URI", + SECRETVALUE = "SECRET_VALUE" } // @public export enum KnownStatus { - ACCEPTED = "ACCEPTED", - CANCELLED = "CANCELLED", - CANCELLING = "CANCELLING", - CONFIGURED = "CONFIGURED", - CONFIGURING = "CONFIGURING", - DEPROVISIONED = "DEPROVISIONED", - DEPROVISIONING = "DEPROVISIONING", + Accepted = "ACCEPTED", + Cancelled = "CANCELLED", + Cancelling = "CANCELLING", + Configured = "CONFIGURED", + Configuring = "CONFIGURING", + Deprovisioned = "DEPROVISIONED", + Deprovisioning = "DEPROVISIONING", DONE = "DONE", - EXECUTED = "EXECUTED", - EXECUTING = "EXECUTING", + Executed = "EXECUTED", + Executing = "EXECUTING", FAILED = "FAILED", - NOTSTARTED = "NOTSTARTED", - PROVISIONED = "PROVISIONED", - PROVISIONING = "PROVISIONING", - VALIDATION_FAILURE = "VALIDATION_FAILURE", - VALIDATION_SUCCESS = "VALIDATION_SUCCESS" + Notstarted = "NOTSTARTED", + Provisioned = "PROVISIONED", + Provisioning = "PROVISIONING", + ValidationFailure = "VALIDATION_FAILURE", + ValidationSuccess = "VALIDATION_SUCCESS" } // @public @@ -331,13 +331,13 @@ export enum KnownTestKind { // @public export enum KnownTestProfileRunStatus { - ACCEPTED = "ACCEPTED", - CANCELLED = "CANCELLED", - CANCELLING = "CANCELLING", + Accepted = "ACCEPTED", + Cancelled = "CANCELLED", + Cancelling = "CANCELLING", DONE = "DONE", - EXECUTING = "EXECUTING", + Executing = "EXECUTING", FAILED = "FAILED", - NOTSTARTED = "NOTSTARTED" + Notstarted = "NOTSTARTED" } // @public diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts index 943dbcc7bd..fb227a9558 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts @@ -220,15 +220,15 @@ export function passFailMetricDeserializer(item: any): PassFailMetric { /** Metrics for pass/fail criteria. */ export enum KnownPFMetrics { /** Pass fail criteria for response time metric in milliseconds. */ - response_time_ms = "response_time_ms", + ResponseTimeMs = "response_time_ms", /** Pass fail criteria for latency metric in milliseconds. */ - latency = "latency", + Latency = "latency", /** Pass fail criteria for error metric. */ - error = "error", + Error = "error", /** Pass fail criteria for total requests. */ - requests = "requests", + Requests = "requests", /** Pass fail criteria for request per second. */ - requests_per_sec = "requests_per_sec", + RequestsPerSec = "requests_per_sec", } /** @@ -247,35 +247,35 @@ export type PFMetrics = string; /** Aggregation functions for pass/fail criteria. */ export enum KnownPFAgFunc { /** Criteria applies for count value. */ - count = "count", + Count = "count", /** Criteria applies for given percentage value. */ - percentage = "percentage", + Percentage = "percentage", /** Criteria applies for avg value. */ - avg = "avg", + Avg = "avg", /** Criteria applies for 50th percentile value. */ - p50 = "p50", + P50 = "p50", /** Criteria applies for 75th percentile value. */ - p75 = "p75", + P75 = "p75", /** Criteria applies for 90th percentile value. */ - p90 = "p90", + P90 = "p90", /** Criteria applies for 95th percentile value. */ - p95 = "p95", + P95 = "p95", /** Criteria applies for 96th percentile value. */ - p96 = "p96", + P96 = "p96", /** Criteria applies for 97th percentile value. */ - p97 = "p97", + P97 = "p97", /** Criteria applies for 98th percentile value. */ - p98 = "p98", + P98 = "p98", /** Criteria applies for 99th percentile value. */ - p99 = "p99", + P99 = "p99", /** Criteria applies for 99.9th percentile value. */ - "p99.9" = "p99.9", + "P99.9" = "p99.9", /** Criteria applies for 99.99th percentile value. */ - "p99.99" = "p99.99", + "P99.99" = "p99.99", /** Criteria applies for minimum value. */ - min = "min", + Min = "min", /** Criteria applies for maximum value. */ - max = "max", + Max = "max", } /** @@ -304,9 +304,9 @@ export type PFAgFunc = string; /** Action to take on failure of pass/fail criteria. */ export enum KnownPFAction { /** Test will continue to run even if pass fail metric criteria metric gets failed. */ - "continue" = "continue", + Continue = "continue", /** Test run will stop if pass fail criteria metric is not passed. */ - stop = "stop", + Stop = "stop", } /** @@ -322,11 +322,11 @@ export type PFAction = string; /** Pass/fail criteria result. */ export enum KnownPFResult { /** Given pass fail criteria metric has passed. */ - passed = "passed", + Passed = "passed", /** Given pass fail criteria metric couldn't determine. */ - undetermined = "undetermined", + Undetermined = "undetermined", /** Given pass fail criteria metric has failed. */ - failed = "failed", + Failed = "failed", } /** @@ -408,9 +408,9 @@ export function secretDeserializer(item: any): Secret { /** Types of secrets supported. */ export enum KnownSecretType { /** If the secret is stored in an Azure Key Vault. */ - AKV_SECRET_URI = "AKV_SECRET_URI", + AKVSECRETURI = "AKV_SECRET_URI", /** If the secret value provided as plain text. */ - SECRET_VALUE = "SECRET_VALUE", + SECRETVALUE = "SECRET_VALUE", } /** @@ -450,7 +450,7 @@ export function certificateMetadataDeserializer( /** Types of certificates supported. */ export enum KnownCertificateType { /** If the certificate is stored in an Azure Key Vault. */ - AKV_CERT_URI = "AKV_CERT_URI", + AKVCERTURI = "AKV_CERT_URI", } /** @@ -672,17 +672,17 @@ export function testFileInfoDeserializer(item: any): TestFileInfo { /** Types of file supported. */ export enum KnownFileType { /** If the file is a JMX script. */ - JMX_FILE = "JMX_FILE", + JMXFILE = "JMX_FILE", /** If the file is a user properties file. */ - USER_PROPERTIES = "USER_PROPERTIES", + USERProperties = "USER_PROPERTIES", /** If the file is not among any of the other supported file types. */ - ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", + AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", /** If the file is a compressed archive containing a collection of various artifacts or resources. */ - ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS", + ZIPPEDArtifacts = "ZIPPED_ARTIFACTS", /** If the file is a JSON config file to define the requests for a URL test. */ - URL_TEST_CONFIG = "URL_TEST_CONFIG", + URLTESTCONFIG = "URL_TEST_CONFIG", /** If the file is a test script. */ - TEST_SCRIPT = "TEST_SCRIPT", + TESTSCRIPT = "TEST_SCRIPT", } /** @@ -702,15 +702,15 @@ export type FileType = string; /** File status. */ export enum KnownFileStatus { /** File is not validated. */ - NOT_VALIDATED = "NOT_VALIDATED", + NOTValidated = "NOT_VALIDATED", /** File is validated. */ - VALIDATION_SUCCESS = "VALIDATION_SUCCESS", + ValidationSuccess = "VALIDATION_SUCCESS", /** File validation is failed. */ - VALIDATION_FAILURE = "VALIDATION_FAILURE", + ValidationFailure = "VALIDATION_FAILURE", /** File validation is in progress. */ - VALIDATION_INITIATED = "VALIDATION_INITIATED", + ValidationInitiated = "VALIDATION_INITIATED", /** Validation is not required. */ - VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", + ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", } /** @@ -1432,7 +1432,7 @@ export enum KnownPFTestResult { /** Pass/fail criteria has passed. */ PASSED = "PASSED", /** Pass/fail criteria is not applicable. */ - NOT_APPLICABLE = "NOT_APPLICABLE", + NOTApplicable = "NOT_APPLICABLE", /** Pass/fail criteria has failed. */ FAILED = "FAILED", } @@ -1451,37 +1451,37 @@ export type PFTestResult = string; /** Test run status. */ export enum KnownStatus { /** Test run request is accepted. */ - ACCEPTED = "ACCEPTED", + Accepted = "ACCEPTED", /** Test run is not yet started. */ - NOTSTARTED = "NOTSTARTED", + Notstarted = "NOTSTARTED", /** Test run is provisioning. */ - PROVISIONING = "PROVISIONING", + Provisioning = "PROVISIONING", /** Test run is provisioned. */ - PROVISIONED = "PROVISIONED", + Provisioned = "PROVISIONED", /** Test run is getting configured. */ - CONFIGURING = "CONFIGURING", + Configuring = "CONFIGURING", /** Test run configuration is done. */ - CONFIGURED = "CONFIGURED", + Configured = "CONFIGURED", /** Test run has started executing. */ - EXECUTING = "EXECUTING", + Executing = "EXECUTING", /** Test run execution is completed. */ - EXECUTED = "EXECUTED", + Executed = "EXECUTED", /** Test run is getting deprovisioned. */ - DEPROVISIONING = "DEPROVISIONING", + Deprovisioning = "DEPROVISIONING", /** Test run is deprovisioned. */ - DEPROVISIONED = "DEPROVISIONED", + Deprovisioned = "DEPROVISIONED", /** Test run is completed. */ DONE = "DONE", /** Test run is being cancelled. */ - CANCELLING = "CANCELLING", + Cancelling = "CANCELLING", /** Test run request is cancelled. */ - CANCELLED = "CANCELLED", + Cancelled = "CANCELLED", /** Test run request is failed. */ FAILED = "FAILED", /** Test run JMX file is validated. */ - VALIDATION_SUCCESS = "VALIDATION_SUCCESS", + ValidationSuccess = "VALIDATION_SUCCESS", /** Test run JMX file validation is failed. */ - VALIDATION_FAILURE = "VALIDATION_FAILURE", + ValidationFailure = "VALIDATION_FAILURE", } /** @@ -2407,17 +2407,17 @@ export function testProfileRunDeserializer(item: any): TestProfileRun { /** Test profile run status. */ export enum KnownTestProfileRunStatus { /** Test profile run request is accepted. */ - ACCEPTED = "ACCEPTED", + Accepted = "ACCEPTED", /** Test profile run is not yet started. */ - NOTSTARTED = "NOTSTARTED", + Notstarted = "NOTSTARTED", /** Test profile run has started executing. */ - EXECUTING = "EXECUTING", + Executing = "EXECUTING", /** Test profile run has completed successfully. */ DONE = "DONE", /** Test profile run is being cancelled. */ - CANCELLING = "CANCELLING", + Cancelling = "CANCELLING", /** Test profile run is cancelled. */ - CANCELLED = "CANCELLED", + Cancelled = "CANCELLED", /** Test profile run has failed. */ FAILED = "FAILED", } @@ -2548,11 +2548,11 @@ export function testProfileRunArrayDeserializer( /** Azure Load Testing API versions. */ export enum KnownAPIVersions { /** The 2022-11-01 version of the Azure Load Testing API. */ - v2022_11_01 = "2022-11-01", + V2022_11_01 = "2022-11-01", /** The 2023-04-01-preview version of the Azure Load Testing API. */ - v2023_04_01_preview = "2023-04-01-preview", + V2023_04_01_Preview = "2023-04-01-preview", /** The 2024-03-01-preview version of the Azure Load Testing API. */ - v2024_03_01_preview = "2024-03-01-preview", + V2024_03_01_Preview = "2024-03-01-preview", /** The 2024-05-01-preview version of the Azure Load Testing API. */ - v2024_05_01_preview = "2024-05-01-preview", + V2024_05_01_Preview = "2024-05-01-preview", } diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/LICENSE b/packages/typespec-test/test/openai/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/openai/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/LICENSE b/packages/typespec-test/test/openai_generic/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/LICENSE b/packages/typespec-test/test/openai_modular/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md index 4766f76ba8..fd199063ae 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md @@ -823,13 +823,13 @@ export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "102 // @public export enum KnownServiceApiVersions { // (undocumented) - v2022_12_01 = "2022-12-01", + V2022_12_01 = "2022-12-01", // (undocumented) - v2023_05_15 = "2023-05-15", + V2023_05_15 = "2023-05-15", // (undocumented) - v2024_02_01 = "2024-02-01", + V2024_02_01 = "2024-02-01", // (undocumented) - v2024_06_01 = "2024-06-01" + V2024_06_01 = "2024-06-01" } // @public diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts index 75c3fd4e82..a37ac049dc 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts @@ -3865,8 +3865,8 @@ export function embeddingsUsageDeserializer(item: any): EmbeddingsUsage { /** Known values of {@link ServiceApiVersions} that the service accepts. */ export enum KnownServiceApiVersions { - v2022_12_01 = "2022-12-01", - v2023_05_15 = "2023-05-15", - v2024_02_01 = "2024-02-01", - v2024_06_01 = "2024-06-01", + V2022_12_01 = "2022-12-01", + V2023_05_15 = "2023-05-15", + V2024_02_01 = "2024-02-01", + V2024_06_01 = "2024-06-01", } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/LICENSE b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index 8f54a36e38..8d4a0845d3 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -302,29 +302,29 @@ export interface CreateModerationResponse { flagged: boolean; categories: { hate: boolean; - "hate/threatening": boolean; + hateThreatening: boolean; harassment: boolean; - "harassment/threatening": boolean; + harassmentThreatening: boolean; selfHarm: boolean; - "selfHarm/intent": boolean; - "selfHarm/instructive": boolean; + selfHarmIntent: boolean; + selfHarmInstructive: boolean; sexual: boolean; - "sexual/minors": boolean; + sexualMinors: boolean; violence: boolean; - "violence/graphic": boolean; + violenceGraphic: boolean; }; categoryScores: { hate: number; - "hate/threatening": number; + hateThreatening: number; harassment: number; - "harassment/threatening": number; + harassmentThreatening: number; selfHarm: number; - "selfHarm/intent": number; - "selfHarm/instructive": number; + selfHarmIntent: number; + selfHarmInstructive: number; sexual: number; - "sexual/minors": number; + sexualMinors: number; violence: number; - "violence/graphic": number; + violenceGraphic: number; }; }[]; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index db2a532e2c..24d90de7ad 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -48,29 +48,29 @@ export interface CreateModerationResponse { flagged: boolean; categories: { hate: boolean; - "hate/threatening": boolean; + hateThreatening: boolean; harassment: boolean; - "harassment/threatening": boolean; + harassmentThreatening: boolean; selfHarm: boolean; - "selfHarm/intent": boolean; - "selfHarm/instructive": boolean; + selfHarmIntent: boolean; + selfHarmInstructive: boolean; sexual: boolean; - "sexual/minors": boolean; + sexualMinors: boolean; violence: boolean; - "violence/graphic": boolean; + violenceGraphic: boolean; }; categoryScores: { hate: number; - "hate/threatening": number; + hateThreatening: number; harassment: number; - "harassment/threatening": number; + harassmentThreatening: number; selfHarm: number; - "selfHarm/intent": number; - "selfHarm/instructive": number; + selfHarmIntent: number; + selfHarmInstructive: number; sexual: number; - "sexual/minors": number; + sexualMinors: number; violence: number; - "violence/graphic": number; + violenceGraphic: number; }; }[]; } @@ -100,30 +100,30 @@ export interface _CreateModerationResponseResult { /** A list of the categories, and whether they are flagged or not. */ categories: { hate: boolean; - "hate/threatening": boolean; + hateThreatening: boolean; harassment: boolean; - "harassment/threatening": boolean; + harassmentThreatening: boolean; selfHarm: boolean; - "selfHarm/intent": boolean; - "selfHarm/instructive": boolean; + selfHarmIntent: boolean; + selfHarmInstructive: boolean; sexual: boolean; - "sexual/minors": boolean; + sexualMinors: boolean; violence: boolean; - "violence/graphic": boolean; + violenceGraphic: boolean; }; /** A list of the categories along with their scores as predicted by model. */ categoryScores: { hate: number; - "hate/threatening": number; + hateThreatening: number; harassment: number; - "harassment/threatening": number; + harassmentThreatening: number; selfHarm: number; - "selfHarm/intent": number; - "selfHarm/instructive": number; + selfHarmIntent: number; + selfHarmInstructive: number; sexual: number; - "sexual/minors": number; + sexualMinors: number; violence: number; - "violence/graphic": number; + violenceGraphic: number; }; } @@ -154,11 +154,11 @@ export interface _CreateModerationResponseResultCategories { * based on race, gender, ethnicity, religion, nationality, sexual orientation, disability * status, or caste. */ - "hate/threatening": boolean; + hateThreatening: boolean; /** Content that expresses, incites, or promotes harassing language towards any target. */ harassment: boolean; /** Harassment content that also includes violence or serious harm towards any target. */ - "harassment/threatening": boolean; + harassmentThreatening: boolean; /** * Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, * and eating disorders. @@ -168,23 +168,23 @@ export interface _CreateModerationResponseResultCategories { * Content where the speaker expresses that they are engaging or intend to engage in acts of * self-harm, such as suicide, cutting, and eating disorders. */ - "selfHarm/intent": boolean; + selfHarmIntent: boolean; /** * Content that encourages performing acts of self-harm, such as suicide, cutting, and eating * disorders, or that gives instructions or advice on how to commit such acts. */ - "selfHarm/instructive": boolean; + selfHarmInstructive: boolean; /** * Content meant to arouse sexual excitement, such as the description of sexual activity, or * that promotes sexual services (excluding sex education and wellness). */ sexual: boolean; /** Sexual content that includes an individual who is under 18 years old. */ - "sexual/minors": boolean; + sexualMinors: boolean; /** Content that depicts death, violence, or physical injury. */ violence: boolean; /** Content that depicts death, violence, or physical injury in graphic detail. */ - "violence/graphic": boolean; + violenceGraphic: boolean; } export function _createModerationResponseResultCategoriesDeserializer( @@ -192,16 +192,16 @@ export function _createModerationResponseResultCategoriesDeserializer( ): _CreateModerationResponseResultCategories { return { hate: item["hate"], - "hate/threatening": item["hate/threatening"], + hateThreatening: item["hate/threatening"], harassment: item["harassment"], - "harassment/threatening": item["harassment/threatening"], + harassmentThreatening: item["harassment/threatening"], selfHarm: item["self-harm"], - "selfHarm/intent": item["self-harm/intent"], - "selfHarm/instructive": item["self-harm/instructive"], + selfHarmIntent: item["self-harm/intent"], + selfHarmInstructive: item["self-harm/instructive"], sexual: item["sexual"], - "sexual/minors": item["sexual/minors"], + sexualMinors: item["sexual/minors"], violence: item["violence"], - "violence/graphic": item["violence/graphic"], + violenceGraphic: item["violence/graphic"], }; } @@ -210,25 +210,25 @@ export interface _CreateModerationResponseResultCategoryScores { /** The score for the category 'hate'. */ hate: number; /** The score for the category 'hate/threatening'. */ - "hate/threatening": number; + hateThreatening: number; /** The score for the category 'harassment'. */ harassment: number; /** The score for the category 'harassment/threatening'. */ - "harassment/threatening": number; + harassmentThreatening: number; /** The score for the category 'self-harm'. */ selfHarm: number; /** The score for the category 'self-harm/intent'. */ - "selfHarm/intent": number; + selfHarmIntent: number; /** The score for the category 'self-harm/instructive'. */ - "selfHarm/instructive": number; + selfHarmInstructive: number; /** The score for the category 'sexual'. */ sexual: number; /** The score for the category 'sexual/minors'. */ - "sexual/minors": number; + sexualMinors: number; /** The score for the category 'violence'. */ violence: number; /** The score for the category 'violence/graphic'. */ - "violence/graphic": number; + violenceGraphic: number; } export function _createModerationResponseResultCategoryScoresDeserializer( @@ -236,16 +236,16 @@ export function _createModerationResponseResultCategoryScoresDeserializer( ): _CreateModerationResponseResultCategoryScores { return { hate: item["hate"], - "hate/threatening": item["hate/threatening"], + hateThreatening: item["hate/threatening"], harassment: item["harassment"], - "harassment/threatening": item["harassment/threatening"], + harassmentThreatening: item["harassment/threatening"], selfHarm: item["self-harm"], - "selfHarm/intent": item["self-harm/intent"], - "selfHarm/instructive": item["self-harm/instructive"], + selfHarmIntent: item["self-harm/intent"], + selfHarmInstructive: item["self-harm/instructive"], sexual: item["sexual"], - "sexual/minors": item["sexual/minors"], + sexualMinors: item["sexual/minors"], violence: item["violence"], - "violence/graphic": item["violence/graphic"], + violenceGraphic: item["violence/graphic"], }; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/LICENSE b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md index 5eeac5fad9..e92d904e5f 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md @@ -26,7 +26,7 @@ export interface FooOperationsOperations { // @public export enum KnownVersions { - "2022-08-30" = "2022-08-30" + "V2022-08-30" = "2022-08-30" } // @public (undocumented) diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts index 925644a159..af52f2870d 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts @@ -4,5 +4,5 @@ /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - "2022-08-30" = "2022-08-30", + "V2022-08-30" = "2022-08-30", } diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/LICENSE b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/LICENSE b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/spread/generated/typespec-ts/LICENSE b/packages/typespec-test/test/spread/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/spread/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/spread/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/LICENSE b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/translator/generated/typespec-ts/LICENSE b/packages/typespec-test/test/translator/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/translator/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/translator/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/LICENSE b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/LICENSE index 7d59347409..2ad4de7b17 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/LICENSE +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024 Microsoft +Copyright (c) 2025 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md index 2c61b4933b..0ba703c6c2 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md @@ -36,7 +36,7 @@ export type ContinuablePage = TPage & { // @public export enum KnownVersions { - "1.0.0" = "1.0.0" + "V1.0.0" = "1.0.0" } // @public diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts index b5bb89bee6..894805a8e7 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts @@ -97,5 +97,5 @@ export function nonReferencedModelDeserializer(item: any): NonReferencedModel { /** The Contoso Widget Manager service version. */ export enum KnownVersions { /** Version 2022-08-31 */ - "1.0.0" = "1.0.0", + "V1.0.0" = "1.0.0", } From 1a4cf90a78e47d7b36cd0f5eb14e8d2081197259 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 7 Jan 2025 11:22:03 +0800 Subject: [PATCH 80/91] Revert the fix and split it into a new repo --- packages/typespec-ts/src/utils/modelUtils.ts | 58 +++++++++----------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/packages/typespec-ts/src/utils/modelUtils.ts b/packages/typespec-ts/src/utils/modelUtils.ts index 5761fe8d82..eea560afa9 100644 --- a/packages/typespec-ts/src/utils/modelUtils.ts +++ b/packages/typespec-ts/src/utils/modelUtils.ts @@ -605,7 +605,8 @@ function getSchemaForModel( } const program = dpgContext.program; - const friendlyModelName = getFriendlyName(program, model); + const overridedModelName = + getFriendlyName(program, model) ?? getWireName(dpgContext, model); const fullNamespaceName = getModelNamespaceName(dpgContext, model.namespace!) .map((nsName) => { @@ -614,36 +615,28 @@ function getSchemaForModel( .join("") + model.name; let name = model.name; if ( - !friendlyModelName && + !overridedModelName && model.templateMapper && model.templateMapper.args && - model.templateMapper.args.length > 0 + model.templateMapper.args.length > 0 && + getPagedResult(program, model) ) { - const isPagedTemplate = getPagedResult(program, model); - const templateTypes = model.templateMapper.args - .filter((it) => isType(it) || it.entityKind === "Indeterminate") - .map((it) => - it.entityKind === "Indeterminate" ? it.type : it - ) as Type[]; - const templateNamePart = templateTypes - .map((it: Type) => { - switch (it.kind) { - case "Model": - return it.name; - case "String": - case "Boolean": - case "Number": - return it.value; - case "Scalar": - return it.name; - default: - return ""; - } - }) - .join(""); - name = isPagedTemplate - ? `${templateNamePart} List` - : `${name} ${templateNamePart}`; + const templateTypes = model.templateMapper.args.filter((it) => + isType(it) + ) as Type[]; + name = + templateTypes + .map((it: Type) => { + switch (it.kind) { + case "Model": + return it.name; + case "String": + return it.value; + default: + return ""; + } + }) + .join("") + "List"; } const isMultipartBody = isMediaTypeMultipartFormData(contentTypes ?? []); @@ -652,16 +645,17 @@ function getSchemaForModel( const modelSchema: ObjectSchema = { name: isCoreModel ? name - : (friendlyModelName ?? - (dpgContext.rlcOptions?.enableModelNamespace + : overridedModelName !== name + ? overridedModelName + : dpgContext.rlcOptions?.enableModelNamespace ? fullNamespaceName - : name)), + : name, type: "object", isMultipartBody, description: getDoc(program, model) ?? "", fromCore: isCoreModel }; - // normalized the name + // normalized the output name modelSchema.name = normalizeName( modelSchema.name, NameType.Interface, From 3c168ff9bb37f78d374f251b876ec84de1a65904 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 7 Jan 2025 13:59:29 +0800 Subject: [PATCH 81/91] Update a dictionary to improve splitting words --- packages/rlc-common/src/helpers/nameUtils.ts | 54 +- .../rlc-common/src/helpers/wordListUtil.ts | 12 + .../rlc-common/test/helpers/nameUtils.spec.ts | 25 +- packages/rlc-common/wordList.txt | 10000 ++++++++++++++++ 4 files changed, 10077 insertions(+), 14 deletions(-) create mode 100644 packages/rlc-common/src/helpers/wordListUtil.ts create mode 100644 packages/rlc-common/wordList.txt diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 3bc6367952..fa6c4c4891 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import { isValidWord } from "./wordListUtil.js"; + export interface NormalizeNameOption { shouldGuard?: boolean; customReservedNames?: ReservedName[]; @@ -240,34 +242,66 @@ function deconstruct(identifier: string, nameType: NameType): Array { // Split by non-alphanumeric characters and try to keep _-. between numbers const refinedParts: string[] = []; for (let i = 0; i < parts.length; i++) { - const [firstMatch, midPart, lastMatch] = extractReservedCharAndSubString( + const [formerReserved, part, latterReserved] = extractPartWithReserved( parts[i], nameType, parts[i - 1] === undefined ? true : isNumber(parts[i - 1]), parts[i + 1] === undefined ? true : isNumber(parts[i + 1]) ); - if (firstMatch) { - refinedParts.push(firstMatch); + if (formerReserved) { + refinedParts.push(formerReserved); } - if (midPart) { + if (part) { refinedParts.push( - ...midPart - .split(/[\W|_]+/) - .map((each) => (isFullyUpperCase(each) ? each : each.toLowerCase())) + ...deconstructPart(part) ); } - if (lastMatch) { - refinedParts.push(lastMatch); + if (latterReserved) { + refinedParts.push(latterReserved); } } return refinedParts.filter((part) => part.trim().length > 0); } +function deconstructPart(text: string): string[] { + const parts = text + .split(/[\W|_]+/) + const res = []; + for (const part of parts) { + const isUpperCase = isFullyUpperCase(part); + const isValid = isValidWord(part); + if (isValid) { + res.push(part.toLowerCase()); + } else if (isUpperCase && !isValid) { + res.push(part); + } else { + // try to deconstruct further + res.push(...tryDeconstructPart(part.toLowerCase())); + } + } + + return res; +} + +function tryDeconstructPart(text: string = ""): string[] { + if (text.length <= 6) { + return [text]; + } + for (let i = 3; i < text.length - 2; i++) { + const left = text.substring(0, i); + const right = text.substring(i); + if (isValidWord(left) && isValidWord(right)) { + return [left, right]; + } + } + return [text]; +} + function isReservedChar(part: string) { return ["_", "-", "."].includes(part); } -function extractReservedCharAndSubString( +function extractPartWithReserved( part: string, nameType: NameType, isPrevNumber: boolean = false, diff --git a/packages/rlc-common/src/helpers/wordListUtil.ts b/packages/rlc-common/src/helpers/wordListUtil.ts new file mode 100644 index 0000000000..760fed6642 --- /dev/null +++ b/packages/rlc-common/src/helpers/wordListUtil.ts @@ -0,0 +1,12 @@ +import * as fs from 'fs'; + +const dictionary = new Set(fs.readFileSync('./wordList.txt', 'utf8').split(/[\r\n]+/)); + +/** + * Check if a word is valid, true if it is in the dictionary + * @param word + * @returns boolean + */ +export function isValidWord(word: string = ""): boolean { + return dictionary.has(word.toLowerCase()); +} diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index 80df0f9dce..f3ddc7d056 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -4,6 +4,23 @@ import { NameType, normalizeName } from "../../src/helpers/nameUtils.js"; describe("#normalizeName", () => { describe("for enum member name", () => { + it("should normalize upper cases properly", () => { + expect(normalizeName("requests_per_sec", NameType.EnumMemberName)).to.equal("RequestsPerSec"); + expect(normalizeName("HA123", NameType.EnumMemberName)).to.equal("HA123"); + expect(normalizeName("NHELLO", NameType.EnumMemberName)).to.equal("NHELLO"); + expect(normalizeName("NHELLOA", NameType.EnumMemberName)).to.equal("Nhelloa"); + expect(normalizeName("NO_HELLO", NameType.EnumMemberName)).to.equal("NoHello"); + expect(normalizeName("NOHELLO", NameType.EnumMemberName)).to.equal("NoHello"); + expect(normalizeName("nohello", NameType.EnumMemberName)).to.equal("NoHello"); + expect(normalizeName("hellono", NameType.EnumMemberName)).to.equal("HelloNo"); + expect(normalizeName("TEST_SCRIPT", NameType.EnumMemberName)).to.equal("TestScript"); + expect(normalizeName("TESTSCRIPT", NameType.EnumMemberName)).to.equal("TestScript"); + expect(normalizeName("testscript", NameType.EnumMemberName)).to.equal("TestScript"); + expect(normalizeName("NOT_VALIDATED", NameType.EnumMemberName)).to.equal("NotValidated"); + expect(normalizeName("NOTVALIDATED", NameType.EnumMemberName)).to.equal("NotValidated"); + expect(normalizeName("notvalidated", NameType.EnumMemberName)).to.equal("NotValidated"); + expect(normalizeName("validatednot", NameType.EnumMemberName)).to.equal("ValidatedNot"); + }); it("should normalize any chars including digits properly", () => { expect(normalizeName("-10Min", NameType.EnumMemberName)).to.equal("Num-10Min"); expect(normalizeName("LROsPut202Retry200_202Response", NameType.EnumMemberName)).to.equal("LROsPut202Retry200_202Response"); @@ -49,7 +66,7 @@ describe("#normalizeName", () => { expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName)).to.equal("AKVCertURI"); expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName)).to.equal("AzureOpenAIOperationStateOutput"); expect(normalizeName("TSModel", NameType.EnumMemberName)).to.equal("TSModel"); - expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName)).to.equal("ValidationNOTRequired"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName)).to.equal("ValidationNotRequired"); expect(normalizeName("ValidationNotRequired", NameType.EnumMemberName)).to.equal("ValidationNotRequired"); expect(normalizeName("KnownPFTestResult", NameType.EnumMemberName)).to.equal("KnownPFTestResult"); expect(normalizeName("repeatabilityRequestID", NameType.EnumMemberName)).to.equal("RepeatabilityRequestID"); @@ -105,7 +122,7 @@ describe("#normalizeName", () => { expect(normalizeName("AKV_cert_URI", NameType.Property)).to.equal("akvCertURI"); expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.Property)).to.equal("azureOpenAIOperationStateOutput"); expect(normalizeName("TSModel", NameType.Property)).to.equal("tsModel"); - expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.Property)).to.equal("validationNOTRequired"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.Property)).to.equal("validationNotRequired"); expect(normalizeName("ValidationNotRequired", NameType.Property)).to.equal("validationNotRequired"); expect(normalizeName("KnownPFTestResult", NameType.Property)).to.equal("knownPFTestResult"); expect(normalizeName("repeatabilityRequestID", NameType.Property)).to.equal("repeatabilityRequestID"); @@ -168,8 +185,8 @@ describe("#normalizeName", () => { it("should normalize the name", () => { expect( - normalizeName("create_ wideget", NameType.Parameter,) - ).to.equal("createWideget"); + normalizeName("create_ widget", NameType.Parameter,) + ).to.equal("createWidget"); }); }); diff --git a/packages/rlc-common/wordList.txt b/packages/rlc-common/wordList.txt new file mode 100644 index 0000000000..3164d7bf96 --- /dev/null +++ b/packages/rlc-common/wordList.txt @@ -0,0 +1,10000 @@ +the +of +and +to +a +in +for +is +on +that +by +this +with +i +you +it +not +or +be +are +from +at +as +your +all +have +new +more +an +was +we +will +home +can +us +about +if +page +my +has +search +free +but +our +one +other +do +no +information +time +they +site +he +up +may +what +which +their +news +out +use +any +there +see +only +so +his +when +contact +here +business +who +web +also +now +help +get +pm +view +online +c +e +first +am +been +would +how +were +me +s +services +some +these +click +its +like +service +x +than +find +price +date +back +top +people +had +list +name +just +over +state +year +day +into +email +two +health +n +world +re +next +used +go +b +work +last +most +products +music +buy +data +make +them +should +product +system +post +her +city +t +add +policy +number +such +please +available +copyright +support +message +after +best +software +then +jan +good +video +well +d +where +info +rights +public +books +high +school +through +m +each +links +she +review +years +order +very +privacy +book +items +company +r +read +group +sex +need +many +user +said +de +does +set +under +general +research +university +january +mail +full +map +reviews +program +life +know +games +way +days +management +p +part +could +great +united +hotel +real +f +item +international +center +ebay +must +store +travel +comments +made +development +report +off +member +details +line +terms +before +hotels +did +send +right +type +because +local +those +using +results +office +education +national +car +design +take +posted +internet +address +community +within +states +area +want +phone +dvd +shipping +reserved +subject +between +forum +family +l +long +based +w +code +show +o +even +black +check +special +prices +website +index +being +women +much +sign +file +link +open +today +technology +south +case +project +same +pages +uk +version +section +own +found +sports +house +related +security +both +g +county +american +photo +game +members +power +while +care +network +down +computer +systems +three +total +place +end +following +download +h +him +without +per +access +think +north +resources +current +posts +big +media +law +control +water +history +pictures +size +art +personal +since +including +guide +shop +directory +board +location +change +white +text +small +rating +rate +government +children +during +usa +return +students +v +shopping +account +times +sites +level +digital +profile +previous +form +events +love +old +john +main +call +hours +image +department +title +description +non +k +y +insurance +another +why +shall +property +class +cd +still +money +quality +every +listing +content +country +private +little +visit +save +tools +low +reply +customer +december +compare +movies +include +college +value +article +york +man +card +jobs +provide +j +food +source +author +different +press +u +learn +sale +around +print +course +job +canada +process +teen +room +stock +training +too +credit +point +join +science +men +categories +advanced +west +sales +look +english +left +team +estate +box +conditions +select +windows +photos +gay +thread +week +category +note +live +large +gallery +table +register +however +june +october +november +market +library +really +action +start +series +model +features +air +industry +plan +human +provided +tv +yes +required +second +hot +accessories +cost +movie +forums +march +la +september +better +say +questions +july +yahoo +going +medical +test +friend +come +dec +server +pc +study +application +cart +staff +articles +san +feedback +again +play +looking +issues +april +never +users +complete +street +topic +comment +financial +things +working +against +standard +tax +person +below +mobile +less +got +blog +party +payment +equipment +login +student +let +programs +offers +legal +above +recent +park +stores +side +act +problem +red +give +memory +performance +social +q +august +quote +language +story +sell +options +experience +rates +create +key +body +young +america +important +field +few +east +paper +single +ii +age +activities +club +example +girls +additional +password +z +latest +something +road +gift +question +changes +night +ca +hard +texas +oct +pay +four +poker +status +browse +issue +range +building +seller +court +february +always +result +audio +light +write +war +nov +offer +blue +groups +al +easy +given +files +event +release +analysis +request +fax +china +making +picture +needs +possible +might +professional +yet +month +major +star +areas +future +space +committee +hand +sun +cards +problems +london +washington +meeting +rss +become +interest +id +child +keep +enter +california +porn +share +similar +garden +schools +million +added +reference +companies +listed +baby +learning +energy +run +delivery +net +popular +term +film +stories +put +computers +journal +reports +co +try +welcome +central +images +president +notice +god +original +head +radio +until +cell +color +self +council +away +includes +track +australia +discussion +archive +once +others +entertainment +agreement +format +least +society +months +log +safety +friends +sure +faq +trade +edition +cars +messages +marketing +tell +further +updated +association +able +having +provides +david +fun +already +green +studies +close +common +drive +specific +several +gold +feb +living +sep +collection +called +short +arts +lot +ask +display +limited +powered +solutions +means +director +daily +beach +past +natural +whether +due +et +electronics +five +upon +period +planning +database +says +official +weather +mar +land +average +done +technical +window +france +pro +region +island +record +direct +microsoft +conference +environment +records +st +district +calendar +costs +style +url +front +statement +update +parts +aug +ever +downloads +early +miles +sound +resource +present +applications +either +ago +document +word +works +material +bill +apr +written +talk +federal +hosting +rules +final +adult +tickets +thing +centre +requirements +via +cheap +nude +kids +finance +true +minutes +else +mark +third +rock +gifts +europe +reading +topics +bad +individual +tips +plus +auto +cover +usually +edit +together +videos +percent +fast +function +fact +unit +getting +global +tech +meet +far +economic +en +player +projects +lyrics +often +subscribe +submit +germany +amount +watch +included +feel +though +bank +risk +thanks +everything +deals +various +words +linux +jul +production +commercial +james +weight +town +heart +advertising +received +choose +treatment +newsletter +archives +points +knowledge +magazine +error +camera +jun +girl +currently +construction +toys +registered +clear +golf +receive +domain +methods +chapter +makes +protection +policies +loan +wide +beauty +manager +india +position +taken +sort +listings +models +michael +known +half +cases +step +engineering +florida +simple +quick +none +wireless +license +paul +friday +lake +whole +annual +published +later +basic +sony +shows +corporate +google +church +method +purchase +customers +active +response +practice +hardware +figure +materials +fire +holiday +chat +enough +designed +along +among +death +writing +speed +html +countries +loss +face +brand +discount +higher +effects +created +remember +standards +oil +bit +yellow +political +increase +advertise +kingdom +base +near +environmental +thought +stuff +french +storage +oh +japan +doing +loans +shoes +entry +stay +nature +orders +availability +africa +summary +turn +mean +growth +notes +agency +king +monday +european +activity +copy +although +drug +pics +western +income +force +cash +employment +overall +bay +river +commission +ad +package +contents +seen +players +engine +port +album +regional +stop +supplies +started +administration +bar +institute +views +plans +double +dog +build +screen +exchange +types +soon +sponsored +lines +electronic +continue +across +benefits +needed +season +apply +someone +held +ny +anything +printer +condition +effective +believe +organization +effect +asked +eur +mind +sunday +selection +casino +pdf +lost +tour +menu +volume +cross +anyone +mortgage +hope +silver +corporation +wish +inside +solution +mature +role +rather +weeks +addition +came +supply +nothing +certain +usr +executive +running +lower +necessary +union +jewelry +according +dc +clothing +mon +com +particular +fine +names +robert +homepage +hour +gas +skills +six +bush +islands +advice +career +military +rental +decision +leave +british +teens +pre +huge +sat +woman +facilities +zip +bid +kind +sellers +middle +move +cable +opportunities +taking +values +division +coming +tuesday +object +lesbian +appropriate +machine +logo +length +actually +nice +score +statistics +client +ok +returns +capital +follow +sample +investment +sent +shown +saturday +christmas +england +culture +band +flash +ms +lead +george +choice +went +starting +registration +fri +thursday +courses +consumer +hi +airport +foreign +artist +outside +furniture +levels +channel +letter +mode +phones +ideas +wednesday +structure +fund +summer +allow +degree +contract +button +releases +wed +homes +super +male +matter +custom +virginia +almost +took +located +multiple +asian +distribution +editor +inn +industrial +cause +potential +song +cnet +ltd +los +hp +focus +late +fall +featured +idea +rooms +female +responsible +inc +communications +win +associated +thomas +primary +cancer +numbers +reason +tool +browser +spring +foundation +answer +voice +eg +friendly +schedule +documents +communication +purpose +feature +bed +comes +police +everyone +independent +ip +approach +cameras +brown +physical +operating +hill +maps +medicine +deal +hold +ratings +chicago +forms +glass +happy +tue +smith +wanted +developed +thank +safe +unique +survey +prior +telephone +sport +ready +feed +animal +sources +mexico +population +pa +regular +secure +navigation +operations +therefore +ass +simply +evidence +station +christian +round +paypal +favorite +understand +option +master +valley +recently +probably +thu +rentals +sea +built +publications +blood +cut +worldwide +improve +connection +publisher +hall +larger +anti +networks +earth +parents +nokia +impact +transfer +introduction +kitchen +strong +tel +carolina +wedding +properties +hospital +ground +overview +ship +accommodation +owners +disease +tx +excellent +paid +italy +perfect +hair +opportunity +kit +classic +basis +command +cities +william +express +anal +award +distance +tree +peter +assessment +ensure +thus +wall +ie +involved +el +extra +especially +interface +pussy +partners +budget +rated +guides +success +maximum +ma +operation +existing +quite +selected +boy +amazon +patients +restaurants +beautiful +warning +wine +locations +horse +vote +forward +flowers +stars +significant +lists +technologies +owner +retail +animals +useful +directly +manufacturer +ways +est +son +providing +rule +mac +housing +takes +iii +gmt +bring +catalog +searches +max +trying +mother +authority +considered +told +xml +traffic +programme +joined +input +strategy +feet +agent +valid +bin +modern +senior +ireland +sexy +teaching +door +grand +testing +trial +charge +units +instead +canadian +cool +normal +wrote +enterprise +ships +entire +educational +md +leading +metal +positive +fl +fitness +chinese +opinion +mb +asia +football +abstract +uses +output +funds +mr +greater +likely +develop +employees +artists +alternative +processing +responsibility +resolution +java +guest +seems +publication +pass +relations +trust +van +contains +session +multi +photography +republic +fees +components +vacation +century +academic +assistance +completed +skin +graphics +indian +prev +ads +mary +il +expected +ring +grade +dating +pacific +mountain +organizations +pop +filter +mailing +vehicle +longer +consider +int +northern +behind +panel +floor +german +buying +match +proposed +default +require +iraq +boys +outdoor +deep +morning +otherwise +allows +rest +protein +plant +reported +hit +transportation +mm +pool +mini +politics +partner +disclaimer +authors +boards +faculty +parties +fish +membership +mission +eye +string +sense +modified +pack +released +stage +internal +goods +recommended +born +unless +richard +detailed +japanese +race +approved +background +target +except +character +usb +maintenance +ability +maybe +functions +ed +moving +brands +places +php +pretty +trademarks +phentermine +spain +southern +yourself +etc +winter +rape +battery +youth +pressure +submitted +boston +incest +debt +keywords +medium +television +interested +core +break +purposes +throughout +sets +dance +wood +msn +itself +defined +papers +playing +awards +fee +studio +reader +virtual +device +established +answers +rent +las +remote +dark +programming +external +apple +le +regarding +instructions +min +offered +theory +enjoy +remove +aid +surface +minimum +visual +host +variety +teachers +isbn +martin +manual +block +subjects +agents +increased +repair +fair +civil +steel +understanding +songs +fixed +wrong +beginning +hands +associates +finally +az +updates +desktop +classes +paris +ohio +gets +sector +capacity +requires +jersey +un +fat +fully +father +electric +saw +instruments +quotes +officer +driver +businesses +dead +respect +unknown +specified +restaurant +mike +trip +pst +worth +mi +procedures +poor +teacher +xxx +eyes +relationship +workers +farm +fucking +georgia +peace +traditional +campus +tom +showing +creative +coast +benefit +progress +funding +devices +lord +grant +sub +agree +fiction +hear +sometimes +watches +careers +beyond +goes +families +led +museum +themselves +fan +transport +interesting +blogs +wife +evaluation +accepted +former +implementation +ten +hits +zone +complex +th +cat +galleries +references +die +presented +jack +flat +flow +agencies +literature +respective +parent +spanish +michigan +columbia +setting +dr +scale +stand +economy +highest +helpful +monthly +critical +frame +musical +definition +secretary +angeles +networking +path +australian +employee +chief +gives +kb +bottom +magazines +packages +detail +francisco +laws +changed +pet +heard +begin +individuals +colorado +royal +clean +switch +russian +largest +african +guy +titles +relevant +guidelines +justice +connect +bible +dev +cup +basket +applied +weekly +vol +installation +described +demand +pp +suite +vegas +na +square +chris +attention +advance +skip +diet +army +auction +gear +lee +os +difference +allowed +correct +charles +nation +selling +lots +piece +sheet +firm +seven +older +illinois +regulations +elements +species +jump +cells +module +resort +facility +random +pricing +dvds +certificate +minister +motion +looks +fashion +directions +visitors +documentation +monitor +trading +forest +calls +whose +coverage +couple +giving +chance +vision +ball +ending +clients +actions +listen +discuss +accept +automotive +naked +goal +successful +sold +wind +communities +clinical +situation +sciences +markets +lowest +highly +publishing +appear +emergency +developing +lives +currency +leather +determine +milf +temperature +palm +announcements +patient +actual +historical +stone +bob +commerce +ringtones +perhaps +persons +difficult +scientific +satellite +fit +tests +village +accounts +amateur +ex +met +pain +xbox +particularly +factors +coffee +www +settings +cum +buyer +cultural +steve +easily +oral +ford +poster +edge +functional +root +au +fi +closed +holidays +ice +pink +zealand +balance +monitoring +graduate +replies +shot +nc +architecture +initial +label +thinking +scott +llc +sec +recommend +canon +hardcore +league +waste +minute +bus +provider +optional +dictionary +cold +accounting +manufacturing +sections +chair +fishing +effort +phase +fields +bag +fantasy +po +letters +motor +va +professor +context +install +shirt +apparel +generally +continued +foot +mass +crime +count +breast +techniques +ibm +rd +johnson +sc +quickly +dollars +websites +religion +claim +driving +permission +surgery +patch +heat +wild +measures +generation +kansas +miss +chemical +doctor +task +reduce +brought +himself +nor +component +enable +exercise +bug +santa +mid +guarantee +leader +diamond +israel +se +processes +soft +servers +alone +meetings +seconds +jones +arizona +keyword +interests +flight +congress +fuel +username +walk +fuck +produced +italian +paperback +classifieds +wait +supported +pocket +saint +rose +freedom +argument +competition +creating +jim +drugs +joint +premium +providers +fresh +characters +attorney +upgrade +di +factor +growing +thousands +km +stream +apartments +pick +hearing +eastern +auctions +therapy +entries +dates +generated +signed +upper +administrative +serious +prime +samsung +limit +began +louis +steps +errors +shops +bondage +del +efforts +informed +ga +ac +thoughts +creek +ft +worked +quantity +urban +practices +sorted +reporting +essential +myself +tours +platform +load +affiliate +labor +immediately +admin +nursing +defense +machines +designated +tags +heavy +covered +recovery +joe +guys +integrated +configuration +cock +merchant +comprehensive +expert +universal +protect +drop +solid +cds +presentation +languages +became +orange +compliance +vehicles +prevent +theme +rich +im +campaign +marine +improvement +vs +guitar +finding +pennsylvania +examples +ipod +saying +spirit +ar +claims +porno +challenge +motorola +acceptance +strategies +mo +seem +affairs +touch +intended +towards +sa +goals +hire +election +suggest +branch +charges +serve +affiliates +reasons +magic +mount +smart +talking +gave +ones +latin +multimedia +xp +tits +avoid +certified +manage +corner +rank +computing +oregon +element +birth +virus +abuse +interactive +requests +separate +quarter +procedure +leadership +tables +define +racing +religious +facts +breakfast +kong +column +plants +faith +chain +developer +identify +avenue +missing +died +approximately +domestic +sitemap +recommendations +moved +houston +reach +comparison +mental +viewed +moment +extended +sequence +inch +attack +sorry +centers +opening +damage +lab +reserve +recipes +cvs +gamma +plastic +produce +snow +placed +truth +counter +failure +follows +eu +weekend +dollar +camp +ontario +automatically +des +minnesota +films +bridge +native +fill +williams +movement +printing +baseball +owned +approval +draft +chart +played +contacts +cc +jesus +readers +clubs +lcd +wa +jackson +equal +adventure +matching +offering +shirts +profit +leaders +posters +institutions +assistant +variable +ave +dj +advertisement +expect +parking +headlines +yesterday +compared +determined +wholesale +workshop +russia +gone +codes +kinds +extension +seattle +statements +golden +completely +teams +fort +cm +wi +lighting +senate +forces +funny +brother +gene +turned +portable +tried +electrical +applicable +disc +returned +pattern +ct +hentai +boat +named +theatre +laser +earlier +manufacturers +sponsor +classical +icon +warranty +dedicated +indiana +direction +harry +basketball +objects +ends +delete +evening +assembly +nuclear +taxes +mouse +signal +criminal +issued +brain +sexual +wisconsin +powerful +dream +obtained +false +da +cast +flower +felt +personnel +passed +supplied +identified +falls +pic +soul +aids +opinions +promote +stated +stats +hawaii +professionals +appears +carry +flag +decided +nj +covers +hr +em +advantage +hello +designs +maintain +tourism +priority +newsletters +adults +clips +savings +iv +graphic +atom +payments +rw +estimated +binding +brief +ended +winning +eight +anonymous +iron +straight +script +served +wants +miscellaneous +prepared +void +dining +alert +integration +atlanta +dakota +tag +interview +mix +framework +disk +installed +queen +vhs +credits +clearly +fix +handle +sweet +desk +criteria +pubmed +dave +massachusetts +diego +hong +vice +associate +ne +truck +behavior +enlarge +ray +frequently +revenue +measure +changing +votes +du +duty +looked +discussions +bear +gain +festival +laboratory +ocean +flights +experts +signs +lack +depth +iowa +whatever +logged +laptop +vintage +train +exactly +dry +explore +maryland +spa +concept +nearly +eligible +checkout +reality +forgot +handling +origin +knew +gaming +feeds +billion +destination +scotland +faster +intelligence +dallas +bought +con +ups +nations +route +followed +specifications +broken +tripadvisor +frank +alaska +zoom +blow +battle +residential +anime +speak +decisions +industries +protocol +query +clip +partnership +editorial +nt +expression +es +equity +provisions +speech +wire +principles +suggestions +rural +shared +sounds +replacement +tape +strategic +judge +spam +economics +acid +bytes +cent +forced +compatible +fight +apartment +height +null +zero +speaker +filed +gb +netherlands +obtain +bc +consulting +recreation +offices +designer +remain +managed +pr +failed +marriage +roll +korea +banks +fr +participants +secret +bath +aa +kelly +leads +negative +austin +favorites +toronto +theater +springs +missouri +andrew +var +perform +healthy +translation +estimates +font +assets +injury +mt +joseph +ministry +drivers +lawyer +figures +married +protected +proposal +sharing +philadelphia +portal +waiting +birthday +beta +fail +gratis +banking +officials +brian +toward +won +slightly +assist +conduct +contained +lingerie +shemale +legislation +calling +parameters +jazz +serving +bags +profiles +miami +comics +matters +houses +doc +postal +relationships +tennessee +wear +controls +breaking +combined +ultimate +wales +representative +frequency +introduced +minor +finish +departments +residents +noted +displayed +mom +reduced +physics +rare +spent +performed +extreme +samples +davis +daniel +bars +reviewed +row +oz +forecast +removed +helps +singles +administrator +cycle +amounts +contain +accuracy +dual +rise +usd +sleep +mg +bird +pharmacy +brazil +creation +static +scene +hunter +addresses +lady +crystal +famous +writer +chairman +violence +fans +oklahoma +speakers +drink +academy +dynamic +gender +eat +permanent +agriculture +dell +cleaning +constitutes +portfolio +practical +delivered +collectibles +infrastructure +exclusive +seat +concerns +colour +vendor +originally +intel +utilities +philosophy +regulation +officers +reduction +aim +bids +referred +supports +nutrition +recording +regions +junior +toll +les +cape +ann +rings +meaning +tip +secondary +wonderful +mine +ladies +henry +ticket +announced +guess +agreed +prevention +whom +ski +soccer +math +import +posting +presence +instant +mentioned +automatic +healthcare +viewing +maintained +ch +increasing +majority +connected +christ +dan +dogs +sd +directors +aspects +austria +ahead +moon +participation +scheme +utility +preview +fly +manner +matrix +containing +combination +devel +amendment +despite +strength +guaranteed +turkey +libraries +proper +distributed +degrees +singapore +enterprises +delta +fear +seeking +inches +phoenix +rs +convention +shares +principal +daughter +standing +voyeur +comfort +colors +wars +cisco +ordering +kept +alpha +appeal +cruise +bonus +certification +previously +hey +bookmark +buildings +specials +beat +disney +household +batteries +adobe +smoking +bbc +becomes +drives +arms +alabama +tea +improved +trees +avg +achieve +positions +dress +subscription +dealer +contemporary +sky +utah +nearby +rom +carried +happen +exposure +panasonic +hide +permalink +signature +gambling +refer +miller +provision +outdoors +clothes +caused +luxury +babes +frames +viagra +certainly +indeed +newspaper +toy +circuit +layer +printed +slow +removal +easier +src +liability +trademark +hip +printers +faqs +nine +adding +kentucky +mostly +eric +spot +taylor +trackback +prints +spend +factory +interior +revised +grow +americans +optical +promotion +relative +amazing +clock +dot +hiv +identity +suites +conversion +feeling +hidden +reasonable +victoria +serial +relief +revision +broadband +influence +ratio +pda +importance +rain +onto +dsl +planet +webmaster +copies +recipe +zum +permit +seeing +proof +dna +diff +tennis +bass +prescription +bedroom +empty +instance +hole +pets +ride +licensed +orlando +specifically +tim +bureau +maine +sql +represent +conservation +pair +ideal +specs +recorded +don +pieces +finished +parks +dinner +lawyers +sydney +stress +cream +ss +runs +trends +yeah +discover +sexo +ap +patterns +boxes +louisiana +hills +javascript +fourth +nm +advisor +mn +marketplace +nd +evil +aware +wilson +shape +evolution +irish +certificates +objectives +stations +suggested +gps +op +remains +acc +greatest +firms +concerned +euro +operator +structures +generic +encyclopedia +usage +cap +ink +charts +continuing +mixed +census +interracial +peak +tn +competitive +exist +wheel +transit +dick +suppliers +salt +compact +poetry +lights +tracking +angel +bell +keeping +preparation +attempt +receiving +matches +accordance +width +noise +engines +forget +array +discussed +accurate +stephen +elizabeth +climate +reservations +pin +playstation +alcohol +greek +instruction +managing +annotation +sister +raw +differences +walking +explain +smaller +newest +establish +gnu +happened +expressed +jeff +extent +sharp +lesbians +ben +lane +paragraph +kill +mathematics +aol +compensation +ce +export +managers +aircraft +modules +sweden +conflict +conducted +versions +employer +occur +percentage +knows +mississippi +describe +concern +backup +requested +citizens +connecticut +heritage +personals +immediate +holding +trouble +spread +coach +kevin +agricultural +expand +supporting +audience +assigned +jordan +collections +ages +participate +plug +specialist +cook +affect +virgin +experienced +investigation +raised +hat +institution +directed +dealers +searching +sporting +helping +perl +affected +lib +bike +totally +plate +expenses +indicate +blonde +ab +proceedings +favourite +transmission +anderson +utc +characteristics +der +lose +organic +seek +experiences +albums +cheats +extremely +verzeichnis +contracts +guests +hosted +diseases +concerning +developers +equivalent +chemistry +tony +neighborhood +nevada +kits +thailand +variables +agenda +anyway +continues +tracks +advisory +cam +curriculum +logic +template +prince +circle +soil +grants +anywhere +psychology +responses +atlantic +wet +circumstances +edward +investor +identification +ram +leaving +wildlife +appliances +matt +elementary +cooking +speaking +sponsors +fox +unlimited +respond +sizes +plain +exit +entered +iran +arm +keys +launch +wave +checking +costa +belgium +printable +holy +acts +guidance +mesh +trail +enforcement +symbol +crafts +highway +buddy +hardcover +observed +dean +setup +poll +booking +glossary +fiscal +celebrity +styles +denver +unix +filled +bond +channels +ericsson +appendix +notify +blues +chocolate +pub +portion +scope +hampshire +supplier +cables +cotton +bluetooth +controlled +requirement +authorities +biology +dental +killed +border +ancient +debate +representatives +starts +pregnancy +causes +arkansas +biography +leisure +attractions +learned +transactions +notebook +explorer +historic +attached +opened +tm +husband +disabled +authorized +crazy +upcoming +britain +concert +retirement +scores +financing +efficiency +sp +comedy +adopted +efficient +weblog +linear +commitment +specialty +bears +jean +hop +carrier +edited +constant +visa +mouth +jewish +meter +linked +portland +interviews +concepts +nh +gun +reflect +pure +deliver +wonder +hell +lessons +fruit +begins +qualified +reform +lens +alerts +treated +discovery +draw +mysql +classified +relating +assume +confidence +alliance +fm +confirm +warm +neither +lewis +howard +offline +leaves +engineer +lifestyle +consistent +replace +clearance +connections +inventory +converter +suck +organisation +babe +checks +reached +becoming +blowjob +safari +objective +indicated +sugar +crew +legs +sam +stick +securities +allen +pdt +relation +enabled +genre +slide +montana +volunteer +tested +rear +democratic +enhance +switzerland +exact +bound +parameter +adapter +processor +node +formal +dimensions +contribute +lock +hockey +storm +micro +colleges +laptops +mile +showed +challenges +editors +mens +threads +bowl +supreme +brothers +recognition +presents +ref +tank +submission +dolls +estimate +encourage +navy +kid +regulatory +inspection +consumers +cancel +limits +territory +transaction +manchester +weapons +paint +delay +pilot +outlet +contributions +continuous +db +czech +resulting +cambridge +initiative +novel +pan +execution +disability +increases +ultra +winner +idaho +contractor +ph +episode +examination +potter +dish +plays +bulletin +ia +pt +indicates +modify +oxford +adam +truly +epinions +painting +committed +extensive +affordable +universe +candidate +databases +patent +slot +psp +outstanding +ha +eating +perspective +planned +watching +lodge +messenger +mirror +tournament +consideration +ds +discounts +sterling +sessions +kernel +boobs +stocks +buyers +journals +gray +catalogue +ea +jennifer +antonio +charged +broad +taiwan +und +chosen +demo +greece +lg +swiss +sarah +clark +labour +hate +terminal +publishers +nights +behalf +caribbean +liquid +rice +nebraska +loop +salary +reservation +foods +gourmet +guard +properly +orleans +saving +nfl +remaining +empire +resume +twenty +newly +raise +prepare +avatar +gary +depending +illegal +expansion +vary +hundreds +rome +arab +lincoln +helped +premier +tomorrow +purchased +milk +decide +consent +drama +visiting +performing +downtown +keyboard +contest +collected +nw +bands +boot +suitable +ff +absolutely +millions +lunch +dildo +audit +push +chamber +guinea +findings +muscle +featuring +iso +implement +clicking +scheduled +polls +typical +tower +yours +sum +misc +calculator +significantly +chicken +temporary +attend +shower +alan +sending +jason +tonight +dear +sufficient +holdem +shell +province +catholic +oak +vat +awareness +vancouver +governor +beer +seemed +contribution +measurement +swimming +spyware +formula +constitution +packaging +solar +jose +catch +jane +pakistan +ps +reliable +consultation +northwest +sir +doubt +earn +finder +unable +periods +classroom +tasks +democracy +attacks +kim +wallpaper +merchandise +const +resistance +doors +symptoms +resorts +biggest +memorial +visitor +twin +forth +insert +baltimore +gateway +ky +dont +alumni +drawing +candidates +charlotte +ordered +biological +fighting +transition +happens +preferences +spy +romance +instrument +bruce +split +themes +powers +heaven +br +bits +pregnant +twice +classification +focused +egypt +physician +hollywood +bargain +wikipedia +cellular +norway +vermont +asking +blocks +normally +lo +spiritual +hunting +diabetes +suit +ml +shift +chip +res +sit +bodies +photographs +cutting +wow +simon +writers +marks +flexible +loved +favourites +mapping +numerous +relatively +birds +satisfaction +represents +char +indexed +pittsburgh +superior +preferred +saved +paying +cartoon +shots +intellectual +moore +granted +choices +carbon +spending +comfortable +magnetic +interaction +listening +effectively +registry +crisis +outlook +massive +denmark +employed +bright +treat +header +cs +poverty +formed +piano +echo +que +grid +sheets +patrick +experimental +puerto +revolution +consolidation +displays +plasma +allowing +earnings +voip +mystery +landscape +dependent +mechanical +journey +delaware +bidding +consultants +risks +banner +applicant +charter +fig +barbara +cooperation +counties +acquisition +ports +implemented +sf +directories +recognized +dreams +blogger +notification +kg +licensing +stands +teach +occurred +textbooks +rapid +pull +hairy +diversity +cleveland +ut +reverse +deposit +seminar +investments +latina +nasa +wheels +sexcam +specify +accessibility +dutch +sensitive +templates +formats +tab +depends +boots +holds +router +concrete +si +editing +poland +folder +womens +css +completion +upload +pulse +universities +technique +contractors +milfhunter +voting +courts +notices +subscriptions +calculate +mc +detroit +alexander +broadcast +converted +metro +toshiba +anniversary +improvements +strip +specification +pearl +accident +nick +accessible +accessory +resident +plot +qty +possibly +airline +typically +representation +regard +pump +exists +arrangements +smooth +conferences +uniprotkb +beastiality +strike +consumption +birmingham +flashing +lp +narrow +afternoon +threat +surveys +sitting +putting +consultant +controller +ownership +committees +penis +legislative +researchers +vietnam +trailer +anne +castle +gardens +missed +malaysia +unsubscribe +antique +labels +willing +bio +molecular +upskirt +acting +heads +stored +exam +logos +residence +attorneys +milfs +antiques +density +hundred +ryan +operators +strange +sustainable +philippines +statistical +beds +breasts +mention +innovation +pcs +employers +grey +parallel +honda +amended +operate +bills +bold +bathroom +stable +opera +definitions +von +doctors +lesson +cinema +asset +ag +scan +elections +drinking +blowjobs +reaction +blank +enhanced +entitled +severe +generate +stainless +newspapers +hospitals +vi +deluxe +humor +aged +monitors +exception +lived +duration +bulk +successfully +indonesia +pursuant +sci +fabric +edt +visits +primarily +tight +domains +capabilities +pmid +contrast +recommendation +flying +recruitment +sin +berlin +cute +organized +ba +para +siemens +adoption +improving +cr +expensive +meant +capture +pounds +buffalo +organisations +plane +pg +explained +seed +programmes +desire +expertise +mechanism +camping +ee +jewellery +meets +welfare +peer +caught +eventually +marked +driven +measured +medline +bottle +agreements +considering +innovative +marshall +massage +rubber +conclusion +closing +tampa +thousand +meat +legend +grace +susan +ing +ks +adams +python +monster +alex +bang +villa +bone +columns +disorders +bugs +collaboration +hamilton +detection +ftp +cookies +inner +formation +tutorial +med +engineers +entity +cruises +gate +holder +proposals +moderator +sw +tutorials +settlement +portugal +lawrence +roman +duties +valuable +erotic +tone +collectables +ethics +forever +dragon +busy +captain +fantastic +imagine +brings +heating +leg +neck +hd +wing +governments +purchasing +scripts +abc +stereo +appointed +taste +dealing +commit +tiny +operational +rail +airlines +liberal +livecam +jay +trips +gap +sides +tube +turns +corresponding +descriptions +cache +belt +jacket +determination +animation +oracle +er +matthew +lease +productions +aviation +hobbies +proud +excess +disaster +console +commands +jr +telecommunications +instructor +giant +achieved +injuries +shipped +bestiality +seats +approaches +biz +alarm +voltage +anthony +nintendo +usual +loading +stamps +appeared +franklin +angle +rob +vinyl +highlights +mining +designers +melbourne +ongoing +worst +imaging +betting +scientists +liberty +wyoming +blackjack +argentina +era +convert +possibility +analyst +commissioner +dangerous +garage +exciting +reliability +thongs +gcc +unfortunately +respectively +volunteers +attachment +ringtone +finland +morgan +derived +pleasure +honor +asp +oriented +eagle +desktops +pants +columbus +nurse +prayer +appointment +workshops +hurricane +quiet +luck +postage +producer +represented +mortgages +dial +responsibilities +cheese +comic +carefully +jet +productivity +investors +crown +par +underground +diagnosis +maker +crack +principle +picks +vacations +gang +semester +calculated +cumshot +fetish +applies +casinos +appearance +smoke +apache +filters +incorporated +nv +craft +cake +notebooks +apart +fellow +blind +lounge +mad +algorithm +semi +coins +andy +gross +strongly +cafe +valentine +hilton +ken +proteins +horror +su +exp +familiar +capable +douglas +debian +till +involving +pen +investing +christopher +admission +epson +shoe +elected +carrying +victory +sand +madison +terrorism +joy +editions +cpu +mainly +ethnic +ran +parliament +actor +finds +seal +situations +fifth +allocated +citizen +vertical +corrections +structural +municipal +describes +prize +sr +occurs +jon +absolute +disabilities +consists +anytime +substance +prohibited +addressed +lies +pipe +soldiers +nr +guardian +lecture +simulation +layout +initiatives +ill +concentration +classics +lbs +lay +interpretation +horses +lol +dirty +deck +wayne +donate +taught +bankruptcy +mp +worker +optimization +alive +temple +substances +prove +discovered +wings +breaks +genetic +restrictions +participating +waters +promise +thin +exhibition +prefer +ridge +cabinet +modem +harris +mph +bringing +sick +dose +evaluate +tiffany +tropical +collect +bet +composition +toyota +streets +nationwide +vector +definitely +shaved +turning +buffer +purple +existence +commentary +larry +limousines +developments +def +immigration +destinations +lets +mutual +pipeline +necessarily +syntax +li +attribute +prison +skill +chairs +nl +everyday +apparently +surrounding +mountains +moves +popularity +inquiry +ethernet +checked +exhibit +throw +trend +sierra +visible +cats +desert +postposted +ya +oldest +rhode +nba +busty +coordinator +obviously +mercury +steven +handbook +greg +navigate +worse +summit +victims +epa +spaces +fundamental +burning +escape +coupons +somewhat +receiver +substantial +tr +progressive +cialis +bb +boats +glance +scottish +championship +arcade +richmond +sacramento +impossible +ron +russell +tells +obvious +fiber +depression +graph +covering +platinum +judgment +bedrooms +talks +filing +foster +modeling +passing +awarded +testimonials +trials +tissue +nz +memorabilia +clinton +masters +bonds +cartridge +alberta +explanation +folk +org +commons +cincinnati +subsection +fraud +electricity +permitted +spectrum +arrival +okay +pottery +emphasis +roger +aspect +workplace +awesome +mexican +confirmed +counts +priced +wallpapers +hist +crash +lift +desired +inter +closer +assumes +heights +shadow +riding +infection +firefox +lisa +expense +grove +eligibility +venture +clinic +korean +healing +princess +mall +entering +packet +spray +studios +involvement +dad +buttons +placement +observations +vbulletin +funded +thompson +winners +extend +roads +subsequent +pat +dublin +rolling +fell +motorcycle +yard +disclosure +establishment +memories +nelson +te +arrived +creates +faces +tourist +cocks +av +mayor +murder +sean +adequate +senator +yield +presentations +grades +cartoons +pour +digest +reg +lodging +tion +dust +hence +wiki +entirely +replaced +radar +rescue +undergraduate +losses +combat +reducing +stopped +occupation +lakes +butt +donations +associations +citysearch +closely +radiation +diary +seriously +kings +shooting +kent +adds +nsw +ear +flags +pci +baker +launched +elsewhere +pollution +conservative +guestbook +shock +effectiveness +walls +abroad +ebony +tie +ward +drawn +arthur +ian +visited +roof +walker +demonstrate +atmosphere +suggests +kiss +beast +ra +operated +experiment +targets +overseas +purchases +dodge +counsel +federation +pizza +invited +yards +assignment +chemicals +gordon +mod +farmers +rc +queries +bmw +rush +ukraine +absence +nearest +cluster +vendors +mpeg +whereas +yoga +serves +woods +surprise +lamp +rico +partial +shoppers +phil +everybody +couples +nashville +ranking +jokes +cst +http +ceo +simpson +twiki +sublime +counseling +palace +acceptable +satisfied +glad +wins +measurements +verify +globe +trusted +copper +milwaukee +rack +medication +warehouse +shareware +ec +rep +dicke +kerry +receipt +supposed +ordinary +nobody +ghost +violation +configure +stability +mit +applying +southwest +boss +pride +institutional +expectations +independence +knowing +reporter +metabolism +keith +champion +cloudy +linda +ross +personally +chile +anna +plenty +solo +sentence +throat +ignore +maria +uniform +excellence +wealth +tall +rm +somewhere +vacuum +dancing +attributes +recognize +brass +writes +plaza +pdas +outcomes +survival +quest +publish +sri +screening +toe +thumbnail +trans +jonathan +whenever +nova +lifetime +api +pioneer +booty +forgotten +acrobat +plates +acres +venue +athletic +thermal +essays +behaviour +vital +telling +fairly +coastal +config +cf +charity +intelligent +edinburgh +vt +excel +modes +obligation +campbell +wake +stupid +harbor +hungary +traveler +urw +segment +realize +regardless +lan +enemy +puzzle +rising +aluminum +wells +wishlist +opens +insight +sms +shit +restricted +republican +secrets +lucky +latter +merchants +thick +trailers +repeat +syndrome +philips +attendance +penalty +drum +glasses +enables +nec +iraqi +builder +vista +jessica +chips +terry +flood +foto +ease +arguments +amsterdam +orgy +arena +adventures +pupils +stewart +announcement +tabs +outcome +xx +appreciate +expanded +casual +grown +polish +lovely +extras +gm +centres +jerry +clause +smile +lands +ri +troops +indoor +bulgaria +armed +broker +charger +regularly +believed +pine +cooling +tend +gulf +rt +rick +trucks +cp +mechanisms +divorce +laura +shopper +tokyo +partly +nikon +customize +tradition +candy +pills +tiger +donald +folks +sensor +exposed +telecom +hunt +angels +deputy +indicators +sealed +thai +emissions +physicians +loaded +fred +complaint +scenes +experiments +balls +afghanistan +dd +boost +spanking +scholarship +governance +mill +founded +supplements +chronic +icons +tranny +moral +den +catering +aud +finger +keeps +pound +locate +camcorder +pl +trained +burn +implementing +roses +labs +ourselves +bread +tobacco +wooden +motors +tough +roberts +incident +gonna +dynamics +lie +crm +rf +conversation +decrease +cumshots +chest +pension +billy +revenues +emerging +worship +bukkake +capability +ak +fe +craig +herself +producing +churches +precision +damages +reserves +contributed +solve +shorts +reproduction +minority +td +diverse +amp +ingredients +sb +ah +johnny +sole +franchise +recorder +complaints +facing +sm +nancy +promotions +tones +passion +rehabilitation +maintaining +sight +laid +clay +defence +patches +weak +refund +usc +towns +environments +trembl +divided +blvd +reception +amd +wise +emails +cyprus +wv +odds +correctly +insider +seminars +consequences +makers +hearts +geography +appearing +integrity +worry +ns +discrimination +eve +carter +legacy +marc +pleased +danger +vitamin +widely +processed +phrase +genuine +raising +implications +functionality +paradise +hybrid +reads +roles +intermediate +emotional +sons +leaf +pad +glory +platforms +ja +bigger +billing +diesel +versus +combine +overnight +geographic +exceed +bs +rod +saudi +fault +cuba +hrs +preliminary +districts +introduce +silk +promotional +kate +chevrolet +babies +bi +karen +compiled +romantic +revealed +specialists +generator +albert +examine +jimmy +graham +suspension +bristol +margaret +compaq +sad +correction +wolf +slowly +authentication +communicate +rugby +supplement +showtimes +cal +portions +infant +promoting +sectors +samuel +fluid +grounds +fits +kick +regards +meal +ta +hurt +machinery +bandwidth +unlike +equation +baskets +probability +pot +dimension +wright +img +barry +proven +schedules +admissions +cached +warren +slip +studied +reviewer +involves +quarterly +rpm +profits +devil +grass +comply +marie +florist +illustrated +cherry +continental +alternate +deutsch +achievement +limitations +kenya +webcam +cuts +funeral +nutten +earrings +enjoyed +automated +chapters +pee +charlie +quebec +nipples +passenger +convenient +dennis +mars +francis +tvs +sized +manga +noticed +socket +silent +literary +egg +mhz +signals +caps +orientation +pill +theft +childhood +swing +symbols +lat +meta +humans +analog +facial +choosing +talent +dated +flexibility +seeker +wisdom +shoot +boundary +mint +packard +offset +payday +philip +elite +gi +spin +holders +believes +swedish +poems +deadline +jurisdiction +robot +displaying +witness +collins +equipped +stages +encouraged +sur +winds +powder +broadway +acquired +assess +wash +cartridges +stones +entrance +gnome +roots +declaration +losing +attempts +gadgets +noble +glasgow +automation +impacts +rev +gospel +advantages +shore +loves +induced +ll +knight +preparing +loose +aims +recipient +linking +extensions +appeals +cl +earned +illness +islamic +athletics +southeast +ieee +ho +alternatives +pending +parker +determining +lebanon +corp +personalized +kennedy +gt +sh +conditioning +teenage +soap +ae +triple +cooper +nyc +vincent +jam +secured +unusual +answered +partnerships +destruction +slots +increasingly +migration +disorder +routine +toolbar +basically +rocks +conventional +titans +applicants +wearing +axis +sought +genes +mounted +habitat +firewall +median +guns +scanner +herein +occupational +animated +horny +judicial +rio +hs +adjustment +hero +integer +treatments +bachelor +attitude +camcorders +engaged +falling +basics +montreal +carpet +rv +struct +lenses +binary +genetics +attended +difficulty +punk +collective +coalition +pi +dropped +enrollment +duke +walter +ai +pace +besides +wage +producers +ot +collector +arc +hosts +interfaces +advertisers +moments +atlas +strings +dawn +representing +observation +feels +torture +carl +deleted +coat +mitchell +mrs +rica +restoration +convenience +returning +ralph +opposition +container +yr +defendant +warner +confirmation +app +embedded +inkjet +supervisor +wizard +corps +actors +liver +peripherals +liable +brochure +morris +bestsellers +petition +eminem +recall +antenna +picked +assumed +departure +minneapolis +belief +killing +bikini +memphis +shoulder +decor +lookup +texts +harvard +brokers +roy +ion +diameter +ottawa +doll +ic +podcast +tit +seasons +peru +interactions +refine +bidder +singer +evans +herald +literacy +fails +aging +nike +intervention +pissing +fed +plugin +attraction +diving +invite +modification +alice +latinas +suppose +customized +reed +involve +moderate +terror +younger +thirty +mice +opposite +understood +rapidly +dealtime +ban +temp +intro +mercedes +zus +assurance +fisting +clerk +happening +vast +mills +outline +amendments +tramadol +holland +receives +jeans +metropolitan +compilation +verification +fonts +ent +odd +wrap +refers +mood +favor +veterans +quiz +mx +sigma +gr +attractive +xhtml +occasion +recordings +jefferson +victim +demands +sleeping +careful +ext +beam +gardening +obligations +arrive +orchestra +sunset +tracked +moreover +minimal +polyphonic +lottery +tops +framed +aside +outsourcing +licence +adjustable +allocation +michelle +essay +discipline +amy +ts +demonstrated +dialogue +identifying +alphabetical +camps +declared +dispatched +aaron +handheld +trace +disposal +shut +florists +packs +ge +installing +switches +romania +voluntary +ncaa +thou +consult +phd +greatly +blogging +mask +cycling +midnight +ng +commonly +pe +photographer +inform +turkish +coal +cry +messaging +pentium +quantum +murray +intent +tt +zoo +largely +pleasant +announce +constructed +additions +requiring +spoke +aka +arrow +engagement +sampling +rough +weird +tee +refinance +lion +inspired +holes +weddings +blade +suddenly +oxygen +cookie +meals +canyon +goto +meters +merely +calendars +arrangement +conclusions +passes +bibliography +pointer +compatibility +stretch +durham +furthermore +permits +cooperative +muslim +xl +neil +sleeve +netscape +cleaner +cricket +beef +feeding +stroke +township +rankings +measuring +cad +hats +robin +robinson +jacksonville +strap +headquarters +sharon +crowd +tcp +transfers +surf +olympic +transformation +remained +attachments +dv +dir +entities +customs +administrators +personality +rainbow +hook +roulette +decline +gloves +israeli +medicare +cord +skiing +cloud +facilitate +subscriber +valve +val +hewlett +explains +proceed +flickr +feelings +knife +jamaica +priorities +shelf +bookstore +timing +liked +parenting +adopt +denied +fotos +incredible +britney +freeware +fucked +donation +outer +crop +deaths +rivers +commonwealth +pharmaceutical +manhattan +tales +katrina +workforce +islam +nodes +tu +fy +thumbs +seeds +cited +lite +ghz +hub +targeted +organizational +skype +realized +twelve +founder +decade +gamecube +rr +dispute +portuguese +tired +titten +adverse +everywhere +excerpt +eng +steam +discharge +ef +drinks +ace +voices +acute +halloween +climbing +stood +sing +tons +perfume +carol +honest +albany +hazardous +restore +stack +methodology +somebody +sue +ep +housewares +reputation +resistant +democrats +recycling +hang +gbp +curve +creator +amber +qualifications +museums +coding +slideshow +tracker +variation +passage +transferred +trunk +hiking +lb +damn +pierre +jelsoft +headset +photograph +oakland +colombia +waves +camel +distributor +lamps +underlying +hood +wrestling +suicide +archived +photoshop +jp +chi +bt +arabia +gathering +projection +juice +chase +mathematical +logical +sauce +fame +extract +specialized +diagnostic +panama +indianapolis +af +payable +corporations +courtesy +criticism +automobile +confidential +rfc +statutory +accommodations +athens +northeast +downloaded +judges +sl +seo +retired +isp +remarks +detected +decades +paintings +walked +arising +nissan +bracelet +ins +eggs +juvenile +injection +yorkshire +populations +protective +afraid +acoustic +railway +cassette +initially +indicator +pointed +hb +jpg +causing +mistake +norton +locked +eliminate +tc +fusion +mineral +sunglasses +ruby +steering +beads +fortune +preference +canvas +threshold +parish +claimed +screens +cemetery +planner +croatia +flows +stadium +venezuela +exploration +mins +fewer +sequences +coupon +nurses +ssl +stem +proxy +gangbang +astronomy +lanka +opt +edwards +drew +contests +flu +translate +announces +mlb +costume +tagged +berkeley +voted +killer +bikes +gates +adjusted +rap +tune +bishop +pulled +corn +gp +shaped +compression +seasonal +establishing +farmer +counters +puts +constitutional +grew +perfectly +tin +slave +instantly +cultures +norfolk +coaching +examined +trek +encoding +litigation +submissions +oem +heroes +painted +lycos +ir +zdnet +broadcasting +horizontal +artwork +cosmetic +resulted +portrait +terrorist +informational +ethical +carriers +ecommerce +mobility +floral +builders +ties +struggle +schemes +suffering +neutral +fisher +rat +spears +prospective +dildos +bedding +ultimately +joining +heading +equally +artificial +bearing +spectacular +coordination +connector +brad +combo +seniors +worlds +guilty +affiliated +activation +naturally +haven +tablet +jury +dos +tail +subscribers +charm +lawn +violent +mitsubishi +underwear +basin +soup +potentially +ranch +constraints +crossing +inclusive +dimensional +cottage +drunk +considerable +crimes +resolved +mozilla +byte +toner +nose +latex +branches +anymore +oclc +delhi +holdings +alien +locator +selecting +processors +pantyhose +plc +broke +nepal +zimbabwe +difficulties +juan +complexity +msg +constantly +browsing +resolve +barcelona +presidential +documentary +cod +territories +melissa +moscow +thesis +thru +jews +nylon +palestinian +discs +rocky +bargains +frequent +trim +nigeria +ceiling +pixels +ensuring +hispanic +cv +cb +legislature +hospitality +gen +anybody +procurement +diamonds +espn +fleet +untitled +bunch +totals +marriott +singing +theoretical +afford +exercises +starring +referral +nhl +surveillance +optimal +quit +distinct +protocols +lung +highlight +substitute +inclusion +hopefully +brilliant +turner +sucking +cents +reuters +ti +fc +gel +todd +spoken +omega +evaluated +stayed +civic +assignments +fw +manuals +doug +sees +termination +watched +saver +thereof +grill +households +gs +redeem +rogers +grain +aaa +authentic +regime +wanna +wishes +bull +montgomery +architectural +louisville +depend +differ +macintosh +movements +ranging +monica +repairs +breath +amenities +virtually +cole +mart +candle +hanging +colored +authorization +tale +verified +lynn +formerly +projector +bp +situated +comparative +std +seeks +herbal +loving +strictly +routing +docs +stanley +psychological +surprised +retailer +vitamins +elegant +gains +renewal +vid +genealogy +opposed +deemed +scoring +expenditure +panties +brooklyn +liverpool +sisters +critics +connectivity +spots +oo +algorithms +hacker +madrid +similarly +margin +coin +bbw +solely +fake +salon +collaborative +norman +fda +excluding +turbo +headed +voters +cure +madonna +commander +arch +ni +murphy +thinks +thats +suggestion +hdtv +soldier +phillips +asin +aimed +justin +bomb +harm +interval +mirrors +spotlight +tricks +reset +brush +investigate +thy +expansys +panels +repeated +assault +connecting +spare +logistics +deer +kodak +tongue +bowling +tri +danish +pal +monkey +proportion +filename +skirt +florence +invest +honey +um +analyses +drawings +significance +scenario +ye +fs +lovers +atomic +approx +symposium +arabic +gauge +essentials +junction +protecting +nn +faced +mat +rachel +solving +transmitted +weekends +screenshots +produces +oven +ted +intensive +chains +kingston +sixth +engage +deviant +noon +switching +quoted +adapters +correspondence +farms +imports +supervision +cheat +bronze +expenditures +sandy +separation +testimony +suspect +celebrities +macro +sender +mandatory +boundaries +crucial +syndication +gym +celebration +kde +adjacent +filtering +tuition +spouse +exotic +viewer +signup +threats +luxembourg +puzzles +reaching +vb +damaged +cams +receptor +piss +laugh +joel +surgical +destroy +citation +pitch +autos +yo +premises +perry +proved +offensive +imperial +dozen +benjamin +deployment +teeth +cloth +studying +colleagues +stamp +lotus +salmon +olympus +separated +proc +cargo +tan +directive +fx +salem +mate +dl +starter +upgrades +likes +butter +pepper +weapon +luggage +burden +chef +tapes +zones +races +isle +stylish +slim +maple +luke +grocery +offshore +governing +retailers +depot +kenneth +comp +alt +pie +blend +harrison +ls +julie +occasionally +cbs +attending +emission +pete +spec +finest +realty +janet +bow +penn +recruiting +apparent +instructional +phpbb +autumn +traveling +probe +midi +permissions +biotechnology +toilet +ranked +jackets +routes +packed +excited +outreach +helen +mounting +recover +tied +lopez +balanced +prescribed +catherine +timely +talked +upskirts +debug +delayed +chuck +reproduced +hon +dale +explicit +calculation +villas +ebook +consolidated +boob +exclude +peeing +occasions +brooks +equations +newton +oils +sept +exceptional +anxiety +bingo +whilst +spatial +respondents +unto +lt +ceramic +prompt +precious +minds +annually +considerations +scanners +atm +xanax +eq +pays +cox +fingers +sunny +ebooks +delivers +je +queensland +necklace +musicians +leeds +composite +unavailable +cedar +arranged +lang +theaters +advocacy +raleigh +stud +fold +essentially +designing +threaded +uv +qualify +fingering +blair +hopes +assessments +cms +mason +diagram +burns +pumps +slut +ejaculation +footwear +sg +vic +beijing +peoples +victor +mario +pos +attach +licenses +utils +removing +advised +brunswick +spider +phys +ranges +pairs +sensitivity +trails +preservation +hudson +isolated +calgary +interim +assisted +divine +streaming +approve +chose +compound +intensity +technological +syndicate +abortion +dialog +venues +blast +wellness +calcium +newport +antivirus +addressing +pole +discounted +indians +shield +harvest +membrane +prague +previews +bangladesh +constitute +locally +concluded +pickup +desperate +mothers +nascar +iceland +demonstration +governmental +manufactured +candles +graduation +mega +bend +sailing +variations +moms +sacred +addiction +morocco +chrome +tommy +springfield +refused +brake +exterior +greeting +ecology +oliver +congo +glen +botswana +nav +delays +synthesis +olive +undefined +unemployment +cyber +verizon +scored +enhancement +newcastle +clone +dicks +velocity +lambda +relay +composed +tears +performances +oasis +baseline +cab +angry +fa +societies +silicon +brazilian +identical +petroleum +compete +ist +norwegian +lover +belong +honolulu +beatles +lips +escort +retention +exchanges +pond +rolls +thomson +barnes +soundtrack +wondering +malta +daddy +lc +ferry +rabbit +profession +seating +dam +cnn +separately +physiology +lil +collecting +das +exports +omaha +tire +participant +scholarships +recreational +dominican +chad +electron +loads +friendship +heather +passport +motel +unions +treasury +warrant +sys +solaris +frozen +occupied +josh +royalty +scales +rally +observer +sunshine +strain +drag +ceremony +somehow +arrested +expanding +provincial +investigations +icq +ripe +yamaha +rely +medications +hebrew +gained +rochester +dying +laundry +stuck +solomon +placing +stops +homework +adjust +assessed +advertiser +enabling +encryption +filling +downloadable +sophisticated +imposed +silence +scsi +focuses +soviet +possession +cu +laboratories +treaty +vocal +trainer +organ +stronger +volumes +advances +vegetables +lemon +toxic +dns +thumbnails +darkness +pty +ws +nuts +nail +bizrate +vienna +implied +span +stanford +sox +stockings +joke +respondent +packing +statute +rejected +satisfy +destroyed +shelter +chapel +gamespot +manufacture +layers +wordpress +guided +vulnerability +accountability +celebrate +accredited +appliance +compressed +bahamas +powell +mixture +zoophilia +bench +univ +tub +rider +scheduling +radius +perspectives +mortality +logging +hampton +christians +borders +therapeutic +pads +butts +inns +bobby +impressive +sheep +accordingly +architect +railroad +lectures +challenging +wines +nursery +harder +cups +ash +microwave +cheapest +accidents +travesti +relocation +stuart +contributors +salvador +ali +salad +np +monroe +tender +violations +foam +temperatures +paste +clouds +competitions +discretion +tft +tanzania +preserve +jvc +poem +vibrator +unsigned +staying +cosmetics +easter +theories +repository +praise +jeremy +venice +jo +concentrations +vibrators +estonia +christianity +veteran +streams +landing +signing +executed +katie +negotiations +realistic +dt +cgi +showcase +integral +asks +relax +namibia +generating +christina +congressional +synopsis +hardly +prairie +reunion +composer +bean +sword +absent +photographic +sells +ecuador +hoping +accessed +spirits +modifications +coral +pixel +float +colin +bias +imported +paths +bubble +por +acquire +contrary +millennium +tribune +vessel +acids +focusing +viruses +cheaper +admitted +dairy +admit +mem +fancy +equality +samoa +gc +achieving +tap +stickers +fisheries +exceptions +reactions +leasing +lauren +beliefs +ci +macromedia +companion +squad +analyze +ashley +scroll +relate +divisions +swim +wages +additionally +suffer +forests +fellowship +nano +invalid +concerts +martial +males +victorian +retain +colours +execute +tunnel +genres +cambodia +patents +copyrights +yn +chaos +lithuania +mastercard +wheat +chronicles +obtaining +beaver +updating +distribute +readings +decorative +kijiji +confused +compiler +enlargement +eagles +bases +vii +accused +bee +campaigns +unity +loud +conjunction +bride +rats +defines +airports +instances +indigenous +begun +cfr +brunette +packets +anchor +socks +validation +parade +corruption +stat +trigger +incentives +cholesterol +gathered +essex +slovenia +notified +differential +beaches +folders +dramatic +surfaces +terrible +routers +cruz +pendant +dresses +baptist +scientist +starsmerchant +hiring +clocks +arthritis +bios +females +wallace +nevertheless +reflects +taxation +fever +pmc +cuisine +surely +practitioners +transcript +myspace +theorem +inflation +thee +nb +ruth +pray +stylus +compounds +pope +drums +contracting +topless +arnold +structured +reasonably +jeep +chicks +bare +hung +cattle +mba +radical +graduates +rover +recommends +controlling +treasure +reload +distributors +flame +levitra +tanks +assuming +monetary +elderly +pit +arlington +mono +particles +floating +extraordinary +tile +indicating +bolivia +spell +hottest +stevens +coordinate +kuwait +exclusively +emily +alleged +limitation +widescreen +compile +squirting +webster +struck +rx +illustration +plymouth +warnings +construct +apps +inquiries +bridal +annex +mag +gsm +inspiration +tribal +curious +affecting +freight +rebate +meetup +eclipse +sudan +ddr +downloading +rec +shuttle +aggregate +stunning +cycles +affects +forecasts +detect +sluts +actively +ciao +ampland +knee +prep +pb +complicated +chem +fastest +butler +shopzilla +injured +decorating +payroll +cookbook +expressions +ton +courier +uploaded +shakespeare +hints +collapse +americas +connectors +twinks +unlikely +oe +gif +pros +conflicts +techno +beverage +tribute +wired +elvis +immune +latvia +travelers +forestry +barriers +cant +jd +rarely +gpl +infected +offerings +martha +genesis +barrier +argue +incorrect +trains +metals +bicycle +furnishings +letting +arise +guatemala +celtic +thereby +irc +jamie +particle +perception +minerals +advise +humidity +bottles +boxing +wy +dm +bangkok +renaissance +pathology +sara +bra +ordinance +hughes +photographers +bitch +infections +jeffrey +chess +operates +brisbane +configured +survive +oscar +festivals +menus +joan +possibilities +duck +reveal +canal +amino +phi +contributing +herbs +clinics +mls +cow +manitoba +analytical +missions +watson +lying +costumes +strict +dive +saddam +circulation +drill +offense +threesome +bryan +cet +protest +handjob +assumption +jerusalem +hobby +tries +transexuales +invention +nickname +fiji +technician +inline +executives +enquiries +washing +audi +staffing +cognitive +exploring +trick +enquiry +closure +raid +ppc +timber +volt +intense +div +playlist +registrar +showers +supporters +ruling +steady +dirt +statutes +withdrawal +myers +drops +predicted +wider +saskatchewan +jc +cancellation +plugins +enrolled +sensors +screw +ministers +publicly +hourly +blame +geneva +freebsd +veterinary +acer +prostores +reseller +dist +handed +suffered +intake +informal +relevance +incentive +butterfly +tucson +mechanics +heavily +swingers +fifty +headers +mistakes +numerical +ons +geek +uncle +defining +xnxx +counting +reflection +sink +accompanied +assure +invitation +devoted +princeton +jacob +sodium +randy +spirituality +hormone +meanwhile +proprietary +timothy +childrens +brick +grip +naval +thumbzilla +medieval +porcelain +avi +bridges +pichunter +captured +watt +thehun +decent +casting +dayton +translated +shortly +cameron +columnists +pins +carlos +reno +donna +andreas +warrior +diploma +cabin +innocent +bdsm +scanning +ide +consensus +polo +valium +copying +rpg +delivering +cordless +patricia +horn +eddie +uganda +fired +journalism +pd +prot +trivia +adidas +perth +frog +grammar +intention +syria +disagree +klein +harvey +tires +logs +undertaken +tgp +hazard +retro +leo +livesex +statewide +semiconductor +gregory +episodes +boolean +circular +anger +diy +mainland +illustrations +suits +chances +interact +snap +happiness +arg +substantially +bizarre +glenn +ur +auckland +olympics +fruits +identifier +geo +worldsex +ribbon +calculations +doe +jpeg +conducting +startup +suzuki +trinidad +ati +kissing +wal +handy +swap +exempt +crops +reduces +accomplished +calculators +geometry +impression +abs +slovakia +flip +guild +correlation +gorgeous +capitol +sim +dishes +rna +barbados +chrysler +nervous +refuse +extends +fragrance +mcdonald +replica +plumbing +brussels +tribe +neighbors +trades +superb +buzz +transparent +nuke +rid +trinity +charleston +handled +legends +boom +calm +champions +floors +selections +projectors +inappropriate +exhaust +comparing +shanghai +speaks +burton +vocational +davidson +copied +scotia +farming +gibson +pharmacies +fork +troy +ln +roller +introducing +batch +organize +appreciated +alter +nicole +latino +ghana +edges +uc +mixing +handles +skilled +fitted +albuquerque +harmony +distinguished +asthma +projected +assumptions +shareholders +twins +developmental +rip +zope +regulated +triangle +amend +anticipated +oriental +reward +windsor +zambia +completing +gmbh +buf +ld +hydrogen +webshots +sprint +comparable +chick +advocate +sims +confusion +copyrighted +tray +inputs +warranties +genome +escorts +documented +thong +medal +paperbacks +coaches +vessels +harbour +walks +sucks +sol +keyboards +sage +knives +eco +vulnerable +arrange +artistic +bat +honors +booth +indie +reflected +unified +bones +breed +detector +ignored +polar +fallen +precise +sussex +respiratory +notifications +msgid +transexual +mainstream +invoice +evaluating +lip +subcommittee +sap +gather +suse +maternity +backed +alfred +colonial +mf +carey +motels +forming +embassy +cave +journalists +danny +rebecca +slight +proceeds +indirect +amongst +wool +foundations +msgstr +arrest +volleyball +mw +adipex +horizon +nu +deeply +toolbox +ict +marina +liabilities +prizes +bosnia +browsers +decreased +patio +dp +tolerance +surfing +creativity +lloyd +describing +optics +pursue +lightning +overcome +eyed +ou +quotations +grab +inspector +attract +brighton +beans +bookmarks +ellis +disable +snake +succeed +leonard +lending +oops +reminder +nipple +xi +searched +behavioral +riverside +bathrooms +plains +sku +ht +raymond +insights +abilities +initiated +sullivan +za +midwest +karaoke +trap +lonely +fool +ve +nonprofit +lancaster +suspended +hereby +observe +julia +containers +attitudes +karl +berry +collar +simultaneously +racial +integrate +bermuda +amanda +sociology +mobiles +screenshot +exhibitions +kelkoo +confident +retrieved +exhibits +officially +consortium +dies +terrace +bacteria +pts +replied +seafood +novels +rh +rrp +recipients +playboy +ought +delicious +traditions +fg +jail +safely +finite +kidney +periodically +fixes +sends +durable +mazda +allied +throws +moisture +hungarian +roster +referring +symantec +spencer +wichita +nasdaq +uruguay +ooo +hz +transform +timer +tablets +tuning +gotten +educators +tyler +futures +vegetable +verse +highs +humanities +independently +wanting +custody +scratch +launches +ipaq +alignment +masturbating +henderson +bk +britannica +comm +ellen +competitors +nhs +rocket +aye +bullet +towers +racks +lace +nasty +visibility +latitude +consciousness +ste +tumor +ugly +deposits +beverly +mistress +encounter +trustees +watts +duncan +reprints +hart +bernard +resolutions +ment +accessing +forty +tubes +attempted +col +midlands +priest +floyd +ronald +analysts +queue +dx +sk +trance +locale +nicholas +biol +yu +bundle +hammer +invasion +witnesses +runner +rows +administered +notion +sq +skins +mailed +oc +fujitsu +spelling +arctic +exams +rewards +beneath +strengthen +defend +aj +frederick +medicaid +treo +infrared +seventh +gods +une +welsh +belly +aggressive +tex +advertisements +quarters +stolen +cia +sublimedirectory +soonest +haiti +disturbed +determines +sculpture +poly +ears +dod +wp +fist +naturals +neo +motivation +lenders +pharmacology +fitting +fixtures +bloggers +mere +agrees +passengers +quantities +petersburg +consistently +powerpoint +cons +surplus +elder +sonic +obituaries +cheers +dig +taxi +punishment +appreciation +subsequently +om +belarus +nat +zoning +gravity +providence +thumb +restriction +incorporate +backgrounds +treasurer +guitars +essence +flooring +lightweight +ethiopia +tp +mighty +athletes +humanity +transcription +jm +holmes +complications +scholars +dpi +scripting +gis +remembered +galaxy +chester +snapshot +caring +loc +worn +synthetic +shaw +vp +segments +testament +expo +dominant +twist +specifics +itunes +stomach +partially +buried +cn +newbie +minimize +darwin +ranks +wilderness +debut +generations +tournaments +bradley +deny +anatomy +bali +judy +sponsorship +headphones +fraction +trio +proceeding +cube +defects +volkswagen +uncertainty +breakdown +milton +marker +reconstruction +subsidiary +strengths +clarity +rugs +sandra +adelaide +encouraging +furnished +monaco +settled +folding +emirates +terrorists +airfare +comparisons +beneficial +distributions +vaccine +belize +crap +fate +viewpicture +promised +volvo +penny +robust +bookings +threatened +minolta +republicans +discusses +gui +porter +gras +jungle +ver +rn +responded +rim +abstracts +zen +ivory +alpine +dis +prediction +pharmaceuticals +andale +fabulous +remix +alias +thesaurus +individually +battlefield +literally +newer +kay +ecological +spice +oval +implies +cg +soma +ser +cooler +appraisal +consisting +maritime +periodic +submitting +overhead +ascii +prospect +shipment +breeding +citations +geographical +donor +mozambique +tension +href +benz +trash +shapes +wifi +tier +fwd +earl +manor +envelope +diane +homeland +disclaimers +championships +excluded +andrea +breeds +rapids +disco +sheffield +bailey +aus +endif +finishing +emotions +wellington +incoming +prospects +lexmark +cleaners +bulgarian +hwy +eternal +cashiers +guam +cite +aboriginal +remarkable +rotation +nam +preventing +productive +boulevard +eugene +ix +gdp +pig +metric +compliant +minus +penalties +bennett +imagination +hotmail +refurbished +joshua +armenia +varied +grande +closest +activated +actress +mess +conferencing +assign +armstrong +politicians +trackbacks +lit +accommodate +tigers +aurora +una +slides +milan +premiere +lender +villages +shade +chorus +christine +rhythm +digit +argued +dietary +symphony +clarke +sudden +accepting +precipitation +marilyn +lions +findlaw +ada +pools +tb +lyric +claire +isolation +speeds +sustained +matched +approximate +rope +carroll +rational +programmer +fighters +chambers +dump +greetings +inherited +warming +incomplete +vocals +chronicle +fountain +chubby +grave +legitimate +biographies +burner +yrs +foo +investigator +gba +plaintiff +finnish +gentle +bm +prisoners +deeper +muslims +hose +mediterranean +nightlife +footage +howto +worthy +reveals +architects +saints +entrepreneur +carries +sig +freelance +duo +excessive +devon +screensaver +helena +saves +regarded +valuation +unexpected +cigarette +fog +characteristic +marion +lobby +egyptian +tunisia +metallica +outlined +consequently +headline +treating +punch +appointments +str +gotta +cowboy +narrative +bahrain +enormous +karma +consist +betty +queens +academics +pubs +quantitative +shemales +lucas +screensavers +subdivision +tribes +vip +defeat +clicks +distinction +honduras +naughty +hazards +insured +harper +livestock +mardi +exemption +tenant +sustainability +cabinets +tattoo +shake +algebra +shadows +holly +formatting +silly +nutritional +yea +mercy +hartford +freely +marcus +sunrise +wrapping +mild +fur +nicaragua +weblogs +timeline +tar +belongs +rj +readily +affiliation +soc +fence +nudist +infinite +diana +ensures +relatives +lindsay +clan +legally +shame +satisfactory +revolutionary +bracelets +sync +civilian +telephony +mesa +fatal +remedy +realtors +breathing +briefly +thickness +adjustments +graphical +genius +discussing +aerospace +fighter +meaningful +flesh +retreat +adapted +barely +wherever +estates +rug +democrat +borough +maintains +failing +shortcuts +ka +retained +voyeurweb +pamela +andrews +marble +extending +jesse +specifies +hull +logitech +surrey +briefing +belkin +dem +accreditation +wav +blackberry +highland +meditation +modular +microphone +macedonia +combining +brandon +instrumental +giants +organizing +shed +balloon +moderators +winston +memo +ham +solved +tide +kazakhstan +hawaiian +standings +partition +invisible +gratuit +consoles +funk +fbi +qatar +magnet +translations +porsche +cayman +jaguar +reel +sheer +commodity +posing +wang +kilometers +rp +bind +thanksgiving +rand +hopkins +urgent +guarantees +infants +gothic +cylinder +witch +buck +indication +eh +congratulations +tba +cohen +sie +usgs +puppy +kathy +acre +graphs +surround +cigarettes +revenge +expires +enemies +lows +controllers +aqua +chen +emma +consultancy +finances +accepts +enjoying +conventions +eva +patrol +smell +pest +hc +italiano +coordinates +rca +fp +carnival +roughly +sticker +promises +responding +reef +physically +divide +stakeholders +hydrocodone +gst +consecutive +cornell +satin +bon +deserve +attempting +mailto +promo +jj +representations +chan +worried +tunes +garbage +competing +combines +mas +beth +bradford +len +phrases +kai +peninsula +chelsea +boring +reynolds +dom +jill +accurately +speeches +reaches +schema +considers +sofa +catalogs +ministries +vacancies +quizzes +parliamentary +obj +prefix +lucia +savannah +barrel +typing +nerve +dans +planets +deficit +boulder +pointing +renew +coupled +viii +myanmar +metadata +harold +circuits +floppy +texture +handbags +jar +ev +somerset +incurred +acknowledge +thoroughly +antigua +nottingham +thunder +tent +caution +identifies +questionnaire +qualification +locks +modelling +namely +miniature +dept +hack +dare +euros +interstate +pirates +aerial +hawk +consequence +rebel +systematic +perceived +origins +hired +makeup +textile +lamb +madagascar +nathan +tobago +presenting +cos +troubleshooting +uzbekistan +indexes +pac +rl +erp +centuries +gl +magnitude +ui +richardson +hindu +dh +fragrances +vocabulary +licking +earthquake +vpn +fundraising +fcc +markers +weights +albania +geological +assessing +lasting +wicked +eds +introduces +kills +roommate +webcams +pushed +webmasters +ro +df +computational +acdbentity +participated +junk +handhelds +wax +lucy +answering +hans +impressed +slope +reggae +failures +poet +conspiracy +surname +theology +nails +evident +whats +rides +rehab +epic +saturn +organizer +nut +allergy +sake +twisted +combinations +preceding +merit +enzyme +cumulative +zshops +planes +edmonton +tackle +disks +condo +pokemon +amplifier +ambien +arbitrary +prominent +retrieve +lexington +vernon +sans +worldcat +titanium +irs +fairy +builds +contacted +shaft +lean +bye +cdt +recorders +occasional +leslie +casio +deutsche +ana +postings +innovations +kitty +postcards +dude +drain +monte +fires +algeria +blessed +luis +reviewing +cardiff +cornwall +favors +potato +panic +explicitly +sticks +leone +transsexual +ez +citizenship +excuse +reforms +basement +onion +strand +pf +sandwich +uw +lawsuit +alto +informative +girlfriend +bloomberg +cheque +hierarchy +influenced +banners +reject +eau +abandoned +bd +circles +italic +beats +merry +mil +scuba +gore +complement +cult +dash +passive +mauritius +valued +cage +checklist +bangbus +requesting +courage +verde +lauderdale +scenarios +gazette +hitachi +divx +extraction +batman +elevation +hearings +coleman +hugh +lap +utilization +beverages +calibration +jake +eval +efficiently +anaheim +ping +textbook +dried +entertaining +prerequisite +luther +frontier +settle +stopping +refugees +knights +hypothesis +palmer +medicines +flux +derby +sao +peaceful +altered +pontiac +regression +doctrine +scenic +trainers +muze +enhancements +renewable +intersection +passwords +sewing +consistency +collectors +conclude +recognised +munich +oman +celebs +gmc +propose +hh +azerbaijan +lighter +rage +adsl +uh +prix +astrology +advisors +pavilion +tactics +trusts +occurring +supplemental +travelling +talented +annie +pillow +induction +derek +precisely +shorter +harley +spreading +provinces +relying +finals +paraguay +steal +parcel +refined +fd +bo +fifteen +widespread +incidence +fears +predict +boutique +acrylic +rolled +tuner +avon +incidents +peterson +rays +asn +shannon +toddler +enhancing +flavor +alike +walt +homeless +horrible +hungry +metallic +acne +blocked +interference +warriors +palestine +listprice +libs +undo +cadillac +atmospheric +malawi +wm +pk +sagem +knowledgestorm +dana +halo +ppm +curtis +parental +referenced +strikes +lesser +publicity +marathon +ant +proposition +gays +pressing +gasoline +apt +dressed +scout +belfast +exec +dealt +niagara +inf +eos +warcraft +charms +catalyst +trader +bucks +allowance +vcr +denial +uri +designation +thrown +prepaid +raises +gem +duplicate +electro +criterion +badge +wrist +civilization +analyzed +vietnamese +heath +tremendous +ballot +lexus +varying +remedies +validity +trustee +maui +handjobs +weighted +angola +squirt +performs +plastics +realm +corrected +jenny +helmet +salaries +postcard +elephant +yemen +encountered +tsunami +scholar +nickel +internationally +surrounded +psi +buses +expedia +geology +pct +wb +creatures +coating +commented +wallet +cleared +smilies +vids +accomplish +boating +drainage +shakira +corners +broader +vegetarian +rouge +yeast +yale +newfoundland +sn +qld +pas +clearing +investigated +dk +ambassador +coated +intend +stephanie +contacting +vegetation +doom +findarticles +louise +kenny +specially +owen +routines +hitting +yukon +beings +bite +issn +aquatic +reliance +habits +striking +myth +infectious +podcasts +singh +gig +gilbert +sas +ferrari +continuity +brook +fu +outputs +phenomenon +ensemble +insulin +assured +biblical +weed +conscious +accent +mysimon +eleven +wives +ambient +utilize +mileage +oecd +prostate +adaptor +auburn +unlock +hyundai +pledge +vampire +angela +relates +nitrogen +xerox +dice +merger +softball +referrals +quad +dock +differently +firewire +mods +nextel +framing +organised +musician +blocking +rwanda +sorts +integrating +vsnet +limiting +dispatch +revisions +papua +restored +hint +armor +riders +chargers +remark +dozens +varies +msie +reasoning +wn +liz +rendered +picking +charitable +guards +annotated +ccd +sv +convinced +openings +buys +burlington +replacing +researcher +watershed +councils +occupations +acknowledged +nudity +kruger +pockets +granny +pork +zu +equilibrium +viral +inquire +pipes +characterized +laden +aruba +cottages +realtor +merge +privilege +edgar +develops +qualifying +chassis +dubai +estimation +barn +pushing +llp +fleece +pediatric +boc +fare +dg +asus +pierce +allan +dressing +techrepublic +sperm +vg +bald +filme +craps +fuji +frost +leon +institutes +mold +dame +fo +sally +yacht +tracy +prefers +drilling +brochures +herb +tmp +alot +ate +breach +whale +traveller +appropriations +suspected +tomatoes +benchmark +beginners +instructors +highlighted +bedford +stationery +idle +mustang +unauthorized +clusters +antibody +competent +momentum +fin +wiring +io +pastor +mud +calvin +uni +shark +contributor +demonstrates +phases +grateful +emerald +gradually +laughing +grows +cliff +desirable +tract +ul +ballet +ol +journalist +abraham +js +bumper +afterwards +webpage +religions +garlic +hostels +shine +senegal +explosion +pn +banned +wendy +briefs +signatures +diffs +cove +mumbai +ozone +disciplines +casa +mu +daughters +conversations +radios +tariff +nvidia +opponent +pasta +simplified +muscles +serum +wrapped +swift +motherboard +runtime +inbox +focal +bibliographic +vagina +eden +distant +incl +champagne +ala +decimal +hq +deviation +superintendent +propecia +dip +nbc +samba +hostel +housewives +employ +mongolia +penguin +magical +influences +inspections +irrigation +miracle +manually +reprint +reid +wt +hydraulic +centered +robertson +flex +yearly +penetration +wound +belle +rosa +conviction +hash +omissions +writings +hamburg +lazy +mv +mpg +retrieval +qualities +cindy +lolita +fathers +carb +charging +cas +marvel +lined +cio +dow +prototype +importantly +rb +petite +apparatus +upc +terrain +dui +pens +explaining +yen +strips +gossip +rangers +nomination +empirical +mh +rotary +worm +dependence +discrete +beginner +boxed +lid +sexuality +polyester +cubic +deaf +commitments +suggesting +sapphire +kinase +skirts +mats +remainder +crawford +labeled +privileges +televisions +specializing +marking +commodities +pvc +serbia +sheriff +griffin +declined +guyana +spies +blah +mime +neighbor +motorcycles +elect +highways +thinkpad +concentrate +intimate +reproductive +preston +deadly +cunt +feof +bunny +chevy +molecules +rounds +longest +refrigerator +tions +intervals +sentences +dentists +usda +exclusion +workstation +holocaust +keen +flyer +peas +dosage +receivers +urls +customise +disposition +variance +navigator +investigators +cameroon +baking +marijuana +adaptive +computed +needle +baths +enb +gg +cathedral +brakes +og +nirvana +ko +fairfield +owns +til +invision +sticky +destiny +generous +madness +emacs +climb +blowing +fascinating +landscapes +heated +lafayette +jackie +wto +computation +hay +cardiovascular +ww +sparc +cardiac +salvation +dover +adrian +predictions +accompanying +vatican +brutal +learners +gd +selective +arbitration +configuring +token +editorials +zinc +sacrifice +seekers +guru +isa +removable +convergence +yields +gibraltar +levy +suited +numeric +anthropology +skating +kinda +aberdeen +emperor +grad +malpractice +dylan +bras +belts +blacks +educated +rebates +reporters +burke +proudly +pix +necessity +rendering +mic +inserted +pulling +basename +kyle +obesity +curves +suburban +touring +clara +vertex +bw +hepatitis +nationally +tomato +andorra +waterproof +expired +mj +travels +flush +waiver +pale +specialties +hayes +humanitarian +invitations +functioning +delight +survivor +garcia +cingular +economies +alexandria +bacterial +moses +counted +undertake +declare +continuously +johns +valves +gaps +impaired +achievements +donors +tear +jewel +teddy +lf +convertible +ata +teaches +ventures +nil +bufing +stranger +tragedy +julian +nest +pam +dryer +painful +velvet +tribunal +ruled +nato +pensions +prayers +funky +secretariat +nowhere +cop +paragraphs +gale +joins +adolescent +nominations +wesley +dim +lately +cancelled +scary +mattress +mpegs +brunei +likewise +banana +introductory +slovak +cakes +stan +reservoir +occurrence +idol +bloody +mixer +remind +wc +worcester +sbjct +demographic +charming +mai +tooth +disciplinary +annoying +respected +stays +disclose +affair +drove +washer +upset +restrict +springer +beside +mines +portraits +rebound +logan +mentor +interpreted +evaluations +fought +baghdad +elimination +metres +hypothetical +immigrants +complimentary +helicopter +pencil +freeze +hk +performer +abu +titled +commissions +sphere +powerseller +moss +ratios +concord +graduated +endorsed +ty +surprising +walnut +lance +ladder +italia +unnecessary +dramatically +liberia +sherman +cork +maximize +cj +hansen +senators +workout +mali +yugoslavia +bleeding +characterization +colon +likelihood +lanes +purse +fundamentals +contamination +mtv +endangered +compromise +masturbation +optimize +stating +dome +caroline +leu +expiration +namespace +align +peripheral +bless +engaging +negotiation +crest +opponents +triumph +nominated +confidentiality +electoral +changelog +welding +orgasm +deferred +alternatively +heel +alloy +condos +plots +polished +yang +gently +greensboro +tulsa +locking +casey +controversial +draws +fridge +blanket +bloom +qc +simpsons +lou +elliott +recovered +fraser +justify +upgrading +blades +pgp +loops +surge +frontpage +trauma +aw +tahoe +advert +possess +demanding +defensive +sip +flashers +subaru +forbidden +tf +vanilla +programmers +pj +monitored +installations +deutschland +picnic +souls +arrivals +spank +cw +practitioner +motivated +wr +dumb +smithsonian +hollow +vault +securely +examining +fioricet +groove +revelation +rg +pursuit +delegation +wires +bl +dictionaries +mails +backing +greenhouse +sleeps +vc +blake +transparency +dee +travis +wx +endless +figured +orbit +currencies +niger +bacon +survivors +positioning +heater +colony +cannon +circus +promoted +forbes +mae +moldova +mel +descending +paxil +spine +trout +enclosed +feat +temporarily +ntsc +cooked +thriller +transmit +apnic +fatty +gerald +pressed +frequencies +scanned +reflections +hunger +mariah +sic +municipality +usps +joyce +detective +surgeon +cement +experiencing +fireplace +endorsement +bg +planners +disputes +textiles +missile +intranet +closes +seq +psychiatry +persistent +deborah +conf +marco +assists +summaries +glow +gabriel +auditor +wma +aquarium +violin +prophet +cir +bracket +looksmart +isaac +oxide +oaks +magnificent +erik +colleague +naples +promptly +modems +adaptation +hu +harmful +paintball +prozac +sexually +enclosure +acm +dividend +newark +kw +paso +glucose +phantom +norm +playback +supervisors +westminster +turtle +ips +distances +absorption +treasures +dsc +warned +neural +ware +fossil +mia +hometown +badly +transcripts +apollo +wan +disappointed +persian +continually +communist +collectible +handmade +greene +entrepreneurs +robots +grenada +creations +jade +scoop +acquisitions +foul +keno +gtk +earning +mailman +sanyo +nested +biodiversity +excitement +somalia +movers +verbal +blink +presently +seas +carlo +workflow +mysterious +novelty +bryant +tiles +voyuer +librarian +subsidiaries +switched +stockholm +tamil +garmin +ru +pose +fuzzy +indonesian +grams +therapist +richards +mrna +budgets +toolkit +promising +relaxation +goat +render +carmen +ira +sen +thereafter +hardwood +erotica +temporal +sail +forge +commissioners +dense +dts +brave +forwarding +qt +awful +nightmare +airplane +reductions +southampton +istanbul +impose +organisms +sega +telescope +viewers +asbestos +portsmouth +cdna +meyer +enters +pod +savage +advancement +wu +harassment +willow +resumes +bolt +gage +throwing +existed +whore +generators +lu +wagon +barbie +dat +favour +soa +knock +urge +smtp +generates +potatoes +thorough +replication +inexpensive +kurt +receptors +peers +roland +optimum +neon +interventions +quilt +huntington +creature +ours +mounts +syracuse +internship +lone +refresh +aluminium +snowboard +beastality +webcast +michel +evanescence +subtle +coordinated +notre +shipments +maldives +stripes +firmware +antarctica +cope +shepherd +lm +canberra +cradle +chancellor +mambo +lime +kirk +flour +controversy +legendary +bool +sympathy +choir +avoiding +beautifully +blond +expects +cho +jumping +fabrics +antibodies +polymer +hygiene +wit +poultry +virtue +burst +examinations +surgeons +bouquet +immunology +promotes +mandate +wiley +departmental +bbs +spas +ind +corpus +johnston +terminology +gentleman +fibre +reproduce +convicted +shades +jets +indices +roommates +adware +qui +intl +threatening +spokesman +zoloft +activists +frankfurt +prisoner +daisy +halifax +encourages +ultram +cursor +assembled +earliest +donated +stuffed +restructuring +insects +terminals +crude +morrison +maiden +simulations +cz +sufficiently +examines +viking +myrtle +bored +cleanup +yarn +knit +conditional +mug +crossword +bother +budapest +conceptual +knitting +attacked +hl +bhutan +liechtenstein +mating +compute +redhead +arrives +translator +automobiles +tractor +allah +continent +ob +unwrap +fares +longitude +resist +challenged +telecharger +hoped +pike +safer +insertion +instrumentation +ids +hugo +wagner +constraint +groundwater +touched +strengthening +cologne +gzip +wishing +ranger +smallest +insulation +newman +marsh +ricky +ctrl +scared +theta +infringement +bent +laos +subjective +monsters +asylum +lightbox +robbie +stake +cocktail +outlets +swaziland +varieties +arbor +mediawiki +configurations +poison From a17750ba428afb3f96c33d9ad54a41dbf466b8b9 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 7 Jan 2025 15:00:34 +0800 Subject: [PATCH 82/91] Revert word list changes --- packages/rlc-common/src/helpers/nameUtils.ts | 40 +- .../rlc-common/src/helpers/wordListUtil.ts | 12 - packages/rlc-common/wordList.txt | 10000 ---------------- .../test/loadtesting_modular/tspconfig.yaml | 1 + 4 files changed, 4 insertions(+), 10049 deletions(-) delete mode 100644 packages/rlc-common/src/helpers/wordListUtil.ts delete mode 100644 packages/rlc-common/wordList.txt diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index fa6c4c4891..f9c928cfb2 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { isValidWord } from "./wordListUtil.js"; - export interface NormalizeNameOption { shouldGuard?: boolean; customReservedNames?: ReservedName[]; @@ -253,7 +251,9 @@ function deconstruct(identifier: string, nameType: NameType): Array { } if (part) { refinedParts.push( - ...deconstructPart(part) + ...part + .split(/[\W|_]+/) + .map((p) => (isFullyUpperCase(p) ? p : p.toLowerCase())) ); } if (latterReserved) { @@ -263,40 +263,6 @@ function deconstruct(identifier: string, nameType: NameType): Array { return refinedParts.filter((part) => part.trim().length > 0); } -function deconstructPart(text: string): string[] { - const parts = text - .split(/[\W|_]+/) - const res = []; - for (const part of parts) { - const isUpperCase = isFullyUpperCase(part); - const isValid = isValidWord(part); - if (isValid) { - res.push(part.toLowerCase()); - } else if (isUpperCase && !isValid) { - res.push(part); - } else { - // try to deconstruct further - res.push(...tryDeconstructPart(part.toLowerCase())); - } - } - - return res; -} - -function tryDeconstructPart(text: string = ""): string[] { - if (text.length <= 6) { - return [text]; - } - for (let i = 3; i < text.length - 2; i++) { - const left = text.substring(0, i); - const right = text.substring(i); - if (isValidWord(left) && isValidWord(right)) { - return [left, right]; - } - } - return [text]; -} - function isReservedChar(part: string) { return ["_", "-", "."].includes(part); } diff --git a/packages/rlc-common/src/helpers/wordListUtil.ts b/packages/rlc-common/src/helpers/wordListUtil.ts deleted file mode 100644 index 760fed6642..0000000000 --- a/packages/rlc-common/src/helpers/wordListUtil.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as fs from 'fs'; - -const dictionary = new Set(fs.readFileSync('./wordList.txt', 'utf8').split(/[\r\n]+/)); - -/** - * Check if a word is valid, true if it is in the dictionary - * @param word - * @returns boolean - */ -export function isValidWord(word: string = ""): boolean { - return dictionary.has(word.toLowerCase()); -} diff --git a/packages/rlc-common/wordList.txt b/packages/rlc-common/wordList.txt deleted file mode 100644 index 3164d7bf96..0000000000 --- a/packages/rlc-common/wordList.txt +++ /dev/null @@ -1,10000 +0,0 @@ -the -of -and -to -a -in -for -is -on -that -by -this -with -i -you -it -not -or -be -are -from -at -as -your -all -have -new -more -an -was -we -will -home -can -us -about -if -page -my -has -search -free -but -our -one -other -do -no -information -time -they -site -he -up -may -what -which -their -news -out -use -any -there -see -only -so -his -when -contact -here -business -who -web -also -now -help -get -pm -view -online -c -e -first -am -been -would -how -were -me -s -services -some -these -click -its -like -service -x -than -find -price -date -back -top -people -had -list -name -just -over -state -year -day -into -email -two -health -n -world -re -next -used -go -b -work -last -most -products -music -buy -data -make -them -should -product -system -post -her -city -t -add -policy -number -such -please -available -copyright -support -message -after -best -software -then -jan -good -video -well -d -where -info -rights -public -books -high -school -through -m -each -links -she -review -years -order -very -privacy -book -items -company -r -read -group -sex -need -many -user -said -de -does -set -under -general -research -university -january -mail -full -map -reviews -program -life -know -games -way -days -management -p -part -could -great -united -hotel -real -f -item -international -center -ebay -must -store -travel -comments -made -development -report -off -member -details -line -terms -before -hotels -did -send -right -type -because -local -those -using -results -office -education -national -car -design -take -posted -internet -address -community -within -states -area -want -phone -dvd -shipping -reserved -subject -between -forum -family -l -long -based -w -code -show -o -even -black -check -special -prices -website -index -being -women -much -sign -file -link -open -today -technology -south -case -project -same -pages -uk -version -section -own -found -sports -house -related -security -both -g -county -american -photo -game -members -power -while -care -network -down -computer -systems -three -total -place -end -following -download -h -him -without -per -access -think -north -resources -current -posts -big -media -law -control -water -history -pictures -size -art -personal -since -including -guide -shop -directory -board -location -change -white -text -small -rating -rate -government -children -during -usa -return -students -v -shopping -account -times -sites -level -digital -profile -previous -form -events -love -old -john -main -call -hours -image -department -title -description -non -k -y -insurance -another -why -shall -property -class -cd -still -money -quality -every -listing -content -country -private -little -visit -save -tools -low -reply -customer -december -compare -movies -include -college -value -article -york -man -card -jobs -provide -j -food -source -author -different -press -u -learn -sale -around -print -course -job -canada -process -teen -room -stock -training -too -credit -point -join -science -men -categories -advanced -west -sales -look -english -left -team -estate -box -conditions -select -windows -photos -gay -thread -week -category -note -live -large -gallery -table -register -however -june -october -november -market -library -really -action -start -series -model -features -air -industry -plan -human -provided -tv -yes -required -second -hot -accessories -cost -movie -forums -march -la -september -better -say -questions -july -yahoo -going -medical -test -friend -come -dec -server -pc -study -application -cart -staff -articles -san -feedback -again -play -looking -issues -april -never -users -complete -street -topic -comment -financial -things -working -against -standard -tax -person -below -mobile -less -got -blog -party -payment -equipment -login -student -let -programs -offers -legal -above -recent -park -stores -side -act -problem -red -give -memory -performance -social -q -august -quote -language -story -sell -options -experience -rates -create -key -body -young -america -important -field -few -east -paper -single -ii -age -activities -club -example -girls -additional -password -z -latest -something -road -gift -question -changes -night -ca -hard -texas -oct -pay -four -poker -status -browse -issue -range -building -seller -court -february -always -result -audio -light -write -war -nov -offer -blue -groups -al -easy -given -files -event -release -analysis -request -fax -china -making -picture -needs -possible -might -professional -yet -month -major -star -areas -future -space -committee -hand -sun -cards -problems -london -washington -meeting -rss -become -interest -id -child -keep -enter -california -porn -share -similar -garden -schools -million -added -reference -companies -listed -baby -learning -energy -run -delivery -net -popular -term -film -stories -put -computers -journal -reports -co -try -welcome -central -images -president -notice -god -original -head -radio -until -cell -color -self -council -away -includes -track -australia -discussion -archive -once -others -entertainment -agreement -format -least -society -months -log -safety -friends -sure -faq -trade -edition -cars -messages -marketing -tell -further -updated -association -able -having -provides -david -fun -already -green -studies -close -common -drive -specific -several -gold -feb -living -sep -collection -called -short -arts -lot -ask -display -limited -powered -solutions -means -director -daily -beach -past -natural -whether -due -et -electronics -five -upon -period -planning -database -says -official -weather -mar -land -average -done -technical -window -france -pro -region -island -record -direct -microsoft -conference -environment -records -st -district -calendar -costs -style -url -front -statement -update -parts -aug -ever -downloads -early -miles -sound -resource -present -applications -either -ago -document -word -works -material -bill -apr -written -talk -federal -hosting -rules -final -adult -tickets -thing -centre -requirements -via -cheap -nude -kids -finance -true -minutes -else -mark -third -rock -gifts -europe -reading -topics -bad -individual -tips -plus -auto -cover -usually -edit -together -videos -percent -fast -function -fact -unit -getting -global -tech -meet -far -economic -en -player -projects -lyrics -often -subscribe -submit -germany -amount -watch -included -feel -though -bank -risk -thanks -everything -deals -various -words -linux -jul -production -commercial -james -weight -town -heart -advertising -received -choose -treatment -newsletter -archives -points -knowledge -magazine -error -camera -jun -girl -currently -construction -toys -registered -clear -golf -receive -domain -methods -chapter -makes -protection -policies -loan -wide -beauty -manager -india -position -taken -sort -listings -models -michael -known -half -cases -step -engineering -florida -simple -quick -none -wireless -license -paul -friday -lake -whole -annual -published -later -basic -sony -shows -corporate -google -church -method -purchase -customers -active -response -practice -hardware -figure -materials -fire -holiday -chat -enough -designed -along -among -death -writing -speed -html -countries -loss -face -brand -discount -higher -effects -created -remember -standards -oil -bit -yellow -political -increase -advertise -kingdom -base -near -environmental -thought -stuff -french -storage -oh -japan -doing -loans -shoes -entry -stay -nature -orders -availability -africa -summary -turn -mean -growth -notes -agency -king -monday -european -activity -copy -although -drug -pics -western -income -force -cash -employment -overall -bay -river -commission -ad -package -contents -seen -players -engine -port -album -regional -stop -supplies -started -administration -bar -institute -views -plans -double -dog -build -screen -exchange -types -soon -sponsored -lines -electronic -continue -across -benefits -needed -season -apply -someone -held -ny -anything -printer -condition -effective -believe -organization -effect -asked -eur -mind -sunday -selection -casino -pdf -lost -tour -menu -volume -cross -anyone -mortgage -hope -silver -corporation -wish -inside -solution -mature -role -rather -weeks -addition -came -supply -nothing -certain -usr -executive -running -lower -necessary -union -jewelry -according -dc -clothing -mon -com -particular -fine -names -robert -homepage -hour -gas -skills -six -bush -islands -advice -career -military -rental -decision -leave -british -teens -pre -huge -sat -woman -facilities -zip -bid -kind -sellers -middle -move -cable -opportunities -taking -values -division -coming -tuesday -object -lesbian -appropriate -machine -logo -length -actually -nice -score -statistics -client -ok -returns -capital -follow -sample -investment -sent -shown -saturday -christmas -england -culture -band -flash -ms -lead -george -choice -went -starting -registration -fri -thursday -courses -consumer -hi -airport -foreign -artist -outside -furniture -levels -channel -letter -mode -phones -ideas -wednesday -structure -fund -summer -allow -degree -contract -button -releases -wed -homes -super -male -matter -custom -virginia -almost -took -located -multiple -asian -distribution -editor -inn -industrial -cause -potential -song -cnet -ltd -los -hp -focus -late -fall -featured -idea -rooms -female -responsible -inc -communications -win -associated -thomas -primary -cancer -numbers -reason -tool -browser -spring -foundation -answer -voice -eg -friendly -schedule -documents -communication -purpose -feature -bed -comes -police -everyone -independent -ip -approach -cameras -brown -physical -operating -hill -maps -medicine -deal -hold -ratings -chicago -forms -glass -happy -tue -smith -wanted -developed -thank -safe -unique -survey -prior -telephone -sport -ready -feed -animal -sources -mexico -population -pa -regular -secure -navigation -operations -therefore -ass -simply -evidence -station -christian -round -paypal -favorite -understand -option -master -valley -recently -probably -thu -rentals -sea -built -publications -blood -cut -worldwide -improve -connection -publisher -hall -larger -anti -networks -earth -parents -nokia -impact -transfer -introduction -kitchen -strong -tel -carolina -wedding -properties -hospital -ground -overview -ship -accommodation -owners -disease -tx -excellent -paid -italy -perfect -hair -opportunity -kit -classic -basis -command -cities -william -express -anal -award -distance -tree -peter -assessment -ensure -thus -wall -ie -involved -el -extra -especially -interface -pussy -partners -budget -rated -guides -success -maximum -ma -operation -existing -quite -selected -boy -amazon -patients -restaurants -beautiful -warning -wine -locations -horse -vote -forward -flowers -stars -significant -lists -technologies -owner -retail -animals -useful -directly -manufacturer -ways -est -son -providing -rule -mac -housing -takes -iii -gmt -bring -catalog -searches -max -trying -mother -authority -considered -told -xml -traffic -programme -joined -input -strategy -feet -agent -valid -bin -modern -senior -ireland -sexy -teaching -door -grand -testing -trial -charge -units -instead -canadian -cool -normal -wrote -enterprise -ships -entire -educational -md -leading -metal -positive -fl -fitness -chinese -opinion -mb -asia -football -abstract -uses -output -funds -mr -greater -likely -develop -employees -artists -alternative -processing -responsibility -resolution -java -guest -seems -publication -pass -relations -trust -van -contains -session -multi -photography -republic -fees -components -vacation -century -academic -assistance -completed -skin -graphics -indian -prev -ads -mary -il -expected -ring -grade -dating -pacific -mountain -organizations -pop -filter -mailing -vehicle -longer -consider -int -northern -behind -panel -floor -german -buying -match -proposed -default -require -iraq -boys -outdoor -deep -morning -otherwise -allows -rest -protein -plant -reported -hit -transportation -mm -pool -mini -politics -partner -disclaimer -authors -boards -faculty -parties -fish -membership -mission -eye -string -sense -modified -pack -released -stage -internal -goods -recommended -born -unless -richard -detailed -japanese -race -approved -background -target -except -character -usb -maintenance -ability -maybe -functions -ed -moving -brands -places -php -pretty -trademarks -phentermine -spain -southern -yourself -etc -winter -rape -battery -youth -pressure -submitted -boston -incest -debt -keywords -medium -television -interested -core -break -purposes -throughout -sets -dance -wood -msn -itself -defined -papers -playing -awards -fee -studio -reader -virtual -device -established -answers -rent -las -remote -dark -programming -external -apple -le -regarding -instructions -min -offered -theory -enjoy -remove -aid -surface -minimum -visual -host -variety -teachers -isbn -martin -manual -block -subjects -agents -increased -repair -fair -civil -steel -understanding -songs -fixed -wrong -beginning -hands -associates -finally -az -updates -desktop -classes -paris -ohio -gets -sector -capacity -requires -jersey -un -fat -fully -father -electric -saw -instruments -quotes -officer -driver -businesses -dead -respect -unknown -specified -restaurant -mike -trip -pst -worth -mi -procedures -poor -teacher -xxx -eyes -relationship -workers -farm -fucking -georgia -peace -traditional -campus -tom -showing -creative -coast -benefit -progress -funding -devices -lord -grant -sub -agree -fiction -hear -sometimes -watches -careers -beyond -goes -families -led -museum -themselves -fan -transport -interesting -blogs -wife -evaluation -accepted -former -implementation -ten -hits -zone -complex -th -cat -galleries -references -die -presented -jack -flat -flow -agencies -literature -respective -parent -spanish -michigan -columbia -setting -dr -scale -stand -economy -highest -helpful -monthly -critical -frame -musical -definition -secretary -angeles -networking -path -australian -employee -chief -gives -kb -bottom -magazines -packages -detail -francisco -laws -changed -pet -heard -begin -individuals -colorado -royal -clean -switch -russian -largest -african -guy -titles -relevant -guidelines -justice -connect -bible -dev -cup -basket -applied -weekly -vol -installation -described -demand -pp -suite -vegas -na -square -chris -attention -advance -skip -diet -army -auction -gear -lee -os -difference -allowed -correct -charles -nation -selling -lots -piece -sheet -firm -seven -older -illinois -regulations -elements -species -jump -cells -module -resort -facility -random -pricing -dvds -certificate -minister -motion -looks -fashion -directions -visitors -documentation -monitor -trading -forest -calls -whose -coverage -couple -giving -chance -vision -ball -ending -clients -actions -listen -discuss -accept -automotive -naked -goal -successful -sold -wind -communities -clinical -situation -sciences -markets -lowest -highly -publishing -appear -emergency -developing -lives -currency -leather -determine -milf -temperature -palm -announcements -patient -actual -historical -stone -bob -commerce -ringtones -perhaps -persons -difficult -scientific -satellite -fit -tests -village -accounts -amateur -ex -met -pain -xbox -particularly -factors -coffee -www -settings -cum -buyer -cultural -steve -easily -oral -ford -poster -edge -functional -root -au -fi -closed -holidays -ice -pink -zealand -balance -monitoring -graduate -replies -shot -nc -architecture -initial -label -thinking -scott -llc -sec -recommend -canon -hardcore -league -waste -minute -bus -provider -optional -dictionary -cold -accounting -manufacturing -sections -chair -fishing -effort -phase -fields -bag -fantasy -po -letters -motor -va -professor -context -install -shirt -apparel -generally -continued -foot -mass -crime -count -breast -techniques -ibm -rd -johnson -sc -quickly -dollars -websites -religion -claim -driving -permission -surgery -patch -heat -wild -measures -generation -kansas -miss -chemical -doctor -task -reduce -brought -himself -nor -component -enable -exercise -bug -santa -mid -guarantee -leader -diamond -israel -se -processes -soft -servers -alone -meetings -seconds -jones -arizona -keyword -interests -flight -congress -fuel -username -walk -fuck -produced -italian -paperback -classifieds -wait -supported -pocket -saint -rose -freedom -argument -competition -creating -jim -drugs -joint -premium -providers -fresh -characters -attorney -upgrade -di -factor -growing -thousands -km -stream -apartments -pick -hearing -eastern -auctions -therapy -entries -dates -generated -signed -upper -administrative -serious -prime -samsung -limit -began -louis -steps -errors -shops -bondage -del -efforts -informed -ga -ac -thoughts -creek -ft -worked -quantity -urban -practices -sorted -reporting -essential -myself -tours -platform -load -affiliate -labor -immediately -admin -nursing -defense -machines -designated -tags -heavy -covered -recovery -joe -guys -integrated -configuration -cock -merchant -comprehensive -expert -universal -protect -drop -solid -cds -presentation -languages -became -orange -compliance -vehicles -prevent -theme -rich -im -campaign -marine -improvement -vs -guitar -finding -pennsylvania -examples -ipod -saying -spirit -ar -claims -porno -challenge -motorola -acceptance -strategies -mo -seem -affairs -touch -intended -towards -sa -goals -hire -election -suggest -branch -charges -serve -affiliates -reasons -magic -mount -smart -talking -gave -ones -latin -multimedia -xp -tits -avoid -certified -manage -corner -rank -computing -oregon -element -birth -virus -abuse -interactive -requests -separate -quarter -procedure -leadership -tables -define -racing -religious -facts -breakfast -kong -column -plants -faith -chain -developer -identify -avenue -missing -died -approximately -domestic -sitemap -recommendations -moved -houston -reach -comparison -mental -viewed -moment -extended -sequence -inch -attack -sorry -centers -opening -damage -lab -reserve -recipes -cvs -gamma -plastic -produce -snow -placed -truth -counter -failure -follows -eu -weekend -dollar -camp -ontario -automatically -des -minnesota -films -bridge -native -fill -williams -movement -printing -baseball -owned -approval -draft -chart -played -contacts -cc -jesus -readers -clubs -lcd -wa -jackson -equal -adventure -matching -offering -shirts -profit -leaders -posters -institutions -assistant -variable -ave -dj -advertisement -expect -parking -headlines -yesterday -compared -determined -wholesale -workshop -russia -gone -codes -kinds -extension -seattle -statements -golden -completely -teams -fort -cm -wi -lighting -senate -forces -funny -brother -gene -turned -portable -tried -electrical -applicable -disc -returned -pattern -ct -hentai -boat -named -theatre -laser -earlier -manufacturers -sponsor -classical -icon -warranty -dedicated -indiana -direction -harry -basketball -objects -ends -delete -evening -assembly -nuclear -taxes -mouse -signal -criminal -issued -brain -sexual -wisconsin -powerful -dream -obtained -false -da -cast -flower -felt -personnel -passed -supplied -identified -falls -pic -soul -aids -opinions -promote -stated -stats -hawaii -professionals -appears -carry -flag -decided -nj -covers -hr -em -advantage -hello -designs -maintain -tourism -priority -newsletters -adults -clips -savings -iv -graphic -atom -payments -rw -estimated -binding -brief -ended -winning -eight -anonymous -iron -straight -script -served -wants -miscellaneous -prepared -void -dining -alert -integration -atlanta -dakota -tag -interview -mix -framework -disk -installed -queen -vhs -credits -clearly -fix -handle -sweet -desk -criteria -pubmed -dave -massachusetts -diego -hong -vice -associate -ne -truck -behavior -enlarge -ray -frequently -revenue -measure -changing -votes -du -duty -looked -discussions -bear -gain -festival -laboratory -ocean -flights -experts -signs -lack -depth -iowa -whatever -logged -laptop -vintage -train -exactly -dry -explore -maryland -spa -concept -nearly -eligible -checkout -reality -forgot -handling -origin -knew -gaming -feeds -billion -destination -scotland -faster -intelligence -dallas -bought -con -ups -nations -route -followed -specifications -broken -tripadvisor -frank -alaska -zoom -blow -battle -residential -anime -speak -decisions -industries -protocol -query -clip -partnership -editorial -nt -expression -es -equity -provisions -speech -wire -principles -suggestions -rural -shared -sounds -replacement -tape -strategic -judge -spam -economics -acid -bytes -cent -forced -compatible -fight -apartment -height -null -zero -speaker -filed -gb -netherlands -obtain -bc -consulting -recreation -offices -designer -remain -managed -pr -failed -marriage -roll -korea -banks -fr -participants -secret -bath -aa -kelly -leads -negative -austin -favorites -toronto -theater -springs -missouri -andrew -var -perform -healthy -translation -estimates -font -assets -injury -mt -joseph -ministry -drivers -lawyer -figures -married -protected -proposal -sharing -philadelphia -portal -waiting -birthday -beta -fail -gratis -banking -officials -brian -toward -won -slightly -assist -conduct -contained -lingerie -shemale -legislation -calling -parameters -jazz -serving -bags -profiles -miami -comics -matters -houses -doc -postal -relationships -tennessee -wear -controls -breaking -combined -ultimate -wales -representative -frequency -introduced -minor -finish -departments -residents -noted -displayed -mom -reduced -physics -rare -spent -performed -extreme -samples -davis -daniel -bars -reviewed -row -oz -forecast -removed -helps -singles -administrator -cycle -amounts -contain -accuracy -dual -rise -usd -sleep -mg -bird -pharmacy -brazil -creation -static -scene -hunter -addresses -lady -crystal -famous -writer -chairman -violence -fans -oklahoma -speakers -drink -academy -dynamic -gender -eat -permanent -agriculture -dell -cleaning -constitutes -portfolio -practical -delivered -collectibles -infrastructure -exclusive -seat -concerns -colour -vendor -originally -intel -utilities -philosophy -regulation -officers -reduction -aim -bids -referred -supports -nutrition -recording -regions -junior -toll -les -cape -ann -rings -meaning -tip -secondary -wonderful -mine -ladies -henry -ticket -announced -guess -agreed -prevention -whom -ski -soccer -math -import -posting -presence -instant -mentioned -automatic -healthcare -viewing -maintained -ch -increasing -majority -connected -christ -dan -dogs -sd -directors -aspects -austria -ahead -moon -participation -scheme -utility -preview -fly -manner -matrix -containing -combination -devel -amendment -despite -strength -guaranteed -turkey -libraries -proper -distributed -degrees -singapore -enterprises -delta -fear -seeking -inches -phoenix -rs -convention -shares -principal -daughter -standing -voyeur -comfort -colors -wars -cisco -ordering -kept -alpha -appeal -cruise -bonus -certification -previously -hey -bookmark -buildings -specials -beat -disney -household -batteries -adobe -smoking -bbc -becomes -drives -arms -alabama -tea -improved -trees -avg -achieve -positions -dress -subscription -dealer -contemporary -sky -utah -nearby -rom -carried -happen -exposure -panasonic -hide -permalink -signature -gambling -refer -miller -provision -outdoors -clothes -caused -luxury -babes -frames -viagra -certainly -indeed -newspaper -toy -circuit -layer -printed -slow -removal -easier -src -liability -trademark -hip -printers -faqs -nine -adding -kentucky -mostly -eric -spot -taylor -trackback -prints -spend -factory -interior -revised -grow -americans -optical -promotion -relative -amazing -clock -dot -hiv -identity -suites -conversion -feeling -hidden -reasonable -victoria -serial -relief -revision -broadband -influence -ratio -pda -importance -rain -onto -dsl -planet -webmaster -copies -recipe -zum -permit -seeing -proof -dna -diff -tennis -bass -prescription -bedroom -empty -instance -hole -pets -ride -licensed -orlando -specifically -tim -bureau -maine -sql -represent -conservation -pair -ideal -specs -recorded -don -pieces -finished -parks -dinner -lawyers -sydney -stress -cream -ss -runs -trends -yeah -discover -sexo -ap -patterns -boxes -louisiana -hills -javascript -fourth -nm -advisor -mn -marketplace -nd -evil -aware -wilson -shape -evolution -irish -certificates -objectives -stations -suggested -gps -op -remains -acc -greatest -firms -concerned -euro -operator -structures -generic -encyclopedia -usage -cap -ink -charts -continuing -mixed -census -interracial -peak -tn -competitive -exist -wheel -transit -dick -suppliers -salt -compact -poetry -lights -tracking -angel -bell -keeping -preparation -attempt -receiving -matches -accordance -width -noise -engines -forget -array -discussed -accurate -stephen -elizabeth -climate -reservations -pin -playstation -alcohol -greek -instruction -managing -annotation -sister -raw -differences -walking -explain -smaller -newest -establish -gnu -happened -expressed -jeff -extent -sharp -lesbians -ben -lane -paragraph -kill -mathematics -aol -compensation -ce -export -managers -aircraft -modules -sweden -conflict -conducted -versions -employer -occur -percentage -knows -mississippi -describe -concern -backup -requested -citizens -connecticut -heritage -personals -immediate -holding -trouble -spread -coach -kevin -agricultural -expand -supporting -audience -assigned -jordan -collections -ages -participate -plug -specialist -cook -affect -virgin -experienced -investigation -raised -hat -institution -directed -dealers -searching -sporting -helping -perl -affected -lib -bike -totally -plate -expenses -indicate -blonde -ab -proceedings -favourite -transmission -anderson -utc -characteristics -der -lose -organic -seek -experiences -albums -cheats -extremely -verzeichnis -contracts -guests -hosted -diseases -concerning -developers -equivalent -chemistry -tony -neighborhood -nevada -kits -thailand -variables -agenda -anyway -continues -tracks -advisory -cam -curriculum -logic -template -prince -circle -soil -grants -anywhere -psychology -responses -atlantic -wet -circumstances -edward -investor -identification -ram -leaving -wildlife -appliances -matt -elementary -cooking -speaking -sponsors -fox -unlimited -respond -sizes -plain -exit -entered -iran -arm -keys -launch -wave -checking -costa -belgium -printable -holy -acts -guidance -mesh -trail -enforcement -symbol -crafts -highway -buddy -hardcover -observed -dean -setup -poll -booking -glossary -fiscal -celebrity -styles -denver -unix -filled -bond -channels -ericsson -appendix -notify -blues -chocolate -pub -portion -scope -hampshire -supplier -cables -cotton -bluetooth -controlled -requirement -authorities -biology -dental -killed -border -ancient -debate -representatives -starts -pregnancy -causes -arkansas -biography -leisure -attractions -learned -transactions -notebook -explorer -historic -attached -opened -tm -husband -disabled -authorized -crazy -upcoming -britain -concert -retirement -scores -financing -efficiency -sp -comedy -adopted -efficient -weblog -linear -commitment -specialty -bears -jean -hop -carrier -edited -constant -visa -mouth -jewish -meter -linked -portland -interviews -concepts -nh -gun -reflect -pure -deliver -wonder -hell -lessons -fruit -begins -qualified -reform -lens -alerts -treated -discovery -draw -mysql -classified -relating -assume -confidence -alliance -fm -confirm -warm -neither -lewis -howard -offline -leaves -engineer -lifestyle -consistent -replace -clearance -connections -inventory -converter -suck -organisation -babe -checks -reached -becoming -blowjob -safari -objective -indicated -sugar -crew -legs -sam -stick -securities -allen -pdt -relation -enabled -genre -slide -montana -volunteer -tested -rear -democratic -enhance -switzerland -exact -bound -parameter -adapter -processor -node -formal -dimensions -contribute -lock -hockey -storm -micro -colleges -laptops -mile -showed -challenges -editors -mens -threads -bowl -supreme -brothers -recognition -presents -ref -tank -submission -dolls -estimate -encourage -navy -kid -regulatory -inspection -consumers -cancel -limits -territory -transaction -manchester -weapons -paint -delay -pilot -outlet -contributions -continuous -db -czech -resulting -cambridge -initiative -novel -pan -execution -disability -increases -ultra -winner -idaho -contractor -ph -episode -examination -potter -dish -plays -bulletin -ia -pt -indicates -modify -oxford -adam -truly -epinions -painting -committed -extensive -affordable -universe -candidate -databases -patent -slot -psp -outstanding -ha -eating -perspective -planned -watching -lodge -messenger -mirror -tournament -consideration -ds -discounts -sterling -sessions -kernel -boobs -stocks -buyers -journals -gray -catalogue -ea -jennifer -antonio -charged -broad -taiwan -und -chosen -demo -greece -lg -swiss -sarah -clark -labour -hate -terminal -publishers -nights -behalf -caribbean -liquid -rice -nebraska -loop -salary -reservation -foods -gourmet -guard -properly -orleans -saving -nfl -remaining -empire -resume -twenty -newly -raise -prepare -avatar -gary -depending -illegal -expansion -vary -hundreds -rome -arab -lincoln -helped -premier -tomorrow -purchased -milk -decide -consent -drama -visiting -performing -downtown -keyboard -contest -collected -nw -bands -boot -suitable -ff -absolutely -millions -lunch -dildo -audit -push -chamber -guinea -findings -muscle -featuring -iso -implement -clicking -scheduled -polls -typical -tower -yours -sum -misc -calculator -significantly -chicken -temporary -attend -shower -alan -sending -jason -tonight -dear -sufficient -holdem -shell -province -catholic -oak -vat -awareness -vancouver -governor -beer -seemed -contribution -measurement -swimming -spyware -formula -constitution -packaging -solar -jose -catch -jane -pakistan -ps -reliable -consultation -northwest -sir -doubt -earn -finder -unable -periods -classroom -tasks -democracy -attacks -kim -wallpaper -merchandise -const -resistance -doors -symptoms -resorts -biggest -memorial -visitor -twin -forth -insert -baltimore -gateway -ky -dont -alumni -drawing -candidates -charlotte -ordered -biological -fighting -transition -happens -preferences -spy -romance -instrument -bruce -split -themes -powers -heaven -br -bits -pregnant -twice -classification -focused -egypt -physician -hollywood -bargain -wikipedia -cellular -norway -vermont -asking -blocks -normally -lo -spiritual -hunting -diabetes -suit -ml -shift -chip -res -sit -bodies -photographs -cutting -wow -simon -writers -marks -flexible -loved -favourites -mapping -numerous -relatively -birds -satisfaction -represents -char -indexed -pittsburgh -superior -preferred -saved -paying -cartoon -shots -intellectual -moore -granted -choices -carbon -spending -comfortable -magnetic -interaction -listening -effectively -registry -crisis -outlook -massive -denmark -employed -bright -treat -header -cs -poverty -formed -piano -echo -que -grid -sheets -patrick -experimental -puerto -revolution -consolidation -displays -plasma -allowing -earnings -voip -mystery -landscape -dependent -mechanical -journey -delaware -bidding -consultants -risks -banner -applicant -charter -fig -barbara -cooperation -counties -acquisition -ports -implemented -sf -directories -recognized -dreams -blogger -notification -kg -licensing -stands -teach -occurred -textbooks -rapid -pull -hairy -diversity -cleveland -ut -reverse -deposit -seminar -investments -latina -nasa -wheels -sexcam -specify -accessibility -dutch -sensitive -templates -formats -tab -depends -boots -holds -router -concrete -si -editing -poland -folder -womens -css -completion -upload -pulse -universities -technique -contractors -milfhunter -voting -courts -notices -subscriptions -calculate -mc -detroit -alexander -broadcast -converted -metro -toshiba -anniversary -improvements -strip -specification -pearl -accident -nick -accessible -accessory -resident -plot -qty -possibly -airline -typically -representation -regard -pump -exists -arrangements -smooth -conferences -uniprotkb -beastiality -strike -consumption -birmingham -flashing -lp -narrow -afternoon -threat -surveys -sitting -putting -consultant -controller -ownership -committees -penis -legislative -researchers -vietnam -trailer -anne -castle -gardens -missed -malaysia -unsubscribe -antique -labels -willing -bio -molecular -upskirt -acting -heads -stored -exam -logos -residence -attorneys -milfs -antiques -density -hundred -ryan -operators -strange -sustainable -philippines -statistical -beds -breasts -mention -innovation -pcs -employers -grey -parallel -honda -amended -operate -bills -bold -bathroom -stable -opera -definitions -von -doctors -lesson -cinema -asset -ag -scan -elections -drinking -blowjobs -reaction -blank -enhanced -entitled -severe -generate -stainless -newspapers -hospitals -vi -deluxe -humor -aged -monitors -exception -lived -duration -bulk -successfully -indonesia -pursuant -sci -fabric -edt -visits -primarily -tight -domains -capabilities -pmid -contrast -recommendation -flying -recruitment -sin -berlin -cute -organized -ba -para -siemens -adoption -improving -cr -expensive -meant -capture -pounds -buffalo -organisations -plane -pg -explained -seed -programmes -desire -expertise -mechanism -camping -ee -jewellery -meets -welfare -peer -caught -eventually -marked -driven -measured -medline -bottle -agreements -considering -innovative -marshall -massage -rubber -conclusion -closing -tampa -thousand -meat -legend -grace -susan -ing -ks -adams -python -monster -alex -bang -villa -bone -columns -disorders -bugs -collaboration -hamilton -detection -ftp -cookies -inner -formation -tutorial -med -engineers -entity -cruises -gate -holder -proposals -moderator -sw -tutorials -settlement -portugal -lawrence -roman -duties -valuable -erotic -tone -collectables -ethics -forever -dragon -busy -captain -fantastic -imagine -brings -heating -leg -neck -hd -wing -governments -purchasing -scripts -abc -stereo -appointed -taste -dealing -commit -tiny -operational -rail -airlines -liberal -livecam -jay -trips -gap -sides -tube -turns -corresponding -descriptions -cache -belt -jacket -determination -animation -oracle -er -matthew -lease -productions -aviation -hobbies -proud -excess -disaster -console -commands -jr -telecommunications -instructor -giant -achieved -injuries -shipped -bestiality -seats -approaches -biz -alarm -voltage -anthony -nintendo -usual -loading -stamps -appeared -franklin -angle -rob -vinyl -highlights -mining -designers -melbourne -ongoing -worst -imaging -betting -scientists -liberty -wyoming -blackjack -argentina -era -convert -possibility -analyst -commissioner -dangerous -garage -exciting -reliability -thongs -gcc -unfortunately -respectively -volunteers -attachment -ringtone -finland -morgan -derived -pleasure -honor -asp -oriented -eagle -desktops -pants -columbus -nurse -prayer -appointment -workshops -hurricane -quiet -luck -postage -producer -represented -mortgages -dial -responsibilities -cheese -comic -carefully -jet -productivity -investors -crown -par -underground -diagnosis -maker -crack -principle -picks -vacations -gang -semester -calculated -cumshot -fetish -applies -casinos -appearance -smoke -apache -filters -incorporated -nv -craft -cake -notebooks -apart -fellow -blind -lounge -mad -algorithm -semi -coins -andy -gross -strongly -cafe -valentine -hilton -ken -proteins -horror -su -exp -familiar -capable -douglas -debian -till -involving -pen -investing -christopher -admission -epson -shoe -elected -carrying -victory -sand -madison -terrorism -joy -editions -cpu -mainly -ethnic -ran -parliament -actor -finds -seal -situations -fifth -allocated -citizen -vertical -corrections -structural -municipal -describes -prize -sr -occurs -jon -absolute -disabilities -consists -anytime -substance -prohibited -addressed -lies -pipe -soldiers -nr -guardian -lecture -simulation -layout -initiatives -ill -concentration -classics -lbs -lay -interpretation -horses -lol -dirty -deck -wayne -donate -taught -bankruptcy -mp -worker -optimization -alive -temple -substances -prove -discovered -wings -breaks -genetic -restrictions -participating -waters -promise -thin -exhibition -prefer -ridge -cabinet -modem -harris -mph -bringing -sick -dose -evaluate -tiffany -tropical -collect -bet -composition -toyota -streets -nationwide -vector -definitely -shaved -turning -buffer -purple -existence -commentary -larry -limousines -developments -def -immigration -destinations -lets -mutual -pipeline -necessarily -syntax -li -attribute -prison -skill -chairs -nl -everyday -apparently -surrounding -mountains -moves -popularity -inquiry -ethernet -checked -exhibit -throw -trend -sierra -visible -cats -desert -postposted -ya -oldest -rhode -nba -busty -coordinator -obviously -mercury -steven -handbook -greg -navigate -worse -summit -victims -epa -spaces -fundamental -burning -escape -coupons -somewhat -receiver -substantial -tr -progressive -cialis -bb -boats -glance -scottish -championship -arcade -richmond -sacramento -impossible -ron -russell -tells -obvious -fiber -depression -graph -covering -platinum -judgment -bedrooms -talks -filing -foster -modeling -passing -awarded -testimonials -trials -tissue -nz -memorabilia -clinton -masters -bonds -cartridge -alberta -explanation -folk -org -commons -cincinnati -subsection -fraud -electricity -permitted -spectrum -arrival -okay -pottery -emphasis -roger -aspect -workplace -awesome -mexican -confirmed -counts -priced -wallpapers -hist -crash -lift -desired -inter -closer -assumes -heights -shadow -riding -infection -firefox -lisa -expense -grove -eligibility -venture -clinic -korean -healing -princess -mall -entering -packet -spray -studios -involvement -dad -buttons -placement -observations -vbulletin -funded -thompson -winners -extend -roads -subsequent -pat -dublin -rolling -fell -motorcycle -yard -disclosure -establishment -memories -nelson -te -arrived -creates -faces -tourist -cocks -av -mayor -murder -sean -adequate -senator -yield -presentations -grades -cartoons -pour -digest -reg -lodging -tion -dust -hence -wiki -entirely -replaced -radar -rescue -undergraduate -losses -combat -reducing -stopped -occupation -lakes -butt -donations -associations -citysearch -closely -radiation -diary -seriously -kings -shooting -kent -adds -nsw -ear -flags -pci -baker -launched -elsewhere -pollution -conservative -guestbook -shock -effectiveness -walls -abroad -ebony -tie -ward -drawn -arthur -ian -visited -roof -walker -demonstrate -atmosphere -suggests -kiss -beast -ra -operated -experiment -targets -overseas -purchases -dodge -counsel -federation -pizza -invited -yards -assignment -chemicals -gordon -mod -farmers -rc -queries -bmw -rush -ukraine -absence -nearest -cluster -vendors -mpeg -whereas -yoga -serves -woods -surprise -lamp -rico -partial -shoppers -phil -everybody -couples -nashville -ranking -jokes -cst -http -ceo -simpson -twiki -sublime -counseling -palace -acceptable -satisfied -glad -wins -measurements -verify -globe -trusted -copper -milwaukee -rack -medication -warehouse -shareware -ec -rep -dicke -kerry -receipt -supposed -ordinary -nobody -ghost -violation -configure -stability -mit -applying -southwest -boss -pride -institutional -expectations -independence -knowing -reporter -metabolism -keith -champion -cloudy -linda -ross -personally -chile -anna -plenty -solo -sentence -throat -ignore -maria -uniform -excellence -wealth -tall -rm -somewhere -vacuum -dancing -attributes -recognize -brass -writes -plaza -pdas -outcomes -survival -quest -publish -sri -screening -toe -thumbnail -trans -jonathan -whenever -nova -lifetime -api -pioneer -booty -forgotten -acrobat -plates -acres -venue -athletic -thermal -essays -behaviour -vital -telling -fairly -coastal -config -cf -charity -intelligent -edinburgh -vt -excel -modes -obligation -campbell -wake -stupid -harbor -hungary -traveler -urw -segment -realize -regardless -lan -enemy -puzzle -rising -aluminum -wells -wishlist -opens -insight -sms -shit -restricted -republican -secrets -lucky -latter -merchants -thick -trailers -repeat -syndrome -philips -attendance -penalty -drum -glasses -enables -nec -iraqi -builder -vista -jessica -chips -terry -flood -foto -ease -arguments -amsterdam -orgy -arena -adventures -pupils -stewart -announcement -tabs -outcome -xx -appreciate -expanded -casual -grown -polish -lovely -extras -gm -centres -jerry -clause -smile -lands -ri -troops -indoor -bulgaria -armed -broker -charger -regularly -believed -pine -cooling -tend -gulf -rt -rick -trucks -cp -mechanisms -divorce -laura -shopper -tokyo -partly -nikon -customize -tradition -candy -pills -tiger -donald -folks -sensor -exposed -telecom -hunt -angels -deputy -indicators -sealed -thai -emissions -physicians -loaded -fred -complaint -scenes -experiments -balls -afghanistan -dd -boost -spanking -scholarship -governance -mill -founded -supplements -chronic -icons -tranny -moral -den -catering -aud -finger -keeps -pound -locate -camcorder -pl -trained -burn -implementing -roses -labs -ourselves -bread -tobacco -wooden -motors -tough -roberts -incident -gonna -dynamics -lie -crm -rf -conversation -decrease -cumshots -chest -pension -billy -revenues -emerging -worship -bukkake -capability -ak -fe -craig -herself -producing -churches -precision -damages -reserves -contributed -solve -shorts -reproduction -minority -td -diverse -amp -ingredients -sb -ah -johnny -sole -franchise -recorder -complaints -facing -sm -nancy -promotions -tones -passion -rehabilitation -maintaining -sight -laid -clay -defence -patches -weak -refund -usc -towns -environments -trembl -divided -blvd -reception -amd -wise -emails -cyprus -wv -odds -correctly -insider -seminars -consequences -makers -hearts -geography -appearing -integrity -worry -ns -discrimination -eve -carter -legacy -marc -pleased -danger -vitamin -widely -processed -phrase -genuine -raising -implications -functionality -paradise -hybrid -reads -roles -intermediate -emotional -sons -leaf -pad -glory -platforms -ja -bigger -billing -diesel -versus -combine -overnight -geographic -exceed -bs -rod -saudi -fault -cuba -hrs -preliminary -districts -introduce -silk -promotional -kate -chevrolet -babies -bi -karen -compiled -romantic -revealed -specialists -generator -albert -examine -jimmy -graham -suspension -bristol -margaret -compaq -sad -correction -wolf -slowly -authentication -communicate -rugby -supplement -showtimes -cal -portions -infant -promoting -sectors -samuel -fluid -grounds -fits -kick -regards -meal -ta -hurt -machinery -bandwidth -unlike -equation -baskets -probability -pot -dimension -wright -img -barry -proven -schedules -admissions -cached -warren -slip -studied -reviewer -involves -quarterly -rpm -profits -devil -grass -comply -marie -florist -illustrated -cherry -continental -alternate -deutsch -achievement -limitations -kenya -webcam -cuts -funeral -nutten -earrings -enjoyed -automated -chapters -pee -charlie -quebec -nipples -passenger -convenient -dennis -mars -francis -tvs -sized -manga -noticed -socket -silent -literary -egg -mhz -signals -caps -orientation -pill -theft -childhood -swing -symbols -lat -meta -humans -analog -facial -choosing -talent -dated -flexibility -seeker -wisdom -shoot -boundary -mint -packard -offset -payday -philip -elite -gi -spin -holders -believes -swedish -poems -deadline -jurisdiction -robot -displaying -witness -collins -equipped -stages -encouraged -sur -winds -powder -broadway -acquired -assess -wash -cartridges -stones -entrance -gnome -roots -declaration -losing -attempts -gadgets -noble -glasgow -automation -impacts -rev -gospel -advantages -shore -loves -induced -ll -knight -preparing -loose -aims -recipient -linking -extensions -appeals -cl -earned -illness -islamic -athletics -southeast -ieee -ho -alternatives -pending -parker -determining -lebanon -corp -personalized -kennedy -gt -sh -conditioning -teenage -soap -ae -triple -cooper -nyc -vincent -jam -secured -unusual -answered -partnerships -destruction -slots -increasingly -migration -disorder -routine -toolbar -basically -rocks -conventional -titans -applicants -wearing -axis -sought -genes -mounted -habitat -firewall -median -guns -scanner -herein -occupational -animated -horny -judicial -rio -hs -adjustment -hero -integer -treatments -bachelor -attitude -camcorders -engaged -falling -basics -montreal -carpet -rv -struct -lenses -binary -genetics -attended -difficulty -punk -collective -coalition -pi -dropped -enrollment -duke -walter -ai -pace -besides -wage -producers -ot -collector -arc -hosts -interfaces -advertisers -moments -atlas -strings -dawn -representing -observation -feels -torture -carl -deleted -coat -mitchell -mrs -rica -restoration -convenience -returning -ralph -opposition -container -yr -defendant -warner -confirmation -app -embedded -inkjet -supervisor -wizard -corps -actors -liver -peripherals -liable -brochure -morris -bestsellers -petition -eminem -recall -antenna -picked -assumed -departure -minneapolis -belief -killing -bikini -memphis -shoulder -decor -lookup -texts -harvard -brokers -roy -ion -diameter -ottawa -doll -ic -podcast -tit -seasons -peru -interactions -refine -bidder -singer -evans -herald -literacy -fails -aging -nike -intervention -pissing -fed -plugin -attraction -diving -invite -modification -alice -latinas -suppose -customized -reed -involve -moderate -terror -younger -thirty -mice -opposite -understood -rapidly -dealtime -ban -temp -intro -mercedes -zus -assurance -fisting -clerk -happening -vast -mills -outline -amendments -tramadol -holland -receives -jeans -metropolitan -compilation -verification -fonts -ent -odd -wrap -refers -mood -favor -veterans -quiz -mx -sigma -gr -attractive -xhtml -occasion -recordings -jefferson -victim -demands -sleeping -careful -ext -beam -gardening -obligations -arrive -orchestra -sunset -tracked -moreover -minimal -polyphonic -lottery -tops -framed -aside -outsourcing -licence -adjustable -allocation -michelle -essay -discipline -amy -ts -demonstrated -dialogue -identifying -alphabetical -camps -declared -dispatched -aaron -handheld -trace -disposal -shut -florists -packs -ge -installing -switches -romania -voluntary -ncaa -thou -consult -phd -greatly -blogging -mask -cycling -midnight -ng -commonly -pe -photographer -inform -turkish -coal -cry -messaging -pentium -quantum -murray -intent -tt -zoo -largely -pleasant -announce -constructed -additions -requiring -spoke -aka -arrow -engagement -sampling -rough -weird -tee -refinance -lion -inspired -holes -weddings -blade -suddenly -oxygen -cookie -meals -canyon -goto -meters -merely -calendars -arrangement -conclusions -passes -bibliography -pointer -compatibility -stretch -durham -furthermore -permits -cooperative -muslim -xl -neil -sleeve -netscape -cleaner -cricket -beef -feeding -stroke -township -rankings -measuring -cad -hats -robin -robinson -jacksonville -strap -headquarters -sharon -crowd -tcp -transfers -surf -olympic -transformation -remained -attachments -dv -dir -entities -customs -administrators -personality -rainbow -hook -roulette -decline -gloves -israeli -medicare -cord -skiing -cloud -facilitate -subscriber -valve -val -hewlett -explains -proceed -flickr -feelings -knife -jamaica -priorities -shelf -bookstore -timing -liked -parenting -adopt -denied -fotos -incredible -britney -freeware -fucked -donation -outer -crop -deaths -rivers -commonwealth -pharmaceutical -manhattan -tales -katrina -workforce -islam -nodes -tu -fy -thumbs -seeds -cited -lite -ghz -hub -targeted -organizational -skype -realized -twelve -founder -decade -gamecube -rr -dispute -portuguese -tired -titten -adverse -everywhere -excerpt -eng -steam -discharge -ef -drinks -ace -voices -acute -halloween -climbing -stood -sing -tons -perfume -carol -honest -albany -hazardous -restore -stack -methodology -somebody -sue -ep -housewares -reputation -resistant -democrats -recycling -hang -gbp -curve -creator -amber -qualifications -museums -coding -slideshow -tracker -variation -passage -transferred -trunk -hiking -lb -damn -pierre -jelsoft -headset -photograph -oakland -colombia -waves -camel -distributor -lamps -underlying -hood -wrestling -suicide -archived -photoshop -jp -chi -bt -arabia -gathering -projection -juice -chase -mathematical -logical -sauce -fame -extract -specialized -diagnostic -panama -indianapolis -af -payable -corporations -courtesy -criticism -automobile -confidential -rfc -statutory -accommodations -athens -northeast -downloaded -judges -sl -seo -retired -isp -remarks -detected -decades -paintings -walked -arising -nissan -bracelet -ins -eggs -juvenile -injection -yorkshire -populations -protective -afraid -acoustic -railway -cassette -initially -indicator -pointed -hb -jpg -causing -mistake -norton -locked -eliminate -tc -fusion -mineral -sunglasses -ruby -steering -beads -fortune -preference -canvas -threshold -parish -claimed -screens -cemetery -planner -croatia -flows -stadium -venezuela -exploration -mins -fewer -sequences -coupon -nurses -ssl -stem -proxy -gangbang -astronomy -lanka -opt -edwards -drew -contests -flu -translate -announces -mlb -costume -tagged -berkeley -voted -killer -bikes -gates -adjusted -rap -tune -bishop -pulled -corn -gp -shaped -compression -seasonal -establishing -farmer -counters -puts -constitutional -grew -perfectly -tin -slave -instantly -cultures -norfolk -coaching -examined -trek -encoding -litigation -submissions -oem -heroes -painted -lycos -ir -zdnet -broadcasting -horizontal -artwork -cosmetic -resulted -portrait -terrorist -informational -ethical -carriers -ecommerce -mobility -floral -builders -ties -struggle -schemes -suffering -neutral -fisher -rat -spears -prospective -dildos -bedding -ultimately -joining -heading -equally -artificial -bearing -spectacular -coordination -connector -brad -combo -seniors -worlds -guilty -affiliated -activation -naturally -haven -tablet -jury -dos -tail -subscribers -charm -lawn -violent -mitsubishi -underwear -basin -soup -potentially -ranch -constraints -crossing -inclusive -dimensional -cottage -drunk -considerable -crimes -resolved -mozilla -byte -toner -nose -latex -branches -anymore -oclc -delhi -holdings -alien -locator -selecting -processors -pantyhose -plc -broke -nepal -zimbabwe -difficulties -juan -complexity -msg -constantly -browsing -resolve -barcelona -presidential -documentary -cod -territories -melissa -moscow -thesis -thru -jews -nylon -palestinian -discs -rocky -bargains -frequent -trim -nigeria -ceiling -pixels -ensuring -hispanic -cv -cb -legislature -hospitality -gen -anybody -procurement -diamonds -espn -fleet -untitled -bunch -totals -marriott -singing -theoretical -afford -exercises -starring -referral -nhl -surveillance -optimal -quit -distinct -protocols -lung -highlight -substitute -inclusion -hopefully -brilliant -turner -sucking -cents -reuters -ti -fc -gel -todd -spoken -omega -evaluated -stayed -civic -assignments -fw -manuals -doug -sees -termination -watched -saver -thereof -grill -households -gs -redeem -rogers -grain -aaa -authentic -regime -wanna -wishes -bull -montgomery -architectural -louisville -depend -differ -macintosh -movements -ranging -monica -repairs -breath -amenities -virtually -cole -mart -candle -hanging -colored -authorization -tale -verified -lynn -formerly -projector -bp -situated -comparative -std -seeks -herbal -loving -strictly -routing -docs -stanley -psychological -surprised -retailer -vitamins -elegant -gains -renewal -vid -genealogy -opposed -deemed -scoring -expenditure -panties -brooklyn -liverpool -sisters -critics -connectivity -spots -oo -algorithms -hacker -madrid -similarly -margin -coin -bbw -solely -fake -salon -collaborative -norman -fda -excluding -turbo -headed -voters -cure -madonna -commander -arch -ni -murphy -thinks -thats -suggestion -hdtv -soldier -phillips -asin -aimed -justin -bomb -harm -interval -mirrors -spotlight -tricks -reset -brush -investigate -thy -expansys -panels -repeated -assault -connecting -spare -logistics -deer -kodak -tongue -bowling -tri -danish -pal -monkey -proportion -filename -skirt -florence -invest -honey -um -analyses -drawings -significance -scenario -ye -fs -lovers -atomic -approx -symposium -arabic -gauge -essentials -junction -protecting -nn -faced -mat -rachel -solving -transmitted -weekends -screenshots -produces -oven -ted -intensive -chains -kingston -sixth -engage -deviant -noon -switching -quoted -adapters -correspondence -farms -imports -supervision -cheat -bronze -expenditures -sandy -separation -testimony -suspect -celebrities -macro -sender -mandatory -boundaries -crucial -syndication -gym -celebration -kde -adjacent -filtering -tuition -spouse -exotic -viewer -signup -threats -luxembourg -puzzles -reaching -vb -damaged -cams -receptor -piss -laugh -joel -surgical -destroy -citation -pitch -autos -yo -premises -perry -proved -offensive -imperial -dozen -benjamin -deployment -teeth -cloth -studying -colleagues -stamp -lotus -salmon -olympus -separated -proc -cargo -tan -directive -fx -salem -mate -dl -starter -upgrades -likes -butter -pepper -weapon -luggage -burden -chef -tapes -zones -races -isle -stylish -slim -maple -luke -grocery -offshore -governing -retailers -depot -kenneth -comp -alt -pie -blend -harrison -ls -julie -occasionally -cbs -attending -emission -pete -spec -finest -realty -janet -bow -penn -recruiting -apparent -instructional -phpbb -autumn -traveling -probe -midi -permissions -biotechnology -toilet -ranked -jackets -routes -packed -excited -outreach -helen -mounting -recover -tied -lopez -balanced -prescribed -catherine -timely -talked -upskirts -debug -delayed -chuck -reproduced -hon -dale -explicit -calculation -villas -ebook -consolidated -boob -exclude -peeing -occasions -brooks -equations -newton -oils -sept -exceptional -anxiety -bingo -whilst -spatial -respondents -unto -lt -ceramic -prompt -precious -minds -annually -considerations -scanners -atm -xanax -eq -pays -cox -fingers -sunny -ebooks -delivers -je -queensland -necklace -musicians -leeds -composite -unavailable -cedar -arranged -lang -theaters -advocacy -raleigh -stud -fold -essentially -designing -threaded -uv -qualify -fingering -blair -hopes -assessments -cms -mason -diagram -burns -pumps -slut -ejaculation -footwear -sg -vic -beijing -peoples -victor -mario -pos -attach -licenses -utils -removing -advised -brunswick -spider -phys -ranges -pairs -sensitivity -trails -preservation -hudson -isolated -calgary -interim -assisted -divine -streaming -approve -chose -compound -intensity -technological -syndicate -abortion -dialog -venues -blast -wellness -calcium -newport -antivirus -addressing -pole -discounted -indians -shield -harvest -membrane -prague -previews -bangladesh -constitute -locally -concluded -pickup -desperate -mothers -nascar -iceland -demonstration -governmental -manufactured -candles -graduation -mega -bend -sailing -variations -moms -sacred -addiction -morocco -chrome -tommy -springfield -refused -brake -exterior -greeting -ecology -oliver -congo -glen -botswana -nav -delays -synthesis -olive -undefined -unemployment -cyber -verizon -scored -enhancement -newcastle -clone -dicks -velocity -lambda -relay -composed -tears -performances -oasis -baseline -cab -angry -fa -societies -silicon -brazilian -identical -petroleum -compete -ist -norwegian -lover -belong -honolulu -beatles -lips -escort -retention -exchanges -pond -rolls -thomson -barnes -soundtrack -wondering -malta -daddy -lc -ferry -rabbit -profession -seating -dam -cnn -separately -physiology -lil -collecting -das -exports -omaha -tire -participant -scholarships -recreational -dominican -chad -electron -loads -friendship -heather -passport -motel -unions -treasury -warrant -sys -solaris -frozen -occupied -josh -royalty -scales -rally -observer -sunshine -strain -drag -ceremony -somehow -arrested -expanding -provincial -investigations -icq -ripe -yamaha -rely -medications -hebrew -gained -rochester -dying -laundry -stuck -solomon -placing -stops -homework -adjust -assessed -advertiser -enabling -encryption -filling -downloadable -sophisticated -imposed -silence -scsi -focuses -soviet -possession -cu -laboratories -treaty -vocal -trainer -organ -stronger -volumes -advances -vegetables -lemon -toxic -dns -thumbnails -darkness -pty -ws -nuts -nail -bizrate -vienna -implied -span -stanford -sox -stockings -joke -respondent -packing -statute -rejected -satisfy -destroyed -shelter -chapel -gamespot -manufacture -layers -wordpress -guided -vulnerability -accountability -celebrate -accredited -appliance -compressed -bahamas -powell -mixture -zoophilia -bench -univ -tub -rider -scheduling -radius -perspectives -mortality -logging -hampton -christians -borders -therapeutic -pads -butts -inns -bobby -impressive -sheep -accordingly -architect -railroad -lectures -challenging -wines -nursery -harder -cups -ash -microwave -cheapest -accidents -travesti -relocation -stuart -contributors -salvador -ali -salad -np -monroe -tender -violations -foam -temperatures -paste -clouds -competitions -discretion -tft -tanzania -preserve -jvc -poem -vibrator -unsigned -staying -cosmetics -easter -theories -repository -praise -jeremy -venice -jo -concentrations -vibrators -estonia -christianity -veteran -streams -landing -signing -executed -katie -negotiations -realistic -dt -cgi -showcase -integral -asks -relax -namibia -generating -christina -congressional -synopsis -hardly -prairie -reunion -composer -bean -sword -absent -photographic -sells -ecuador -hoping -accessed -spirits -modifications -coral -pixel -float -colin -bias -imported -paths -bubble -por -acquire -contrary -millennium -tribune -vessel -acids -focusing -viruses -cheaper -admitted -dairy -admit -mem -fancy -equality -samoa -gc -achieving -tap -stickers -fisheries -exceptions -reactions -leasing -lauren -beliefs -ci -macromedia -companion -squad -analyze -ashley -scroll -relate -divisions -swim -wages -additionally -suffer -forests -fellowship -nano -invalid -concerts -martial -males -victorian -retain -colours -execute -tunnel -genres -cambodia -patents -copyrights -yn -chaos -lithuania -mastercard -wheat -chronicles -obtaining -beaver -updating -distribute -readings -decorative -kijiji -confused -compiler -enlargement -eagles -bases -vii -accused -bee -campaigns -unity -loud -conjunction -bride -rats -defines -airports -instances -indigenous -begun -cfr -brunette -packets -anchor -socks -validation -parade -corruption -stat -trigger -incentives -cholesterol -gathered -essex -slovenia -notified -differential -beaches -folders -dramatic -surfaces -terrible -routers -cruz -pendant -dresses -baptist -scientist -starsmerchant -hiring -clocks -arthritis -bios -females -wallace -nevertheless -reflects -taxation -fever -pmc -cuisine -surely -practitioners -transcript -myspace -theorem -inflation -thee -nb -ruth -pray -stylus -compounds -pope -drums -contracting -topless -arnold -structured -reasonably -jeep -chicks -bare -hung -cattle -mba -radical -graduates -rover -recommends -controlling -treasure -reload -distributors -flame -levitra -tanks -assuming -monetary -elderly -pit -arlington -mono -particles -floating -extraordinary -tile -indicating -bolivia -spell -hottest -stevens -coordinate -kuwait -exclusively -emily -alleged -limitation -widescreen -compile -squirting -webster -struck -rx -illustration -plymouth -warnings -construct -apps -inquiries -bridal -annex -mag -gsm -inspiration -tribal -curious -affecting -freight -rebate -meetup -eclipse -sudan -ddr -downloading -rec -shuttle -aggregate -stunning -cycles -affects -forecasts -detect -sluts -actively -ciao -ampland -knee -prep -pb -complicated -chem -fastest -butler -shopzilla -injured -decorating -payroll -cookbook -expressions -ton -courier -uploaded -shakespeare -hints -collapse -americas -connectors -twinks -unlikely -oe -gif -pros -conflicts -techno -beverage -tribute -wired -elvis -immune -latvia -travelers -forestry -barriers -cant -jd -rarely -gpl -infected -offerings -martha -genesis -barrier -argue -incorrect -trains -metals -bicycle -furnishings -letting -arise -guatemala -celtic -thereby -irc -jamie -particle -perception -minerals -advise -humidity -bottles -boxing -wy -dm -bangkok -renaissance -pathology -sara -bra -ordinance -hughes -photographers -bitch -infections -jeffrey -chess -operates -brisbane -configured -survive -oscar -festivals -menus -joan -possibilities -duck -reveal -canal -amino -phi -contributing -herbs -clinics -mls -cow -manitoba -analytical -missions -watson -lying -costumes -strict -dive -saddam -circulation -drill -offense -threesome -bryan -cet -protest -handjob -assumption -jerusalem -hobby -tries -transexuales -invention -nickname -fiji -technician -inline -executives -enquiries -washing -audi -staffing -cognitive -exploring -trick -enquiry -closure -raid -ppc -timber -volt -intense -div -playlist -registrar -showers -supporters -ruling -steady -dirt -statutes -withdrawal -myers -drops -predicted -wider -saskatchewan -jc -cancellation -plugins -enrolled -sensors -screw -ministers -publicly -hourly -blame -geneva -freebsd -veterinary -acer -prostores -reseller -dist -handed -suffered -intake -informal -relevance -incentive -butterfly -tucson -mechanics -heavily -swingers -fifty -headers -mistakes -numerical -ons -geek -uncle -defining -xnxx -counting -reflection -sink -accompanied -assure -invitation -devoted -princeton -jacob -sodium -randy -spirituality -hormone -meanwhile -proprietary -timothy -childrens -brick -grip -naval -thumbzilla -medieval -porcelain -avi -bridges -pichunter -captured -watt -thehun -decent -casting -dayton -translated -shortly -cameron -columnists -pins -carlos -reno -donna -andreas -warrior -diploma -cabin -innocent -bdsm -scanning -ide -consensus -polo -valium -copying -rpg -delivering -cordless -patricia -horn -eddie -uganda -fired -journalism -pd -prot -trivia -adidas -perth -frog -grammar -intention -syria -disagree -klein -harvey -tires -logs -undertaken -tgp -hazard -retro -leo -livesex -statewide -semiconductor -gregory -episodes -boolean -circular -anger -diy -mainland -illustrations -suits -chances -interact -snap -happiness -arg -substantially -bizarre -glenn -ur -auckland -olympics -fruits -identifier -geo -worldsex -ribbon -calculations -doe -jpeg -conducting -startup -suzuki -trinidad -ati -kissing -wal -handy -swap -exempt -crops -reduces -accomplished -calculators -geometry -impression -abs -slovakia -flip -guild -correlation -gorgeous -capitol -sim -dishes -rna -barbados -chrysler -nervous -refuse -extends -fragrance -mcdonald -replica -plumbing -brussels -tribe -neighbors -trades -superb -buzz -transparent -nuke -rid -trinity -charleston -handled -legends -boom -calm -champions -floors -selections -projectors -inappropriate -exhaust -comparing -shanghai -speaks -burton -vocational -davidson -copied -scotia -farming -gibson -pharmacies -fork -troy -ln -roller -introducing -batch -organize -appreciated -alter -nicole -latino -ghana -edges -uc -mixing -handles -skilled -fitted -albuquerque -harmony -distinguished -asthma -projected -assumptions -shareholders -twins -developmental -rip -zope -regulated -triangle -amend -anticipated -oriental -reward -windsor -zambia -completing -gmbh -buf -ld -hydrogen -webshots -sprint -comparable -chick -advocate -sims -confusion -copyrighted -tray -inputs -warranties -genome -escorts -documented -thong -medal -paperbacks -coaches -vessels -harbour -walks -sucks -sol -keyboards -sage -knives -eco -vulnerable -arrange -artistic -bat -honors -booth -indie -reflected -unified -bones -breed -detector -ignored -polar -fallen -precise -sussex -respiratory -notifications -msgid -transexual -mainstream -invoice -evaluating -lip -subcommittee -sap -gather -suse -maternity -backed -alfred -colonial -mf -carey -motels -forming -embassy -cave -journalists -danny -rebecca -slight -proceeds -indirect -amongst -wool -foundations -msgstr -arrest -volleyball -mw -adipex -horizon -nu -deeply -toolbox -ict -marina -liabilities -prizes -bosnia -browsers -decreased -patio -dp -tolerance -surfing -creativity -lloyd -describing -optics -pursue -lightning -overcome -eyed -ou -quotations -grab -inspector -attract -brighton -beans -bookmarks -ellis -disable -snake -succeed -leonard -lending -oops -reminder -nipple -xi -searched -behavioral -riverside -bathrooms -plains -sku -ht -raymond -insights -abilities -initiated -sullivan -za -midwest -karaoke -trap -lonely -fool -ve -nonprofit -lancaster -suspended -hereby -observe -julia -containers -attitudes -karl -berry -collar -simultaneously -racial -integrate -bermuda -amanda -sociology -mobiles -screenshot -exhibitions -kelkoo -confident -retrieved -exhibits -officially -consortium -dies -terrace -bacteria -pts -replied -seafood -novels -rh -rrp -recipients -playboy -ought -delicious -traditions -fg -jail -safely -finite -kidney -periodically -fixes -sends -durable -mazda -allied -throws -moisture -hungarian -roster -referring -symantec -spencer -wichita -nasdaq -uruguay -ooo -hz -transform -timer -tablets -tuning -gotten -educators -tyler -futures -vegetable -verse -highs -humanities -independently -wanting -custody -scratch -launches -ipaq -alignment -masturbating -henderson -bk -britannica -comm -ellen -competitors -nhs -rocket -aye -bullet -towers -racks -lace -nasty -visibility -latitude -consciousness -ste -tumor -ugly -deposits -beverly -mistress -encounter -trustees -watts -duncan -reprints -hart -bernard -resolutions -ment -accessing -forty -tubes -attempted -col -midlands -priest -floyd -ronald -analysts -queue -dx -sk -trance -locale -nicholas -biol -yu -bundle -hammer -invasion -witnesses -runner -rows -administered -notion -sq -skins -mailed -oc -fujitsu -spelling -arctic -exams -rewards -beneath -strengthen -defend -aj -frederick -medicaid -treo -infrared -seventh -gods -une -welsh -belly -aggressive -tex -advertisements -quarters -stolen -cia -sublimedirectory -soonest -haiti -disturbed -determines -sculpture -poly -ears -dod -wp -fist -naturals -neo -motivation -lenders -pharmacology -fitting -fixtures -bloggers -mere -agrees -passengers -quantities -petersburg -consistently -powerpoint -cons -surplus -elder -sonic -obituaries -cheers -dig -taxi -punishment -appreciation -subsequently -om -belarus -nat -zoning -gravity -providence -thumb -restriction -incorporate -backgrounds -treasurer -guitars -essence -flooring -lightweight -ethiopia -tp -mighty -athletes -humanity -transcription -jm -holmes -complications -scholars -dpi -scripting -gis -remembered -galaxy -chester -snapshot -caring -loc -worn -synthetic -shaw -vp -segments -testament -expo -dominant -twist -specifics -itunes -stomach -partially -buried -cn -newbie -minimize -darwin -ranks -wilderness -debut -generations -tournaments -bradley -deny -anatomy -bali -judy -sponsorship -headphones -fraction -trio -proceeding -cube -defects -volkswagen -uncertainty -breakdown -milton -marker -reconstruction -subsidiary -strengths -clarity -rugs -sandra -adelaide -encouraging -furnished -monaco -settled -folding -emirates -terrorists -airfare -comparisons -beneficial -distributions -vaccine -belize -crap -fate -viewpicture -promised -volvo -penny -robust -bookings -threatened -minolta -republicans -discusses -gui -porter -gras -jungle -ver -rn -responded -rim -abstracts -zen -ivory -alpine -dis -prediction -pharmaceuticals -andale -fabulous -remix -alias -thesaurus -individually -battlefield -literally -newer -kay -ecological -spice -oval -implies -cg -soma -ser -cooler -appraisal -consisting -maritime -periodic -submitting -overhead -ascii -prospect -shipment -breeding -citations -geographical -donor -mozambique -tension -href -benz -trash -shapes -wifi -tier -fwd -earl -manor -envelope -diane -homeland -disclaimers -championships -excluded -andrea -breeds -rapids -disco -sheffield -bailey -aus -endif -finishing -emotions -wellington -incoming -prospects -lexmark -cleaners -bulgarian -hwy -eternal -cashiers -guam -cite -aboriginal -remarkable -rotation -nam -preventing -productive -boulevard -eugene -ix -gdp -pig -metric -compliant -minus -penalties -bennett -imagination -hotmail -refurbished -joshua -armenia -varied -grande -closest -activated -actress -mess -conferencing -assign -armstrong -politicians -trackbacks -lit -accommodate -tigers -aurora -una -slides -milan -premiere -lender -villages -shade -chorus -christine -rhythm -digit -argued -dietary -symphony -clarke -sudden -accepting -precipitation -marilyn -lions -findlaw -ada -pools -tb -lyric -claire -isolation -speeds -sustained -matched -approximate -rope -carroll -rational -programmer -fighters -chambers -dump -greetings -inherited -warming -incomplete -vocals -chronicle -fountain -chubby -grave -legitimate -biographies -burner -yrs -foo -investigator -gba -plaintiff -finnish -gentle -bm -prisoners -deeper -muslims -hose -mediterranean -nightlife -footage -howto -worthy -reveals -architects -saints -entrepreneur -carries -sig -freelance -duo -excessive -devon -screensaver -helena -saves -regarded -valuation -unexpected -cigarette -fog -characteristic -marion -lobby -egyptian -tunisia -metallica -outlined -consequently -headline -treating -punch -appointments -str -gotta -cowboy -narrative -bahrain -enormous -karma -consist -betty -queens -academics -pubs -quantitative -shemales -lucas -screensavers -subdivision -tribes -vip -defeat -clicks -distinction -honduras -naughty -hazards -insured -harper -livestock -mardi -exemption -tenant -sustainability -cabinets -tattoo -shake -algebra -shadows -holly -formatting -silly -nutritional -yea -mercy -hartford -freely -marcus -sunrise -wrapping -mild -fur -nicaragua -weblogs -timeline -tar -belongs -rj -readily -affiliation -soc -fence -nudist -infinite -diana -ensures -relatives -lindsay -clan -legally -shame -satisfactory -revolutionary -bracelets -sync -civilian -telephony -mesa -fatal -remedy -realtors -breathing -briefly -thickness -adjustments -graphical -genius -discussing -aerospace -fighter -meaningful -flesh -retreat -adapted -barely -wherever -estates -rug -democrat -borough -maintains -failing -shortcuts -ka -retained -voyeurweb -pamela -andrews -marble -extending -jesse -specifies -hull -logitech -surrey -briefing -belkin -dem -accreditation -wav -blackberry -highland -meditation -modular -microphone -macedonia -combining -brandon -instrumental -giants -organizing -shed -balloon -moderators -winston -memo -ham -solved -tide -kazakhstan -hawaiian -standings -partition -invisible -gratuit -consoles -funk -fbi -qatar -magnet -translations -porsche -cayman -jaguar -reel -sheer -commodity -posing -wang -kilometers -rp -bind -thanksgiving -rand -hopkins -urgent -guarantees -infants -gothic -cylinder -witch -buck -indication -eh -congratulations -tba -cohen -sie -usgs -puppy -kathy -acre -graphs -surround -cigarettes -revenge -expires -enemies -lows -controllers -aqua -chen -emma -consultancy -finances -accepts -enjoying -conventions -eva -patrol -smell -pest -hc -italiano -coordinates -rca -fp -carnival -roughly -sticker -promises -responding -reef -physically -divide -stakeholders -hydrocodone -gst -consecutive -cornell -satin -bon -deserve -attempting -mailto -promo -jj -representations -chan -worried -tunes -garbage -competing -combines -mas -beth -bradford -len -phrases -kai -peninsula -chelsea -boring -reynolds -dom -jill -accurately -speeches -reaches -schema -considers -sofa -catalogs -ministries -vacancies -quizzes -parliamentary -obj -prefix -lucia -savannah -barrel -typing -nerve -dans -planets -deficit -boulder -pointing -renew -coupled -viii -myanmar -metadata -harold -circuits -floppy -texture -handbags -jar -ev -somerset -incurred -acknowledge -thoroughly -antigua -nottingham -thunder -tent -caution -identifies -questionnaire -qualification -locks -modelling -namely -miniature -dept -hack -dare -euros -interstate -pirates -aerial -hawk -consequence -rebel -systematic -perceived -origins -hired -makeup -textile -lamb -madagascar -nathan -tobago -presenting -cos -troubleshooting -uzbekistan -indexes -pac -rl -erp -centuries -gl -magnitude -ui -richardson -hindu -dh -fragrances -vocabulary -licking -earthquake -vpn -fundraising -fcc -markers -weights -albania -geological -assessing -lasting -wicked -eds -introduces -kills -roommate -webcams -pushed -webmasters -ro -df -computational -acdbentity -participated -junk -handhelds -wax -lucy -answering -hans -impressed -slope -reggae -failures -poet -conspiracy -surname -theology -nails -evident -whats -rides -rehab -epic -saturn -organizer -nut -allergy -sake -twisted -combinations -preceding -merit -enzyme -cumulative -zshops -planes -edmonton -tackle -disks -condo -pokemon -amplifier -ambien -arbitrary -prominent -retrieve -lexington -vernon -sans -worldcat -titanium -irs -fairy -builds -contacted -shaft -lean -bye -cdt -recorders -occasional -leslie -casio -deutsche -ana -postings -innovations -kitty -postcards -dude -drain -monte -fires -algeria -blessed -luis -reviewing -cardiff -cornwall -favors -potato -panic -explicitly -sticks -leone -transsexual -ez -citizenship -excuse -reforms -basement -onion -strand -pf -sandwich -uw -lawsuit -alto -informative -girlfriend -bloomberg -cheque -hierarchy -influenced -banners -reject -eau -abandoned -bd -circles -italic -beats -merry -mil -scuba -gore -complement -cult -dash -passive -mauritius -valued -cage -checklist -bangbus -requesting -courage -verde -lauderdale -scenarios -gazette -hitachi -divx -extraction -batman -elevation -hearings -coleman -hugh -lap -utilization -beverages -calibration -jake -eval -efficiently -anaheim -ping -textbook -dried -entertaining -prerequisite -luther -frontier -settle -stopping -refugees -knights -hypothesis -palmer -medicines -flux -derby -sao -peaceful -altered -pontiac -regression -doctrine -scenic -trainers -muze -enhancements -renewable -intersection -passwords -sewing -consistency -collectors -conclude -recognised -munich -oman -celebs -gmc -propose -hh -azerbaijan -lighter -rage -adsl -uh -prix -astrology -advisors -pavilion -tactics -trusts -occurring -supplemental -travelling -talented -annie -pillow -induction -derek -precisely -shorter -harley -spreading -provinces -relying -finals -paraguay -steal -parcel -refined -fd -bo -fifteen -widespread -incidence -fears -predict -boutique -acrylic -rolled -tuner -avon -incidents -peterson -rays -asn -shannon -toddler -enhancing -flavor -alike -walt -homeless -horrible -hungry -metallic -acne -blocked -interference -warriors -palestine -listprice -libs -undo -cadillac -atmospheric -malawi -wm -pk -sagem -knowledgestorm -dana -halo -ppm -curtis -parental -referenced -strikes -lesser -publicity -marathon -ant -proposition -gays -pressing -gasoline -apt -dressed -scout -belfast -exec -dealt -niagara -inf -eos -warcraft -charms -catalyst -trader -bucks -allowance -vcr -denial -uri -designation -thrown -prepaid -raises -gem -duplicate -electro -criterion -badge -wrist -civilization -analyzed -vietnamese -heath -tremendous -ballot -lexus -varying -remedies -validity -trustee -maui -handjobs -weighted -angola -squirt -performs -plastics -realm -corrected -jenny -helmet -salaries -postcard -elephant -yemen -encountered -tsunami -scholar -nickel -internationally -surrounded -psi -buses -expedia -geology -pct -wb -creatures -coating -commented -wallet -cleared -smilies -vids -accomplish -boating -drainage -shakira -corners -broader -vegetarian -rouge -yeast -yale -newfoundland -sn -qld -pas -clearing -investigated -dk -ambassador -coated -intend -stephanie -contacting -vegetation -doom -findarticles -louise -kenny -specially -owen -routines -hitting -yukon -beings -bite -issn -aquatic -reliance -habits -striking -myth -infectious -podcasts -singh -gig -gilbert -sas -ferrari -continuity -brook -fu -outputs -phenomenon -ensemble -insulin -assured -biblical -weed -conscious -accent -mysimon -eleven -wives -ambient -utilize -mileage -oecd -prostate -adaptor -auburn -unlock -hyundai -pledge -vampire -angela -relates -nitrogen -xerox -dice -merger -softball -referrals -quad -dock -differently -firewire -mods -nextel -framing -organised -musician -blocking -rwanda -sorts -integrating -vsnet -limiting -dispatch -revisions -papua -restored -hint -armor -riders -chargers -remark -dozens -varies -msie -reasoning -wn -liz -rendered -picking -charitable -guards -annotated -ccd -sv -convinced -openings -buys -burlington -replacing -researcher -watershed -councils -occupations -acknowledged -nudity -kruger -pockets -granny -pork -zu -equilibrium -viral -inquire -pipes -characterized -laden -aruba -cottages -realtor -merge -privilege -edgar -develops -qualifying -chassis -dubai -estimation -barn -pushing -llp -fleece -pediatric -boc -fare -dg -asus -pierce -allan -dressing -techrepublic -sperm -vg -bald -filme -craps -fuji -frost -leon -institutes -mold -dame -fo -sally -yacht -tracy -prefers -drilling -brochures -herb -tmp -alot -ate -breach -whale -traveller -appropriations -suspected -tomatoes -benchmark -beginners -instructors -highlighted -bedford -stationery -idle -mustang -unauthorized -clusters -antibody -competent -momentum -fin -wiring -io -pastor -mud -calvin -uni -shark -contributor -demonstrates -phases -grateful -emerald -gradually -laughing -grows -cliff -desirable -tract -ul -ballet -ol -journalist -abraham -js -bumper -afterwards -webpage -religions -garlic -hostels -shine -senegal -explosion -pn -banned -wendy -briefs -signatures -diffs -cove -mumbai -ozone -disciplines -casa -mu -daughters -conversations -radios -tariff -nvidia -opponent -pasta -simplified -muscles -serum -wrapped -swift -motherboard -runtime -inbox -focal -bibliographic -vagina -eden -distant -incl -champagne -ala -decimal -hq -deviation -superintendent -propecia -dip -nbc -samba -hostel -housewives -employ -mongolia -penguin -magical -influences -inspections -irrigation -miracle -manually -reprint -reid -wt -hydraulic -centered -robertson -flex -yearly -penetration -wound -belle -rosa -conviction -hash -omissions -writings -hamburg -lazy -mv -mpg -retrieval -qualities -cindy -lolita -fathers -carb -charging -cas -marvel -lined -cio -dow -prototype -importantly -rb -petite -apparatus -upc -terrain -dui -pens -explaining -yen -strips -gossip -rangers -nomination -empirical -mh -rotary -worm -dependence -discrete -beginner -boxed -lid -sexuality -polyester -cubic -deaf -commitments -suggesting -sapphire -kinase -skirts -mats -remainder -crawford -labeled -privileges -televisions -specializing -marking -commodities -pvc -serbia -sheriff -griffin -declined -guyana -spies -blah -mime -neighbor -motorcycles -elect -highways -thinkpad -concentrate -intimate -reproductive -preston -deadly -cunt -feof -bunny -chevy -molecules -rounds -longest -refrigerator -tions -intervals -sentences -dentists -usda -exclusion -workstation -holocaust -keen -flyer -peas -dosage -receivers -urls -customise -disposition -variance -navigator -investigators -cameroon -baking -marijuana -adaptive -computed -needle -baths -enb -gg -cathedral -brakes -og -nirvana -ko -fairfield -owns -til -invision -sticky -destiny -generous -madness -emacs -climb -blowing -fascinating -landscapes -heated -lafayette -jackie -wto -computation -hay -cardiovascular -ww -sparc -cardiac -salvation -dover -adrian -predictions -accompanying -vatican -brutal -learners -gd -selective -arbitration -configuring -token -editorials -zinc -sacrifice -seekers -guru -isa -removable -convergence -yields -gibraltar -levy -suited -numeric -anthropology -skating -kinda -aberdeen -emperor -grad -malpractice -dylan -bras -belts -blacks -educated -rebates -reporters -burke -proudly -pix -necessity -rendering -mic -inserted -pulling -basename -kyle -obesity -curves -suburban -touring -clara -vertex -bw -hepatitis -nationally -tomato -andorra -waterproof -expired -mj -travels -flush -waiver -pale -specialties -hayes -humanitarian -invitations -functioning -delight -survivor -garcia -cingular -economies -alexandria -bacterial -moses -counted -undertake -declare -continuously -johns -valves -gaps -impaired -achievements -donors -tear -jewel -teddy -lf -convertible -ata -teaches -ventures -nil -bufing -stranger -tragedy -julian -nest -pam -dryer -painful -velvet -tribunal -ruled -nato -pensions -prayers -funky -secretariat -nowhere -cop -paragraphs -gale -joins -adolescent -nominations -wesley -dim -lately -cancelled -scary -mattress -mpegs -brunei -likewise -banana -introductory -slovak -cakes -stan -reservoir -occurrence -idol -bloody -mixer -remind -wc -worcester -sbjct -demographic -charming -mai -tooth -disciplinary -annoying -respected -stays -disclose -affair -drove -washer -upset -restrict -springer -beside -mines -portraits -rebound -logan -mentor -interpreted -evaluations -fought -baghdad -elimination -metres -hypothetical -immigrants -complimentary -helicopter -pencil -freeze -hk -performer -abu -titled -commissions -sphere -powerseller -moss -ratios -concord -graduated -endorsed -ty -surprising -walnut -lance -ladder -italia -unnecessary -dramatically -liberia -sherman -cork -maximize -cj -hansen -senators -workout -mali -yugoslavia -bleeding -characterization -colon -likelihood -lanes -purse -fundamentals -contamination -mtv -endangered -compromise -masturbation -optimize -stating -dome -caroline -leu -expiration -namespace -align -peripheral -bless -engaging -negotiation -crest -opponents -triumph -nominated -confidentiality -electoral -changelog -welding -orgasm -deferred -alternatively -heel -alloy -condos -plots -polished -yang -gently -greensboro -tulsa -locking -casey -controversial -draws -fridge -blanket -bloom -qc -simpsons -lou -elliott -recovered -fraser -justify -upgrading -blades -pgp -loops -surge -frontpage -trauma -aw -tahoe -advert -possess -demanding -defensive -sip -flashers -subaru -forbidden -tf -vanilla -programmers -pj -monitored -installations -deutschland -picnic -souls -arrivals -spank -cw -practitioner -motivated -wr -dumb -smithsonian -hollow -vault -securely -examining -fioricet -groove -revelation -rg -pursuit -delegation -wires -bl -dictionaries -mails -backing -greenhouse -sleeps -vc -blake -transparency -dee -travis -wx -endless -figured -orbit -currencies -niger -bacon -survivors -positioning -heater -colony -cannon -circus -promoted -forbes -mae -moldova -mel -descending -paxil -spine -trout -enclosed -feat -temporarily -ntsc -cooked -thriller -transmit -apnic -fatty -gerald -pressed -frequencies -scanned -reflections -hunger -mariah -sic -municipality -usps -joyce -detective -surgeon -cement -experiencing -fireplace -endorsement -bg -planners -disputes -textiles -missile -intranet -closes -seq -psychiatry -persistent -deborah -conf -marco -assists -summaries -glow -gabriel -auditor -wma -aquarium -violin -prophet -cir -bracket -looksmart -isaac -oxide -oaks -magnificent -erik -colleague -naples -promptly -modems -adaptation -hu -harmful -paintball -prozac -sexually -enclosure -acm -dividend -newark -kw -paso -glucose -phantom -norm -playback -supervisors -westminster -turtle -ips -distances -absorption -treasures -dsc -warned -neural -ware -fossil -mia -hometown -badly -transcripts -apollo -wan -disappointed -persian -continually -communist -collectible -handmade -greene -entrepreneurs -robots -grenada -creations -jade -scoop -acquisitions -foul -keno -gtk -earning -mailman -sanyo -nested -biodiversity -excitement -somalia -movers -verbal -blink -presently -seas -carlo -workflow -mysterious -novelty -bryant -tiles -voyuer -librarian -subsidiaries -switched -stockholm -tamil -garmin -ru -pose -fuzzy -indonesian -grams -therapist -richards -mrna -budgets -toolkit -promising -relaxation -goat -render -carmen -ira -sen -thereafter -hardwood -erotica -temporal -sail -forge -commissioners -dense -dts -brave -forwarding -qt -awful -nightmare -airplane -reductions -southampton -istanbul -impose -organisms -sega -telescope -viewers -asbestos -portsmouth -cdna -meyer -enters -pod -savage -advancement -wu -harassment -willow -resumes -bolt -gage -throwing -existed -whore -generators -lu -wagon -barbie -dat -favour -soa -knock -urge -smtp -generates -potatoes -thorough -replication -inexpensive -kurt -receptors -peers -roland -optimum -neon -interventions -quilt -huntington -creature -ours -mounts -syracuse -internship -lone -refresh -aluminium -snowboard -beastality -webcast -michel -evanescence -subtle -coordinated -notre -shipments -maldives -stripes -firmware -antarctica -cope -shepherd -lm -canberra -cradle -chancellor -mambo -lime -kirk -flour -controversy -legendary -bool -sympathy -choir -avoiding -beautifully -blond -expects -cho -jumping -fabrics -antibodies -polymer -hygiene -wit -poultry -virtue -burst -examinations -surgeons -bouquet -immunology -promotes -mandate -wiley -departmental -bbs -spas -ind -corpus -johnston -terminology -gentleman -fibre -reproduce -convicted -shades -jets -indices -roommates -adware -qui -intl -threatening -spokesman -zoloft -activists -frankfurt -prisoner -daisy -halifax -encourages -ultram -cursor -assembled -earliest -donated -stuffed -restructuring -insects -terminals -crude -morrison -maiden -simulations -cz -sufficiently -examines -viking -myrtle -bored -cleanup -yarn -knit -conditional -mug -crossword -bother -budapest -conceptual -knitting -attacked -hl -bhutan -liechtenstein -mating -compute -redhead -arrives -translator -automobiles -tractor -allah -continent -ob -unwrap -fares -longitude -resist -challenged -telecharger -hoped -pike -safer -insertion -instrumentation -ids -hugo -wagner -constraint -groundwater -touched -strengthening -cologne -gzip -wishing -ranger -smallest -insulation -newman -marsh -ricky -ctrl -scared -theta -infringement -bent -laos -subjective -monsters -asylum -lightbox -robbie -stake -cocktail -outlets -swaziland -varieties -arbor -mediawiki -configurations -poison diff --git a/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml b/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml index 5fe68fa528..72b89a9fd2 100644 --- a/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml +++ b/packages/typespec-test/test/loadtesting_modular/tspconfig.yaml @@ -13,6 +13,7 @@ options: isModularLibrary: true hierarchyClient: false experimentalExtensibleEnums: true + ignoreEnumMemberNameNormalize: true packageDetails: name: "@azure/load-testing" description: This package contains Microsoft Azure LoadTestingClient client library. From cf01ad522a438d4be466a06ff70a708553efd247 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 7 Jan 2025 15:06:06 +0800 Subject: [PATCH 83/91] Revert the test cases --- .../rlc-common/test/helpers/nameUtils.spec.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index f3ddc7d056..eb0c74f9e0 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -9,17 +9,6 @@ describe("#normalizeName", () => { expect(normalizeName("HA123", NameType.EnumMemberName)).to.equal("HA123"); expect(normalizeName("NHELLO", NameType.EnumMemberName)).to.equal("NHELLO"); expect(normalizeName("NHELLOA", NameType.EnumMemberName)).to.equal("Nhelloa"); - expect(normalizeName("NO_HELLO", NameType.EnumMemberName)).to.equal("NoHello"); - expect(normalizeName("NOHELLO", NameType.EnumMemberName)).to.equal("NoHello"); - expect(normalizeName("nohello", NameType.EnumMemberName)).to.equal("NoHello"); - expect(normalizeName("hellono", NameType.EnumMemberName)).to.equal("HelloNo"); - expect(normalizeName("TEST_SCRIPT", NameType.EnumMemberName)).to.equal("TestScript"); - expect(normalizeName("TESTSCRIPT", NameType.EnumMemberName)).to.equal("TestScript"); - expect(normalizeName("testscript", NameType.EnumMemberName)).to.equal("TestScript"); - expect(normalizeName("NOT_VALIDATED", NameType.EnumMemberName)).to.equal("NotValidated"); - expect(normalizeName("NOTVALIDATED", NameType.EnumMemberName)).to.equal("NotValidated"); - expect(normalizeName("notvalidated", NameType.EnumMemberName)).to.equal("NotValidated"); - expect(normalizeName("validatednot", NameType.EnumMemberName)).to.equal("ValidatedNot"); }); it("should normalize any chars including digits properly", () => { expect(normalizeName("-10Min", NameType.EnumMemberName)).to.equal("Num-10Min"); @@ -66,7 +55,7 @@ describe("#normalizeName", () => { expect(normalizeName("AKV_cert_URI", NameType.EnumMemberName)).to.equal("AKVCertURI"); expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.EnumMemberName)).to.equal("AzureOpenAIOperationStateOutput"); expect(normalizeName("TSModel", NameType.EnumMemberName)).to.equal("TSModel"); - expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName)).to.equal("ValidationNotRequired"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.EnumMemberName)).to.equal("ValidationNOTRequired"); expect(normalizeName("ValidationNotRequired", NameType.EnumMemberName)).to.equal("ValidationNotRequired"); expect(normalizeName("KnownPFTestResult", NameType.EnumMemberName)).to.equal("KnownPFTestResult"); expect(normalizeName("repeatabilityRequestID", NameType.EnumMemberName)).to.equal("RepeatabilityRequestID"); @@ -122,7 +111,7 @@ describe("#normalizeName", () => { expect(normalizeName("AKV_cert_URI", NameType.Property)).to.equal("akvCertURI"); expect(normalizeName("AzureOpenAIOperationStateOutput", NameType.Property)).to.equal("azureOpenAIOperationStateOutput"); expect(normalizeName("TSModel", NameType.Property)).to.equal("tsModel"); - expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.Property)).to.equal("validationNotRequired"); + expect(normalizeName("VALIDATION_NOT_REQUIRED", NameType.Property)).to.equal("validationNOTRequired"); expect(normalizeName("ValidationNotRequired", NameType.Property)).to.equal("validationNotRequired"); expect(normalizeName("KnownPFTestResult", NameType.Property)).to.equal("knownPFTestResult"); expect(normalizeName("repeatabilityRequestID", NameType.Property)).to.equal("repeatabilityRequestID"); From 9827649430c52e8e42ae1e610baa106d99285a38 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Tue, 7 Jan 2025 15:30:39 +0800 Subject: [PATCH 84/91] Update the smoke test --- .../typespec-ts/review/authoring.api.md | 10 +- .../generated/typespec-ts/src/outputModels.ts | 2 +- .../generated/typespec-ts/src/responses.ts | 10 +- .../review/contosowidgetmanager-rest.api.md | 10 +- .../generated/typespec-ts/src/outputModels.ts | 4 +- .../generated/typespec-ts/src/responses.ts | 10 +- .../typespec-ts/review/ai-face-rest.api.md | 173 +++++++----------- .../generated/typespec-ts/src/models.ts | 133 -------------- .../generated/typespec-ts/src/parameters.ts | 63 +++++-- .../typespec-ts/review/load-testing.api.md | 126 ++++++------- .../typespec-ts/src/models/models.ts | 126 ++++++------- .../typespec-ts/src/api/widgets/index.ts | 2 +- 12 files changed, 266 insertions(+), 403 deletions(-) diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md b/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md index c2c9cdcca3..7aafe160f5 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md @@ -114,7 +114,7 @@ export interface Delete202Headers { // @public export interface Delete202Response extends HttpResponse { // (undocumented) - body: OperationStatusErrorOutput; + body: OperationStatusOutput; // (undocumented) headers: RawHttpHeaders & Delete202Headers; // (undocumented) @@ -144,7 +144,7 @@ export interface DeleteDeployment202Headers { // @public export interface DeleteDeployment202Response extends HttpResponse { // (undocumented) - body: OperationStatusErrorOutput; + body: OperationStatusOutput; // (undocumented) headers: RawHttpHeaders & DeleteDeployment202Headers; // (undocumented) @@ -169,7 +169,7 @@ export interface DeleteDeploymentDefaultResponse extends HttpResponse { // @public export interface DeleteDeploymentLogicalResponse extends HttpResponse { // (undocumented) - body: OperationStatusErrorOutput; + body: OperationStatusOutput; // (undocumented) status: "200"; } @@ -180,7 +180,7 @@ export type DeleteDeploymentParameters = RequestParameters; // @public export interface DeleteLogicalResponse extends HttpResponse { // (undocumented) - body: OperationStatusErrorOutput; + body: OperationStatusOutput; // (undocumented) status: "200"; } @@ -730,7 +730,7 @@ export interface ListTrainingConfigVersionsQueryParamProperties { export type OperationStateOutput = string; // @public -export interface OperationStatusErrorOutput { +export interface OperationStatusOutput { error?: ErrorModel; id: string; status: OperationStateOutput; diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts index 74bdb3ca03..899254cb56 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts @@ -33,7 +33,7 @@ export interface ProjectOutput { export interface ProjectSettingsOutput extends Record {} /** Provides status details for long running operations. */ -export interface OperationStatusErrorOutput { +export interface OperationStatusOutput { /** The unique ID of the operation. */ id: string; /** diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts index 3a30cdee72..6f83968d0f 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts @@ -5,7 +5,7 @@ import { RawHttpHeaders } from "@azure/core-rest-pipeline"; import { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; import { ProjectOutput, - OperationStatusErrorOutput, + OperationStatusOutput, PagedProjectOutput, DeploymentOutput, PagedDeploymentOutput, @@ -81,7 +81,7 @@ export interface Delete202Headers { /** The request has been accepted for processing, but processing has not yet completed. */ export interface Delete202Response extends HttpResponse { status: "202"; - body: OperationStatusErrorOutput; + body: OperationStatusOutput; headers: RawHttpHeaders & Delete202Headers; } @@ -99,7 +99,7 @@ export interface DeleteDefaultResponse extends HttpResponse { /** The final response for long-running delete operation */ export interface DeleteLogicalResponse extends HttpResponse { status: "200"; - body: OperationStatusErrorOutput; + body: OperationStatusOutput; } /** The request has succeeded. */ @@ -266,7 +266,7 @@ export interface DeleteDeployment202Headers { /** The request has been accepted for processing, but processing has not yet completed. */ export interface DeleteDeployment202Response extends HttpResponse { status: "202"; - body: OperationStatusErrorOutput; + body: OperationStatusOutput; headers: RawHttpHeaders & DeleteDeployment202Headers; } @@ -284,7 +284,7 @@ export interface DeleteDeploymentDefaultResponse extends HttpResponse { /** The final response for long-running deleteDeployment operation */ export interface DeleteDeploymentLogicalResponse extends HttpResponse { status: "200"; - body: OperationStatusErrorOutput; + body: OperationStatusOutput; } /** The request has succeeded. */ diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md b/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md index b79e32d841..9cbb13ea01 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md @@ -96,7 +96,7 @@ export interface DeleteWidget202Headers { // @public export interface DeleteWidget202Response extends HttpResponse { // (undocumented) - body: OperationStatusErrorOutput; + body: OperationStatusOutput; // (undocumented) headers: RawHttpHeaders & DeleteWidget202Headers; // (undocumented) @@ -121,7 +121,7 @@ export interface DeleteWidgetDefaultResponse extends HttpResponse { // @public export interface DeleteWidgetLogicalResponse extends HttpResponse { // (undocumented) - body: OperationStatusErrorOutput; + body: OperationStatusOutput; // (undocumented) status: "200"; } @@ -194,7 +194,7 @@ export interface GetWidgetOperationStatus { // @public export interface GetWidgetOperationStatus200Response extends HttpResponse { // (undocumented) - body: ResourceOperationStatusWidgetWidgetErrorOutput; + body: ResourceOperationStatusOutput; // (undocumented) status: "200"; } @@ -270,7 +270,7 @@ export type ListWidgetsParameters = RequestParameters; export type OperationStateOutput = string; // @public -export interface OperationStatusErrorOutput { +export interface OperationStatusOutput { error?: ErrorModel; id: string; status: OperationStateOutput; @@ -310,7 +310,7 @@ export interface PagingOptions { } // @public -export interface ResourceOperationStatusWidgetWidgetErrorOutput { +export interface ResourceOperationStatusOutput { error?: ErrorModel; id: string; result?: WidgetOutput; diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts index bf407e1891..ebbb280692 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts @@ -22,7 +22,7 @@ export interface FakedSharedModelOutput { } /** Provides status details for long running operations. */ -export interface ResourceOperationStatusWidgetWidgetErrorOutput { +export interface ResourceOperationStatusOutput { /** The unique ID of the operation. */ id: string; /** @@ -38,7 +38,7 @@ export interface ResourceOperationStatusWidgetWidgetErrorOutput { } /** Provides status details for long running operations. */ -export interface OperationStatusErrorOutput { +export interface OperationStatusOutput { /** The unique ID of the operation. */ id: string; /** diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts index 7ae7cd2752..9e6bc9c785 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/src/responses.ts @@ -5,8 +5,8 @@ import { RawHttpHeaders } from "@azure/core-rest-pipeline"; import { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; import { WidgetOutput, - ResourceOperationStatusWidgetWidgetErrorOutput, - OperationStatusErrorOutput, + ResourceOperationStatusOutput, + OperationStatusOutput, PagedWidgetOutput, } from "./outputModels.js"; @@ -30,7 +30,7 @@ export interface GetWidgetDefaultResponse extends HttpResponse { /** The request has succeeded. */ export interface GetWidgetOperationStatus200Response extends HttpResponse { status: "200"; - body: ResourceOperationStatusWidgetWidgetErrorOutput; + body: ResourceOperationStatusOutput; } export interface GetWidgetOperationStatusDefaultHeaders { @@ -93,7 +93,7 @@ export interface DeleteWidget202Headers { /** The request has been accepted for processing, but processing has not yet completed. */ export interface DeleteWidget202Response extends HttpResponse { status: "202"; - body: OperationStatusErrorOutput; + body: OperationStatusOutput; headers: RawHttpHeaders & DeleteWidget202Headers; } @@ -111,7 +111,7 @@ export interface DeleteWidgetDefaultResponse extends HttpResponse { /** The final response for long-running deleteWidget operation */ export interface DeleteWidgetLogicalResponse extends HttpResponse { status: "200"; - body: OperationStatusErrorOutput; + body: OperationStatusOutput; } /** The request has succeeded. */ diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md b/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md index 1dd2892f58..c0f70c23de 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md @@ -1061,7 +1061,10 @@ export interface CreatePerson202Response extends HttpResponse { // @public (undocumented) export interface CreatePersonBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + name: string; + userData?: string; + }; } // @public (undocumented) @@ -1839,99 +1842,6 @@ export interface FaceErrorOutput { message: string; } -// @public (undocumented) -export interface FaceErrorResponse { - faceId: string; - faceIds: string[]; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; -} - -// @public (undocumented) -export interface FaceErrorResponse { - faceId: string; - faceListId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; -} - -// @public (undocumented) -export interface FaceErrorResponse { - faceId: string; - largeFaceListId: string; - maxNumOfCandidatesReturned?: number; - mode?: FindSimilarMatchMode; -} - -// @public (undocumented) -export interface FaceErrorResponse { - confidenceThreshold?: number; - faceIds: string[]; - maxNumOfCandidatesReturned?: number; - personGroupId: string; -} - -// @public (undocumented) -export interface FaceErrorResponse { - confidenceThreshold?: number; - faceIds: string[]; - largePersonGroupId: string; - maxNumOfCandidatesReturned?: number; -} - -// @public (undocumented) -export interface FaceErrorResponse { - confidenceThreshold?: number; - faceIds: string[]; - maxNumOfCandidatesReturned?: number; - personIds: string[]; -} - -// @public (undocumented) -export interface FaceErrorResponse { - confidenceThreshold?: number; - dynamicPersonGroupId: string; - faceIds: string[]; - maxNumOfCandidatesReturned?: number; -} - -// @public (undocumented) -export interface FaceErrorResponse { - faceId1: string; - faceId2: string; -} - -// @public (undocumented) -export interface FaceErrorResponse { - faceId: string; - personGroupId: string; - personId: string; -} - -// @public (undocumented) -export interface FaceErrorResponse { - faceId: string; - largePersonGroupId: string; - personId: string; -} - -// @public (undocumented) -export interface FaceErrorResponse { - faceId: string; - personId: string; -} - -// @public (undocumented) -export interface FaceErrorResponse { - faceIds: string[]; -} - -// @public (undocumented) -export interface FaceErrorResponse { - name: string; - userData?: string; -} - // @public export interface FaceErrorResponseOutput { error: FaceErrorOutput; @@ -2027,7 +1937,12 @@ export interface FindSimilar200Response extends HttpResponse { // @public (undocumented) export interface FindSimilarBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; + faceIds: string[]; + }; } // @public (undocumented) @@ -2056,7 +1971,12 @@ export interface FindSimilarFromFaceList200Response extends HttpResponse { // @public (undocumented) export interface FindSimilarFromFaceListBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; + faceListId: string; + }; } // @public (undocumented) @@ -2088,7 +2008,12 @@ export interface FindSimilarFromLargeFaceList200Response extends HttpResponse { // @public (undocumented) export interface FindSimilarFromLargeFaceListBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; + largeFaceListId: string; + }; } // @public (undocumented) @@ -3346,7 +3271,9 @@ export interface Group200Response extends HttpResponse { // @public (undocumented) export interface GroupBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceIds: string[]; + }; } // @public (undocumented) @@ -3419,7 +3346,12 @@ export interface IdentifyFromDynamicPersonGroup200Response extends HttpResponse // @public (undocumented) export interface IdentifyFromDynamicPersonGroupBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceIds: string[]; + dynamicPersonGroupId: string; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } // @public (undocumented) @@ -3451,7 +3383,12 @@ export interface IdentifyFromLargePersonGroup200Response extends HttpResponse { // @public (undocumented) export interface IdentifyFromLargePersonGroupBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceIds: string[]; + largePersonGroupId: string; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } // @public (undocumented) @@ -3483,7 +3420,12 @@ export interface IdentifyFromPersonDirectory200Response extends HttpResponse { // @public (undocumented) export interface IdentifyFromPersonDirectoryBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceIds: string[]; + personIds: string[]; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } // @public (undocumented) @@ -3523,7 +3465,12 @@ export interface IdentifyFromPersonGroup200Response extends HttpResponse { // @public (undocumented) export interface IdentifyFromPersonGroupBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceIds: string[]; + personGroupId: string; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } // @public (undocumented) @@ -4820,7 +4767,10 @@ export interface VerifyFaceToFace200Response extends HttpResponse { // @public (undocumented) export interface VerifyFaceToFaceBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceId1: string; + faceId2: string; + }; } // @public (undocumented) @@ -4852,7 +4802,11 @@ export interface VerifyFromLargePersonGroup200Response extends HttpResponse { // @public (undocumented) export interface VerifyFromLargePersonGroupBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceId: string; + largePersonGroupId: string; + personId: string; + }; } // @public (undocumented) @@ -4884,7 +4838,10 @@ export interface VerifyFromPersonDirectory200Response extends HttpResponse { // @public (undocumented) export interface VerifyFromPersonDirectoryBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceId: string; + personId: string; + }; } // @public (undocumented) @@ -4916,7 +4873,11 @@ export interface VerifyFromPersonGroup200Response extends HttpResponse { // @public (undocumented) export interface VerifyFromPersonGroupBodyParam { // (undocumented) - body: FaceErrorResponse; + body: { + faceId: string; + personGroupId: string; + personId: string; + }; } // @public (undocumented) diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts index 242d66d962..e45818722c 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/src/models.ts @@ -1,139 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export interface FaceErrorResponse { - /** faceId of the query face. User needs to call "Detect" first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call. */ - faceId: string; - /** The number of top similar faces returned. The valid range is [1, 1000]. Default value is 20. */ - maxNumOfCandidatesReturned?: number; - /** - * Similar face searching mode. It can be 'matchPerson' or 'matchFace'. Default value is 'matchPerson'. - * - * Possible values: "matchPerson", "matchFace" - */ - mode?: FindSimilarMatchMode; - /** An array of candidate faceIds. All of them are created by "Detect" and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. */ - faceIds: string[]; -} - -export interface FaceErrorResponse { - /** faceId of the query face. User needs to call "Detect" first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call. */ - faceId: string; - /** The number of top similar faces returned. The valid range is [1, 1000]. Default value is 20. */ - maxNumOfCandidatesReturned?: number; - /** - * Similar face searching mode. It can be 'matchPerson' or 'matchFace'. Default value is 'matchPerson'. - * - * Possible values: "matchPerson", "matchFace" - */ - mode?: FindSimilarMatchMode; - /** An existing user-specified unique candidate Face List, created in "Create Face List". Face List contains a set of persistedFaceIds which are persisted and will never expire. */ - faceListId: string; -} - -export interface FaceErrorResponse { - /** faceId of the query face. User needs to call "Detect" first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call. */ - faceId: string; - /** The number of top similar faces returned. The valid range is [1, 1000]. Default value is 20. */ - maxNumOfCandidatesReturned?: number; - /** - * Similar face searching mode. It can be 'matchPerson' or 'matchFace'. Default value is 'matchPerson'. - * - * Possible values: "matchPerson", "matchFace" - */ - mode?: FindSimilarMatchMode; - /** An existing user-specified unique candidate Large Face List, created in "Create Large Face List". Large Face List contains a set of persistedFaceIds which are persisted and will never expire. */ - largeFaceListId: string; -} - -export interface FaceErrorResponse { - /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ - faceIds: string[]; - /** personGroupId of the target Person Group, created by "Create Person Group". Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ - personGroupId: string; - /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ - maxNumOfCandidatesReturned?: number; - /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ - confidenceThreshold?: number; -} - -export interface FaceErrorResponse { - /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ - faceIds: string[]; - /** largePersonGroupId of the target Large Person Group, created by "Create Large Person Group". Parameter personGroupId and largePersonGroupId should not be provided at the same time. */ - largePersonGroupId: string; - /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ - maxNumOfCandidatesReturned?: number; - /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ - confidenceThreshold?: number; -} - -export interface FaceErrorResponse { - /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ - faceIds: string[]; - /** Array of personIds created in Person Directory "Create Person". The valid number of personIds is between [1,30]. */ - personIds: string[]; - /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ - maxNumOfCandidatesReturned?: number; - /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ - confidenceThreshold?: number; -} - -export interface FaceErrorResponse { - /** Array of query faces faceIds, created by the "Detect". Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. */ - faceIds: string[]; - /** DynamicPersonGroupId of the target PersonDirectory DynamicPersonGroup to match against. */ - dynamicPersonGroupId: string; - /** The range of maxNumOfCandidatesReturned is between 1 and 100. Default value is 10. */ - maxNumOfCandidatesReturned?: number; - /** Customized identification confidence threshold, in the range of [0, 1]. Advanced user can tweak this value to override default internal threshold for better precision on their scenario data. Note there is no guarantee of this threshold value working on other data and after algorithm updates. */ - confidenceThreshold?: number; -} - -export interface FaceErrorResponse { - /** The faceId of one face, come from "Detect". */ - faceId1: string; - /** The faceId of another face, come from "Detect". */ - faceId2: string; -} - -export interface FaceErrorResponse { - /** The faceId of the face, come from "Detect". */ - faceId: string; - /** Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in "Create Person Group". */ - personGroupId: string; - /** Specify a certain person in Person Group. */ - personId: string; -} - -export interface FaceErrorResponse { - /** The faceId of the face, come from "Detect". */ - faceId: string; - /** Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in "Create Large Person Group". */ - largePersonGroupId: string; - /** Specify a certain person in Large Person Group. */ - personId: string; -} - -export interface FaceErrorResponse { - /** The faceId of the face, come from "Detect". */ - faceId: string; - /** Specify a certain person in PersonDirectory Person. */ - personId: string; -} - -export interface FaceErrorResponse { - /** Array of candidate faceIds created by "Detect". The maximum is 1000 faces. */ - faceIds: string[]; -} - -export interface FaceErrorResponse { - /** User defined name, maximum length is 128. */ - name: string; - /** Optional user defined data. Length should not exceed 16K. */ - userData?: string; -} - /** Request for creating liveness session. */ export interface LivenessSessionCreationContent { /** diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts b/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts index 36742348ba..b2ef5bdb1c 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/src/parameters.ts @@ -6,7 +6,7 @@ import { FaceAttributeType, RecognitionModel, DetectionModel, - FaceErrorResponse, + FindSimilarMatchMode, LivenessSessionCreationContent, LivenessSessionWithVerifyImageCreationContent, } from "./models.js"; @@ -133,83 +133,118 @@ export type DetectParameters = DetectQueryParam & RequestParameters; export interface FindSimilarBodyParam { - body: FaceErrorResponse; + body: { + faceId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; + faceIds: string[]; + }; } export type FindSimilarParameters = FindSimilarBodyParam & RequestParameters; export interface FindSimilarFromFaceListBodyParam { - body: FaceErrorResponse; + body: { + faceId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; + faceListId: string; + }; } export type FindSimilarFromFaceListParameters = FindSimilarFromFaceListBodyParam & RequestParameters; export interface FindSimilarFromLargeFaceListBodyParam { - body: FaceErrorResponse; + body: { + faceId: string; + maxNumOfCandidatesReturned?: number; + mode?: FindSimilarMatchMode; + largeFaceListId: string; + }; } export type FindSimilarFromLargeFaceListParameters = FindSimilarFromLargeFaceListBodyParam & RequestParameters; export interface IdentifyFromPersonGroupBodyParam { - body: FaceErrorResponse; + body: { + faceIds: string[]; + personGroupId: string; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } export type IdentifyFromPersonGroupParameters = IdentifyFromPersonGroupBodyParam & RequestParameters; export interface IdentifyFromLargePersonGroupBodyParam { - body: FaceErrorResponse; + body: { + faceIds: string[]; + largePersonGroupId: string; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } export type IdentifyFromLargePersonGroupParameters = IdentifyFromLargePersonGroupBodyParam & RequestParameters; export interface IdentifyFromPersonDirectoryBodyParam { - body: FaceErrorResponse; + body: { + faceIds: string[]; + personIds: string[]; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } export type IdentifyFromPersonDirectoryParameters = IdentifyFromPersonDirectoryBodyParam & RequestParameters; export interface IdentifyFromDynamicPersonGroupBodyParam { - body: FaceErrorResponse; + body: { + faceIds: string[]; + dynamicPersonGroupId: string; + maxNumOfCandidatesReturned?: number; + confidenceThreshold?: number; + }; } export type IdentifyFromDynamicPersonGroupParameters = IdentifyFromDynamicPersonGroupBodyParam & RequestParameters; export interface VerifyFaceToFaceBodyParam { - body: FaceErrorResponse; + body: { faceId1: string; faceId2: string }; } export type VerifyFaceToFaceParameters = VerifyFaceToFaceBodyParam & RequestParameters; export interface VerifyFromPersonGroupBodyParam { - body: FaceErrorResponse; + body: { faceId: string; personGroupId: string; personId: string }; } export type VerifyFromPersonGroupParameters = VerifyFromPersonGroupBodyParam & RequestParameters; export interface VerifyFromLargePersonGroupBodyParam { - body: FaceErrorResponse; + body: { faceId: string; largePersonGroupId: string; personId: string }; } export type VerifyFromLargePersonGroupParameters = VerifyFromLargePersonGroupBodyParam & RequestParameters; export interface VerifyFromPersonDirectoryBodyParam { - body: FaceErrorResponse; + body: { faceId: string; personId: string }; } export type VerifyFromPersonDirectoryParameters = VerifyFromPersonDirectoryBodyParam & RequestParameters; export interface GroupBodyParam { - body: FaceErrorResponse; + body: { faceIds: string[] }; } export type GroupParameters = GroupBodyParam & RequestParameters; @@ -853,7 +888,7 @@ export type UpdateLargePersonGroupPersonFaceParameters = UpdateLargePersonGroupPersonFaceBodyParam & RequestParameters; export interface CreatePersonBodyParam { - body: FaceErrorResponse; + body: { name: string; userData?: string }; } export type CreatePersonParameters = CreatePersonBodyParam & RequestParameters; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index 4467c90c1c..5ffc76bdf1 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -189,34 +189,34 @@ export enum KnownAggregationType { // @public export enum KnownAPIVersions { - V2022_11_01 = "2022-11-01", - V2023_04_01_Preview = "2023-04-01-preview", - V2024_03_01_Preview = "2024-03-01-preview", - V2024_05_01_Preview = "2024-05-01-preview" + v2022_11_01 = "2022-11-01", + v2023_04_01_preview = "2023-04-01-preview", + v2024_03_01_preview = "2024-03-01-preview", + v2024_05_01_preview = "2024-05-01-preview" } // @public export enum KnownCertificateType { - AKVCERTURI = "AKV_CERT_URI" + AKV_CERT_URI = "AKV_CERT_URI" } // @public export enum KnownFileStatus { - NOTValidated = "NOT_VALIDATED", - ValidationFailure = "VALIDATION_FAILURE", - ValidationInitiated = "VALIDATION_INITIATED", - ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", - ValidationSuccess = "VALIDATION_SUCCESS" + NOT_VALIDATED = "NOT_VALIDATED", + VALIDATION_FAILURE = "VALIDATION_FAILURE", + VALIDATION_INITIATED = "VALIDATION_INITIATED", + VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS" } // @public export enum KnownFileType { - AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", - JMXFILE = "JMX_FILE", - TESTSCRIPT = "TEST_SCRIPT", - URLTESTCONFIG = "URL_TEST_CONFIG", - USERProperties = "USER_PROPERTIES", - ZIPPEDArtifacts = "ZIPPED_ARTIFACTS" + ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", + JMX_FILE = "JMX_FILE", + TEST_SCRIPT = "TEST_SCRIPT", + URL_TEST_CONFIG = "URL_TEST_CONFIG", + USER_PROPERTIES = "USER_PROPERTIES", + ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS" } // @public @@ -233,49 +233,49 @@ export enum KnownMetricUnit { // @public export enum KnownPFAction { - Continue = "continue", - Stop = "stop" + "continue" = "continue", + stop = "stop" } // @public export enum KnownPFAgFunc { - "P99.9" = "p99.9", - "P99.99" = "p99.99", - Avg = "avg", - Count = "count", - Max = "max", - Min = "min", - P50 = "p50", - P75 = "p75", - P90 = "p90", - P95 = "p95", - P96 = "p96", - P97 = "p97", - P98 = "p98", - P99 = "p99", - Percentage = "percentage" + "p99.9" = "p99.9", + "p99.99" = "p99.99", + avg = "avg", + count = "count", + max = "max", + min = "min", + p50 = "p50", + p75 = "p75", + p90 = "p90", + p95 = "p95", + p96 = "p96", + p97 = "p97", + p98 = "p98", + p99 = "p99", + percentage = "percentage" } // @public export enum KnownPFMetrics { - Error = "error", - Latency = "latency", - Requests = "requests", - RequestsPerSec = "requests_per_sec", - ResponseTimeMs = "response_time_ms" + error = "error", + latency = "latency", + requests = "requests", + requests_per_sec = "requests_per_sec", + response_time_ms = "response_time_ms" } // @public export enum KnownPFResult { - Failed = "failed", - Passed = "passed", - Undetermined = "undetermined" + failed = "failed", + passed = "passed", + undetermined = "undetermined" } // @public export enum KnownPFTestResult { FAILED = "FAILED", - NOTApplicable = "NOT_APPLICABLE", + NOT_APPLICABLE = "NOT_APPLICABLE", PASSED = "PASSED" } @@ -298,28 +298,28 @@ export enum KnownResourceKind { // @public export enum KnownSecretType { - AKVSECRETURI = "AKV_SECRET_URI", - SECRETVALUE = "SECRET_VALUE" + AKV_SECRET_URI = "AKV_SECRET_URI", + SECRET_VALUE = "SECRET_VALUE" } // @public export enum KnownStatus { - Accepted = "ACCEPTED", - Cancelled = "CANCELLED", - Cancelling = "CANCELLING", - Configured = "CONFIGURED", - Configuring = "CONFIGURING", - Deprovisioned = "DEPROVISIONED", - Deprovisioning = "DEPROVISIONING", + ACCEPTED = "ACCEPTED", + CANCELLED = "CANCELLED", + CANCELLING = "CANCELLING", + CONFIGURED = "CONFIGURED", + CONFIGURING = "CONFIGURING", + DEPROVISIONED = "DEPROVISIONED", + DEPROVISIONING = "DEPROVISIONING", DONE = "DONE", - Executed = "EXECUTED", - Executing = "EXECUTING", + EXECUTED = "EXECUTED", + EXECUTING = "EXECUTING", FAILED = "FAILED", - Notstarted = "NOTSTARTED", - Provisioned = "PROVISIONED", - Provisioning = "PROVISIONING", - ValidationFailure = "VALIDATION_FAILURE", - ValidationSuccess = "VALIDATION_SUCCESS" + NOTSTARTED = "NOTSTARTED", + PROVISIONED = "PROVISIONED", + PROVISIONING = "PROVISIONING", + VALIDATION_FAILURE = "VALIDATION_FAILURE", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS" } // @public @@ -331,13 +331,13 @@ export enum KnownTestKind { // @public export enum KnownTestProfileRunStatus { - Accepted = "ACCEPTED", - Cancelled = "CANCELLED", - Cancelling = "CANCELLING", + ACCEPTED = "ACCEPTED", + CANCELLED = "CANCELLED", + CANCELLING = "CANCELLING", DONE = "DONE", - Executing = "EXECUTING", + EXECUTING = "EXECUTING", FAILED = "FAILED", - Notstarted = "NOTSTARTED" + NOTSTARTED = "NOTSTARTED" } // @public diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts index fb227a9558..943dbcc7bd 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/models/models.ts @@ -220,15 +220,15 @@ export function passFailMetricDeserializer(item: any): PassFailMetric { /** Metrics for pass/fail criteria. */ export enum KnownPFMetrics { /** Pass fail criteria for response time metric in milliseconds. */ - ResponseTimeMs = "response_time_ms", + response_time_ms = "response_time_ms", /** Pass fail criteria for latency metric in milliseconds. */ - Latency = "latency", + latency = "latency", /** Pass fail criteria for error metric. */ - Error = "error", + error = "error", /** Pass fail criteria for total requests. */ - Requests = "requests", + requests = "requests", /** Pass fail criteria for request per second. */ - RequestsPerSec = "requests_per_sec", + requests_per_sec = "requests_per_sec", } /** @@ -247,35 +247,35 @@ export type PFMetrics = string; /** Aggregation functions for pass/fail criteria. */ export enum KnownPFAgFunc { /** Criteria applies for count value. */ - Count = "count", + count = "count", /** Criteria applies for given percentage value. */ - Percentage = "percentage", + percentage = "percentage", /** Criteria applies for avg value. */ - Avg = "avg", + avg = "avg", /** Criteria applies for 50th percentile value. */ - P50 = "p50", + p50 = "p50", /** Criteria applies for 75th percentile value. */ - P75 = "p75", + p75 = "p75", /** Criteria applies for 90th percentile value. */ - P90 = "p90", + p90 = "p90", /** Criteria applies for 95th percentile value. */ - P95 = "p95", + p95 = "p95", /** Criteria applies for 96th percentile value. */ - P96 = "p96", + p96 = "p96", /** Criteria applies for 97th percentile value. */ - P97 = "p97", + p97 = "p97", /** Criteria applies for 98th percentile value. */ - P98 = "p98", + p98 = "p98", /** Criteria applies for 99th percentile value. */ - P99 = "p99", + p99 = "p99", /** Criteria applies for 99.9th percentile value. */ - "P99.9" = "p99.9", + "p99.9" = "p99.9", /** Criteria applies for 99.99th percentile value. */ - "P99.99" = "p99.99", + "p99.99" = "p99.99", /** Criteria applies for minimum value. */ - Min = "min", + min = "min", /** Criteria applies for maximum value. */ - Max = "max", + max = "max", } /** @@ -304,9 +304,9 @@ export type PFAgFunc = string; /** Action to take on failure of pass/fail criteria. */ export enum KnownPFAction { /** Test will continue to run even if pass fail metric criteria metric gets failed. */ - Continue = "continue", + "continue" = "continue", /** Test run will stop if pass fail criteria metric is not passed. */ - Stop = "stop", + stop = "stop", } /** @@ -322,11 +322,11 @@ export type PFAction = string; /** Pass/fail criteria result. */ export enum KnownPFResult { /** Given pass fail criteria metric has passed. */ - Passed = "passed", + passed = "passed", /** Given pass fail criteria metric couldn't determine. */ - Undetermined = "undetermined", + undetermined = "undetermined", /** Given pass fail criteria metric has failed. */ - Failed = "failed", + failed = "failed", } /** @@ -408,9 +408,9 @@ export function secretDeserializer(item: any): Secret { /** Types of secrets supported. */ export enum KnownSecretType { /** If the secret is stored in an Azure Key Vault. */ - AKVSECRETURI = "AKV_SECRET_URI", + AKV_SECRET_URI = "AKV_SECRET_URI", /** If the secret value provided as plain text. */ - SECRETVALUE = "SECRET_VALUE", + SECRET_VALUE = "SECRET_VALUE", } /** @@ -450,7 +450,7 @@ export function certificateMetadataDeserializer( /** Types of certificates supported. */ export enum KnownCertificateType { /** If the certificate is stored in an Azure Key Vault. */ - AKVCERTURI = "AKV_CERT_URI", + AKV_CERT_URI = "AKV_CERT_URI", } /** @@ -672,17 +672,17 @@ export function testFileInfoDeserializer(item: any): TestFileInfo { /** Types of file supported. */ export enum KnownFileType { /** If the file is a JMX script. */ - JMXFILE = "JMX_FILE", + JMX_FILE = "JMX_FILE", /** If the file is a user properties file. */ - USERProperties = "USER_PROPERTIES", + USER_PROPERTIES = "USER_PROPERTIES", /** If the file is not among any of the other supported file types. */ - AdditionalArtifacts = "ADDITIONAL_ARTIFACTS", + ADDITIONAL_ARTIFACTS = "ADDITIONAL_ARTIFACTS", /** If the file is a compressed archive containing a collection of various artifacts or resources. */ - ZIPPEDArtifacts = "ZIPPED_ARTIFACTS", + ZIPPED_ARTIFACTS = "ZIPPED_ARTIFACTS", /** If the file is a JSON config file to define the requests for a URL test. */ - URLTESTCONFIG = "URL_TEST_CONFIG", + URL_TEST_CONFIG = "URL_TEST_CONFIG", /** If the file is a test script. */ - TESTSCRIPT = "TEST_SCRIPT", + TEST_SCRIPT = "TEST_SCRIPT", } /** @@ -702,15 +702,15 @@ export type FileType = string; /** File status. */ export enum KnownFileStatus { /** File is not validated. */ - NOTValidated = "NOT_VALIDATED", + NOT_VALIDATED = "NOT_VALIDATED", /** File is validated. */ - ValidationSuccess = "VALIDATION_SUCCESS", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS", /** File validation is failed. */ - ValidationFailure = "VALIDATION_FAILURE", + VALIDATION_FAILURE = "VALIDATION_FAILURE", /** File validation is in progress. */ - ValidationInitiated = "VALIDATION_INITIATED", + VALIDATION_INITIATED = "VALIDATION_INITIATED", /** Validation is not required. */ - ValidationNOTRequired = "VALIDATION_NOT_REQUIRED", + VALIDATION_NOT_REQUIRED = "VALIDATION_NOT_REQUIRED", } /** @@ -1432,7 +1432,7 @@ export enum KnownPFTestResult { /** Pass/fail criteria has passed. */ PASSED = "PASSED", /** Pass/fail criteria is not applicable. */ - NOTApplicable = "NOT_APPLICABLE", + NOT_APPLICABLE = "NOT_APPLICABLE", /** Pass/fail criteria has failed. */ FAILED = "FAILED", } @@ -1451,37 +1451,37 @@ export type PFTestResult = string; /** Test run status. */ export enum KnownStatus { /** Test run request is accepted. */ - Accepted = "ACCEPTED", + ACCEPTED = "ACCEPTED", /** Test run is not yet started. */ - Notstarted = "NOTSTARTED", + NOTSTARTED = "NOTSTARTED", /** Test run is provisioning. */ - Provisioning = "PROVISIONING", + PROVISIONING = "PROVISIONING", /** Test run is provisioned. */ - Provisioned = "PROVISIONED", + PROVISIONED = "PROVISIONED", /** Test run is getting configured. */ - Configuring = "CONFIGURING", + CONFIGURING = "CONFIGURING", /** Test run configuration is done. */ - Configured = "CONFIGURED", + CONFIGURED = "CONFIGURED", /** Test run has started executing. */ - Executing = "EXECUTING", + EXECUTING = "EXECUTING", /** Test run execution is completed. */ - Executed = "EXECUTED", + EXECUTED = "EXECUTED", /** Test run is getting deprovisioned. */ - Deprovisioning = "DEPROVISIONING", + DEPROVISIONING = "DEPROVISIONING", /** Test run is deprovisioned. */ - Deprovisioned = "DEPROVISIONED", + DEPROVISIONED = "DEPROVISIONED", /** Test run is completed. */ DONE = "DONE", /** Test run is being cancelled. */ - Cancelling = "CANCELLING", + CANCELLING = "CANCELLING", /** Test run request is cancelled. */ - Cancelled = "CANCELLED", + CANCELLED = "CANCELLED", /** Test run request is failed. */ FAILED = "FAILED", /** Test run JMX file is validated. */ - ValidationSuccess = "VALIDATION_SUCCESS", + VALIDATION_SUCCESS = "VALIDATION_SUCCESS", /** Test run JMX file validation is failed. */ - ValidationFailure = "VALIDATION_FAILURE", + VALIDATION_FAILURE = "VALIDATION_FAILURE", } /** @@ -2407,17 +2407,17 @@ export function testProfileRunDeserializer(item: any): TestProfileRun { /** Test profile run status. */ export enum KnownTestProfileRunStatus { /** Test profile run request is accepted. */ - Accepted = "ACCEPTED", + ACCEPTED = "ACCEPTED", /** Test profile run is not yet started. */ - Notstarted = "NOTSTARTED", + NOTSTARTED = "NOTSTARTED", /** Test profile run has started executing. */ - Executing = "EXECUTING", + EXECUTING = "EXECUTING", /** Test profile run has completed successfully. */ DONE = "DONE", /** Test profile run is being cancelled. */ - Cancelling = "CANCELLING", + CANCELLING = "CANCELLING", /** Test profile run is cancelled. */ - Cancelled = "CANCELLED", + CANCELLED = "CANCELLED", /** Test profile run has failed. */ FAILED = "FAILED", } @@ -2548,11 +2548,11 @@ export function testProfileRunArrayDeserializer( /** Azure Load Testing API versions. */ export enum KnownAPIVersions { /** The 2022-11-01 version of the Azure Load Testing API. */ - V2022_11_01 = "2022-11-01", + v2022_11_01 = "2022-11-01", /** The 2023-04-01-preview version of the Azure Load Testing API. */ - V2023_04_01_Preview = "2023-04-01-preview", + v2023_04_01_preview = "2023-04-01-preview", /** The 2024-03-01-preview version of the Azure Load Testing API. */ - V2024_03_01_Preview = "2024-03-01-preview", + v2024_03_01_preview = "2024-03-01-preview", /** The 2024-05-01-preview version of the Azure Load Testing API. */ - V2024_05_01_Preview = "2024-05-01-preview", + v2024_05_01_preview = "2024-05-01-preview", } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts index 768d13c245..ae9a604c1a 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts @@ -25,11 +25,11 @@ import { AnalyzeResult, analyzeResultDeserializer, } from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { buildCsvCollection } from "../../static-helpers/serialization/build-csv-collection.js"; import { StreamableMethod, From a8f87574b498d80e8c158252b4d1b6ee78441584 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:49:51 +0800 Subject: [PATCH 85/91] fix ci --- .../typespec-ts/src/api/widgets/index.ts | 2 +- .../test/unit/modelsGenerator.spec.ts | 34 ------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts index ae9a604c1a..768d13c245 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts @@ -25,11 +25,11 @@ import { AnalyzeResult, analyzeResultDeserializer, } from "../../models/models.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { buildCsvCollection } from "../../static-helpers/serialization/build-csv-collection.js"; import { StreamableMethod, diff --git a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts index 9baeb7e914..dfb1595029 100644 --- a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts +++ b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts @@ -2861,40 +2861,6 @@ describe("Input/output model type", () => { }); }); - it("should generate templated friendly name", async () => { - const tspDefinition = ` - @friendlyName("{name}Model", Base) - model Base { } - - @friendlyName("Templated{name}", T) - model Templated { - prop: T; - } - - model X is Templated{}; - `; - const tspType = "X"; - const inputModelName = "X"; - await verifyPropertyType(tspType, inputModelName, { - additionalTypeSpecDefinition: tspDefinition, - outputType: `XOutput`, - additionalInputContent: ` - export interface X { - prop: BaseModel; - } - - export interface BaseModel {} - `, - additionalOutputContent: ` - export interface XOutput { - prop: BaseModelOutput; - } - - export interface BaseModelOutput {} - ` - }); - }); - it("should generate template model successfully even without @friendlyName", async () => { const tspDefinition = ` model Base { } From 3a100be4cdf7b9e0fbe1e53c91569bbb202a3d2b Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:38:10 +0800 Subject: [PATCH 86/91] Update modelsGenerator.spec.ts This reverts commit a8f87574b498d80e8c158252b4d1b6ee78441584. --- .../test/unit/modelsGenerator.spec.ts | 80 +++---------------- 1 file changed, 13 insertions(+), 67 deletions(-) diff --git a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts index dfb1595029..3a9ca2f89a 100644 --- a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts +++ b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts @@ -2861,90 +2861,36 @@ describe("Input/output model type", () => { }); }); - it("should generate template model successfully even without @friendlyName", async () => { + it("should generate templated friendly name", async () => { const tspDefinition = ` + @friendlyName("{name}Model", Base) model Base { } + @friendlyName("Templated{name}", T) model Templated { prop: T; } - model Foo { - x: Templated; - y: Templated; - z: Templated<"cat">; - h: Templated; - j: Templated<1>; - } + model X is Templated{}; `; - const tspType = "Foo"; - const inputModelName = "Foo"; + const tspType = "X"; + const inputModelName = "X"; await verifyPropertyType(tspType, inputModelName, { additionalTypeSpecDefinition: tspDefinition, - outputType: `FooOutput`, + outputType: `XOutput`, additionalInputContent: ` - export interface Foo { - x: TemplatedBase; - y: TemplatedString; - z: TemplatedCat; - h: TemplatedTrue; - j: Templated1; - } - - export interface TemplatedBase { - prop: Base; - } - - export interface Base { - } - - export interface TemplatedString { - prop: string; - } - - export interface TemplatedCat { - prop: "cat"; - } - - export interface TemplatedTrue { - prop: true; + export interface X { + prop: BaseModel; } - export interface Templated1 { - prop: 1; - } + export interface BaseModel {} `, additionalOutputContent: ` - export interface FooOutput { - x: TemplatedBaseOutput; - y: TemplatedStringOutput; - z: TemplatedCatOutput; - h: TemplatedTrueOutput; - j: Templated1Output; - } - - export interface TemplatedBaseOutput { - prop: BaseOutput; - } - - export interface BaseOutput { - } - - export interface TemplatedStringOutput { - prop: string; - } - - export interface TemplatedCatOutput { - prop: "cat"; + export interface XOutput { + prop: BaseModelOutput; } - export interface TemplatedTrueOutput { - prop: true; - } - - export interface Templated1Output { - prop: 1; - } + export interface BaseModelOutput {} ` }); }); From 6dbeb377d5495142040fda8bd3844720dd08afae Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:44:58 +0800 Subject: [PATCH 87/91] fix ci --- .../modularUnit/scenarios/enumUnion/enumUnion.md | 12 ++++++------ .../models/apiVersion/apiVersionAsKnownVersions.md | 2 +- .../flatten/experimentalExtensibleEnumsTrue.md | 4 ++-- .../notFlatten/experimentalExtensibleEnumsFalse.md | 2 +- .../scenarios/models/serialization/enumKeyNorm.md | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md b/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md index e2cb86ea40..72e70cfae0 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md @@ -1148,27 +1148,27 @@ export enum KnownImageSize { * Very small image size of 256x256 pixels. * Only supported with dall-e-2 models. */ - size256x256 = "256x256", + Size256X256 = "256x256", /** * A smaller image size of 512x512 pixels. * Only supported with dall-e-2 models. */ - size512x512 = "512x512", + Size512X512 = "512x512", /** * A standard, square image size of 1024x1024 pixels. * Supported by both dall-e-2 and dall-e-3 models. */ - size1024x1024 = "1024x1024", + Size1024X1024 = "1024x1024", /** * A wider image size of 1024x1792 pixels. * Only supported with dall-e-3 models. */ - size1792x1024 = "1792x1024", + Size1792X1024 = "1792x1024", /** * A taller image size of 1792x1024 pixels. * Only supported with dall-e-3 models. */ - size1024x1792 = "1024x1792", + Size1024X1792 = "1024x1792", } ``` @@ -1197,7 +1197,7 @@ op read(@body body: Test): void; ```ts models interface Test /** model interface Test */ export interface Test { - color: Lr | Ud; + color: LR | UD; } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md index 204f65afe4..b6ab5e2cc6 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/apiVersion/apiVersionAsKnownVersions.md @@ -40,6 +40,6 @@ Should generate KnownVersions in models.ts. /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V2021_10_01_Preview = "2021-10-01-preview" + V2021_10_01_Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md index a3efcbf0de..cb6180838e 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/flatten/experimentalExtensibleEnumsTrue.md @@ -92,7 +92,7 @@ export enum KnownProvisioningState { /** The resource is being deleted */ Deleting = "Deleting", /** The resource create request has been accepted */ - Accepted = "Accepted" + Accepted = "Accepted", } /** @@ -113,6 +113,6 @@ export type ProvisioningState = string; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V2021_10_01_Preview = "2021-10-01-preview" + V2021_10_01_Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md index 171756147e..c972e68d0f 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/nestedEnum/notFlatten/experimentalExtensibleEnumsFalse.md @@ -96,6 +96,6 @@ export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; /** The available API versions. */ export enum KnownVersions { /** 2021-10-01-preview version */ - V2021_10_01_Preview = "2021-10-01-preview" + V2021_10_01_Preview = "2021-10-01-preview", } ``` diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md index 7f1af1bcb9..467549652c 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/enumKeyNorm.md @@ -93,7 +93,7 @@ export interface Foo { export function fooSerializer(item: Foo): any { return { extensibleString: item["extensibleString"], - extensibleNumber: item["extensibleNumber"] + extensibleNumber: item["extensibleNumber"], }; } @@ -118,7 +118,7 @@ export enum KnownExtensibleString { Num10 = "10", Num20 = "20", "Num1.0" = "1.0", - "Item-1.0" = "-2.0" + "Item-1.0" = "-2.0", } /** Type of ExtensibleString */ @@ -129,7 +129,7 @@ export enum KnownExtensibleNumber { One = 1, Num2 = 2, "Num-2.1" = -2.1, - Num3 = 3 + Num3 = 3, } /** Type of ExtensibleNumber */ @@ -139,6 +139,6 @@ export type ExtensibleNumber = number; export enum KnownVersions { PreviewVersion = "2024-07-01-preview", StableVersion = "2024-07-01", - "V2024-08-01-Preview" = "2024-08-01-preview" + "V2024-08-01-Preview" = "2024-08-01-preview", } ``` From 80dee4daf9ef420133837bcc766a8e1782df68cb Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 8 Jan 2025 11:17:14 +0800 Subject: [PATCH 88/91] Fix the failed UTs --- .../scenarios/enumUnion/enumUnion.md | 106 +++++++++--------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md b/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md index 72e70cfae0..456163b120 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md @@ -53,26 +53,24 @@ import { StreamableMethod, PathUncheckedResponse, createRestError, - operationOptionsToRequestParameters, + operationOptionsToRequestParameters } from "@azure-rest/core-client"; export function _getSend( context: Client, contentType: SchemaContentTypeValues, body: string, - options: GetOptionalParams = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} } ): StreamableMethod { - return context - .path("/") - .post({ - ...operationOptionsToRequestParameters(options), - contentType: contentType, - body: body, - }); + return context.path("/").post({ + ...operationOptionsToRequestParameters(options), + contentType: contentType, + body: body + }); } export async function _getDeserialize( - result: PathUncheckedResponse, + result: PathUncheckedResponse ): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { @@ -86,7 +84,7 @@ export async function get( context: Client, contentType: SchemaContentTypeValues, body: string, - options: GetOptionalParams = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} } ): Promise { const result = await _getSend(context, contentType, body, options); return _getDeserialize(result); @@ -227,7 +225,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues, + item: SchemaContentTypeValues ): any { return item; } @@ -287,7 +285,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues, + item: SchemaContentTypeValues ): any { return item; } @@ -388,7 +386,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues, + item: SchemaContentTypeValues ): any { return item; } @@ -448,7 +446,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues, + item: SchemaContentTypeValues ): any { return item; } @@ -502,30 +500,28 @@ import { StreamableMethod, PathUncheckedResponse, createRestError, - operationOptionsToRequestParameters, + operationOptionsToRequestParameters } from "@azure-rest/core-client"; export function _getSend( context: Client, testHeader: "A" | "B", body: string, - options: GetOptionalParams = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} } ): StreamableMethod { - return context - .path("/") - .post({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - "test-header": testHeader, - ...options.requestOptions?.headers, - }, - body: body, - }); + return context.path("/").post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + "test-header": testHeader, + ...options.requestOptions?.headers + }, + body: body + }); } export async function _getDeserialize( - result: PathUncheckedResponse, + result: PathUncheckedResponse ): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { @@ -539,7 +535,7 @@ export async function get( context: Client, testHeader: "A" | "B", body: string, - options: GetOptionalParams = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} } ): Promise { const result = await _getSend(context, testHeader, body, options); return _getDeserialize(result); @@ -590,30 +586,28 @@ import { StreamableMethod, PathUncheckedResponse, createRestError, - operationOptionsToRequestParameters, + operationOptionsToRequestParameters } from "@azure-rest/core-client"; export function _getSend( context: Client, testHeader: string, body: string, - options: GetOptionalParams = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} } ): StreamableMethod { - return context - .path("/") - .post({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - "test-header": testHeader, - ...options.requestOptions?.headers, - }, - body: body, - }); + return context.path("/").post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + "test-header": testHeader, + ...options.requestOptions?.headers + }, + body: body + }); } export async function _getDeserialize( - result: PathUncheckedResponse, + result: PathUncheckedResponse ): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { @@ -627,7 +621,7 @@ export async function get( context: Client, testHeader: string, body: string, - options: GetOptionalParams = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} } ): Promise { const result = await _getSend(context, testHeader, body, options); return _getDeserialize(result); @@ -967,6 +961,10 @@ model Test { op read(@body body: Test): void; ``` +```yaml +mustEmptyDiagnostic: false +``` + ## Model interface Test ```ts models interface Test @@ -1168,7 +1166,7 @@ export enum KnownImageSize { * A taller image size of 1792x1024 pixels. * Only supported with dall-e-3 models. */ - Size1024X1792 = "1024x1792", + Size1024X1792 = "1024x1792" } ``` @@ -1201,18 +1199,18 @@ export interface Test { } ``` -## Model Alias Lr +## Model Alias LR -```ts models alias Lr -/** Type of Lr */ -export type Lr = "left" | "right"; +```ts models alias LR +/** Type of LR */ +export type LR = "left" | "right"; ``` -## Model Alias Ud +## Model Alias UD -```ts models alias Ud -/** Type of Ud */ -export type Ud = "up" | "down"; +```ts models alias UD +/** Type of UD */ +export type UD = "up" | "down"; ``` # model type non-standard enum/union name From bf3d00031397a5a3ffa3e19735c2ed3bf3e5d7f1 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:23:55 +0800 Subject: [PATCH 89/91] Update enumUnion.md --- .../scenarios/enumUnion/enumUnion.md | 86 ++++++++++--------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md b/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md index 456163b120..aaafa71344 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/enumUnion/enumUnion.md @@ -53,24 +53,26 @@ import { StreamableMethod, PathUncheckedResponse, createRestError, - operationOptionsToRequestParameters + operationOptionsToRequestParameters, } from "@azure-rest/core-client"; export function _getSend( context: Client, contentType: SchemaContentTypeValues, body: string, - options: GetOptionalParams = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/").post({ - ...operationOptionsToRequestParameters(options), - contentType: contentType, - body: body - }); + return context + .path("/") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: contentType, + body: body, + }); } export async function _getDeserialize( - result: PathUncheckedResponse + result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { @@ -84,7 +86,7 @@ export async function get( context: Client, contentType: SchemaContentTypeValues, body: string, - options: GetOptionalParams = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, contentType, body, options); return _getDeserialize(result); @@ -225,7 +227,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues + item: SchemaContentTypeValues, ): any { return item; } @@ -285,7 +287,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues + item: SchemaContentTypeValues, ): any { return item; } @@ -386,7 +388,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues + item: SchemaContentTypeValues, ): any { return item; } @@ -446,7 +448,7 @@ export type SchemaContentTypeValues = | string; export function schemaContentTypeValuesSerializer( - item: SchemaContentTypeValues + item: SchemaContentTypeValues, ): any { return item; } @@ -500,28 +502,30 @@ import { StreamableMethod, PathUncheckedResponse, createRestError, - operationOptionsToRequestParameters + operationOptionsToRequestParameters, } from "@azure-rest/core-client"; export function _getSend( context: Client, testHeader: "A" | "B", body: string, - options: GetOptionalParams = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/").post({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - "test-header": testHeader, - ...options.requestOptions?.headers - }, - body: body - }); + return context + .path("/") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + "test-header": testHeader, + ...options.requestOptions?.headers, + }, + body: body, + }); } export async function _getDeserialize( - result: PathUncheckedResponse + result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { @@ -535,7 +539,7 @@ export async function get( context: Client, testHeader: "A" | "B", body: string, - options: GetOptionalParams = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, testHeader, body, options); return _getDeserialize(result); @@ -586,28 +590,30 @@ import { StreamableMethod, PathUncheckedResponse, createRestError, - operationOptionsToRequestParameters + operationOptionsToRequestParameters, } from "@azure-rest/core-client"; export function _getSend( context: Client, testHeader: string, body: string, - options: GetOptionalParams = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { - return context.path("/").post({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - "test-header": testHeader, - ...options.requestOptions?.headers - }, - body: body - }); + return context + .path("/") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + "test-header": testHeader, + ...options.requestOptions?.headers, + }, + body: body, + }); } export async function _getDeserialize( - result: PathUncheckedResponse + result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { @@ -621,7 +627,7 @@ export async function get( context: Client, testHeader: string, body: string, - options: GetOptionalParams = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, testHeader, body, options); return _getDeserialize(result); @@ -1166,7 +1172,7 @@ export enum KnownImageSize { * A taller image size of 1792x1024 pixels. * Only supported with dall-e-3 models. */ - Size1024X1792 = "1024x1792" + Size1024X1792 = "1024x1792", } ``` From a64819b9431810cfce1c226468597a6e94d3ddd0 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:43:18 +0800 Subject: [PATCH 90/91] Update index.d.ts --- .../modularIntegration/generated/encode/bytes/src/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts index e4b71816c6..ddcc3e040f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts @@ -64,9 +64,8 @@ export declare interface PropertyDefaultOptionalParams extends OperationOptions } export declare interface PropertyOperations { - base64url: (body: Base64UrlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; base64urlArray: (body: Base64UrlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; - base64url: (body: Base64urlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; + base64url: (body: Base64UrlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; base64: (body: Base64BytesProperty, options?: PropertyBase64OptionalParams) => Promise; default: (body: DefaultBytesProperty, options?: PropertyDefaultOptionalParams) => Promise; } From f809bbf435239eea7c11ab0cf316f0785f46143e Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Mon, 13 Jan 2025 11:28:39 +0800 Subject: [PATCH 91/91] Merge to the latest main --- .../corecompattest/src/models/index.ts | 53 +------ .../generated/petstore/src/models/index.ts | 53 +------ .../test/integration/swaggers/petstore.json | 23 +-- .../src/bodyComplexRestClient.ts | 5 +- .../bodyComplexRest/src/clientDefinitions.ts | 6 +- .../bodyComplexRest/src/isUnexpected.ts | 2 +- .../bodyComplexRest/src/parameters.ts | 4 +- .../bodyComplexRest/src/responses.ts | 4 +- .../generated/bodyFileRest/src/bodyFile.ts | 5 +- .../bodyFileRest/src/clientDefinitions.ts | 6 +- .../bodyFileRest/src/isUnexpected.ts | 2 +- .../generated/bodyFileRest/src/parameters.ts | 2 +- .../generated/bodyFileRest/src/responses.ts | 4 +- .../bodyFormDataRest/src/bodyFormData.ts | 5 +- .../bodyFormDataRest/src/clientDefinitions.ts | 6 +- .../bodyFormDataRest/src/isUnexpected.ts | 2 +- .../bodyFormDataRest/src/parameters.ts | 2 +- .../bodyFormDataRest/src/responses.ts | 4 +- .../bodyStringRest/src/bodyStringRest.ts | 5 +- .../bodyStringRest/src/clientDefinitions.ts | 6 +- .../bodyStringRest/src/isUnexpected.ts | 2 +- .../bodyStringRest/src/parameters.ts | 4 +- .../generated/bodyStringRest/src/responses.ts | 4 +- .../customUrlRest/src/clientDefinitions.ts | 6 +- .../customUrlRest/src/customUrlRestClient.ts | 5 +- .../customUrlRest/src/isUnexpected.ts | 2 +- .../generated/customUrlRest/src/parameters.ts | 2 +- .../generated/customUrlRest/src/responses.ts | 4 +- .../generated/dpgCustomization/package.json | 2 +- .../dpgCustomization/src/clientDefinitions.ts | 6 +- .../src/dPGCustomizationClient.ts | 61 ++++++++ .../src/dpgCustomizationClient.ts | 5 +- .../generated/dpgCustomization/src/index.ts | 4 +- .../dpgCustomization/src/paginateHelper.ts | 7 +- .../dpgCustomization/src/parameters.ts | 4 +- .../dpgCustomization/src/pollingHelper.ts | 8 +- .../dpgCustomization/src/responses.ts | 4 +- .../headerRest/src/clientDefinitions.ts | 6 +- .../headerRest/src/headerRestClient.ts | 5 +- .../generated/headerRest/src/isUnexpected.ts | 2 +- .../generated/headerRest/src/parameters.ts | 4 +- .../generated/headerRest/src/responses.ts | 6 +- .../src/clientDefinitions.ts | 6 +- .../src/httpInfrastructureRestClient.ts | 5 +- .../src/isUnexpected.ts | 2 +- .../httpInfrastructureRest/src/parameters.ts | 2 +- .../httpInfrastructureRest/src/responses.ts | 6 +- .../lroRest/src/clientDefinitions.ts | 6 +- .../generated/lroRest/src/index.ts | 4 +- .../generated/lroRest/src/isUnexpected.ts | 2 +- .../generated/lroRest/src/lRORestClient.ts | 45 ++++++ .../generated/lroRest/src/lroRestClient.ts | 5 +- .../generated/lroRest/src/parameters.ts | 4 +- .../generated/lroRest/src/pollingHelper.ts | 8 +- .../generated/lroRest/src/responses.ts | 6 +- .../mediaTypesRest/src/clientDefinitions.ts | 6 +- .../mediaTypesRest/src/isUnexpected.ts | 2 +- .../mediaTypesRest/src/mediaTypes.ts | 5 +- .../mediaTypesRest/src/parameters.ts | 4 +- .../generated/mediaTypesRest/src/responses.ts | 2 +- .../src/clientDefinitions.ts | 6 +- .../src/isUnexpected.ts | 2 +- .../src/multipleInheritanceRestClient.ts | 5 +- .../multipleInheritanceRest/src/parameters.ts | 4 +- .../multipleInheritanceRest/src/responses.ts | 4 +- .../src/clientDefinitions.ts | 6 +- .../multipleUrlParameters/src/isUnexpected.ts | 2 +- .../src/multipleUrlParameterRestClient.ts | 7 +- .../multipleUrlParameters/src/parameters.ts | 4 +- .../multipleUrlParameters/src/responses.ts | 4 +- .../pagingRest/src/clientDefinitions.ts | 6 +- .../generated/pagingRest/src/isUnexpected.ts | 2 +- .../pagingRest/src/paginateHelper.ts | 7 +- .../generated/pagingRest/src/paging.ts | 5 +- .../generated/pagingRest/src/parameters.ts | 6 +- .../generated/pagingRest/src/pollingHelper.ts | 8 +- .../generated/pagingRest/src/responses.ts | 4 +- .../securityAADRest/src/clientDefinitions.ts | 6 +- .../securityAADRest/src/parameters.ts | 2 +- .../securityAADRest/src/responses.ts | 2 +- .../src/securityAADRestClient.ts | 7 +- .../securityKeyRest/src/clientDefinitions.ts | 6 +- .../securityKeyRest/src/parameters.ts | 2 +- .../securityKeyRest/src/responses.ts | 2 +- .../src/securityKeyRestClient.ts | 7 +- .../urlRest/src/clientDefinitions.ts | 6 +- .../generated/urlRest/src/isUnexpected.ts | 2 +- .../generated/urlRest/src/parameters.ts | 2 +- .../generated/urlRest/src/responses.ts | 4 +- .../generated/urlRest/src/urlRestClient.ts | 5 +- .../review/agrifood-data-plane.api.md | 22 +-- .../azureAgriFoodPlatformDataPlaneService.ts | 7 +- .../src/clientDefinitions.ts | 6 +- .../agrifood-data-plane/src/isUnexpected.ts | 2 +- .../agrifood-data-plane/src/paginateHelper.ts | 7 +- .../agrifood-data-plane/src/parameters.ts | 4 +- .../agrifood-data-plane/src/pollingHelper.ts | 8 +- .../agrifood-data-plane/src/responses.ts | 4 +- .../review/anomaly-detector-mv-rest.api.md | 16 +- .../src/anomalyDetectorMV.ts | 7 +- .../src/clientDefinitions.ts | 6 +- .../src/isUnexpected.ts | 2 +- .../src/paginateHelper.ts | 7 +- .../src/parameters.ts | 8 +- .../anomaly-detector-mv-rest/src/responses.ts | 6 +- .../review/anomaly-detector-rest.api.md | 24 +-- .../src/anomalyDetectorRest.ts | 7 +- .../src/clientDefinitions.ts | 6 +- .../anomaly-detector-rest/src/isUnexpected.ts | 2 +- .../src/paginateHelper.ts | 7 +- .../anomaly-detector-rest/src/parameters.ts | 4 +- .../src/pollingHelper.ts | 8 +- .../anomaly-detector-rest/src/responses.ts | 6 +- .../review/purview-administration-rest.api.md | 18 +-- .../src/account/clientDefinitions.ts | 6 +- .../src/account/isUnexpected.ts | 2 +- .../src/account/paginateHelper.ts | 7 +- .../src/account/parameters.ts | 4 +- .../src/account/purviewAccount.ts | 7 +- .../src/account/responses.ts | 4 +- .../purview-administration-rest/src/index.ts | 4 +- .../src/metadataPolicies/clientDefinitions.ts | 6 +- .../src/metadataPolicies/isUnexpected.ts | 2 +- .../src/metadataPolicies/paginateHelper.ts | 7 +- .../src/metadataPolicies/parameters.ts | 4 +- .../purviewMetadataPolicies.ts | 7 +- .../src/metadataPolicies/responses.ts | 6 +- .../src/clientDefinitions.ts | 6 +- .../src/isUnexpected.ts | 2 +- .../src/paginateHelper.ts | 7 +- .../synapse-artifacts-rest/src/parameters.ts | 6 +- .../src/pollingHelper.ts | 8 +- .../synapse-artifacts-rest/src/responses.ts | 6 +- .../src/synapseArtifacts.ts | 7 +- .../test/unit/utils/nameConstructors.spec.ts | 47 ++++++ .../rlc-initial/src/clientDefinitions.ts | 6 +- .../generated/rlc-initial/src/dPGClient.ts | 64 ++++++++ .../generated/rlc-initial/src/dpgClient.ts | 5 +- .../generated/rlc-initial/src/index.ts | 4 +- .../generated/rlc-initial/src/parameters.ts | 4 +- .../generated/rlc-initial/src/responses.ts | 2 +- .../rlc-updated/src/clientDefinitions.ts | 6 +- .../generated/rlc-updated/src/dPGClient.ts | 70 +++++++++ .../generated/rlc-updated/src/dpgClient.ts | 5 +- .../generated/rlc-updated/src/index.ts | 4 +- .../generated/rlc-updated/src/parameters.ts | 4 +- .../generated/rlc-updated/src/responses.ts | 2 +- .../authentication/api-key/src/index.d.ts | 12 +- .../authentication/api-key/tspconfig.yaml | 4 +- .../authentication/http/custom/src/index.d.ts | 12 +- .../authentication/http/custom/tspconfig.yaml | 4 +- .../authentication/oauth2/src/index.d.ts | 12 +- .../authentication/oauth2/tspconfig.yaml | 4 +- .../authentication/union/src/index.d.ts | 14 +- .../authentication/union/tspconfig.yaml | 4 +- .../generated/encode/bytes/src/index.d.ts | 144 +++++++++--------- .../generated/encode/bytes/tspconfig.yaml | 5 +- .../generated/encode/datetime/src/index.d.ts | 14 +- .../generated/encode/datetime/tspconfig.yaml | 5 +- .../generated/encode/duration/src/index.d.ts | 12 +- .../generated/encode/duration/tspconfig.yaml | 4 +- .../generated/encode/numeric/src/index.d.ts | 10 +- .../generated/encode/numeric/tspconfig.yaml | 4 +- .../generated/parameters/basic/src/index.d.ts | 10 +- .../generated/parameters/basic/tspconfig.yaml | 4 +- .../body-optionality/src/index.d.ts | 10 +- .../body-optionality/tspconfig.yaml | 4 +- .../collection-format/src/index.d.ts | 12 +- .../collection-format/tspconfig.yaml | 4 +- .../parameters/spread/src/index.d.ts | 12 +- .../parameters/spread/tspconfig.yaml | 4 +- .../content-negotiation/src/index.d.ts | 14 +- .../content-negotiation/tspconfig.yaml | 4 +- .../payload/media-type/src/index.d.ts | 12 +- .../payload/media-type/tspconfig.yaml | 4 +- .../payload/multipart/src/index.d.ts | 10 +- .../payload/multipart/tspconfig.yaml | 4 +- .../generated/routes/src/index.d.ts | 10 +- .../generated/routes/tspconfig.yaml | 4 +- .../encoded-name/json/src/index.d.ts | 10 +- .../encoded-name/json/tspconfig.yaml | 4 +- .../endpoint/not-defined/src/index.d.ts | 10 +- .../endpoint/not-defined/tspconfig.yaml | 4 +- .../server/path/multiple/src/index.d.ts | 10 +- .../server/path/multiple/tspconfig.yaml | 4 +- .../server/path/single/src/index.d.ts | 10 +- .../server/path/single/tspconfig.yaml | 4 +- .../versions/not-versioned/src/index.d.ts | 10 +- .../versions/not-versioned/tspconfig.yaml | 4 +- .../server/versions/versioned/src/index.d.ts | 10 +- .../server/versions/versioned/tspconfig.yaml | 4 +- .../generated/shared-route/src/index.d.ts | 16 +- .../generated/shared-route/tspconfig.yaml | 4 +- .../repeatability/src/index.d.ts | 14 +- .../repeatability/tspconfig.yaml | 4 +- .../generated/special-words/src/index.d.ts | 10 +- .../generated/special-words/tspconfig.yaml | 3 +- .../generated/type/array/src/index.d.ts | 10 +- .../generated/type/array/tspconfig.yaml | 4 +- .../generated/type/dictionary/src/index.d.ts | 10 +- .../generated/type/dictionary/tspconfig.yaml | 4 +- .../type/enum/extensible/src/index.d.ts | 10 +- .../type/enum/extensible/tspconfig.yaml | 4 +- .../generated/type/enum/fixed/src/index.d.ts | 10 +- .../generated/type/enum/fixed/tspconfig.yaml | 4 +- .../generated/type/model/empty/src/index.d.ts | 10 +- .../generated/type/model/empty/tspconfig.yaml | 4 +- .../enum-discriminator/src/index.d.ts | 10 +- .../enum-discriminator/tspconfig.yaml | 4 +- .../nested-discriminator/src/index.d.ts | 10 +- .../nested-discriminator/tspconfig.yaml | 4 +- .../not-discriminated/src/index.d.ts | 10 +- .../not-discriminated/tspconfig.yaml | 4 +- .../inheritance/recursive/src/index.d.ts | 10 +- .../inheritance/recursive/tspconfig.yaml | 4 +- .../single-discriminator/src/index.d.ts | 10 +- .../single-discriminator/tspconfig.yaml | 4 +- .../generated/type/model/usage/src/index.d.ts | 10 +- .../generated/type/model/usage/tspconfig.yaml | 4 +- .../type/model/visibility/src/index.d.ts | 10 +- .../type/model/visibility/tspconfig.yaml | 4 +- .../type/property/nullable/src/index.d.ts | 10 +- .../type/property/nullable/tspconfig.yaml | 4 +- .../type/property/optionality/src/index.d.ts | 10 +- .../type/property/optionality/tspconfig.yaml | 4 +- .../type/property/value-types/src/index.d.ts | 10 +- .../type/property/value-types/tspconfig.yaml | 3 +- .../generated/type/scalar/src/index.d.ts | 10 +- .../generated/type/scalar/tspconfig.yaml | 4 +- .../generated/type/union/src/index.d.ts | 26 ++-- .../generated/type/union/tspconfig.yaml | 4 +- .../generated/union-body/src/index.d.ts | 10 +- .../generated/union-body/tspconfig.yaml | 4 +- .../generated/versioning/added/src/index.d.ts | 12 +- .../generated/versioning/added/tspconfig.yaml | 4 +- .../versioning/madeOptional/src/index.d.ts | 10 +- .../versioning/madeOptional/tspconfig.yaml | 4 +- .../versioning/renamedFrom/src/index.d.ts | 10 +- .../versioning/renamedFrom/tspconfig.yaml | 4 +- .../returnTypeChangedFrom/src/index.d.ts | 10 +- .../returnTypeChangedFrom/tspconfig.yaml | 4 +- .../versioning/typeChangedFrom/src/index.d.ts | 10 +- .../versioning/typeChangedFrom/tspconfig.yaml | 4 +- .../authentication/api-key/src/index.d.ts | 8 +- .../authentication/api-key/tspconfig.yaml | 4 +- .../authentication/http/custom/src/index.d.ts | 8 +- .../authentication/http/custom/tspconfig.yaml | 4 +- .../authentication/oauth2/src/index.d.ts | 8 +- .../authentication/oauth2/tspconfig.yaml | 4 +- .../authentication/union/src/index.d.ts | 10 +- .../authentication/union/tspconfig.yaml | 5 +- .../generated/encode/bytes/src/index.d.ts | 14 +- .../generated/encode/bytes/tspconfig.yaml | 4 +- .../generated/encode/datetime/src/index.d.ts | 6 +- .../generated/encode/datetime/tspconfig.yaml | 4 +- .../generated/encode/duration/src/index.d.ts | 6 +- .../generated/encode/duration/tspconfig.yaml | 4 +- .../generated/encode/numeric/src/index.d.ts | 6 +- .../generated/encode/numeric/tspconfig.yaml | 4 +- .../generated/parameters/basic/src/index.d.ts | 6 +- .../generated/parameters/basic/tspconfig.yaml | 4 +- .../body-optionality/src/index.d.ts | 6 +- .../body-optionality/tspconfig.yaml | 4 +- .../collection-format/src/index.d.ts | 6 +- .../collection-format/tspconfig.yaml | 4 +- .../parameters/spread/src/index.d.ts | 6 +- .../parameters/spread/tspconfig.yaml | 4 +- .../content-negotiation/src/index.d.ts | 6 +- .../content-negotiation/tspconfig.yaml | 4 +- .../payload/media-type/src/index.d.ts | 6 +- .../payload/media-type/tspconfig.yaml | 4 +- .../encoded-name/json/src/index.d.ts | 6 +- .../encoded-name/json/tspconfig.yaml | 4 +- .../endpoint/not-defined/src/index.d.ts | 6 +- .../endpoint/not-defined/tspconfig.yaml | 4 +- .../server/path/multiple/src/index.d.ts | 6 +- .../server/path/multiple/tspconfig.yaml | 4 +- .../server/path/single/src/index.d.ts | 6 +- .../server/path/single/tspconfig.yaml | 4 +- .../versions/not-versioned/src/index.d.ts | 6 +- .../versions/not-versioned/tspconfig.yaml | 4 +- .../server/versions/versioned/src/index.d.ts | 10 +- .../server/versions/versioned/tspconfig.yaml | 4 +- .../repeatability/src/index.d.ts | 6 +- .../repeatability/tspconfig.yaml | 4 +- .../generated/special-words/src/index.d.ts | 6 +- .../generated/special-words/tspconfig.yaml | 4 +- .../generated/type/array/src/index.d.ts | 6 +- .../generated/type/array/tspconfig.yaml | 4 +- .../generated/type/dictionary/src/index.d.ts | 6 +- .../generated/type/dictionary/tspconfig.yaml | 4 +- .../type/enum/extensible/src/index.d.ts | 6 +- .../type/enum/extensible/tspconfig.yaml | 4 +- .../generated/type/enum/fixed/src/index.d.ts | 6 +- .../generated/type/enum/fixed/tspconfig.yaml | 4 +- .../generated/type/model/empty/src/index.d.ts | 6 +- .../generated/type/model/empty/tspconfig.yaml | 4 +- .../enum-discriminator/src/index.d.ts | 6 +- .../enum-discriminator/tspconfig.yaml | 4 +- .../nested-discriminator/src/index.d.ts | 6 +- .../nested-discriminator/tspconfig.yaml | 4 +- .../not-discriminated/src/index.d.ts | 6 +- .../not-discriminated/tspconfig.yaml | 4 +- .../inheritance/recursive/src/index.d.ts | 6 +- .../inheritance/recursive/tspconfig.yaml | 4 +- .../single-discriminator/src/index.d.ts | 6 +- .../single-discriminator/tspconfig.yaml | 4 +- .../generated/type/model/usage/src/index.d.ts | 6 +- .../generated/type/model/usage/tspconfig.yaml | 4 +- .../type/property/nullable/src/index.d.ts | 6 +- .../type/property/nullable/tspconfig.yaml | 4 +- .../type/property/optionality/src/index.d.ts | 6 +- .../type/property/optionality/tspconfig.yaml | 4 +- .../type/property/value-types/src/index.d.ts | 6 +- .../type/property/value-types/tspconfig.yaml | 4 +- .../generated/type/scalar/src/index.d.ts | 6 +- .../generated/type/scalar/tspconfig.yaml | 4 +- .../generated/type/union/src/index.d.ts | 8 +- .../generated/type/union/tspconfig.yaml | 4 +- .../generated/versioning/added/src/index.d.ts | 6 +- .../generated/versioning/added/tspconfig.yaml | 4 +- .../versioning/madeOptional/src/index.d.ts | 6 +- .../versioning/madeOptional/tspconfig.yaml | 4 +- .../versioning/removed/src/index.d.ts | 6 +- .../versioning/removed/tspconfig.yaml | 4 +- .../versioning/renamedFrom/src/index.d.ts | 6 +- .../versioning/renamedFrom/tspconfig.yaml | 4 +- .../returnTypeChangedFrom/src/index.d.ts | 6 +- .../returnTypeChangedFrom/tspconfig.yaml | 4 +- .../versioning/typeChangedFrom/src/index.d.ts | 6 +- .../versioning/typeChangedFrom/tspconfig.yaml | 4 +- 331 files changed, 1268 insertions(+), 1189 deletions(-) create mode 100644 packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dPGCustomizationClient.ts create mode 100644 packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lRORestClient.ts create mode 100644 packages/autorest.typescript/test/unit/utils/nameConstructors.spec.ts create mode 100644 packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts create mode 100644 packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dPGClient.ts diff --git a/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts b/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts index dd417bff60..2c91864cd5 100644 --- a/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts +++ b/packages/autorest.typescript/test/integration/generated/corecompattest/src/models/index.ts @@ -71,40 +71,6 @@ export enum KnownPetStatus { Pending = "pending", /** Sold */ Sold = "sold", - /** PascalCase1 */ - PascalCase1 = "pascalCase1", - /** PascalCase2 */ - PascalCase2 = "PascalCase2", - /** Pascalcase3 */ - Pascalcase3 = "pascalcase3", - /** Pascalcase4 */ - Pascalcase4 = "Pascalcase4", - /** PascalCase5 */ - PascalCase5 = "pascal_case_5", - /** PascalCase6 */ - PascalCase6 = "pascal_case6", - /** PascalCase7 */ - PascalCase7 = "_pascal_case7", - /** PascalCase8 */ - PascalCase8 = "pascal, case8", - /** MAXOfMLD */ - MAXOfMLD = "MAX_of_MLD", - /** YESORNO */ - YESORNO = "YES OR NO", - /** FailedNOTValidation */ - FailedNOTValidation = "FAILED_NOT_VALIDATION", - /** ValidationSuccess */ - ValidationSuccess = "VALIDATION_SUCCESS", - /** PascalCase6666 */ - PascalCase6666 = "___pascal____case6666", - /** Ninety */ - Ninety = "090", - /** One0 */ - One0 = "1.0", - /** Select */ - Select = "$select", - /** HateThreating */ - HateThreating = "hate/threating", } /** @@ -114,24 +80,7 @@ export enum KnownPetStatus { * ### Known values supported by the service * **available** \ * **pending** \ - * **sold** \ - * **pascalCase1** \ - * **PascalCase2** \ - * **pascalcase3** \ - * **Pascalcase4** \ - * **pascal_case_5** \ - * **pascal_case6** \ - * **_pascal_case7** \ - * **pascal, case8** \ - * **MAX_of_MLD** \ - * **YES OR NO** \ - * **FAILED_NOT_VALIDATION** \ - * **VALIDATION_SUCCESS** \ - * **___pascal____case6666** \ - * **090** \ - * **1.0** \ - * **$select** \ - * **hate\/threating** + * **sold** */ export type PetStatus = string; diff --git a/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts b/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts index a29d865e2a..accaaae99e 100644 --- a/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts +++ b/packages/autorest.typescript/test/integration/generated/petstore/src/models/index.ts @@ -70,40 +70,6 @@ export enum KnownPetStatus { Pending = "pending", /** Sold */ Sold = "sold", - /** PascalCase1 */ - PascalCase1 = "pascalCase1", - /** PascalCase2 */ - PascalCase2 = "PascalCase2", - /** Pascalcase3 */ - Pascalcase3 = "pascalcase3", - /** Pascalcase4 */ - Pascalcase4 = "Pascalcase4", - /** PascalCase5 */ - PascalCase5 = "pascal_case_5", - /** PascalCase6 */ - PascalCase6 = "pascal_case6", - /** PascalCase7 */ - PascalCase7 = "_pascal_case7", - /** PascalCase8 */ - PascalCase8 = "pascal, case8", - /** MAXOfMLD */ - MAXOfMLD = "MAX_of_MLD", - /** YESORNO */ - YESORNO = "YES OR NO", - /** FailedNOTValidation */ - FailedNOTValidation = "FAILED_NOT_VALIDATION", - /** ValidationSuccess */ - ValidationSuccess = "VALIDATION_SUCCESS", - /** PascalCase6666 */ - PascalCase6666 = "___pascal____case6666", - /** Ninety */ - Ninety = "090", - /** One0 */ - One0 = "1.0", - /** Select */ - Select = "$select", - /** HateThreating */ - HateThreating = "hate/threating", } /** @@ -113,24 +79,7 @@ export enum KnownPetStatus { * ### Known values supported by the service * **available** \ * **pending** \ - * **sold** \ - * **pascalCase1** \ - * **PascalCase2** \ - * **pascalcase3** \ - * **Pascalcase4** \ - * **pascal_case_5** \ - * **pascal_case6** \ - * **_pascal_case7** \ - * **pascal, case8** \ - * **MAX_of_MLD** \ - * **YES OR NO** \ - * **FAILED_NOT_VALIDATION** \ - * **VALIDATION_SUCCESS** \ - * **___pascal____case6666** \ - * **090** \ - * **1.0** \ - * **$select** \ - * **hate\/threating** + * **sold** */ export type PetStatus = string; diff --git a/packages/autorest.typescript/test/integration/swaggers/petstore.json b/packages/autorest.typescript/test/integration/swaggers/petstore.json index 71f828c9a1..9e2d3223b6 100644 --- a/packages/autorest.typescript/test/integration/swaggers/petstore.json +++ b/packages/autorest.typescript/test/integration/swaggers/petstore.json @@ -884,28 +884,7 @@ "status": { "type": "string", "description": "pet status in the store", - "enum": [ - "available", - "pending", - "sold", - "pascalCase1", - "PascalCase2", - "pascalcase3", - "Pascalcase4", - "pascal_case_5", - "pascal_case6", - "_pascal_case7", - "pascal, case8", - "MAX_of_MLD", - "YES OR NO", - "FAILED_NOT_VALIDATION", - "VALIDATION_SUCCESS", - "___pascal____case6666", - "090", - "1.0", - "$select", - "hate/threating" - ] + "enum": ["available", "pending", "sold"] }, "petRestrictionLevel": { "type": "string", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/bodyComplexRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/bodyComplexRestClient.ts index 6e7ad55457..f4995d37c5 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/bodyComplexRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/bodyComplexRestClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { BodyComplexRestClient } from "./clientDefinitions"; +import type { BodyComplexRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface BodyComplexRestClientOptions extends ClientOptions { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts index 93b1ac5e2b..2bb28fac80 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { BasicGetValidParameters, BasicPutValidParameters, BasicGetInvalidParameters, @@ -58,7 +58,7 @@ import { ReadonlypropertyPutValidParameters, FlattencomplexGetValidParameters, } from "./parameters"; -import { +import type { BasicGetValid200Response, BasicGetValidDefaultResponse, BasicPutValid200Response, @@ -169,7 +169,7 @@ import { ReadonlypropertyPutValidDefaultResponse, FlattencomplexGetValid200Response, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface BasicGetValid { /** Get complex type {id: 2, name: 'abc', color: 'YELLOW'} */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/isUnexpected.ts index 1a16d19e53..4e9f6447a3 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { BasicGetValid200Response, BasicGetValidDefaultResponse, BasicPutValid200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts index 85dc564c3a..1675e50e79 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { +import type { RequestParameters } from "@azure-rest/core-client"; +import type { BasicDef, IntWrapper, LongWrapper, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts index e825007a74..8dc3b8acbc 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { HttpResponse } from "@azure-rest/core-client"; +import type { BasicDefOutput, ErrorModelOutput, IntWrapperOutput, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/bodyFile.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/bodyFile.ts index 8fedbe8eec..3c68bb29e8 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/bodyFile.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/bodyFile.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { BodyFileClient } from "./clientDefinitions"; +import type { BodyFileClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface BodyFileClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/clientDefinitions.ts index 24ece0917a..0472662379 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/clientDefinitions.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { FilesGetFileParameters, FilesGetFileLargeParameters, FilesGetEmptyFileParameters, } from "./parameters"; -import { +import type { FilesGetFile200Response, FilesGetFileDefaultResponse, FilesGetFileLarge200Response, @@ -14,7 +14,7 @@ import { FilesGetEmptyFile200Response, FilesGetEmptyFileDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface GetFile { /** Get file */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/isUnexpected.ts index 4a26399ec8..74d30b7bc9 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { FilesGetFile200Response, FilesGetFileDefaultResponse, FilesGetFileLarge200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/parameters.ts index 83a9d18914..8bda42b057 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/parameters.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; +import type { RequestParameters } from "@azure-rest/core-client"; export type FilesGetFileParameters = RequestParameters; export type FilesGetFileLargeParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/responses.ts index f909a2a610..87cd695fe9 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { ErrorModelOutput } from "./outputModels"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ErrorModelOutput } from "./outputModels"; /** Get file */ export interface FilesGetFile200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/bodyFormData.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/bodyFormData.ts index 608bf16233..5f38199b7e 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/bodyFormData.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/bodyFormData.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { BodyFormDataClient } from "./clientDefinitions"; +import type { BodyFormDataClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface BodyFormDataClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/clientDefinitions.ts index e210482a53..85fad206c7 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/clientDefinitions.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { FormdataUploadFileParameters, FormdataUploadFileViaBodyParameters, FormdataUploadFilesParameters, } from "./parameters"; -import { +import type { FormdataUploadFile200Response, FormdataUploadFileDefaultResponse, FormdataUploadFileViaBody200Response, @@ -14,7 +14,7 @@ import { FormdataUploadFiles200Response, FormdataUploadFilesDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface UploadFile { /** Upload file */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/isUnexpected.ts index 10159686d7..4db8139776 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { FormdataUploadFile200Response, FormdataUploadFileDefaultResponse, FormdataUploadFileViaBody200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/parameters.ts index 3f86c3ac81..e6fd09aa83 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/parameters.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; +import type { RequestParameters } from "@azure-rest/core-client"; export interface FormdataUploadFileBodyParam { body: FormdataUploadFileFormBody; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/responses.ts index 5131e053c9..be520968b0 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { ErrorModelOutput } from "./outputModels"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ErrorModelOutput } from "./outputModels"; /** Upload file */ export interface FormdataUploadFile200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/bodyStringRest.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/bodyStringRest.ts index ef926ff828..99160b863b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/bodyStringRest.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/bodyStringRest.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { BodyStringRestClient } from "./clientDefinitions"; +import type { BodyStringRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface BodyStringRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts index a168f2c590..be13d5a946 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { StringGetNullParameters, StringPutNullParameters, StringGetEmptyParameters, @@ -22,7 +22,7 @@ import { EnumGetReferencedConstantParameters, EnumPutReferencedConstantParameters, } from "./parameters"; -import { +import type { StringGetNull200Response, StringGetNullDefaultResponse, StringPutNull200Response, @@ -62,7 +62,7 @@ import { EnumPutReferencedConstant200Response, EnumPutReferencedConstantDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface StringGetNull { /** Get null string value value */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/isUnexpected.ts index 2056abcbb8..697f9f75aa 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { StringGetNull200Response, StringGetNullDefaultResponse, StringPutNull200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts index bffaa32b09..eaaff7e138 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { RefColorConstant } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { RefColorConstant } from "./models"; export type StringGetNullParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts index 0d3376423a..8e43e4e7c1 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { ErrorModelOutput, RefColorConstantOutput } from "./outputModels"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ErrorModelOutput, RefColorConstantOutput } from "./outputModels"; /** Get null string value value */ export interface StringGetNull200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/clientDefinitions.ts index 9387c73df2..2cdcfdda7b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/clientDefinitions.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PathsGetEmptyParameters } from "./parameters"; -import { +import type { PathsGetEmptyParameters } from "./parameters"; +import type { PathsGetEmpty200Response, PathsGetEmptyDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Paths operations */ export interface PathsOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/customUrlRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/customUrlRestClient.ts index ce689f20b9..d53eae1578 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/customUrlRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/customUrlRestClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { CustomUrlRestClient } from "./clientDefinitions"; +import type { CustomUrlRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface CustomUrlRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/isUnexpected.ts index ee242599e6..71fd5717b1 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { PathsGetEmpty200Response, PathsGetEmptyDefaultResponse, } from "./responses"; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/parameters.ts index a06c8ea3d7..6384392844 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/parameters.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; +import type { RequestParameters } from "@azure-rest/core-client"; export interface PathsGetEmptyPathParameters { /** Account Name */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/responses.ts index 4a91fd3c63..a184d90a5b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { ErrorModelOutput } from "./outputModels"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ErrorModelOutput } from "./outputModels"; /** Get a 200 to test a valid base uri */ export interface PathsGetEmpty200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json index 18ca39885e..c55ea5fb4e 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json @@ -35,7 +35,7 @@ "prefix": "package-version" }, { - "path": "src/dpgCustomizationClient.ts", + "path": "src/dPGCustomizationClient.ts", "prefix": "userAgentInfo" } ] diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/clientDefinitions.ts index f25f05966c..86f6a1bd6f 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/clientDefinitions.ts @@ -1,19 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { GetModelParameters, PostModelParameters, GetPagesParameters, LroParameters, } from "./parameters"; -import { +import type { GetModel200Response, PostModel200Response, GetPages200Response, Lro200Response, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Client operations */ export interface ClientOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dPGCustomizationClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dPGCustomizationClient.ts new file mode 100644 index 0000000000..c1d04669f5 --- /dev/null +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dPGCustomizationClient.ts @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import type { DPGCustomizationClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface DPGCustomizationClientOptions extends ClientOptions {} + +/** + * Initialize a new instance of `DPGCustomizationClient` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: DPGCustomizationClientOptions = {}, +): DPGCustomizationClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-dpg-customization-rest/1.0.0-preview1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + const client = getClient(endpointUrl, options) as DPGCustomizationClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + + return { + ...client, + ...{ + getModel: (mode, options) => { + return client.path("/customization/model/{mode}", mode).get(options); + }, + postModel: (mode, options) => { + return client.path("/customization/model/{mode}", mode).post(options); + }, + getPages: (mode, options) => { + return client.path("/customization/paging/{mode}", mode).get(options); + }, + lro: (mode, options) => { + return client.path("/customization/lro/{mode}", mode).put(options); + }, + }, + }; +} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts index b9876033b9..c1d04669f5 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/dpgCustomizationClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { DPGCustomizationClient } from "./clientDefinitions"; +import type { DPGCustomizationClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface DPGCustomizationClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts index 86715b481d..aed4707bb0 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGCustomizationClient from "./dpgCustomizationClient"; +import DPGCustomizationClient from "./dPGCustomizationClient"; -export * from "./dpgCustomizationClient"; +export * from "./dPGCustomizationClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/paginateHelper.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/paginateHelper.ts index e06d305e58..92ec360741 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/paginateHelper.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/parameters.ts index 83e2fc7c3a..e1e0390f47 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { Input } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { Input } from "./models"; export type GetModelParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/pollingHelper.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/pollingHelper.ts index 131043e0b2..9c95257147 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/pollingHelper.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/pollingHelper.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, HttpResponse } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { +import type { Client, HttpResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { CancelOnProgress, CreateHttpPollerOptions, RunningOperation, OperationResponse, OperationState, - createHttpPoller, } from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/responses.ts index 1b27e95215..6fba28f0f5 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ProductOutput, ProductResultOutput, LROProductOutput, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/clientDefinitions.ts index 13d37f6183..1bd6751646 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { HeaderParamExistingKeyParameters, HeaderResponseExistingKeyParameters, HeaderParamProtectedKeyParameters, @@ -32,7 +32,7 @@ import { HeaderResponseEnumParameters, HeaderCustomRequestIdParameters, } from "./parameters"; -import { +import type { HeaderParamExistingKey200Response, HeaderParamExistingKeyDefaultResponse, HeaderResponseExistingKey200Response, @@ -92,7 +92,7 @@ import { HeaderCustomRequestId200Response, HeaderCustomRequestIdDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface ParamExistingKey { /** Send a post request with header value "User-Agent": "overwrite" */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/headerRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/headerRestClient.ts index 31007f0771..fe31f95465 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/headerRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/headerRestClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { HeaderRestClient } from "./clientDefinitions"; +import type { HeaderRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface HeaderRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/isUnexpected.ts index 79089af622..c365c06a82 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { HeaderParamExistingKey200Response, HeaderParamExistingKeyDefaultResponse, HeaderResponseExistingKey200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts index eb87b8d6bf..0acc64e7bd 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; -import { RequestParameters } from "@azure-rest/core-client"; +import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; +import type { RequestParameters } from "@azure-rest/core-client"; export interface HeaderParamExistingKeyHeaders { /** Send a post request with header value "User-Agent": "overwrite" */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/responses.ts index f300465d89..59068971ed 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/src/responses.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { ErrorModelOutput } from "./outputModels"; +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ErrorModelOutput } from "./outputModels"; /** Send a post request with header value "User-Agent": "overwrite" */ export interface HeaderParamExistingKey200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/clientDefinitions.ts index 255e51d740..bb9ce7f52e 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { HttpFailureGetEmptyErrorParameters, HttpFailureGetNoModelErrorParameters, HttpFailureGetNoModelEmptyParameters, @@ -114,7 +114,7 @@ import { MultipleResponsesGet200ModelA400InvalidParameters, MultipleResponsesGet200ModelA202ValidParameters, } from "./parameters"; -import { +import type { HttpFailureGetEmptyError200Response, HttpFailureGetEmptyErrorDefaultResponse, HttpFailureGetNoModelError200Response, @@ -333,7 +333,7 @@ import { MultipleResponsesGet200ModelA400Invalid200Response, MultipleResponsesGet200ModelA202Valid200Response, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for HttpFailure operations */ export interface HttpFailureOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/httpInfrastructureRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/httpInfrastructureRestClient.ts index b5da8d664c..fce8b8aaa7 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/httpInfrastructureRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/httpInfrastructureRestClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { HttpInfrastructureRestClient } from "./clientDefinitions"; +import type { HttpInfrastructureRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface HttpInfrastructureRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/isUnexpected.ts index cd26bdaac4..0817228608 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { HttpFailureGetEmptyError200Response, HttpFailureGetEmptyErrorDefaultResponse, HttpSuccessHead200200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts index 61c4ddfe1a..c71e2bed44 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/parameters.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; +import type { RequestParameters } from "@azure-rest/core-client"; export type HttpFailureGetEmptyErrorParameters = RequestParameters; export type HttpFailureGetNoModelErrorParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/responses.ts index c4b4fd7b72..351d6a41e2 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/src/responses.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ErrorModelOutput, MyExceptionOutput, BOutput, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/clientDefinitions.ts index 9a14db8a5a..4cf069c088 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { LROsPut200SucceededParameters, LROsPatch200SucceededIgnoreHeadersParameters, LROsPatch201RetryWithAsyncHeaderParameters, @@ -84,7 +84,7 @@ import { LROsCustomHeaderPost202Retry200Parameters, LROsCustomHeaderPostAsyncRetrySucceededParameters, } from "./parameters"; -import { +import type { LROsPut200Succeeded200Response, LROsPut200Succeeded204Response, LROsPut200SucceededDefaultResponse, @@ -272,7 +272,7 @@ import { LROsCustomHeaderPostAsyncRetrySucceeded202Response, LROsCustomHeaderPostAsyncRetrySucceededDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface LROsPut200Succeeded { /** Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts index e330dc9c21..fd135e7119 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import LRORestClient from "./lroRestClient"; +import LRORestClient from "./lRORestClient"; -export * from "./lroRestClient"; +export * from "./lRORestClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/isUnexpected.ts index e5fef4fceb..28c8a36fa5 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { LROsPut200Succeeded200Response, LROsPut200Succeeded204Response, LROsPut200SucceededDefaultResponse, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lRORestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lRORestClient.ts new file mode 100644 index 0000000000..b2f551513e --- /dev/null +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lRORestClient.ts @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import type { LRORestClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface LRORestClientOptions extends ClientOptions {} + +/** + * Initialize a new instance of `LRORestClient` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: LRORestClientOptions = {}, +): LRORestClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-lro-rest/1.0.0-preview1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + const client = getClient(endpointUrl, options) as LRORestClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + + return client; +} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts index e23cf52862..b2f551513e 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/lroRestClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { LRORestClient } from "./clientDefinitions"; +import type { LRORestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface LRORestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts index ed1b92edce..65395a6114 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { Product, Sku, SubProduct } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { Product, Sku, SubProduct } from "./models"; export interface LROsPut200SucceededBodyParam { /** Product to put */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/pollingHelper.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/pollingHelper.ts index 131043e0b2..9c95257147 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/pollingHelper.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/pollingHelper.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, HttpResponse } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { +import type { Client, HttpResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { CancelOnProgress, CreateHttpPollerOptions, RunningOperation, OperationResponse, OperationState, - createHttpPoller, } from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts index c4ab58dab2..395dfd4d92 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/src/responses.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ProductOutput, CloudErrorOutput, SkuOutput, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/clientDefinitions.ts index c545a615d4..d50d2050f6 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { AnalyzeBodyParameters, AnalyzeBodyNoAcceptHeaderParameters, ContentTypeWithEncodingParameters, @@ -10,7 +10,7 @@ import { BodyThreeTypesParameters, PutTextAndJsonBodyParameters, } from "./parameters"; -import { +import type { AnalyzeBody200Response, AnalyzeBodyNoAcceptHeader202Response, AnalyzeBodyNoAcceptHeaderDefaultResponse, @@ -20,7 +20,7 @@ import { BodyThreeTypes200Response, PutTextAndJsonBody200Response, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface AnalyzeBody { /** Analyze body, that could be different media types. */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/isUnexpected.ts index bc62426fa8..be2ebba638 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { AnalyzeBodyNoAcceptHeader202Response, AnalyzeBodyNoAcceptHeaderDefaultResponse, } from "./responses"; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/mediaTypes.ts b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/mediaTypes.ts index 6fa63618dc..84a754b9ab 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/mediaTypes.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/mediaTypes.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { MediaTypesClient } from "./clientDefinitions"; +import type { MediaTypesClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface MediaTypesClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/parameters.ts index fa1b6ac09b..c499012695 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { SourcePath } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { SourcePath } from "./models"; export interface AnalyzeBodyBodyParam { /** diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/responses.ts index 64c023c965..d3728ce520 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/src/responses.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; +import type { HttpResponse } from "@azure-rest/core-client"; /** Analyze body, that could be different media types. */ export interface AnalyzeBody200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/clientDefinitions.ts index a57e01b712..d630debdbc 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { GetHorseParameters, PutHorseParameters, GetPetParameters, @@ -13,7 +13,7 @@ import { GetKittenParameters, PutKittenParameters, } from "./parameters"; -import { +import type { GetHorse200Response, GetHorseDefaultResponse, PutHorse200Response, @@ -30,7 +30,7 @@ import { GetKittenDefaultResponse, PutKitten200Response, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Client operations */ export interface ClientOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/isUnexpected.ts index 53211c0669..03bd236486 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { GetHorse200Response, GetHorseDefaultResponse, GetPet200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/multipleInheritanceRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/multipleInheritanceRestClient.ts index e11d3b2657..ecfe498453 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/multipleInheritanceRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/multipleInheritanceRestClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { MultipleInheritanceRestClient } from "./clientDefinitions"; +import type { MultipleInheritanceRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface MultipleInheritanceRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/parameters.ts index 152e374f76..af00f25f31 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { Horse, Pet, Feline, Cat, Kitten } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { Horse, Pet, Feline, Cat, Kitten } from "./models"; export type GetHorseParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/responses.ts index 490166095a..c503506a78 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { HttpResponse } from "@azure-rest/core-client"; +import type { HorseOutput, ErrorModelOutput, PetOutput, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/clientDefinitions.ts index 136cee34f1..a06fbecf24 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { EntityCreateOrUpdateParameters, EntityListByGuidsParameters, EntityCreateOrUpdateEntitiesParameters, @@ -12,7 +12,7 @@ import { EntityDeleteByGuidParameters, EntityExportGuidParameters, } from "./parameters"; -import { +import type { EntityCreateOrUpdate200Response, EntityCreateOrUpdateDefaultResponse, EntityListByGuids200Response, @@ -32,7 +32,7 @@ import { EntityExportGuid202Response, EntityExportGuidDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Entity operations */ export interface EntityOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/isUnexpected.ts index f8562c36a7..8ceb7d7cb6 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { EntityCreateOrUpdate200Response, EntityCreateOrUpdateDefaultResponse, EntityListByGuids200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/multipleUrlParameterRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/multipleUrlParameterRestClient.ts index c2c051880f..5d09ef9577 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/multipleUrlParameterRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/multipleUrlParameterRestClient.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { TokenCredential } from "@azure/core-auth"; -import { MultipleUrlParameterRestClient } from "./clientDefinitions"; +import type { TokenCredential } from "@azure/core-auth"; +import type { MultipleUrlParameterRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface MultipleUrlParameterRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/parameters.ts index 364a6189dd..8fa131a3c9 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { +import type { RequestParameters } from "@azure-rest/core-client"; +import type { AtlasEntityWithExtInfo, AtlasEntitiesWithExtInfo, ClassificationAssociateRequest, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/responses.ts index bf84a6024a..b9e8ae8bfa 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { HttpResponse } from "@azure-rest/core-client"; +import type { EntityMutationResponseOutput, ErrorResponseOutput, AtlasEntitiesWithExtInfoOutput, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/clientDefinitions.ts index e242258cfe..9f6535cb9a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { PagingGetNoItemNamePagesParameters, PagingGetEmptyNextLinkNamePagesParameters, PagingGetNullNextLinkNamePagesParameters, @@ -29,7 +29,7 @@ import { PagingNextFragmentWithGroupingParameters, PagingGetPagingModelWithItemNameWithXMSClientNameParameters, } from "./parameters"; -import { +import type { PagingGetNoItemNamePages200Response, PagingGetNoItemNamePagesDefaultResponse, PagingGetEmptyNextLinkNamePages200Response, @@ -83,7 +83,7 @@ import { PagingGetPagingModelWithItemNameWithXMSClientName200Response, PagingGetPagingModelWithItemNameWithXMSClientNameDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface GetNoItemNamePages { /** A paging operation that must return result of the default 'value' node. */ diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/isUnexpected.ts index 62202e8ffe..430275da83 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { PagingGetNoItemNamePages200Response, PagingGetNoItemNamePagesDefaultResponse, PagingGetEmptyNextLinkNamePages200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paginateHelper.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paginateHelper.ts index 0660b2ef8d..8f394a160b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paginateHelper.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paging.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paging.ts index 3f46abee42..9798e43376 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paging.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/paging.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { PagingClient } from "./clientDefinitions"; +import type { PagingClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface PagingClientOptions extends ClientOptions { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts index acc58555bc..d800a891b5 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/parameters.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; -import { RequestParameters } from "@azure-rest/core-client"; -import { BodyParam } from "./models"; +import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { BodyParam } from "./models"; export type PagingGetNoItemNamePagesParameters = RequestParameters; export type PagingGetEmptyNextLinkNamePagesParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/pollingHelper.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/pollingHelper.ts index 131043e0b2..9c95257147 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/pollingHelper.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/pollingHelper.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, HttpResponse } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { +import type { Client, HttpResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { CancelOnProgress, CreateHttpPollerOptions, RunningOperation, OperationResponse, OperationState, - createHttpPoller, } from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts index 0e5ee7a131..145755a4ac 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ProductResultValueOutput, ProductResultOutput, OdataProductResultOutput, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/clientDefinitions.ts index bf61916a2c..2431c524cd 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/clientDefinitions.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HeadParameters } from "./parameters"; -import { Head200Response } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { HeadParameters } from "./parameters"; +import type { Head200Response } from "./responses"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Client operations */ export interface ClientOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/parameters.ts index fb8696147d..9c66a4301b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/parameters.ts @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; +import type { RequestParameters } from "@azure-rest/core-client"; export type HeadParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/responses.ts index ef04eb4392..f353c6aab9 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/responses.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; +import type { HttpResponse } from "@azure-rest/core-client"; /** Operation */ export interface Head200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/securityAADRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/securityAADRestClient.ts index 4b381a5ae0..5e3f793b53 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/securityAADRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/src/securityAADRestClient.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { TokenCredential } from "@azure/core-auth"; -import { SecurityAADRestClient } from "./clientDefinitions"; +import type { TokenCredential } from "@azure/core-auth"; +import type { SecurityAADRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface SecurityAADRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/clientDefinitions.ts index e359ba8ed2..e2769a50ee 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/clientDefinitions.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HeadParameters } from "./parameters"; -import { Head200Response } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { HeadParameters } from "./parameters"; +import type { Head200Response } from "./responses"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Client operations */ export interface ClientOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/parameters.ts index fb8696147d..9c66a4301b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/parameters.ts @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; +import type { RequestParameters } from "@azure-rest/core-client"; export type HeadParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/responses.ts index ef04eb4392..f353c6aab9 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/responses.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; +import type { HttpResponse } from "@azure-rest/core-client"; /** Operation */ export interface Head200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/securityKeyRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/securityKeyRestClient.ts index 7bf8af68a4..14c76b0b10 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/securityKeyRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/src/securityKeyRestClient.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { KeyCredential } from "@azure/core-auth"; -import { SecurityKeyRestClient } from "./clientDefinitions"; +import type { KeyCredential } from "@azure/core-auth"; +import type { SecurityKeyRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface SecurityKeyRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts index 90de748e6f..ea18aadf74 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { PathsGetBooleanTrueParameters, PathsGetBooleanFalseParameters, PathsGetIntOneMillionParameters, @@ -69,7 +69,7 @@ import { PathItemsGetGlobalAndLocalQueryNullParameters, PathItemsGetLocalPathItemQueryNullParameters, } from "./parameters"; -import { +import type { PathsGetBooleanTrue200Response, PathsGetBooleanTrueDefaultResponse, PathsGetBooleanFalse200Response, @@ -203,7 +203,7 @@ import { PathItemsGetLocalPathItemQueryNull200Response, PathItemsGetLocalPathItemQueryNullDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Paths operations */ export interface PathsOperations { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/isUnexpected.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/isUnexpected.ts index 9d1d510023..e54df934f6 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { PathsGetBooleanTrue200Response, PathsGetBooleanTrueDefaultResponse, PathsGetBooleanFalse200Response, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts index 0a4f94a1ed..99d2722e80 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/parameters.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; +import type { RequestParameters } from "@azure-rest/core-client"; export type PathsGetBooleanTrueParameters = RequestParameters; export type PathsGetBooleanFalseParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts index cc4be8315b..39fd54e22a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { ErrorModelOutput } from "./outputModels"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ErrorModelOutput } from "./outputModels"; /** Get true Boolean value on path */ export interface PathsGetBooleanTrue200Response extends HttpResponse { diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts index f375654b51..804722edd8 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/src/urlRestClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { UrlRestClient } from "./clientDefinitions"; +import type { UrlRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface UrlRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/review/agrifood-data-plane.api.md b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/review/agrifood-data-plane.api.md index 57ac4b3b38..f172af82d7 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/review/agrifood-data-plane.api.md +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/review/agrifood-data-plane.api.md @@ -4,17 +4,17 @@ ```ts -import { AbortSignalLike } from '@azure/abort-controller'; -import { CancelOnProgress } from '@azure/core-lro'; -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { CreateHttpPollerOptions } from '@azure/core-lro'; -import { HttpResponse } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationState } from '@azure/core-lro'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { CancelOnProgress } from '@azure/core-lro'; +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { CreateHttpPollerOptions } from '@azure/core-lro'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { OperationState } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; // @public export interface ApplicationData { diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/azureAgriFoodPlatformDataPlaneService.ts b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/azureAgriFoodPlatformDataPlaneService.ts index 40f8a0aa2e..0c96badd86 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/azureAgriFoodPlatformDataPlaneService.ts +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/azureAgriFoodPlatformDataPlaneService.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { KeyCredential } from "@azure/core-auth"; -import { AzureAgriFoodPlatformDataPlaneServiceClient } from "./clientDefinitions"; +import type { KeyCredential } from "@azure/core-auth"; +import type { AzureAgriFoodPlatformDataPlaneServiceClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface AzureAgriFoodPlatformDataPlaneServiceClientOptions diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/clientDefinitions.ts b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/clientDefinitions.ts index 0eebba92bb..84077f047d 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { ApplicationDataListByFarmerIdParameters, ApplicationDataListParameters, ApplicationDataGetParameters, @@ -99,7 +99,7 @@ import { WeatherGetDataDeleteJobDetailsParameters, WeatherCreateDataDeleteJobParameters, } from "./parameters"; -import { +import type { ApplicationDataListByFarmerId200Response, ApplicationDataListByFarmerIdDefaultResponse, ApplicationDataList200Response, @@ -306,7 +306,7 @@ import { WeatherCreateDataDeleteJob202Response, WeatherCreateDataDeleteJobDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface ApplicationDataListByFarmerId { /** Returns a paginated list of application data resources under a particular farm. */ diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/isUnexpected.ts b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/isUnexpected.ts index 6e64fc5231..a2e2b9f978 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { ApplicationDataListByFarmerId200Response, ApplicationDataListByFarmerIdDefaultResponse, ApplicationDataList200Response, diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/paginateHelper.ts b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/paginateHelper.ts index 5ef95e5ea0..70694e2c93 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/paginateHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/parameters.ts b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/parameters.ts index 6602f732e0..ec1fe0c642 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/parameters.ts +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { +import type { RequestParameters } from "@azure-rest/core-client"; +import type { ApplicationData, SearchBoundaryQuery, Boundary, diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/pollingHelper.ts b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/pollingHelper.ts index 131043e0b2..9c95257147 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/pollingHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/pollingHelper.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, HttpResponse } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { +import type { Client, HttpResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { CancelOnProgress, CreateHttpPollerOptions, RunningOperation, OperationResponse, OperationState, - createHttpPoller, } from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/responses.ts b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/responses.ts index 008253f300..07a954a986 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/responses.ts +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/src/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { HttpResponse } from "@azure-rest/core-client"; +import type { ApplicationDataListResponseOutput, ErrorResponseOutput, ApplicationDataOutput, diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/review/anomaly-detector-mv-rest.api.md b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/review/anomaly-detector-mv-rest.api.md index 7703e82142..d5360ed225 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/review/anomaly-detector-mv-rest.api.md +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/review/anomaly-detector-mv-rest.api.md @@ -4,14 +4,14 @@ ```ts -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; // @public export interface AlignPolicy { diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/anomalyDetectorMV.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/anomalyDetectorMV.ts index fe2bb17197..2a4193433a 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/anomalyDetectorMV.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/anomalyDetectorMV.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { KeyCredential } from "@azure/core-auth"; -import { AnomalyDetectorMVClient } from "./clientDefinitions"; +import type { KeyCredential } from "@azure/core-auth"; +import type { AnomalyDetectorMVClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface AnomalyDetectorMVClientOptions extends ClientOptions { diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/clientDefinitions.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/clientDefinitions.ts index bb5de536fb..0d65479164 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { GetMultivariateBatchDetectionResultParameters, CreateAndTrainMultivariateModelParameters, ListMultivariateModelsParameters, @@ -10,7 +10,7 @@ import { DetectMultivariateBatchAnomalyParameters, DetectMultivariateLastAnomalyParameters, } from "./parameters"; -import { +import type { GetMultivariateBatchDetectionResult200Response, GetMultivariateBatchDetectionResultDefaultResponse, CreateAndTrainMultivariateModel201Response, @@ -26,7 +26,7 @@ import { DetectMultivariateLastAnomaly200Response, DetectMultivariateLastAnomalyDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface GetMultivariateBatchDetectionResult { /** For asynchronous inference, get multivariate anomaly detection result based on resultId returned by the BatchDetectAnomaly api. */ diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/isUnexpected.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/isUnexpected.ts index 5b1a6c62e7..b5ead00d2a 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { GetMultivariateBatchDetectionResult200Response, GetMultivariateBatchDetectionResultDefaultResponse, CreateAndTrainMultivariateModel201Response, diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/paginateHelper.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/paginateHelper.ts index fb810388e0..f968faec40 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/paginateHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/parameters.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/parameters.ts index 0c62d6e7d2..1a8c4835d6 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/parameters.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/parameters.ts @@ -1,8 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { ModelInfo, DetectionRequest, LastDetectionRequest } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { + ModelInfo, + DetectionRequest, + LastDetectionRequest, +} from "./models"; export type GetMultivariateBatchDetectionResultParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/responses.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/responses.ts index 25e7edbadf..71bc4eb7cd 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/responses.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/src/responses.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { DetectionResultOutput, ErrorResponseOutput, ModelOutput, diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/review/anomaly-detector-rest.api.md b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/review/anomaly-detector-rest.api.md index a54636278a..29d57fb020 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/review/anomaly-detector-rest.api.md +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/review/anomaly-detector-rest.api.md @@ -4,18 +4,18 @@ ```ts -import { AbortSignalLike } from '@azure/abort-controller'; -import { CancelOnProgress } from '@azure/core-lro'; -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { CreateHttpPollerOptions } from '@azure/core-lro'; -import { HttpResponse } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationState } from '@azure/core-lro'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { CancelOnProgress } from '@azure/core-lro'; +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { CreateHttpPollerOptions } from '@azure/core-lro'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { OperationState } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; // @public export interface AlignPolicy { diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/anomalyDetectorRest.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/anomalyDetectorRest.ts index 935e986146..d0dd86f98c 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/anomalyDetectorRest.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/anomalyDetectorRest.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { KeyCredential } from "@azure/core-auth"; -import { AnomalyDetectorRestClient } from "./clientDefinitions"; +import type { KeyCredential } from "@azure/core-auth"; +import type { AnomalyDetectorRestClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface AnomalyDetectorRestClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/clientDefinitions.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/clientDefinitions.ts index 3b132903f6..b8c364fba8 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { DetectEntireSeriesParameters, DetectLastPointParameters, DetectChangePointParameters, @@ -13,7 +13,7 @@ import { BatchDetectAnomalyParameters, LastDetectAnomalyParameters, } from "./parameters"; -import { +import type { DetectEntireSeries200Response, DetectEntireSeriesDefaultResponse, DetectLastPoint200Response, @@ -35,7 +35,7 @@ import { LastDetectAnomaly200Response, LastDetectAnomalyDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface DetectEntireSeries { /** This operation generates a model with an entire series, each point is detected with the same model. With this method, points before and after a certain point are used to determine whether it is an anomaly. The entire detection can give user an overall status of the time series. */ diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/isUnexpected.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/isUnexpected.ts index c815c73953..2db420526b 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { DetectEntireSeries200Response, DetectEntireSeriesDefaultResponse, DetectLastPoint200Response, diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/paginateHelper.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/paginateHelper.ts index fb810388e0..f968faec40 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/paginateHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/parameters.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/parameters.ts index 9b409c322e..8cfc5898c9 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/parameters.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { +import type { RequestParameters } from "@azure-rest/core-client"; +import type { DetectRequest, ChangePointDetectRequest, ModelInfo, diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/pollingHelper.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/pollingHelper.ts index 131043e0b2..9c95257147 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/pollingHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/pollingHelper.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, HttpResponse } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { +import type { Client, HttpResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { CancelOnProgress, CreateHttpPollerOptions, RunningOperation, OperationResponse, OperationState, - createHttpPoller, } from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/responses.ts b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/responses.ts index 2d955d61e1..ac1e1c7c64 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/responses.ts +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/src/responses.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { EntireDetectResponseOutput, AnomalyDetectorErrorOutput, LastDetectResponseOutput, diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/review/purview-administration-rest.api.md b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/review/purview-administration-rest.api.md index 873a11b21d..c697c7d614 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/review/purview-administration-rest.api.md +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/review/purview-administration-rest.api.md @@ -4,15 +4,15 @@ ```ts -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; -import { TokenCredential } from '@azure/core-auth'; +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; // @public interface AccessKeyOptions { diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/clientDefinitions.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/clientDefinitions.ts index f4b586742a..4f0fd352bf 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/clientDefinitions.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { AccountsGetAccountPropertiesParameters, AccountsUpdateAccountPropertiesParameters, AccountsGetAccessKeysParameters, @@ -17,7 +17,7 @@ import { ResourceSetRulesDeleteResourceSetRuleParameters, ResourceSetRulesListResourceSetRulesParameters, } from "./parameters"; -import { +import type { AccountsGetAccountProperties200Response, AccountsGetAccountPropertiesDefaultResponse, AccountsUpdateAccountProperties200Response, @@ -48,7 +48,7 @@ import { ResourceSetRulesListResourceSetRules200Response, ResourceSetRulesListResourceSetRulesDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface AccountsGetAccountProperties { /** Get an account */ diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/isUnexpected.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/isUnexpected.ts index 086e2d5dcf..a4f12d6b70 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/isUnexpected.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { AccountsGetAccountProperties200Response, AccountsGetAccountPropertiesDefaultResponse, AccountsUpdateAccountProperties200Response, diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/paginateHelper.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/paginateHelper.ts index 5ef95e5ea0..70694e2c93 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/paginateHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/parameters.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/parameters.ts index 414caa30ba..ec9c83eadd 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/parameters.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { +import type { RequestParameters } from "@azure-rest/core-client"; +import type { DataPlaneAccountUpdateParameters, AccessKeyOptions, Collection, diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/purviewAccount.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/purviewAccount.ts index ba9d341702..69d457ca9f 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/purviewAccount.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/purviewAccount.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "../logger"; -import { TokenCredential } from "@azure/core-auth"; -import { PurviewAccountClient } from "./clientDefinitions"; +import type { TokenCredential } from "@azure/core-auth"; +import type { PurviewAccountClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface PurviewAccountClientOptions extends ClientOptions { diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/responses.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/responses.ts index 8da34f68ac..cbd3fb25e6 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/responses.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/responses.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { HttpResponse } from "@azure-rest/core-client"; +import type { AccountOutput, ErrorResponseModelOutput, AccessKeysOutput, diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/index.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/index.ts index ea3ca2557e..c57e9fc0a7 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/index.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import * as PurviewMetadataPolicies from "./metadataPolicies"; -import * as PurviewAccount from "./account"; +import type * as PurviewMetadataPolicies from "./metadataPolicies"; +import type * as PurviewAccount from "./account"; export { PurviewMetadataPolicies, PurviewAccount }; diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts index ed1f926364..c7afb323ef 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { MetadataRolesListParameters, MetadataPolicyListAllParameters, MetadataPolicyUpdateParameters, MetadataPolicyGetParameters, } from "./parameters"; -import { +import type { MetadataRolesList200Response, MetadataRolesListDefaultResponse, MetadataPolicyListAll200Response, @@ -17,7 +17,7 @@ import { MetadataPolicyGet200Response, MetadataPolicyGetDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface MetadataRolesList { /** Lists roles for Purview Account */ diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/isUnexpected.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/isUnexpected.ts index 918a7a7b37..72d04fec15 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/isUnexpected.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { MetadataRolesList200Response, MetadataRolesListDefaultResponse, MetadataPolicyListAll200Response, diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/paginateHelper.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/paginateHelper.ts index e06d305e58..92ec360741 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/paginateHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/parameters.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/parameters.ts index 1b01d456c6..d8d6a5dbb1 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/parameters.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { MetadataPolicy } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { MetadataPolicy } from "./models"; export type MetadataRolesListParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts index 3832aae260..97954bd3fd 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "../logger"; -import { KeyCredential } from "@azure/core-auth"; -import { PurviewMetadataPoliciesClient } from "./clientDefinitions"; +import type { KeyCredential } from "@azure/core-auth"; +import type { PurviewMetadataPoliciesClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface PurviewMetadataPoliciesClientOptions extends ClientOptions { diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/responses.ts b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/responses.ts index d818fe65bd..aaed757560 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/responses.ts +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/metadataPolicies/responses.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { MetadataRoleListOutput, ErrorResponseModelOutput, MetadataPolicyListOutput, diff --git a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/clientDefinitions.ts b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/clientDefinitions.ts index 4af0a5f2c0..eefcf429a2 100644 --- a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { KqlScriptsGetAllParameters, KqlScriptCreateOrUpdateParameters, KqlScriptGetByNameParameters, @@ -93,7 +93,7 @@ import { TriggerRunQueryTriggerRunsByWorkspaceParameters, WorkspaceGetParameters, } from "./parameters"; -import { +import type { KqlScriptsGetAll200Response, KqlScriptsGetAllDefaultResponse, KqlScriptCreateOrUpdate200Response, @@ -336,7 +336,7 @@ import { WorkspaceGet200Response, WorkspaceGetDefaultResponse, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for KqlScripts operations */ export interface KqlScriptsOperations { diff --git a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/isUnexpected.ts b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/isUnexpected.ts index 76c6193595..8d4fe5488c 100644 --- a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/isUnexpected.ts +++ b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { KqlScriptsGetAll200Response, KqlScriptsGetAllDefaultResponse, KqlScriptCreateOrUpdate200Response, diff --git a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/paginateHelper.ts b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/paginateHelper.ts index 5ef95e5ea0..70694e2c93 100644 --- a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/paginateHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/paginateHelper.ts @@ -1,11 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; /** * returns an async iterator that iterates over results. It also has a `byPage` diff --git a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/parameters.ts b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/parameters.ts index 382b58cf5c..2970c5d6f9 100644 --- a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/parameters.ts +++ b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/parameters.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; -import { RequestParameters } from "@azure-rest/core-client"; -import { +import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { KqlScriptResource, ArtifactRenameRequest, MetastoreRegisterObject, diff --git a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/pollingHelper.ts b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/pollingHelper.ts index 131043e0b2..9c95257147 100644 --- a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/pollingHelper.ts +++ b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/pollingHelper.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, HttpResponse } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { +import type { Client, HttpResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { CancelOnProgress, CreateHttpPollerOptions, RunningOperation, OperationResponse, OperationState, - createHttpPoller, } from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. diff --git a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/responses.ts b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/responses.ts index bdf0e65576..91c5b722f6 100644 --- a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/responses.ts +++ b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/responses.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { KqlScriptsResourceCollectionResponseOutput, ErrorContractOutput, KqlScriptResourceOutput, diff --git a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/synapseArtifacts.ts b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/synapseArtifacts.ts index 3fc83505aa..a3a5dacaec 100644 --- a/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/synapseArtifacts.ts +++ b/packages/autorest.typescript/test/smoke/generated/synapse-artifacts-rest/src/synapseArtifacts.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { TokenCredential } from "@azure/core-auth"; -import { SynapseArtifactsClient } from "./clientDefinitions"; +import type { TokenCredential } from "@azure/core-auth"; +import type { SynapseArtifactsClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface SynapseArtifactsClientOptions extends ClientOptions { diff --git a/packages/autorest.typescript/test/unit/utils/nameConstructors.spec.ts b/packages/autorest.typescript/test/unit/utils/nameConstructors.spec.ts new file mode 100644 index 0000000000..4255aa72f0 --- /dev/null +++ b/packages/autorest.typescript/test/unit/utils/nameConstructors.spec.ts @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { expect } from "chai"; +import { + ModuleName, + getImportModuleName +} from "../../../src/utils/nameConstructors"; + +describe("#getImportModuleName", () => { + describe("when using cjs", () => { + it("generates the correct module name for simple files", () => { + const name: ModuleName = "myModule"; + expect(getImportModuleName(name, "cjs")).to.equal("myModule"); + }); + + it("generates the correct module name for directories", () => { + const name: ModuleName = { + cjsName: "myModule", + esModulesName: "myModule/index.js" + }; + expect(getImportModuleName(name, "cjs")).to.equal("myModule"); + }); + }); + + describe("when using esm", () => { + it("generates the correct module name for simple files", () => { + const name: ModuleName = "myModule"; + expect(getImportModuleName(name, "esm")).to.equal("myModule.js"); + }); + + it("generates the correct module name for directories", () => { + const name: ModuleName = { + cjsName: "myModule", + esModulesName: "myModule/index.js" + }; + expect(getImportModuleName(name, "esm")).to.equal("myModule/index.js"); + }); + }); + + describe("when omitting module kind", () => { + it("defaults to cjs", () => { + const name: ModuleName = "myModule"; + expect(getImportModuleName(name)).to.equal("myModule"); + }); + }); +}); diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/clientDefinitions.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/clientDefinitions.ts index 4a59678ab8..b908b3286f 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/clientDefinitions.ts @@ -1,21 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { ParamsHeadNoParamsParameters, ParamsGetRequiredParameters, ParamsPutRequiredOptionalParameters, ParamsPostParametersParameters, ParamsGetOptionalParameters, } from "./parameters"; -import { +import type { ParamsHeadNoParams200Response, ParamsGetRequired200Response, ParamsPutRequiredOptional200Response, ParamsPostParameters200Response, ParamsGetOptional200Response, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Params operations */ export interface ParamsOperations { diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts new file mode 100644 index 0000000000..6c4c92c7ca --- /dev/null +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dPGClient.ts @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import type { DPGClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface DPGClientOptions extends ClientOptions {} + +/** + * Initialize a new instance of `DPGClient` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: DPGClientOptions = {}, +): DPGClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-rlcClient-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + const client = getClient(endpointUrl, options) as DPGClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + + return { + ...client, + params: { + headNoParams: (options) => { + return client.path("/serviceDriven/parameters").head(options); + }, + getRequired: (options) => { + return client.path("/serviceDriven/parameters").get(options); + }, + putRequiredOptional: (options) => { + return client.path("/serviceDriven/parameters").put(options); + }, + postParameters: (options) => { + return client.path("/serviceDriven/parameters").post(options); + }, + getOptional: (options) => { + return client.path("/serviceDriven/moreParameters").get(options); + }, + }, + }; +} diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts index 589984849a..6c4c92c7ca 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/dpgClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { DPGClient } from "./clientDefinitions"; +import type { DPGClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface DPGClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts index 477abcdc86..1b9b69d069 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dpgClient"; +import DPGClient from "./dPGClient"; -export * from "./dpgClient"; +export * from "./dPGClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/parameters.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/parameters.ts index c631b6578b..04dad77848 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/parameters.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { PostInput } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { PostInput } from "./models"; export type ParamsHeadNoParamsParameters = RequestParameters; diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/responses.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/responses.ts index 7493eb8370..11a4d2555f 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/responses.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/src/responses.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; +import type { HttpResponse } from "@azure-rest/core-client"; /** * Head request, no params. diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/clientDefinitions.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/clientDefinitions.ts index 977bda25d7..f5b52ff660 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/clientDefinitions.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { ParamsHeadNoParamsParameters, ParamsGetRequiredParameters, ParamsPutRequiredOptionalParameters, @@ -10,7 +10,7 @@ import { ParamsGetOptionalParameters, ParamsGetNewOperationParameters, } from "./parameters"; -import { +import type { ParamsHeadNoParams200Response, ParamsGetRequired200Response, ParamsPutRequiredOptional200Response, @@ -19,7 +19,7 @@ import { ParamsGetOptional200Response, ParamsGetNewOperation200Response, } from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; /** Contains operations for Params operations */ export interface ParamsOperations { diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dPGClient.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dPGClient.ts new file mode 100644 index 0000000000..35bdd9c859 --- /dev/null +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dPGClient.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import type { DPGClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface DPGClientOptions extends ClientOptions {} + +/** + * Initialize a new instance of `DPGClient` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: DPGClientOptions = {}, +): DPGClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-rlcClient-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + const client = getClient(endpointUrl, options) as DPGClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + if (options.apiVersion) { + logger.warning( + "This client does not support client api-version, please change it at the operation level", + ); + } + + return { + ...client, + params: { + headNoParams: (options) => { + return client.path("/serviceDriven/parameters").head(options); + }, + getRequired: (options) => { + return client.path("/serviceDriven/parameters").get(options); + }, + putRequiredOptional: (options) => { + return client.path("/serviceDriven/parameters").put(options); + }, + postParameters: (options) => { + return client.path("/serviceDriven/parameters").post(options); + }, + deleteParameters: (options) => { + return client.path("/serviceDriven/parameters").delete(options); + }, + getOptional: (options) => { + return client.path("/serviceDriven/moreParameters").get(options); + }, + getNewOperation: (options) => { + return client.path("/serviceDriven/newPath").get(options); + }, + }, + }; +} diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient.ts index 8971d0afd3..35bdd9c859 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/dpgClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger"; -import { DPGClient } from "./clientDefinitions"; +import type { DPGClient } from "./clientDefinitions"; /** The optional parameters for the client */ export interface DPGClientOptions extends ClientOptions {} diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts index 477abcdc86..1b9b69d069 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import DPGClient from "./dpgClient"; +import DPGClient from "./dPGClient"; -export * from "./dpgClient"; +export * from "./dPGClient"; export * from "./parameters"; export * from "./responses"; export * from "./clientDefinitions"; diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/parameters.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/parameters.ts index 918d10bfe2..6a8a528819 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/parameters.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/parameters.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RequestParameters } from "@azure-rest/core-client"; -import { PostInput } from "./models"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { PostInput } from "./models"; export interface ParamsHeadNoParamsQueryParamProperties { /** I'm a new input optional parameter */ diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/responses.ts b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/responses.ts index bd640b874c..65de952231 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/responses.ts +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/src/responses.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HttpResponse } from "@azure-rest/core-client"; +import type { HttpResponse } from "@azure-rest/core-client"; /** Head request, no params. Initially has no query parameters. After evolution, a new optional query parameter is added */ export interface ParamsHeadNoParams200Response extends HttpResponse { diff --git a/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts index bce8c47897..de9843e1df 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { KeyCredential } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type AuthApiKeyClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml index fcf7239bc5..966e076176 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml @@ -3,10 +3,10 @@ emit: options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthApiKeyClient packageDetails: - name: "@msinternal/auth-apikey" + name: "@unbranded/auth-apikey" description: "Auth api key Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts index b5521dda34..2998619c59 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { KeyCredential } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type AuthHttpCustomClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml index cd90c8cee8..708ad88746 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml @@ -3,10 +3,10 @@ emit: options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthHttpCustomClient packageDetails: - name: "@msinternal/auth-httpcustom" + name: "@unbranded/auth-httpcustom" description: "Auth Http Custom Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts index 80403e1ada..93ab9bf8a0 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; -import { TokenCredential } from '@azure/core-auth'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; +import type { TokenCredential } from '@typespec/ts-http-runtime'; export declare type AuthOauth2Client = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml index 6f010339a7..7f66af592c 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: true - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthOauth2Client packageDetails: - name: "@msinternal/auth-oauth2" + name: "@unbranded/auth-oauth2" description: "Auth oauth2 Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts index 39b7c2aa76..69826a9332 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts @@ -1,10 +1,10 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; -import { TokenCredential } from '@azure/core-auth'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { KeyCredential } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; +import type { TokenCredential } from '@typespec/ts-http-runtime'; export declare type AuthUnionClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml index 4d76803e4e..da29489b1a 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: true - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthUnionClient packageDetails: - name: "@msinternal/auth-union" + name: "@unbranded/auth-union" description: "Auth Union Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts index bb2d91ed28..e18e541981 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts @@ -1,10 +1,10 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Base64BytesProperty { value: string; @@ -14,19 +14,19 @@ export declare interface Base64BytesPropertyOutput { value: string; } -export declare interface Base64UrlArrayBytesProperty { +export declare interface Base64urlArrayBytesProperty { value: string[]; } -export declare interface Base64UrlArrayBytesPropertyOutput { +export declare interface Base64urlArrayBytesPropertyOutput { value: string[]; } -export declare interface Base64UrlBytesProperty { +export declare interface Base64urlBytesProperty { value: string; } -export declare interface Base64UrlBytesPropertyOutput { +export declare interface Base64urlBytesPropertyOutput { value: string; } @@ -68,41 +68,41 @@ export declare interface HeaderBase64Headers { export declare type HeaderBase64Parameters = HeaderBase64HeaderParam & RequestParameters; -export declare interface HeaderBase64Url { - get(options: HeaderBase64UrlParameters): StreamableMethod; +export declare interface HeaderBase64url { + get(options: HeaderBase64urlParameters): StreamableMethod; } -export declare interface HeaderBase64Url204Response extends HttpResponse { +export declare interface HeaderBase64url204Response extends HttpResponse { status: "204"; } -export declare interface HeaderBase64UrlArray { - get(options: HeaderBase64UrlArrayParameters): StreamableMethod; +export declare interface HeaderBase64urlArray { + get(options: HeaderBase64urlArrayParameters): StreamableMethod; } -export declare interface HeaderBase64UrlArray204Response extends HttpResponse { +export declare interface HeaderBase64urlArray204Response extends HttpResponse { status: "204"; } -export declare interface HeaderBase64UrlArrayHeaderParam { - headers: RawHttpHeadersInput & HeaderBase64UrlArrayHeaders; +export declare interface HeaderBase64urlArrayHeaderParam { + headers: RawHttpHeadersInput & HeaderBase64urlArrayHeaders; } -export declare interface HeaderBase64UrlArrayHeaders { +export declare interface HeaderBase64urlArrayHeaders { value: string; } -export declare type HeaderBase64UrlArrayParameters = HeaderBase64UrlArrayHeaderParam & RequestParameters; +export declare type HeaderBase64urlArrayParameters = HeaderBase64urlArrayHeaderParam & RequestParameters; -export declare interface HeaderBase64UrlHeaderParam { - headers: RawHttpHeadersInput & HeaderBase64UrlHeaders; +export declare interface HeaderBase64urlHeaderParam { + headers: RawHttpHeadersInput & HeaderBase64urlHeaders; } -export declare interface HeaderBase64UrlHeaders { +export declare interface HeaderBase64urlHeaders { value: string; } -export declare type HeaderBase64UrlParameters = HeaderBase64UrlHeaderParam & RequestParameters; +export declare type HeaderBase64urlParameters = HeaderBase64urlHeaderParam & RequestParameters; export declare interface HeaderDefault { get(options: HeaderDefaultParameters): StreamableMethod; @@ -137,35 +137,35 @@ export declare interface PropertyBase64BodyParam { export declare type PropertyBase64Parameters = PropertyBase64BodyParam & RequestParameters; -export declare interface PropertyBase64Url { - post(options: PropertyBase64UrlParameters): StreamableMethod; +export declare interface PropertyBase64url { + post(options: PropertyBase64urlParameters): StreamableMethod; } -export declare interface PropertyBase64Url200Response extends HttpResponse { +export declare interface PropertyBase64url200Response extends HttpResponse { status: "200"; - body: Base64UrlBytesPropertyOutput; + body: Base64urlBytesPropertyOutput; } -export declare interface PropertyBase64UrlArray { - post(options: PropertyBase64UrlArrayParameters): StreamableMethod; +export declare interface PropertyBase64urlArray { + post(options: PropertyBase64urlArrayParameters): StreamableMethod; } -export declare interface PropertyBase64UrlArray200Response extends HttpResponse { +export declare interface PropertyBase64urlArray200Response extends HttpResponse { status: "200"; - body: Base64UrlArrayBytesPropertyOutput; + body: Base64urlArrayBytesPropertyOutput; } -export declare interface PropertyBase64UrlArrayBodyParam { - body: Base64UrlArrayBytesProperty; +export declare interface PropertyBase64urlArrayBodyParam { + body: Base64urlArrayBytesProperty; } -export declare type PropertyBase64UrlArrayParameters = PropertyBase64UrlArrayBodyParam & RequestParameters; +export declare type PropertyBase64urlArrayParameters = PropertyBase64urlArrayBodyParam & RequestParameters; -export declare interface PropertyBase64UrlBodyParam { - body: Base64UrlBytesProperty; +export declare interface PropertyBase64urlBodyParam { + body: Base64urlBytesProperty; } -export declare type PropertyBase64UrlParameters = PropertyBase64UrlBodyParam & RequestParameters; +export declare type PropertyBase64urlParameters = PropertyBase64urlBodyParam & RequestParameters; export declare interface PropertyDefault { post(options: PropertyDefaultParameters): StreamableMethod; @@ -200,45 +200,45 @@ export declare interface QueryBase64QueryParamProperties { value: string; } -export declare interface QueryBase64Url { - get(options: QueryBase64UrlParameters): StreamableMethod; +export declare interface QueryBase64url { + get(options: QueryBase64urlParameters): StreamableMethod; } -export declare interface QueryBase64Url204Response extends HttpResponse { +export declare interface QueryBase64url204Response extends HttpResponse { status: "204"; } -export declare interface QueryBase64UrlArray { - get(options: QueryBase64UrlArrayParameters): StreamableMethod; +export declare interface QueryBase64urlArray { + get(options: QueryBase64urlArrayParameters): StreamableMethod; } -export declare interface QueryBase64UrlArray204Response extends HttpResponse { +export declare interface QueryBase64urlArray204Response extends HttpResponse { status: "204"; } -export declare type QueryBase64UrlArrayParameters = QueryBase64UrlArrayQueryParam & RequestParameters; +export declare type QueryBase64urlArrayParameters = QueryBase64urlArrayQueryParam & RequestParameters; -export declare interface QueryBase64UrlArrayQueryParam { - queryParameters: QueryBase64UrlArrayQueryParamProperties; +export declare interface QueryBase64urlArrayQueryParam { + queryParameters: QueryBase64urlArrayQueryParamProperties; } -export declare interface QueryBase64UrlArrayQueryParamProperties { - value: string[] | QueryBase64UrlArrayValueQueryParam; +export declare interface QueryBase64urlArrayQueryParamProperties { + value: string[] | QueryBase64urlArrayValueQueryParam; } -export declare interface QueryBase64UrlArrayValueQueryParam { +export declare interface QueryBase64urlArrayValueQueryParam { value: string[]; explode: false; style: "form"; } -export declare type QueryBase64UrlParameters = QueryBase64UrlQueryParam & RequestParameters; +export declare type QueryBase64urlParameters = QueryBase64urlQueryParam & RequestParameters; -export declare interface QueryBase64UrlQueryParam { - queryParameters: QueryBase64UrlQueryParamProperties; +export declare interface QueryBase64urlQueryParam { + queryParameters: QueryBase64urlQueryParamProperties; } -export declare interface QueryBase64UrlQueryParamProperties { +export declare interface QueryBase64urlQueryParamProperties { value: string; } @@ -274,19 +274,19 @@ export declare interface RequestBodyBase64BodyParam { export declare type RequestBodyBase64Parameters = RequestBodyBase64BodyParam & RequestParameters; -export declare interface RequestBodyBase64Url { - post(options: RequestBodyBase64UrlParameters): StreamableMethod; +export declare interface RequestBodyBase64url { + post(options: RequestBodyBase64urlParameters): StreamableMethod; } -export declare interface RequestBodyBase64Url204Response extends HttpResponse { +export declare interface RequestBodyBase64url204Response extends HttpResponse { status: "204"; } -export declare interface RequestBodyBase64UrlBodyParam { +export declare interface RequestBodyBase64urlBodyParam { body: string; } -export declare type RequestBodyBase64UrlParameters = RequestBodyBase64UrlBodyParam & RequestParameters; +export declare type RequestBodyBase64urlParameters = RequestBodyBase64urlBodyParam & RequestParameters; export declare interface RequestBodyCustomContentType { post(options: RequestBodyCustomContentTypeParameters): StreamableMethod; @@ -349,16 +349,16 @@ export declare interface ResponseBodyBase64200Response extends HttpResponse { export declare type ResponseBodyBase64Parameters = RequestParameters; -export declare interface ResponseBodyBase64Url { - get(options?: ResponseBodyBase64UrlParameters): StreamableMethod; +export declare interface ResponseBodyBase64url { + get(options?: ResponseBodyBase64urlParameters): StreamableMethod; } -export declare interface ResponseBodyBase64Url200Response extends HttpResponse { +export declare interface ResponseBodyBase64url200Response extends HttpResponse { status: "200"; body: string; } -export declare type ResponseBodyBase64UrlParameters = RequestParameters; +export declare type ResponseBodyBase64urlParameters = RequestParameters; export declare interface ResponseBodyCustomContentType { get(options?: ResponseBodyCustomContentTypeParameters): StreamableMethod; @@ -406,26 +406,26 @@ export declare type ResponseBodyOctetStreamParameters = RequestParameters; export declare interface Routes { (path: "/encode/bytes/query/default"): QueryDefault; (path: "/encode/bytes/query/base64"): QueryBase64; - (path: "/encode/bytes/query/base64url"): QueryBase64Url; - (path: "/encode/bytes/query/base64url-array"): QueryBase64UrlArray; + (path: "/encode/bytes/query/base64url"): QueryBase64url; + (path: "/encode/bytes/query/base64url-array"): QueryBase64urlArray; (path: "/encode/bytes/property/default"): PropertyDefault; (path: "/encode/bytes/property/base64"): PropertyBase64; - (path: "/encode/bytes/property/base64url"): PropertyBase64Url; - (path: "/encode/bytes/property/base64url-array"): PropertyBase64UrlArray; + (path: "/encode/bytes/property/base64url"): PropertyBase64url; + (path: "/encode/bytes/property/base64url-array"): PropertyBase64urlArray; (path: "/encode/bytes/header/default"): HeaderDefault; (path: "/encode/bytes/header/base64"): HeaderBase64; - (path: "/encode/bytes/header/base64url"): HeaderBase64Url; - (path: "/encode/bytes/header/base64url-array"): HeaderBase64UrlArray; + (path: "/encode/bytes/header/base64url"): HeaderBase64url; + (path: "/encode/bytes/header/base64url-array"): HeaderBase64urlArray; (path: "/encode/bytes/body/request/default"): RequestBodyDefault; (path: "/encode/bytes/body/request/octet-stream"): RequestBodyOctetStream; (path: "/encode/bytes/body/request/custom-content-type"): RequestBodyCustomContentType; (path: "/encode/bytes/body/request/base64"): RequestBodyBase64; - (path: "/encode/bytes/body/request/base64url"): RequestBodyBase64Url; + (path: "/encode/bytes/body/request/base64url"): RequestBodyBase64url; (path: "/encode/bytes/body/response/default"): ResponseBodyDefault; (path: "/encode/bytes/body/response/octet-stream"): ResponseBodyOctetStream; (path: "/encode/bytes/body/response/custom-content-type"): ResponseBodyCustomContentType; (path: "/encode/bytes/body/response/base64"): ResponseBodyBase64; - (path: "/encode/bytes/body/response/base64url"): ResponseBodyBase64Url; + (path: "/encode/bytes/body/response/base64url"): ResponseBodyBase64url; } export { } diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml index 734e47351e..1141d953cf 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml @@ -4,10 +4,9 @@ options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" generateMetadata: true - generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-bytes" + name: "@unbranded/encode-bytes" diff --git a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts index 42632262a2..1962a0d4b9 100644 --- a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts @@ -1,10 +1,10 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare function buildCsvCollection(items: string[] | number[]): string; diff --git a/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml index 010a839f0a..44a09ba726 100644 --- a/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml @@ -4,10 +4,9 @@ options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" generateMetadata: true - generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-datetime" + name: "@unbranded/encode-datetime" diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts index 0d950809be..df04308e86 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare function buildCsvCollection(items: string[] | number[]): string; diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml index 5b0e79e874..b4d65f1695 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml @@ -5,8 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-duration" + name: "@unbranded/encode-duration" diff --git a/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts index 93656a4632..468096b046 100644 --- a/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: NumericClientOptions): NumericClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml index b6bd24941b..dd4c5dc131 100644 --- a/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml @@ -5,8 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-numeric" + name: "@unbranded/encode-numeric" diff --git a/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts index f483d72a8e..b8e2fcb4d9 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type BasicClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml index b9742c37ec..6b36a8e2af 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true isTypeSpecTest: true packageDetails: - name: "@msinternal/parameterBasic" + name: "@unbranded/parameterBasic" diff --git a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts index bcbc9838e7..8cc8e774b9 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BodyModel { name: string; diff --git a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml index ebfed5c478..4ce9910372 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true isTypeSpecTest: true packageDetails: - name: "@msinternal/collectionFormat" + name: "@unbranded/collectionFormat" diff --git a/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts index e5613f094e..c24d5610e4 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare function buildCsvCollection(items: string[] | number[]): string; diff --git a/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml index 25e4be7579..da6eb41074 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml @@ -6,11 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true compatibilityQueryMultiFormat: true isTypeSpecTest: true title: CollectionFormatClient packageDetails: - name: "@msinternal/collectionFormat" + name: "@unbranded/collectionFormat" description: "CollectionFormat Test Service" diff --git a/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts index f91256336f..cee9289926 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface AliasSpreadAsRequestBody { put(options: AliasSpreadAsRequestBodyParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml index 8d064e4dcd..35a8a193bf 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true isTypeSpecTest: true packageDetails: - name: "@msinternal/parameterSpread" + name: "@unbranded/parameterSpread" diff --git a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts index ec375843f6..119e34c057 100644 --- a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts @@ -1,10 +1,10 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type ContentNegotiationClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml index 936f5d0a1c..17a40e59f4 100644 --- a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/payload-content-negotiation" \ No newline at end of file + name: "@unbranded/payload-content-negotiation" diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts index 248d033a6d..f5baeafba7 100644 --- a/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: MediaTypeClientOptions): MediaTypeClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml index a5b574817b..dd34458d64 100644 --- a/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/payload-media-type" + name: "@unbranded/payload-media-type" diff --git a/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts b/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts index c2f795aae7..62f2b114b2 100644 --- a/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Address { city: string; diff --git a/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml index 08196f9142..c65f8055ad 100644 --- a/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/payload-multipart" + name: "@unbranded/payload-multipart" diff --git a/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts index 195a8fe287..dce58e7547 100644 --- a/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: RoutesClientOptions): RoutesClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml index ba69ca1b18..027528c988 100644 --- a/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml @@ -5,9 +5,9 @@ options: "emitter-output-dir": "{project-root}" generateTest: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: RoutesClient packageDetails: - name: "@msinternal/routes" + name: "@unbranded/routes" description: "Routes Test Service" diff --git a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts index 15a0ae67db..b5cf7fed43 100644 --- a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: SerializationEncodedNameJsonClientOptions): SerializationEncodedNameJsonClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml index c63bf5394b..9d4b150b91 100644 --- a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml @@ -6,10 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: SerializationEncodedNameJsonClient enableOperationGroup: true packageDetails: - name: "@msinternal/serialization-encoded-name-json" + name: "@unbranded/serialization-encoded-name-json" description: "Serialization Encoded Name Json Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts index 19436d2fcf..b6d7ab1d23 100644 --- a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: NotDefinedParamInServerEndpointClientOptions): NotDefinedParamInServerEndpointClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml index 6ebd95f350..d020cf667a 100644 --- a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: NotDefinedParamInServerEndpointClient packageDetails: - name: "@msinternal/notdefinedparam" + name: "@unbranded/notdefinedparam" description: "NotDefinedParameter Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts index 3f1c926897..d25450adb4 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, { apiVersion, ...options }?: MultipleParamInServerPathClientOptions): MultipleParamInServerPathClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml index 4298357b12..39d16dc36d 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: MultipleParamInServerPathClient packageDetails: - name: "@msinternal/multipleparam" + name: "@unbranded/multipleparam" description: "MultipleParameter Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts index a9d96bc3f2..13f9a0329b 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: SingleParamInServerPathClientOptions): SingleParamInServerPathClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml index 56938c9e4c..5c27ee10ae 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: SingleParamInServerPathClient packageDetails: - name: "@msinternal/singleparam" + name: "@unbranded/singleparam" description: "SingleParameter Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts index d849f65475..d37ad18607 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: NotVersionedParamInServerVersionsClientOptions): NotVersionedParamInServerVersionsClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml index 0db07d2a01..cac48be5c5 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: NotVersionedParamInServerVersionsClient packageDetails: - name: "@msinternal/not-versioned" + name: "@unbranded/not-versioned" description: "Not-versioned Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts index d44e38879d..f47af935af 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: VersionedParamInServerVersionsClientOptions): VersionedParamInServerVersionsClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml index 807c51f80b..4c7edd0d40 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: VersionedParamInServerVersionsClient packageDetails: - name: "@msinternal/versioned" + name: "@unbranded/versioned" description: "Versioned Test Service" diff --git a/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts b/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts index 3c071e24cf..0c677baa0c 100644 --- a/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts @@ -1,11 +1,11 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; - -declare function createClient(host: string, options?: SharedRouteClientOptions): SharedRouteClient; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; + +declare function createClient($host: string, options?: SharedRouteClientOptions): SharedRouteClient; export default createClient; export declare interface ErrorModelOutput { diff --git a/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml index 390011f6fa..3b047335e3 100644 --- a/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml @@ -5,7 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/media-types" + name: "@unbranded/media-types" diff --git a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts index 496a95a4e6..5cc3d6d564 100644 --- a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts @@ -1,10 +1,10 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: RepeatabilityClientOptions): RepeatabilityClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml index b51d512152..0962a2746c 100644 --- a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml @@ -6,7 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/repeatable-header" + name: "@unbranded/repeatable-header" diff --git a/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts b/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts index 41df3a827a..db24397493 100644 --- a/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface And { name: string; diff --git a/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml index 9ac3a40dd4..f8142c2564 100644 --- a/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml @@ -7,9 +7,10 @@ options: generateTest: false addCredentials: false azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true title: SpecialWordsClient packageDetails: - name: "@msinternal/special-words" + name: "@unbranded/special-words" description: "Special Words Test Service" diff --git a/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts index e7f80732f1..140c31adb3 100644 --- a/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type ArrayItemTypesClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml index 6b8ad9feff..f5a80ab302 100644 --- a/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml @@ -6,12 +6,12 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: ArrayItemTypesClient enableOperationGroup: true packageDetails: - name: "@msinternal/array-itemtypes" + name: "@unbranded/array-itemtypes" description: "Array item-types Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts index 673b146c82..b43b9e7a9f 100644 --- a/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanValueGet { get(options?: BooleanValueGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml index 3a99986a91..537b8b6df0 100644 --- a/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml @@ -6,12 +6,12 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: DictClient enableOperationGroup: true packageDetails: - name: "@msinternal/dictionary" + name: "@unbranded/dictionary" description: "Dictionary Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts index 5032a16d19..8a2306e373 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: ExtensibleClientOptions): ExtensibleClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml index 98963a616d..1f746f21a1 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/extensible-enums" + name: "@unbranded/extensible-enums" description: "Extensible Enums Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts index 050979da0f..3d0ff3de4a 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: FixedClientOptions): FixedClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml index 99e61c06ed..5a8559f9b8 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/extensible-fixed" + name: "@unbranded/extensible-fixed" description: "Fixed Enums Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts index 00473b1f40..06959adce7 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: EmptyClientOptions): EmptyClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml index c51cf5c73b..e9c60eee9b 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/empty-model" + name: "@unbranded/empty-model" description: "Empty model Service" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts index 46033a7578..a41ae82257 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Cobra extends SnakeParent { kind: "cobra"; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml index 87dc7807c4..daaca4af1f 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance-enum-discriminator" + name: "@unbranded/model-inheritance-enum-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts index b469dafab2..b4239b6fa5 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: NestedDiscriminatorClientOptions): NestedDiscriminatorClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml index a5613954e7..eb3ee42145 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance" + name: "@unbranded/model-inheritance" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts index 57620dae64..efdaf9189e 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Cat extends Pet { age: number; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml index c4048faf70..5e3e30d11d 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance-not-discriminated" + name: "@unbranded/model-inheritance-not-discriminated" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts index 84291e5b33..51c60f48c3 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: RecursiveClientOptions): RecursiveClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml index 888b181216..f83b49f20a 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/inheritance-recursive" + name: "@unbranded/inheritance-recursive" description: "recursive Service" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts index 9e33805d64..0d7bf0dce2 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type Bird = BirdParent | SeaGull | Sparrow | Goose | Eagle; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml index 6fb5cb68cf..18374f2cd6 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance-single-discriminator" + name: "@unbranded/model-inheritance-single-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts index cd34d3402b..add3437667 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: UsageClientOptions): UsageClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml index 3afa886288..fdbf7a79c0 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml @@ -7,8 +7,8 @@ options: generateTest: false addCredentials: false isTypeSpecTest: true - azureSdkForJs: false + isModularLibrary: false packageDetails: - name: "@msinternal/usage" + name: "@unbranded/usage" description: "Usage Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts index 677c77e57a..06b5ecbd78 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: VisibilityClientOptions): VisibilityClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml index ec2f0be158..7fb2e7ef68 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/visibility" + name: "@unbranded/visibility" description: "Visibility Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts index 293723062c..2848e7abf6 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BytesGetNonNull { get(options?: BytesGetNonNullParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml index cce2c68f8d..453c26798d 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml @@ -6,10 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/nullable-property" + name: "@unbranded/nullable-property" description: "Nullable Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts index e90c2c31d7..3a2727d2e6 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanLiteralGetAll { get(options?: BooleanLiteralGetAllParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml index 9fe1b41098..613e09cfc6 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml @@ -6,10 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/optional-property" + name: "@unbranded/optional-property" description: "Optional Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts index 7f1f1102d0..f0f358f015 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanLiteralGet { get(options?: BooleanLiteralGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml index e9f9208568..2b2657c1e4 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml @@ -7,9 +7,10 @@ options: generateTest: false addCredentials: false azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/property-types" + name: "@unbranded/property-types" description: "Property Types Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts index 872bd046fc..63a8cb40d6 100644 --- a/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanModelGet { get(options?: BooleanModelGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml index bdd42b8b22..ab2f084297 100644 --- a/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/scalar" + name: "@unbranded/scalar" diff --git a/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts index 1dfcbcfd5c..0fcdfdcb90 100644 --- a/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Cat { name: string; @@ -24,13 +24,13 @@ export declare interface DogOutput { } export declare interface EnumsOnlyCases { - lr: LR | UD; - ud: UD | UD; + lr: Lr | Ud; + ud: Ud | Ud; } export declare interface EnumsOnlyCasesOutput { - lr: LROutput | UDOutput; - ud: UDOutput | UDOutput; + lr: LrOutput | UdOutput; + ud: UdOutput | UdOutput; } export declare interface EnumsOnlyGet { @@ -111,9 +111,9 @@ export declare interface IntsOnlySendBodyParam { export declare type IntsOnlySendParameters = IntsOnlySendBodyParam & RequestParameters; -export declare type LR = "left" | "right"; +export declare type Lr = "left" | "right"; -export declare type LROutput = "left" | "right"; +export declare type LrOutput = "left" | "right"; export declare interface MixedLiteralsCases { stringLiteral: "a" | 2 | 3.3 | true; @@ -354,9 +354,9 @@ export declare interface StringsOnlySendBodyParam { export declare type StringsOnlySendParameters = StringsOnlySendBodyParam & RequestParameters; -export declare type UD = "up" | "down"; +export declare type Ud = "up" | "down"; -export declare type UDOutput = "up" | "down"; +export declare type UdOutput = "up" | "down"; export declare type UnionsClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml index 6c2f4da2a0..0c39df57d5 100644 --- a/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml @@ -5,11 +5,11 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: UnionsClient experimentalExtensibleEnums: true packageDetails: - name: "@msinternal/unions" + name: "@unbranded/unions" description: "Unions Test Service" diff --git a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts index a17e3f37d4..ebef0f1128 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface CommonRegistrationRequest { payMethod: PaymentMethods; diff --git a/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml index 8bd5a4a8fa..26590cdd45 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: UnionBodyClient packageDetails: - name: "@msinternal/union-body" + name: "@unbranded/union-body" description: "Union Body Test Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts index 6cdc6053da..806abf19ac 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts @@ -1,9 +1,9 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningAddedClientOptions): VersioningAddedClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml index 4f39a9aa30..f3fecaa5a3 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningAddedClient packageDetails: - name: "@msinternal/versioning-added" + name: "@unbranded/versioning-added" description: "Versioning Added Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts index e817ae88ff..bb45e10034 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningMadeOptionalClientOptions): VersioningMadeOptionalClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml index ec693ec76f..4c13c8e7c1 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningMadeOptionalClient packageDetails: - name: "@msinternal/versioning-madeOptional" + name: "@unbranded/versioning-madeOptional" description: "Versioning MadeOptional Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts index 4db98b8b0c..4957fa1f2e 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningRenamedFromClientOptions): VersioningRenamedFromClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml index ea3e7dddf6..c0e5e99b32 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningRenamedFromClient packageDetails: - name: "@msinternal/versioning-renamedFrom" + name: "@unbranded/versioning-renamedFrom" description: "Versioning RenamedFrom Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts index d3edfad412..f138a3ac74 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningReturnTypeChangedFromClientOptions): VersioningReturnTypeChangedFromClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml index 4a8c2f9f6c..0c3385a89a 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningReturnTypeChangedFromClient packageDetails: - name: "@msinternal/versioning-returnTypeChangedFrom" + name: "@unbranded/versioning-returnTypeChangedFrom" description: "Versioning ReturnTypeChangedFrom Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts index 6fa318d42b..f9847434ae 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts @@ -1,8 +1,8 @@ -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningTypeChangedFromClientOptions): VersioningTypeChangedFromClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml index 66f56b3ca5..2abecf793c 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningTypeChangedFromClient packageDetails: - name: "@msinternal/versioning-typeChangedFrom" + name: "@unbranded/versioning-typeChangedFrom" description: "Versioning TypeChangedFrom Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts index 519d8e6934..1a8c187551 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts @@ -1,7 +1,7 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { KeyCredential } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ApiKeyClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml index 96a97c860c..3672fc97c5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml @@ -5,10 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-api-key" + name: "@unbranded/azure-api-key" description: "Azure API Key Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts index 5f729c295e..70b1f055b2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts @@ -1,7 +1,7 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { KeyCredential } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class CustomClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml index 4fe7f76e6f..d376908d99 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml @@ -5,10 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-http-custom" + name: "@unbranded/azure-http-custom" description: "Azure Http Custom Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts index 028d21f5e9..70348651f7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts @@ -1,7 +1,7 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { TokenCredential } from '@azure/core-auth'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; +import { TokenCredential } from '@typespec/ts-http-runtime'; export declare interface InvalidOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml index 4360fa3fd0..b209ee6a49 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml @@ -5,10 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-oauth2" + name: "@unbranded/azure-oauth2" description: "Azure Oauth2 Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts index 96ce7bf62b..c8f8606866 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts @@ -1,8 +1,8 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { TokenCredential } from '@azure/core-auth'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { KeyCredential } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; +import { TokenCredential } from '@typespec/ts-http-runtime'; export declare class UnionClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml index 3fb83a573e..18528c761c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml @@ -5,10 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-auth-union" - description: "Azure Auth Union Test Service" + name: "@unbranded/azure-auth-union" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts index ddcc3e040f..88ab9583c1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts @@ -1,16 +1,16 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Base64BytesProperty { value: Uint8Array; } -export declare interface Base64UrlArrayBytesProperty { +export declare interface Base64urlArrayBytesProperty { value: Uint8Array[]; } -export declare interface Base64UrlBytesProperty { +export declare interface Base64urlBytesProperty { value: Uint8Array; } @@ -64,8 +64,8 @@ export declare interface PropertyDefaultOptionalParams extends OperationOptions } export declare interface PropertyOperations { - base64urlArray: (body: Base64UrlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; - base64url: (body: Base64UrlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; + base64urlArray: (body: Base64urlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; + base64url: (body: Base64urlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; base64: (body: Base64BytesProperty, options?: PropertyBase64OptionalParams) => Promise; default: (body: DefaultBytesProperty, options?: PropertyDefaultOptionalParams) => Promise; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml index 1d81b2c952..4ad37ff4e5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-bytes" + name: "@unbranded/encode-bytes" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts index 8ed5a8c89a..86d9569fe3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class DatetimeClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml index 001e59ab51..435c9bd32f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-datatime" + name: "@unbranded/encode-datatime" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts index a0dd0c9b57..8965a735bc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface DefaultDurationProperty { value: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml index 727c2b53b7..ca533b2df4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-duration" + name: "@unbranded/encode-duration" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts index 287846bfd0..36a6f941a4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class NumericClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml index f867d3e667..fdd2eeb2fe 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-numeric" + name: "@unbranded/encode-numeric" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts index 819ac7181b..680a4251eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class BasicClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml index c1cacabe4a..66a1200bd2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false enableOperationGroup: true isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/parameterBasic" + name: "@unbranded/parameterBasic" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts index 666db44d14..570d529906 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BodyModel { name: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml index 40fa7f26f6..1d0269ef66 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/body-optionality" + name: "@unbranded/body-optionality" description: "Parameter Body Optionality Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts index 4de5b37875..87f449f9c3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class CollectionFormatClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml index c5b408db17..efd0f3f7db 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-collection-format" + name: "@unbranded/azure-collection-format" description: "Azure Collection Format Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts index c57d6c8d7f..07f162d45e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface AliasOperations { spreadParameterWithInnerAlias: (id: string, name: string, age: number, xMsTestHeader: string, options?: AliasSpreadParameterWithInnerAliasOptionalParams) => Promise; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml index 6c55570de8..adb8ce8b9a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false enableOperationGroup: true isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/parameterSpread" + name: "@unbranded/parameterSpread" diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts index a1bac61e87..b5b7e0f221 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ContentNegotiationClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml index 6e43646a11..d32010170f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/payload-content-negotiation" + name: "@unbranded/payload-content-negotiation" description: "Payload Content Negotiation Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts index 7539463102..b6bade1d64 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class MediaTypeClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml index f2f1bc6d66..5fcdcd7704 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/payload-mediaType" + name: "@unbranded/payload-mediaType" description: "Payload Media Type Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts index 4898f205ec..75984d9716 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface GetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml index be5f36c986..6991cfff72 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: SerializationEncodedNameJsonClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/serialization-encoded-name-json" + name: "@unbranded/serialization-encoded-name-json" description: "Serialization Encoded Name Json Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts index 26662d6d1e..df020c3387 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class NotDefinedClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml index e19a4c2337..ac27cf07d7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: NotDefinedParamInServerEndpointClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/notdefinedparam" + name: "@unbranded/notdefinedparam" description: "NotDefinedParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts index 90f3fe2998..929c106eba 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class MultipleClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml index c5ef84bbf8..4f5ebb1a47 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: MultipleParamInServerPathClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/multipleparam" + name: "@unbranded/multipleparam" description: "MultipleParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts index 3bf8a1a437..e7c8f60ccf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface MyOpOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml index ff45f2f128..b98318ec1f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: SingleParamInServerPathClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/singleparam" + name: "@unbranded/singleparam" description: "SingleParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts index 00b750b873..4faf5b242a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class NotVersionedClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml index 81d21cf77d..097ddf8f38 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: NotVersionedParamInServerVersionsClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/not-versioned" + name: "@unbranded/not-versioned" description: "NotVersioned Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts index 3556718fda..08a98ad7f9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts @@ -1,10 +1,10 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare enum KnownVersions { - V2021_01_01_Preview = "2021-01-01-preview", - V2022_12_01_Preview = "2022-12-01-preview" + v2021_01_01_preview = "2021-01-01-preview", + v2022_12_01_preview = "2022-12-01-preview" } export declare class VersionedClient { diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml index 6fdcf3e495..50f3457f57 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersionedParamInServerVersionsClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versioned" + name: "@unbranded/versioned" description: "Versioned Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts index 21e9bdb2f7..498e18f0f9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface ImmediateSuccessOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml index fa92a6dace..debfcbd8be 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/headers-repeatability" + name: "@unbranded/headers-repeatability" diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts index 1cdcb34aa9..d15514dbc2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface And { name: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml index fdfa61f010..a1286921ea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: SpecialWordsClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/special-words" + name: "@unbranded/special-words" description: "Special Words Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts index 6cbb0f1789..e911c2d87d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ArrayClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml index 56f18cfab5..18c62164b8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml @@ -5,9 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/arrays-item-types" + name: "@unbranded/arrays-item-types" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts index 7f436b2287..108c35088f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanValueGetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml index 60327cff7d..86d23b6456 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml @@ -6,13 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true # temporary only support legacy client for additional properties in modular compatibilityMode: true packageDetails: - name: "@msinternal/dictionary" + name: "@unbranded/dictionary" description: "Dictionary Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts index 0b6947054e..40b84b4b1c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type DaysOfWeekExtensibleEnum = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml index 3566336d74..1d9b3856cf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/extensible-enums" + name: "@unbranded/extensible-enums" description: "Extensible Enums Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts index f5fe843f17..0070af7269 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type DaysOfWeekEnum = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml index 8e3a29dd9b..1dcd2bde62 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/fixed-enums" + name: "@unbranded/fixed-enums" description: "Enums Fixed Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts index ef81818e57..2952fce930 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class EmptyClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml index ae7bacef86..f13882436f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/modular-model-empty" + name: "@unbranded/modular-model-empty" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts index 20a1c6d030..b774295bc5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Cobra extends Snake { kind: "cobra"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml index 073a21294e..4878328125 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-enum-discriminator" + name: "@unbranded/model-inheritance-enum-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts index 64bf16dfe4..7aa7b91781 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Fish { kind: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml index 7b0bdf9fb7..a47a9d1922 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-nested-discriminator" + name: "@unbranded/model-inheritance-nested-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts index b41328d759..77493a6b73 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Cat extends Pet { age: number; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml index 28df6de8d9..c6bb13e460 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-not-discriminated" + name: "@unbranded/model-inheritance-not-discriminated" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts index c6777a5ecb..fe19c5b9da 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; declare interface Element_2 { extension?: Extension[]; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml index e8efa39fb6..dcead3e1b9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/model-inheritance-recursive" + name: "@unbranded/model-inheritance-recursive" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts index 1af2d7be19..9b0283851f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Bird { kind: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml index 3e48c59304..74614eaf05 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-single-discriminator" + name: "@unbranded/model-inheritance-single-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts index 6331da3ee0..dd6ad6fec4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface InputAndOutputOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml index 4772e70667..8651b4dc59 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/modular-model-usage" + name: "@unbranded/modular-model-usage" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts index 2fdba31b3f..485b4ca5ea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BytesGetNonNullOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml index 989ea7a2ef..f5d1643bf9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml @@ -6,13 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true # temporary only support legacy client for additional properties in modular compatibilityMode: true packageDetails: - name: "@msinternal/nullable-property" + name: "@unbranded/nullable-property" description: "nullable Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts index 464c6a85a1..aaad74b0f6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanLiteralGetAllOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml index d655511f02..8fa990db33 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml @@ -6,13 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true # temporary only support legacy client for additional properties in modular compatibilityMode: true packageDetails: - name: "@msinternal/optional-property" + name: "@unbranded/optional-property" description: "Optional Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts index 857c4d2a2e..a3bae4b194 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanGetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml index d34d405313..77f5e79bea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/modular-model-propertyTypes" + name: "@unbranded/modular-model-propertyTypes" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts index 8c32ce0c65..2069909b63 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanGetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml index a5c5386cb0..1d16764ce9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: ScalarClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/scalar" + name: "@unbranded/scalar" description: "Scalar client" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts index 0ffaeba05f..13b4e108e6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Cat { name: string; @@ -56,7 +56,7 @@ export declare interface IntsOnlySendOptionalParams extends OperationOptions { export declare enum KnownStringExtensibleNamedUnion { OptionB = "b", - C = "c" + c = "c" } export declare interface MixedLiteralsCases { diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml index e32cbbb3e4..c2ca9fa639 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml @@ -6,12 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: UnionClient - isModularLibrary: true hierarchyClient: false experimentalExtensibleEnums: true packageDetails: - name: "@msinternal/union" + name: "@unbranded/union" description: "Union client" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts index 94789a31a6..0f38becee2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class AddedClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml index 6a3383b3fa..8c1436a662 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningAddedClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-added" + name: "@unbranded/versionning-added" description: "Versioning Added Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts index 329eb2b8a6..4b88e972eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class MadeOptionalClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml index 8a6c24db34..353ca983d5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningMadeOptionalClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-madeOptional" + name: "@unbranded/versionning-madeOptional" description: "Versioning MadeOptional Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts index 03b965f7ce..a68817b5c5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type EnumV2 = "enumMemberV2"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml index 2fe3f4e2f9..d7369441b1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningRemovedClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-removed" + name: "@unbranded/versionning-removed" description: "Versioning Removed Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts index f1ed550f89..30e3a64b80 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type NewEnum = "newEnumMember"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml index 51ae79d53c..0ad76c8428 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningRenamedFromClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-renamedFrom" + name: "@unbranded/versionning-renamedFrom" description: "Versioning Renamed Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts index ada90270f7..e210698c60 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ReturnTypeChangedFromClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml index e775c589bd..23208274c7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningReturnTypeChangedFromClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-returnTypeChangedFrom" + name: "@unbranded/versionning-returnTypeChangedFrom" description: "Versioning ReturnTypeChanged Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts index 59c28ab532..92624395bd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface TestModel { prop: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml index 2dfcc997a6..7bdd7224e1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningTypeChangedFromClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-typeChangedFrom" + name: "@unbranded/versionning-typeChangedFrom" description: "Versioning TypeChanged Test Service"