Skip to content

Commit 2152ddc

Browse files
committed
address jose's comments
1 parent 347e7fb commit 2152ddc

File tree

8 files changed

+25
-60
lines changed

8 files changed

+25
-60
lines changed

Diff for: docs/client/initializing.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ Next, on to initialization. Your constructor can take any number of parameters.
2222
```js
2323
import { PetsClient } from "@azure/pets";
2424

25-
let client: PetsClient;
26-
27-
client = new PetsClient();
25+
const client: PetsClient = new PetsClient();
2826
```
2927

3028
If you generate with flag `--add-credentials`, your client wil be generated with an [Azure Active Directory (AAD) token credential][aad_authentication]. We always recommend
@@ -37,9 +35,7 @@ As an installation note, the [`@azure/identity`][azure_identity_library] library
3735
import { DefaultAzureCredential } from "@azure/identity";
3836
import { PetsClient } from "@azure/pets";
3937

40-
let client: PetsClient;
41-
42-
client = new PetsClient(new DefaultAzureCredential());
38+
const client: PetsClient = new PetsClient(new DefaultAzureCredential());
4339
```
4440

4541
<!-- LINKS -->

Diff for: docs/client/models.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22

33
## General
44

5-
Models and enums are generated in the `models` namespace. So, say you are using package `@azure/pets`. To access model `Dog`, you would use the following code
5+
Models and enums are generated in the `models` module. So, say you are using package `@azure/pets`. To access model `Dog`, you would use the following code
66
snippet
77

88
```js
9-
import { Dog } from "@azure/pets.models";
9+
import { Dog } from "@azure/pets";
1010
```
1111

1212
Enums are also listed in the `models` namespace, so say you have enum class `DogTypes`. To access the `Dalmation` enum, your code would look like
1313

1414
```js
15-
import { DogTypes } from "@azure/pets.models";
15+
import { DogTypes } from "@azure/pets";
1616

17-
let dogType: str;
18-
19-
dogType = DogTypes.Dalmation;
17+
const dogType: str = DogTypes.Dalmation;
2018
```

Diff for: docs/client/operations.md

+7-33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# <img align="center" src="../images/logo.png"> Calling Operations with Your Typescript Client
22

3-
AutoRest provides both synchronous and asynchronous method overloads for each service operation.
3+
AutoRest provides asynchronous method overloads for each service operation.
44
Depending on your swagger definition, operations can be accessed through operation groups (TODO: link to swagger docs) on the client,
55
or directly on the client.
66

@@ -14,22 +14,13 @@ itself, i.e. `client.getDog()`.
1414

1515
## Regular Operations
1616

17-
### Sync Operations
18-
19-
We don't generate sync operations, all of our operations are async.
20-
21-
### Async Operations
22-
23-
When calling our async operations, we use our async client, which is in a different module. Following the [example above](#sync-operations Sync Operations),
24-
our call to `getDog` looks like this:
17+
When calling our async operations, we go through our client
2518

2619
```js
2720
import { DefaultAzureCredential } from "@azure/identity";
2821
import { PetsClient } from "@azure/pets";
2922

30-
let client: PetsClient;
31-
32-
client = new PetsClient(new DefaultAzureCredential());
23+
const client: PetsClient = new PetsClient(new DefaultAzureCredential());
3324
const dog = await client.getDog();
3425
```
3526

@@ -41,25 +32,16 @@ In concurrence with our [typescript guidelines][poller_guidelines], all of our l
4132

4233
For our example, we will use the long running operation generated from [this][example_swagger] swagger. Let's say we generated this swagger with package name `@azure/lro`.
4334

44-
### Sync Long Running Operations
45-
46-
We don't generate sync operations, all of our operations are async.
47-
48-
### Async Long Running Operations
49-
5035
By default, our async long running operations return an [`Poller`][poller] polling object, though there [are ways][custom_poller] of changing this. Calling `.pollUntilDone()`
5136
on the poller will wait until the long running operation finishes then return the final result.
5237

5338
```js
5439
import { DefaultAzureCredential } from "@azure/identity";
5540
import { Product, PollingPagingExampleClient } from "@azure/lro";
5641

57-
let client: PollingPagingExampleClient;
58-
let inputProduct: Product;
59-
60-
client = new PollingPagingExampleClient(new DefaultAzureCredential());
42+
const client: PollingPagingExampleClient = new PollingPagingExampleClient(new DefaultAzureCredential());
6143

