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

fix readme.md #24055

Merged
merged 2 commits into from
Nov 30, 2022
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
12 changes: 6 additions & 6 deletions sdk/loadtestservice/load-testing-rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ import { DefaultAzureCredential } from "@azure/identity";
var TEST_ID = "some-test-id";
var DISPLAY_NAME = "my-load-test";

const Client: AzureLoadTestingClient = AzureLoadTesting(Endpoint, new DefaultAzureCredential());
const client: AzureLoadTestingClient = AzureLoadTesting(Endpoint, new DefaultAzureCredential());

await Client.path("/loadtests/{testId}", TEST_ID).patch({
await client.path("/loadtests/{testId}", TEST_ID).patch({
contentType: "application/merge-patch+json",
body: {
displayName: DISPLAY_NAME,
Expand All @@ -128,9 +128,9 @@ var TEST_ID = "some-test-id";
var FILE_ID = "some-file-id";
const readStream = createReadStream("./sample.jmx");

const Client: AzureLoadTestingClient = AzureLoadTesting(Endpoint, new DefaultAzureCredential());
const client: AzureLoadTestingClient = AzureLoadTesting(Endpoint, new DefaultAzureCredential());

await Client.path("/loadtests/{testId}/files/{fileId}", TEST_ID, FILE_ID).put({
await client.path("/loadtests/{testId}/files/{fileId}", TEST_ID, FILE_ID).put({
contentType: "multipart/form-data",
body: {
file: readStream,
Expand All @@ -148,9 +148,9 @@ var TEST_ID = "some-test-id";
var TEST_RUN_ID = "some-testrun-id";
var DISPLAY_NAME = "my-load-test-run";

const Client: AzureLoadTestingClient = AzureLoadTesting(Endpoint, new DefaultAzureCredential());
const client: AzureLoadTestingClient = AzureLoadTesting(Endpoint, new DefaultAzureCredential());

await Client.path("/testruns/{testRunId}", TEST_RUN_ID).patch({
await client.path("/testruns/{testRunId}", TEST_RUN_ID).patch({
contentType: "application/merge-patch+json",
body: {
testId: TEST_ID,
Expand Down
21 changes: 11 additions & 10 deletions sdk/maps/maps-route-rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ You can authenticate with your Azure Maps Subscription Key.

```javascript
const MapsRoute = require("@azure-rest/maps-route").default;
const { AzureKeyCredential } = require("@azure-core-auth");
const { AzureKeyCredential } = require("@azure/core-auth");

const credential = new AzureKeyCredential("<subscription-key>");
const client = MapsRoute(credential);
Expand All @@ -89,15 +89,15 @@ To retrieve the route direction, you need to pass in the parameters the coordina
By default, the Route service will return an array of coordinates. The response will contain the coordinates that make up the path in a list named points. Route response also includes the distance from the start of the route and the estimated elapsed time. These values can be used to calculate the average speed for the entire route.

```javascript
const routeDirectionsResult = await client.path("/route/directions/{format}", "json").get({
let routeDirectionsResult = await client.path("/route/directions/{format}", "json").get({
queryParameters: {
query: "51.368752,-0.118332:41.385426,-0.128929",
},
});

// You can use the helper function `toColonDelimitedLatLonString` to compose the query string.
const { toColonDelimitedLatLonString } = require("@azure-rest/maps-route");
const routeDirectionsResult = await client.path("/route/directions/{format}", "json").get({
routeDirectionsResult = await client.path("/route/directions/{format}", "json").get({
queryParameters: {
query: toColonDelimitedLatLonString([
// Origin:
Expand All @@ -117,16 +117,17 @@ if (isUnexpected(routeDirectionsResult)) {
throw routeDirectionsResult.body.error;
}

const { summary, legs } = routeDirectionsResult.body.routes;
const { summary, legs } = routeDirectionsResult.body.routes[0];
console.log(
`The total distance is ${summary.lengthInMeters} meters, and it takes ${summary.travelTimeInSeconds} seconds.`
);

legs.points.forEach(({ summary: { travelTimeInSeconds }, points }, idx) => {
console.log(`${idx + 1}th leg takes ${travelTimeInSeconds} seconds to travel, and the path is: `);
points.points.forEach(({ latitude, longitude }, idx) =>
console.log(`${idx}: (${latitude}, ${longitude})`)
});
legs.forEach(({ summary: { travelTimeInSeconds }, points }, idx) => {
console.log(`${idx + 1}th leg takes ${travelTimeInSeconds} seconds to travel, and the path is: `);
console.log("111111111111",points);
points.forEach(({ latitude, longitude }, idx) =>
console.log(`${idx}: (${latitude}, ${longitude})`))
});
```

### Request a route for a commercial vehicle
Expand Down Expand Up @@ -208,7 +209,7 @@ console.log(
`The optimized distance is ${summary.lengthInMeters} meters, and it takes ${summary.travelTimeInSeconds} seconds.`
);
console.log("The route is optimized by: ");
routeDirectionsResult.body.routes.optimizedWaypoints.forEach(
routeDirectionsResult.body.optimizedWaypoints.forEach(
({ providedIndex, optimizedIndex }) => `Moving index ${providedIndex} to ${optimizedIndex}`
);
```
Expand Down