Skip to content

Commit b3ac7b4

Browse files
authored
feat(dart): minor whitespace and doc changes to the Dart templates (#2636)
Minor whitespace and doc changes to the Dart templates: - add some whitespace between field definitions - update doc comments to avoid orphaned trailing lines - normalize the pubspec field order a bit (tracking what we've done in other packages) cc @brianquinlan
1 parent 3be1e3d commit b3ac7b4

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

internal/sidekick/internal/dart/templates/lib/main.dart.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ part '{{Codec.PartFileReference}}';
3636
{{#Codec.HasServices}}
3737
const _apiKeys = [
3838
{{#Codec.ApiKeyEnvironmentVariables}}
39-
"{{{.}}}",
39+
'{{{.}}}',
4040
{{/Codec.ApiKeyEnvironmentVariables}}
4141
];
4242
{{/Codec.HasServices}}

internal/sidekick/internal/dart/templates/lib/method.mustache

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ limitations under the License.
2020
///
2121
/// Throws a [http.ClientException] if there were problems communicating with
2222
/// the API service. Throws a [StatusException] if the API failed with a
23-
/// [Status] message. Throws a [ServiceException] if the API failed for any
24-
/// other reason.
23+
/// [Status] message. Throws a [ServiceException] for any other failure.
2524
{{#Codec.ServerSideStreaming}}
2625
Stream<{{Codec.ResponseType}}> {{Codec.Name}}({{Codec.RequestType}} request) {
2726
final url = Uri.https(_host, '{{PathInfo.Codec.PathFmt}}'

internal/sidekick/internal/dart/templates/lib/service.mustache

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ limitations under the License.
1919
{{/Codec.DocLines}}
2020
final class {{Codec.Name}} {
2121
static const _host = '{{DefaultHost}}';
22+
2223
final ServiceClient _client;
2324
2425
/// Creates a `{{Codec.Name}}` using [client] for transport.
2526
///
2627
/// The provided [http.Client] must be configured to provide whatever
27-
/// authentication is required by `{{Codec.Name}}`. You can do that
28-
/// using
28+
/// authentication is required by `{{Codec.Name}}`. You can do that using
2929
/// [`package:googleapis_auth`](https://pub.dev/packages/googleapis_auth).
3030
{{Codec.Name}}({required http.Client client})
3131
: _client = ServiceClient(client: client);
@@ -34,8 +34,9 @@ final class {{Codec.Name}} {
3434
///
3535
/// If called without arguments, the API key is taken from these environment
3636
/// variables:
37+
///
3738
{{#Model.Codec.ApiKeyEnvironmentVariables}}
38-
/// * `{{{.}}}`
39+
/// - `{{{.}}}`
3940
{{/Model.Codec.ApiKeyEnvironmentVariables}}
4041
///
4142
/// Throws [ArgumentError] if called without arguments and none of the above
@@ -46,7 +47,7 @@ final class {{Codec.Name}} {
4647
apiKey ??= _apiKeys.map(environmentVariable).nonNulls.firstOrNull;
4748
if (apiKey == null) {
4849
throw ArgumentError('apiKey or one of these environment variables must '
49-
'be set to an API key: ${_apiKeys.join(", ")}');
50+
'be set to an API key: ${_apiKeys.join(', ')}');
5051
}
5152
return {{Codec.Name}}(client: auth.clientViaApiKey(apiKey));
5253
}

internal/sidekick/internal/dart/templates/pubspec.yaml.mustache

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ limitations under the License.
2020

2121
name: {{Codec.PackageName}}
2222
description: The Google Cloud client library for the {{{Title}}}.
23+
{{^Codec.DoNotPublish}}
24+
version: {{Codec.PackageVersion}}
25+
{{/Codec.DoNotPublish}}
2326
{{#Codec.RepositoryURL}}
2427
repository: {{Codec.RepositoryURL}}
2528
{{/Codec.RepositoryURL}}
2629
issue_tracker: {{{Codec.IssueTrackerURL}}}
27-
{{^Codec.DoNotPublish}}
28-
version: {{Codec.PackageVersion}}
29-
{{/Codec.DoNotPublish}}
30+
3031
{{#Codec.DoNotPublish}}
3132
publish_to: none
32-
{{/Codec.DoNotPublish}}
3333

34+
{{/Codec.DoNotPublish}}
3435
environment:
3536
sdk: ^3.9.0
3637

0 commit comments

Comments
 (0)