62-
inputProduct = {
44+
const inputProduct: Product = {
6345
id: 1;
6446
name: "My Polling example"
6547
};
@@ -75,23 +57,15 @@ is initially called.
7557

7658
For our example, we will use the long running operation generated from [this][example_swagger] swagger. Let's say we generated this swagger with package name `@azure/paging`.
7759

78-
### Sync Paging Operations
79-
80-
We don't generate sync operations, all of our operations are async.
81-
82-
### Async Paging Operations
83-
84-
By default, our sync paging operations return an [`PagedAsyncIterableIterator`][paged_async_iterable_iterator] pager. Since network calls aren't
60+
By default, our async paging operations return an [`PagedAsyncIterableIterator`][paged_async_iterable_iterator] pager. Since network calls aren't
8561
made until starting to page, our generated operation is synchronous, and there's no need to wait the initial call to the function. Since network calls are made when iterating,
8662
we have to do async looping.
8763

8864
```js
8965
import { DefaultAzureCredential } from "@azure/identity";
9066
import { PollingPagingExampleClient } from "@azure/paging";
9167

92-
let client: PollingPagingExampleClient;
93-
94-
client = new PollingPagingExampleClient(new DefaultAzureCredential());
68+
const client: PollingPagingExampleClient = new PollingPagingExampleClient(new DefaultAzureCredential());
9569

9670
const pager = client.basicPaging();
9771
for await (const product of pager) {

Diff for: docs/client/tracing.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Since there is no explicit context you need to pass, you can create your usual O
1818
The following example uses the [Zipkin][zipkin] exporter.
1919

2020
```js
21-
const tracing = require("@opencensus/nodejs");
22-
const { ZipkinTraceExporter } = require("@opencensus/exporter-zipkin");
23-
const {
21+
import tracing from "@opencensus/nodejs");
22+
import { ZipkinTraceExporter } from "@opencensus/exporter-zipkin";
23+
import {
2424
setTracer,
2525
OpenCensusTracerWrapper,
2626
OpenCensusSpanWrapper
27-
} = require("@azure/core-tracing");
27+
} from "@azure/core-tracing";
2828

2929
const tracer = tracing.start({ samplingRate: 1 }).tracer;
3030

@@ -46,17 +46,17 @@ tracer.startRootSpan({ name: "root" }, async (rootSpanEx) => {
4646

4747
First step is to install our [`OpenTelemetry` library][our_open_telemetry_library]:
4848

49-
```python
50-
pip install azure-core-tracing-opentelemetry
49+
```bash
50+
npm install --save @azure/core-tracing
5151
```
5252

5353
Since there is no explicit context you need to pass, you can create your usual OpenTelemetry tracer and call the generated SDKs.
5454
The following example uses the [Zipkin][zipkin] exporter.
5555
```js
56-
const opentelemetry = require("@opentelemetry/core");
57-
const { BasicTracer, SimpleSpanProcessor } = require("@opentelemetry/tracing");
58-
const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin");
59-
const { setTracer } = require("@azure/core-tracing");
56+
import opentelemetry from "@opentelemetry/core";
57+
import { BasicTracer, SimpleSpanProcessor } from "@opentelemetry/tracing";
58+
import { ZipkinExporter } = from "@opentelemetry/exporter-zipkin";
59+
import { setTracer } from "@azure/core-tracing";
6060

6161
const exporter = new ZipkinExporter({
6262
serviceName: "azure-tracing-sample"

Diff for: docs/client/troubleshooting.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ A very basic form of error handling looks like this
1010
import { DefaultAzureCredential } from "@azure/identity";
1111
import { PetsClient } from "@azure/pets";
1212

13-
let client: PetsClient;
14-
15-
client = new PetsClient(new DefaultAzureCredential());
13+
const client: PetsClient = new PetsClient(new DefaultAzureCredential());
1614
try {
1715
const dog = await client.getDog();
1816
} catch (err) {

Diff for: docs/faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
1. What version of AutoRest Typescript should I use?
44

5-
CURRENTLY NO AUTOREST TYPESCRIPT ION NPM
5+
CURRENTLY NO AUTOREST TYPESCRIPT ON NPM
66

77
We highly recommend you use the latest AutoRest Typescript version published to [npm][autorest_npm]. The latest version
88
is the default if you use flag `--typescript`, though you may need to run an `autorest --reset` if it seems

Diff for: docs/readme.md

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
These documents are Typescript-specific, see [our main docs][main_docs] for more general information
44

5-
65
1. Generating Typescript Clients with AutoRest
76
- How do I generate code? Main documents are [here][main_generate], while here are the [typescript-specific docs][typescript_generate]
87

File renamed without changes.

0 commit comments

Comments
 (0)