Skip to content

Commit 500413c

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

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
/// ```
20+
/// # use {{Service.Model.Codec.PackageNamespace}}::client::{{Service.Codec.Name}};
21+
/// async fn sample(
22+
{{> /templates/common/client_method_samples/parameters}}
23+
/// ) -> gax::Result<()> {
24+
{{#ReturnsEmpty}}
25+
/// client
26+
/// .{{Codec.Name}}()
27+
{{> /templates/common/client_method_samples/builder_fields}}
28+
/// .send()
29+
/// .await?;
30+
{{/ReturnsEmpty}}
31+
{{^ReturnsEmpty}}
32+
/// let response = client
33+
/// .{{Codec.Name}}()
34+
{{> /templates/common/client_method_samples/builder_fields}}
35+
/// .send()
36+
/// .await?;
37+
/// println!("response {:?}", response);
38+
{{/ReturnsEmpty}}
39+
/// Ok(())
40+
/// }
41+
/// ```
42+
{{/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)