Skip to content

Commit

Permalink
fix readme.md (#24055)
Browse files Browse the repository at this point in the history
* update files

* Update README.md
  • Loading branch information
kazrael2119 authored Nov 30, 2022
1 parent 11f1fb3 commit 2484aa3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
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

0 comments on commit 2484aa3

Please sign in to comment.