Skip to content

feat: Add JSON input support for contacts update#200

Draft
jrossi wants to merge 2 commits intosteipete:mainfrom
jrossi:feat/contacts-json-input
Draft

feat: Add JSON input support for contacts update#200
jrossi wants to merge 2 commits intosteipete:mainfrom
jrossi:feat/contacts-json-input

Conversation

@jrossi
Copy link

@jrossi jrossi commented Feb 7, 2026

Summary

Adds --from-file flag to gog contacts update command, enabling contact updates from JSON files or stdin. This provides full access to all Google People API fields without requiring individual CLI flags.

Motivation

Currently, gog contacts update only supports a limited set of fields via CLI flags (--given, --family, --email, --phone). Many useful fields like URLs, notes/biographies, addresses, and birthdays are not accessible.

Instead of adding individual flags for every possible field, this PR implements a more flexible JSON-based approach.

Testing

Fully tested with real Google Contacts:

  • File mode: Successfully added Obsidian deep link URI
  • Stdin mode: Successfully added biography/note via pipe
  • Both modes verified working end-to-end

See full PR description at: #200


🤖 AI-Generated: Implemented with Claude Code, fully tested by contributor

Adds --from-file flag to 'gog contacts update' command, enabling updates
from JSON files or stdin. This provides full access to Google People API
fields (URLs, notes, addresses, birthdays, etc.) without requiring
individual CLI flags for each field.

Usage:
  gog contacts get people/c123 --json > contact.json
  # Edit contact.json to add/modify fields
  gog contacts update people/c123 --from-file=contact.json

  # Or pipe directly:
  gog contacts get people/c123 --json | \
    jq '.contact.urls += [{"value": "https://example.com"}]' | \
    gog contacts update people/c123 --from-file=-

Benefits:
- Supports all Google People API fields
- Future-proof (new fields work automatically)
- Scriptable with jq and other JSON tools
- Enables complex nested structure updates

---
🤖 This PR was generated with AI assistance (Claude Code).
The implementation was reviewed and tested by the contributor.
The read mask for 'contacts get' now includes additional fields that can
be updated via JSON input: urls, biographies, addresses, organizations.

This ensures fields written via --from-file are visible when reading
the contact back.

Tested:
- Added Obsidian URI via JSON file - verified in contact
- Added biography via stdin pipe - verified in contact
@jrossi
Copy link
Author

jrossi commented Feb 7, 2026

I completely understand that many of the pull requests are AI-generated. If you want me to pull this and remove it, no problem. It serves my purpose. It will lead to confirmed work and the outcomes I want. I don't want to flood you if you don't want this. No problem. I completely understand. Thank you. Great PR, great tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant