Skip to content

Commit 95fc7ee

Browse files
samples: add more TS samples (#1666)
* samples: work in progress on sample conversion to TS * chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport (#1663) * chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java) PiperOrigin-RevId: 493113566 Source-Link: googleapis/googleapis@758f0d1 Source-Link: googleapis/googleapis-gen@78bd8f0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Megan Potter <57276408+feywind@users.noreply.github.com> * build: use typeless bot 1.2.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * build: also run fix before README generation * samples: add missing validateSchema.ts, and fix copyright dates in setTopicPolicy * build: use hermetic version of gts for owlbot * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * samples: update copyright * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * samples: manually update validateSchema since it's not technically sample snippet * chore: update typeless bot version * chore: linting updates * samples: update module export method for resumePublish.ts * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent fb6d530 commit 95fc7ee

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

handwritten/pubsub/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async function quickstart(
9696
});
9797

9898
// Send a message to the topic
99-
topic.publish(Buffer.from('Test message!'));
99+
topic.publishMessage({data: Buffer.from('Test message!')});
100100
}
101101

102102
```
@@ -174,6 +174,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree
174174
| Test Subscription Permissions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/testSubscriptionPermissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/testSubscriptionPermissions.js,samples/README.md) |
175175
| Test Topic Permissions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/testTopicPermissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/testTopicPermissions.js,samples/README.md) |
176176
| Update Dead Letter Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/updateDeadLetterPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/updateDeadLetterPolicy.js,samples/README.md) |
177+
| Validate a schema definition | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/validateSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/validateSchema.js,samples/README.md) |
177178

178179

179180

handwritten/pubsub/owlbot.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,31 @@
1717
# This code snippet can be used to manually update the typeless bot
1818
# to a different version than OwlBot has baked in, but this shouldn't
1919
# be needed once it's settled down.
20-
"""
2120
import os
2221
from synthtool import shell
2322
from synthtool.log import logger
2423
old_path = os.getcwd()
2524
os.chdir("/synthtool")
26-
logger.debug("Update typeless sample bot [1.1.0]")
27-
shell.run(["npm", "i", "@google-cloud/typeless-sample-bot@1.1.0"])
25+
logger.debug("Update typeless sample bot [1.3.0]")
26+
shell.run(["npm", "i", "@google-cloud/typeless-sample-bot@1.3.0"])
2827
os.chdir(old_path)
29-
"""
3028

3129
node.typeless_samples_hermetic()
3230

31+
# We need to run this before the main owlbot processing, to make
32+
# sure quickstart.js gets gts fixed before the README is generated.
33+
# This needs to be worked out more properly, this is temporary.
34+
logger.debug("Copy eslint config")
35+
shell.run(
36+
["cp", "-r", f"/synthtool/node_modules", "."],
37+
check=True,
38+
)
39+
logger.debug("Running fix...")
40+
shell.run(
41+
[f"/synthtool/node_modules/.bin/gts", "fix"],
42+
check=False,
43+
)
44+
3345
node.owlbot_main(templates_excludes=[
3446
'src/index.ts',
3547
'.github/PULL_REQUEST_TEMPLATE.md',

0 commit comments

Comments
 (0)