GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add datastore v1beta3 snippets by stephenplusplus · Pull Request #16 · GoogleCloudPlatform/nodejs-docs-samples

Conversation

@stephenplusplus

@stephenplusplus stephenplusplus commented Oct 14, 2015

Copy link
Copy Markdown
Contributor

// @pcostell

To Dos

  • Entities
  • Queries
  • Indexes
  • Transactions
  • Metadata

This is some snippet code in preparation of the datastore v1beta3 release. It's a work in progress, so I wanted to get reviews and guidance on the structure to follow as early as possible.

Some questions:

  • Do we have freedom to use taskKey (convention) vs task_key (snippet spreadsheet) - the linter caught this as an error, and I wasn't sure if either is a hard requirement.
  • gcloud-node doesn't have an Entity type; data that goes or comes from an entity are just plain JavaScript objects, without special capabilities
  • I assume this JavaScript snippet file is meant to be runnable-- as in, instead of dumping out a bunch of vars and function calls, I should box them inside of functions that can be called individually?

Any insight into how the docs are generated from this file, requirements or tips for conventions to follow would be helpful to make sure I get this right. Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pcostell

pcostell commented Oct 14, 2015

Copy link
Copy Markdown
Contributor
  • taskKey is perfectly fine in this context, whatever is language idiomatic.
  • For the case of snippets like basic_entity, just show creating a javascript object with the appropriate fields.
  • Yes, all of our snippets are runnable (and do basic smoke tests to make sure the snippet is correct).

Snippets are handled using different regions. So for the basic_entity region this could look in code something like:

function testBasicEntity() {
  // [START basic_entity]
  var task = { .... };
  // [END basic_entity]
  datastore.put(task); // Just a smoke test to make sure the test doesn't fail.
}

One thing to note about the snippet is that is removes the appropriate whitespace, so don't have to worry about the snippets being at a top level.

In general, if an operation is not possible either provide a comment with a workaround or a comment that says it's not possible. For example some of our clients don't expose the insert command, so instead we show a transaction that does a get, verifies that it fails, then performs a put.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pcostell
pcostell reviewed Oct 14, 2015
View reviewed changes
Comment thread datastore/concepts.js Outdated

@pcostell pcostell Oct 14, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just call these task.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@stephenplusplus
stephenplusplus force-pushed the master branch from f4cc5f0 to 2879377 Compare October 15, 2015 19:04
@stephenplusplus

stephenplusplus commented Oct 15, 2015

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I pushed some updates, let me know if I'm headed in the right direction. (updated first post with todos - feel free to add on)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stephenplusplus
stephenplusplus reviewed Oct 15, 2015
View reviewed changes
Comment thread package.json Outdated

