forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeGen from PR 29440 in Azure/azure-rest-api-specs
Merge 02b541d35fc6862db3f7955cd6178b61635ba4f4 into 30c95a2a424a347f27ac78b6bdefd37f71314b7e
- Loading branch information
SDKAuto
committed
Jun 14, 2024
1 parent
090184d
commit 9f86b7c
Showing
20 changed files
with
168 additions
and
263 deletions.
There are no files selected for viewing
25 changes: 19 additions & 6 deletions
25
sdk/communication/communication-messages-rest/api-extractor.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
"mainEntryPointFilePath": "./types/src/index.d.ts", | ||
"docModel": { "enabled": true }, | ||
"apiReport": { "enabled": true, "reportFolder": "./review" }, | ||
"docModel": { | ||
"enabled": true | ||
}, | ||
"apiReport": { | ||
"enabled": true, | ||
"reportFolder": "./review" | ||
}, | ||
"dtsRollup": { | ||
"enabled": true, | ||
"untrimmedFilePath": "", | ||
"publicTrimmedFilePath": "./types/communication-messages.d.ts" | ||
}, | ||
"messages": { | ||
"tsdocMessageReporting": { "default": { "logLevel": "none" } }, | ||
"tsdocMessageReporting": { | ||
"default": { | ||
"logLevel": "none" | ||
} | ||
}, | ||
"extractorMessageReporting": { | ||
"ae-missing-release-tag": { "logLevel": "none" }, | ||
"ae-unresolved-link": { "logLevel": "none" } | ||
"ae-missing-release-tag": { | ||
"logLevel": "none" | ||
}, | ||
"ae-unresolved-link": { | ||
"logLevel": "none" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,4 +121,4 @@ | |
"azure-communication-services" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
sdk/communication/communication-messages-rest/src/generated/src/index.ts
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
sdk/communication/communication-messages-rest/src/generated/src/messagesServiceClient.ts
This file was deleted.
Oops, something went wrong.
20 changes: 11 additions & 9 deletions
20
sdk/communication/communication-messages-rest/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import MessagesServiceClient from "./messagesServiceClient"; | ||
export * from "./generated/src/messagesServiceClient"; | ||
export * from "./generated/src/parameters"; | ||
export * from "./generated/src/responses"; | ||
export * from "./generated/src/clientDefinitions"; | ||
export * from "./generated/src/isUnexpected"; | ||
export * from "./generated/src/models"; | ||
export * from "./generated/src/outputModels"; | ||
export * from "./generated/src/paginateHelper"; | ||
import MessagesServiceClient from "./messagesServiceClient.js"; | ||
|
||
export * from "./messagesServiceClient.js"; | ||
export * from "./parameters.js"; | ||
export * from "./responses.js"; | ||
export * from "./clientDefinitions.js"; | ||
export * from "./isUnexpected.js"; | ||
export * from "./models.js"; | ||
export * from "./outputModels.js"; | ||
export * from "./paginateHelper.js"; | ||
|
||
export default MessagesServiceClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
87 changes: 37 additions & 50 deletions
87
sdk/communication/communication-messages-rest/src/messagesServiceClient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,51 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import { | ||
TokenCredential, | ||
isTokenCredential, | ||
KeyCredential, | ||
isKeyCredential, | ||
} from "@azure/core-auth"; | ||
import { ClientOptions } from "@azure-rest/core-client"; | ||
import { parseClientArguments, createCommunicationAuthPolicy } from "@azure/communication-common"; | ||
import { MessagesServiceClient } from "./generated/src/clientDefinitions"; | ||
import GeneratedAzureCommunicationMessageServiceClient from "./generated/src/messagesServiceClient"; | ||
import { getClient, ClientOptions } from "@azure-rest/core-client"; | ||
import { logger } from "./logger.js"; | ||
import { TokenCredential, KeyCredential } from "@azure/core-auth"; | ||
import { MessagesServiceClient } from "./clientDefinitions.js"; | ||
|
||
/** | ||
* Initialize a new instance of `MessagesServiceClient` | ||
* @param connectionString - The connectionString or url of your Communication Services resource. | ||
* @param options - the parameter for all optional parameters | ||
*/ | ||
export default function createClient( | ||
connectionString: string, | ||
options?: ClientOptions, | ||
): MessagesServiceClient; | ||
|
||
/** | ||
* Initialize a new instance of `MessagesServiceClient` | ||
* @param endpoint - The endpoint of your Communication Services resource. | ||
* @param credential - The key or token credential. | ||
* @param options - the parameter for all optional parameters | ||
*/ | ||
export default function createClient( | ||
endpoint: string, | ||
credential: KeyCredential | TokenCredential, | ||
options?: ClientOptions, | ||
): MessagesServiceClient; | ||
|
||
/** | ||
* Initialize a new instance of `MessagesServiceClient` | ||
* @param endpoint - The communication resource, for example https://my-resource.communication.azure.com | ||
* @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com | ||
* @param credentials - uniquely identify client credential | ||
* @param options - the parameter for all optional parameters | ||
*/ | ||
export default function createClient( | ||
endpointOrConnectionString: string, | ||
credentialOrOptions?: ClientOptions | (TokenCredential | KeyCredential), | ||
options?: ClientOptions, | ||
endpointParam: string, | ||
credentials: TokenCredential | KeyCredential, | ||
options: ClientOptions = {}, | ||
): MessagesServiceClient { | ||
if (!(isTokenCredential(credentialOrOptions) || isKeyCredential(credentialOrOptions))) { | ||
options = credentialOrOptions as ClientOptions; | ||
} | ||
|
||
if (options === undefined) { | ||
options = {}; | ||
} | ||
|
||
const { url, credential } = parseClientArguments(endpointOrConnectionString, credentialOrOptions); | ||
const baseUrl = options.baseUrl ?? `${url}`; | ||
|
||
const client = GeneratedAzureCommunicationMessageServiceClient(baseUrl, credential, options); | ||
const authPolicy = createCommunicationAuthPolicy(credential); | ||
client.pipeline.addPolicy(authPolicy); | ||
const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`; | ||
options.apiVersion = options.apiVersion ?? "2024-02-01"; | ||
const userAgentInfo = `azsdk-js-communication-messages-rest/1.0.0-beta.2`; | ||
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://communication.azure.com/.default", | ||
], | ||
apiKeyHeaderName: | ||
options.credentials?.apiKeyHeaderName ?? "Authorization", | ||
}, | ||
}; | ||
|
||
const client = getClient( | ||
endpointUrl, | ||
credentials, | ||
options, | ||
) as MessagesServiceClient; | ||
|
||
return client; | ||
} |
Oops, something went wrong.