Skip to content

Commit 919997f

Browse files
committed
feat(sidekick): Add very simple RPC samples for simple methods
1 parent d08ccc8 commit 919997f

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

internal/sidekick/rust/templates/common/client_method_preamble.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ limitations under the License.
2828
/// [user guide]: https://googleapis.github.io/google-cloud-rust/
2929
/// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3030
{{/OperationInfo}}
31+
{{> /templates/common/client_method_samples/client_method_sample}}
3132
{{#Deprecated}}
3233
#[deprecated]
3334
{{/Deprecated}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{!
2+
Copyright 2025 Google LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
}}
16+
/// /* set fields */
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{!
2+
Copyright 2025 Google LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
}}
16+
{{#IsSimple}}
17+
///
18+
/// # Example
19+
/// # use {{Service.Model.Codec.PackageNamespace}}::client::{{Service.Codec.Name}};
20+
/// async fn sample(
21+
{{> /templates/common/client_method_samples/parameters}}
22+
/// ) -> gax::Result<()> {
23+
{{#ReturnsEmpty}}
24+
/// client
25+
{{/ReturnsEmpty}}
26+
{{^ReturnsEmpty}}
27+
/// let response = client
28+
{{/ReturnsEmpty}}
29+
/// .{{Codec.Name}}()
30+
{{> /templates/common/client_method_samples/builder_fields}}
31+
/// .send()
32+
{{#ReturnsEmpty}}
33+
/// .await;
34+
{{/ReturnsEmpty}}
35+
{{^ReturnsEmpty}}
36+
/// .await?;
37+
/// println!("response {:?}", response);
38+
{{/ReturnsEmpty}}
39+
/// Ok(());
40+
/// }
41+
{{/IsSimple}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{!
2+
Copyright 2025 Google LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
}}
16+
/// client: &{{Service.Codec.Name}}

0 commit comments

Comments
 (0)