@stephenplusplus stephenplusplus Oct 15, 2015

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(temporary until release: googleapis/google-cloud-node#897)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@stephenplusplus
stephenplusplus force-pushed the master branch from 2879377 to 3b62380 Compare October 15, 2015 20:13
pcostell
pcostell reviewed Oct 16, 2015
View reviewed changes
Comment thread datastore/entity.js Outdated

@pcostell pcostell Oct 16, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's be ok here to do things in a language idomatic way and call this percentComplete.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@theacodes theacodes Oct 16, 2015

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, other node.js + datastore samples use camelCase.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@stephenplusplus stephenplusplus Oct 16, 2015

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@stephenplusplus stephenplusplus Oct 16, 2015

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this will change the indexes though, which are currently:

indexes:
- kind: Task
  properties:
  - name: done
  - name: priority
    direction: desc
- kind: Task
  properties:
  - name: priority
  - name: percent_complete
- kind: Task
  properties:
  - name: type
  - name: priority
- kind: Task
  properties:
  - name: priority
  - name: created
- kind: Task
  properties:
  - name: done
  - name: created
- kind: Task
  properties:
  - name: type
  - name: priority
    direction: desc
- kind: Task
  properties:
  - name: type
  - name: created

I was planning to include that file in this repo, but wherever it goes the percent_complete will have to be changed to match if we camelcase it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pcostell

pcostell commented Oct 16, 2015

Copy link
Copy Markdown
Contributor

So far the entity stuff LGTM

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus
stephenplusplus force-pushed the master branch from 3b62380 to 9d152ef Compare October 19, 2015 17:48
@stephenplusplus

stephenplusplus commented Oct 19, 2015

Copy link
Copy Markdown
Contributor Author

The query files are up, please let me know if things look good.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus
stephenplusplus force-pushed the master branch 3 times, most recently from 67bc340 to fe4f73a Compare October 19, 2015 18:06
pcostell
pcostell reviewed Oct 19, 2015
View reviewed changes
Comment thread datastore/index.js Outdated

@pcostell pcostell Oct 19, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to insert on this snippet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
stephenplusplus added a commit to stephenplusplus/nodejs-docs-samples that referenced this pull request Oct 19, 2015
@stephenplusplus
https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/16#di…
61fbb61
…scussion_r42408072
stephenplusplus added a commit to stephenplusplus/nodejs-docs-samples that referenced this pull request Oct 19, 2015
@stephenplusplus
https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/16#di…
12e40e3
…scussion_r42409314
stephenplusplus added a commit to stephenplusplus/nodejs-docs-samples that referenced this pull request Oct 19, 2015
@stephenplusplus
https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/16#di…
8c19d1a
…scussion_r42409820
@stephenplusplus

stephenplusplus commented Oct 19, 2015

Copy link
Copy Markdown
Contributor Author

@pcostell thanks! I've made the requested changes in the last few commits.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus
stephenplusplus force-pushed the master branch from a86f9df to 5ba5d81 Compare October 20, 2015 01:40
@stephenplusplus

stephenplusplus commented Oct 20, 2015

Copy link
Copy Markdown
Contributor Author

All the sections are covered now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pcostell
pcostell reviewed Oct 20, 2015
View reviewed changes
Comment thread datastore/metadata.js Outdated

@pcostell pcostell Oct 20, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should build (and the other comments) in a language-agnostic way into the docs around the snippets, so no need to include them here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@snyk-bot snyk-bot mentioned this pull request Mar 11, 2022
[Snyk] Upgrade safe-buffer from 5.1.1 to 5.2.1 theWindSweptDev/nodejs-docs-samples#13
Open
NimJay pushed a commit that referenced this pull request Nov 11, 2022
@renovate @JustinBeckwith
chore(deps): lock file maintenance (#16)
b61e866
@NimJay NimJay mentioned this pull request Nov 11, 2022
migrate code from googleapis/nodejs-kms #2839
Merged
ace-n pushed a commit that referenced this pull request Nov 11, 2022
@renovate Ace Nassri
chore(deps): lock file maintenance (#16)
43e82b2
ace-n pushed a commit that referenced this pull request Nov 11, 2022
@jkwlui @JustinBeckwith
nit: Google LLC (#16)
59dd3ca
@ace-n ace-n mentioned this pull request Nov 11, 2022
migrate code from googleapis/nodejs-automl #2841
Merged
ace-n pushed a commit that referenced this pull request Nov 11, 2022
@jkwlui @JustinBeckwith
nit: Google LLC (#16)
7fc2cb9
ace-n pushed a commit that referenced this pull request Nov 14, 2022
@jkwlui Ace Nassri
nit: Google LLC (#16)
adc5445
ace-n pushed a commit that referenced this pull request Nov 15, 2022
@jkwlui Ace Nassri
nit: Google LLC (#16)
77121bb
ace-n pushed a commit that referenced this pull request Nov 15, 2022
@jkwlui Ace Nassri
nit: Google LLC (#16)
fec8580
ace-n pushed a commit that referenced this pull request Nov 17, 2022
@jkwlui Ace Nassri
nit: Google LLC (#16)
d715ca1
ace-n pushed a commit that referenced this pull request Nov 17, 2022
@jkwlui Ace Nassri
nit: Google LLC (#16)
8d11be5
ahrarmonsur pushed a commit that referenced this pull request Nov 17, 2022
@jkwlui Ahrar Monsur
nit: Google LLC (#16)
9feedfc
@kweinmeister kweinmeister mentioned this pull request Nov 18, 2022
migrate code from googleapis/nodejs-text-to-speech #2872
Merged
kweinmeister pushed a commit that referenced this pull request Nov 18, 2022
@alexander-fenster @callmehiphop
chore: lock files maintenance (#16)
7317e04
* chore: lock files maintenance

* chore: lock files maintenance
pattishin pushed a commit that referenced this pull request Nov 18, 2022
@telpirion
feat(samples): adds samples for enhanced version of library (#16)
ea5e774
pattishin pushed a commit that referenced this pull request Nov 18, 2022
@release-please
chore: release 1.3.0 (#39)
4daab03
🤖 I have created a release \*beep\* \*boop\* 
---
## [1.3.0](https://www.github.com/googleapis/nodejs-ai-platform/compare/v1.2.0...v1.3.0) (2021-01-14)


### Features

* **samples:** adds samples for enhanced version of library ([#16](https://www.github.com/googleapis/nodejs-ai-platform/issues/16)) ([aef443c](https://www.github.com/googleapis/nodejs-ai-platform/commit/aef443c41b8a9a2199e0c5b100a5ab91444b0dfe))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@pattishin pattishin mentioned this pull request Nov 18, 2022
migrate code from googleapis/nodejs-ai-platform #2876
Merged
NimJay pushed a commit that referenced this pull request Nov 18, 2022
@renovate-bot @JustinBeckwith
chore(deps): update dependency execa to v2 (#16)
10c3369
@NimJay NimJay mentioned this pull request Nov 18, 2022
migrate code from googleapis/nodejs-datacatalog #2877
Merged
NimJay pushed a commit that referenced this pull request Nov 18, 2022
@renovate-bot @NimJay
chore(deps): update dependency execa to v2 (#16)
b74a346
pattishin pushed a commit that referenced this pull request Nov 22, 2022
@telpirion @pattishin
feat(samples): adds samples for enhanced version of library (#16)
8d365cc
pattishin pushed a commit that referenced this pull request Nov 22, 2022
@release-please @pattishin
chore: release 1.3.0 (#39)
4014d50
🤖 I have created a release \*beep\* \*boop\* 
---
## [1.3.0](https://www.github.com/googleapis/nodejs-ai-platform/compare/v1.2.0...v1.3.0) (2021-01-14)


### Features

* **samples:** adds samples for enhanced version of library ([#16](https://www.github.com/googleapis/nodejs-ai-platform/issues/16)) ([aef443c](https://www.github.com/googleapis/nodejs-ai-platform/commit/aef443c41b8a9a2199e0c5b100a5ab91444b0dfe))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
jsimonweb pushed a commit to jsimonweb/nodejs-docs-samples that referenced this pull request Dec 12, 2022
@enocom
chore: add script for tagging containers (GoogleCloudPlatform#16)
4f2c62b
telpirion pushed a commit that referenced this pull request Jan 11, 2023
@release-please
chore(main): release 0.1.1 (#16)
bcb4ca8
🤖 I have created a release *beep* *boop*
---


## [0.1.1](googleapis/nodejs-video-stitcher@v0.1.0...v0.1.1) (2022-06-23)


### Bug Fixes

* **deps:** update dependency google-gax to v3 ([#15](googleapis/nodejs-video-stitcher#15)) ([345085f](googleapis/nodejs-video-stitcher@345085f))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@telpirion telpirion mentioned this pull request Jan 11, 2023
chore(video-stitcher): migrate code from googleapis/nodejs-video-stitcher #2976
Closed
@irataxy irataxy mentioned this pull request Jan 13, 2023
migrate code from googleapis/nodejs-video-stitcher #2986
Merged
irataxy pushed a commit that referenced this pull request Jan 13, 2023
@release-please @irataxy
chore(main): release 0.1.1 (#16)
9e7282a
🤖 I have created a release *beep* *boop*
---


## [0.1.1](googleapis/nodejs-video-stitcher@v0.1.0...v0.1.1) (2022-06-23)


### Bug Fixes

* **deps:** update dependency google-gax to v3 ([#15](googleapis/nodejs-video-stitcher#15)) ([345085f](googleapis/nodejs-video-stitcher@345085f))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
pattishin added a commit that referenced this pull request Dec 13, 2023
@pattishin
# This is a combination of 16 commits.
f5e5888
# This is the 1st commit message:

refactor: updating codeowners

# This is the commit message #2:

add chat functions

# This is the commit message #3:

use correct testing project

# This is the commit message #4:

refactor: adding system tests + updating corresponding chat samples

# This is the commit message #5:

add countTokens sample

# This is the commit message #6:

refactor: adding in region tags, abstracting out mimetype, adding new image ur

# This is the commit message #7:

refactor: updating gs url in test, fix to args getting passed to sample functions

# This is the commit message #8:

refactor: resolving file paths in tests, adding wait helper function

# This is the commit message #9:

add warning about safety concerns

# This is the commit message #10:

refactor:filling out nonstreamingchat and streamcontent tests

# This is the commit message #11:

add countTokens test

# This is the commit message #12:

refactor: filling out more streaming tests

# This is the commit message #13:

add safety settings test

# This is the commit message #14:

refactor: adding in stream content and multipart content tests

# This is the commit message #15:

feat: add new sendMultiModalPromptWithImage sample

# This is the commit message #16:

refactor: adding region tags
pattishin added a commit that referenced this pull request Dec 13, 2023
@LukeSchlangen @pattishin
feat: genai sample base (#3587)
dfb4fa9
* feat: initial base for generative-ai

* # This is a combination of 16 commits.
# This is the 1st commit message:

refactor: updating codeowners

# This is the commit message #2:

add chat functions

# This is the commit message #3:

use correct testing project

# This is the commit message #4:

refactor: adding system tests + updating corresponding chat samples

# This is the commit message #5:

add countTokens sample

# This is the commit message #6:

refactor: adding in region tags, abstracting out mimetype, adding new image ur

# This is the commit message #7:

refactor: updating gs url in test, fix to args getting passed to sample functions

# This is the commit message #8:

refactor: resolving file paths in tests, adding wait helper function

# This is the commit message #9:

add warning about safety concerns

# This is the commit message #10:

refactor:filling out nonstreamingchat and streamcontent tests

# This is the commit message #11:

add countTokens test

# This is the commit message #12:

refactor: filling out more streaming tests

# This is the commit message #13:

add safety settings test

# This is the commit message #14:

refactor: adding in stream content and multipart content tests

# This is the commit message #15:

feat: add new sendMultiModalPromptWithImage sample

# This is the commit message #16:

refactor: adding region tags

* refactor: updating codeowners

add chat functions

use correct testing project

refactor: adding system tests + updating corresponding chat samples

add countTokens sample

refactor: adding in region tags, abstracting out mimetype, adding new image ur

refactor: updating gs url in test, fix to args getting passed to sample functions

refactor: resolving file paths in tests, adding wait helper function

add warning about safety concerns

refactor:filling out nonstreamingchat and streamcontent tests

add countTokens test

refactor: filling out more streaming tests

add safety settings test

refactor: adding in stream content and multipart content tests

feat: add new sendMultiModalPromptWithImage sample

refactor: adding region tags

update to common prompt

fix: resolve linting

* refactor: remove index file

---------

Co-authored-by: [email protected] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@stephenplusplus @pcostell @jmdobry @theacodes
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.