Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade V6 SDK Generator Version for Text Analytics #13359

Merged
merged 1 commit into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export interface HealthcareSuccessResult extends TextAnalyticsSuccessResult {
export type HealthPollerLike = PollerLike<BeginAnalyzeHealthcareOperationState, PaginatedHealthcareEntities>;

// @public
export type InnerErrorCodeValue = "InvalidParameterValue" | "InvalidRequestBodyFormat" | "EmptyRequest" | "MissingInputRecords" | "InvalidDocument" | "ModelVersionIncorrect" | "InvalidDocumentBatch" | "UnsupportedLanguageCode" | "InvalidCountryHint" | string;
export type InnerErrorCodeValue = string;

// @public
export interface JobManifestTasks {
Expand All @@ -229,6 +229,44 @@ export interface KeyPhrasesTask {
modelVersion?: string;
}

// @public
export const enum KnownInnerErrorCodeValue {
// (undocumented)
Copy link
Member Author

@sarangan12 sarangan12 Jan 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (undocumented) is part of the generated code that comes from the swagger. And Adding documentation for enum values does not make much sense. So, I think this is acceptable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sarangan12! I wonder why this enum is not generated as a union of string as before but without unioning with string of course?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new method. For any extensible enums we define it simply as a string and take the allowed values and put it enum just as above. We export both the values

EmptyRequest = "EmptyRequest",
// (undocumented)
InvalidCountryHint = "InvalidCountryHint",
// (undocumented)
InvalidDocument = "InvalidDocument",
// (undocumented)
InvalidDocumentBatch = "InvalidDocumentBatch",
// (undocumented)
InvalidParameterValue = "InvalidParameterValue",
// (undocumented)
InvalidRequestBodyFormat = "InvalidRequestBodyFormat",
// (undocumented)
MissingInputRecords = "MissingInputRecords",
// (undocumented)
ModelVersionIncorrect = "ModelVersionIncorrect",
// (undocumented)
UnsupportedLanguageCode = "UnsupportedLanguageCode"
}

// @public
export const enum KnownPiiTaskParametersDomain {
// (undocumented)
None = "none",
// (undocumented)
Phi = "phi"
}

// @public
export const enum KnownWarningCode {
// (undocumented)
DocumentTruncated = "DocumentTruncated",
// (undocumented)
LongWordsInDocument = "LongWordsInDocument"
}

// @public
export interface LinkedEntity {
bingEntitySearchApiId?: string;
Expand Down Expand Up @@ -290,7 +328,7 @@ export type PiiTask = {
};

// @public
export type PiiTaskParametersDomain = "phi" | "none" | string;
export type PiiTaskParametersDomain = string;

// @public
export interface PollingOptions {
Expand Down Expand Up @@ -483,7 +521,7 @@ export interface TextDocumentStatistics {
export type TokenSentimentValue = "positive" | "mixed" | "negative";

// @public
export type WarningCode = "LongWordsInDocument" | "DocumentTruncated" | string;
export type WarningCode = string;


// (No @packageDocumentation comment for this package)
Expand Down
106 changes: 58 additions & 48 deletions sdk/textanalytics/ai-text-analytics/src/generated/generatedClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
GeneratedClientSentimentResponse
} from "./models";

/** @hidden */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to replace @hidden with @internal here because we want to reserve @hidden for definitions that are supposed to be exported to the user but we still do not want them showing up in the docs. I can make this change later in the code generator after I replace all @hidden tags in the SDK repo first.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. I will fix it today.

export class GeneratedClient extends GeneratedClientContext {
/**
* Initializes a new instance of the GeneratedClient class.
Expand All @@ -55,11 +56,11 @@ export class GeneratedClient extends GeneratedClientContext {
analyze(
options?: GeneratedClientAnalyzeOptionalParams
): Promise<GeneratedClientAnalyzeResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ options: operationOptions },
operationArguments,
analyzeOperationSpec
) as Promise<GeneratedClientAnalyzeResponse>;
}
Expand All @@ -75,11 +76,12 @@ export class GeneratedClient extends GeneratedClientContext {
jobId: string,
options?: GeneratedClientAnalyzeStatusOptionalParams
): Promise<GeneratedClientAnalyzeStatusResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
jobId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ jobId, options: operationOptions },
operationArguments,
analyzeStatusOperationSpec
) as Promise<GeneratedClientAnalyzeStatusResponse>;
}
Expand All @@ -93,11 +95,12 @@ export class GeneratedClient extends GeneratedClientContext {
jobId: string,
options?: GeneratedClientHealthStatusOptionalParams
): Promise<GeneratedClientHealthStatusResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
jobId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ jobId, options: operationOptions },
operationArguments,
healthStatusOperationSpec
) as Promise<GeneratedClientHealthStatusResponse>;
}
Expand All @@ -111,11 +114,12 @@ export class GeneratedClient extends GeneratedClientContext {
jobId: string,
options?: coreHttp.OperationOptions
): Promise<GeneratedClientCancelHealthJobResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
jobId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ jobId, options: operationOptions },
operationArguments,
cancelHealthJobOperationSpec
) as Promise<GeneratedClientCancelHealthJobResponse>;
}
Expand All @@ -130,11 +134,12 @@ export class GeneratedClient extends GeneratedClientContext {
input: MultiLanguageBatchInput,
options?: GeneratedClientHealthOptionalParams
): Promise<GeneratedClientHealthResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
input,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ input, options: operationOptions },
operationArguments,
healthOperationSpec
) as Promise<GeneratedClientHealthResponse>;
}
Expand All @@ -151,11 +156,12 @@ export class GeneratedClient extends GeneratedClientContext {
input: MultiLanguageBatchInput,
options?: GeneratedClientEntitiesRecognitionGeneralOptionalParams
): Promise<GeneratedClientEntitiesRecognitionGeneralResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
input,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ input, options: operationOptions },
operationArguments,
entitiesRecognitionGeneralOperationSpec
) as Promise<GeneratedClientEntitiesRecognitionGeneralResponse>;
}
Expand All @@ -173,11 +179,12 @@ export class GeneratedClient extends GeneratedClientContext {
input: MultiLanguageBatchInput,
options?: GeneratedClientEntitiesRecognitionPiiOptionalParams
): Promise<GeneratedClientEntitiesRecognitionPiiResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
input,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ input, options: operationOptions },
operationArguments,
entitiesRecognitionPiiOperationSpec
) as Promise<GeneratedClientEntitiesRecognitionPiiResponse>;
}
Expand All @@ -193,11 +200,12 @@ export class GeneratedClient extends GeneratedClientContext {
input: MultiLanguageBatchInput,
options?: GeneratedClientEntitiesLinkingOptionalParams
): Promise<GeneratedClientEntitiesLinkingResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
input,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ input, options: operationOptions },
operationArguments,
entitiesLinkingOperationSpec
) as Promise<GeneratedClientEntitiesLinkingResponse>;
}
Expand All @@ -213,11 +221,12 @@ export class GeneratedClient extends GeneratedClientContext {
input: MultiLanguageBatchInput,
options?: GeneratedClientKeyPhrasesOptionalParams
): Promise<GeneratedClientKeyPhrasesResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
input,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ input, options: operationOptions },
operationArguments,
keyPhrasesOperationSpec
) as Promise<GeneratedClientKeyPhrasesResponse>;
}
Expand All @@ -234,11 +243,12 @@ export class GeneratedClient extends GeneratedClientContext {
input: LanguageBatchInput,
options?: GeneratedClientLanguagesOptionalParams
): Promise<GeneratedClientLanguagesResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
input,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ input, options: operationOptions },
operationArguments,
languagesOperationSpec
) as Promise<GeneratedClientLanguagesResponse>;
}
Expand All @@ -254,17 +264,17 @@ export class GeneratedClient extends GeneratedClientContext {
input: MultiLanguageBatchInput,
options?: GeneratedClientSentimentOptionalParams
): Promise<GeneratedClientSentimentResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
const operationArguments: coreHttp.OperationArguments = {
input,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
};
return this.sendOperationRequest(
{ input, options: operationOptions },
operationArguments,
sentimentOperationSpec
) as Promise<GeneratedClientSentimentResponse>;
}
}
// Operation Specifications

const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false);

const analyzeOperationSpec: coreHttp.OperationSpec = {
Expand Down Expand Up @@ -311,7 +321,7 @@ const analyzeStatusOperationSpec: coreHttp.OperationSpec = {
Parameters.skip
],
urlParameters: [Parameters.endpoint, Parameters.jobId],
headerParameters: [Parameters.accept1],
headerParameters: [Parameters.accept],
serializer
};
const healthStatusOperationSpec: coreHttp.OperationSpec = {
Expand All @@ -336,7 +346,7 @@ const healthStatusOperationSpec: coreHttp.OperationSpec = {
Parameters.skip
],
urlParameters: [Parameters.endpoint, Parameters.jobId1],
headerParameters: [Parameters.accept1],
headerParameters: [Parameters.accept],
serializer
};
const cancelHealthJobOperationSpec: coreHttp.OperationSpec = {
Expand All @@ -356,7 +366,7 @@ const cancelHealthJobOperationSpec: coreHttp.OperationSpec = {
}
},
urlParameters: [Parameters.endpoint, Parameters.jobId1],
headerParameters: [Parameters.accept1],
headerParameters: [Parameters.accept],
serializer
};
const healthOperationSpec: coreHttp.OperationSpec = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { GeneratedClientOptionalParams } from "./models";
const packageName = "@azure/ai-text-analytics";
const packageVersion = "5.1.0-beta.3";

/** @hidden */
export class GeneratedClientContext extends coreHttp.ServiceClient {
endpoint: string;

Expand Down
Loading