aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2021-05-22event_id_from_base64(): Return a `Result`Teddy Wing
2021-05-22print_event(): Return a `Result`Teddy Wing
2021-05-22Add `--verbose` flag to print event details on successTeddy Wing
When the `--verbose` flag is given, print the event summary and description, time, conference info, and attendees.
2021-05-22Silence `email_eid` unused warningTeddy Wing
Silence this warning: warning: value assigned to `email_eid` is never read --> src/main.rs:44:9 | 44 | let mut email_eid = String::new(); | ^^^^^^^^^^^^^ | = note: `#[warn(unused_assignments)]` on by default = help: maybe it is overwritten before being read? warning: 1 warning emitted We are reading the variable, but only if `should_read_email`.
2021-05-22Rename `email` to `should_read_email`Teddy Wing
Make the variable's usage clearer.
2021-05-22Get event eid from email on standard inputTeddy Wing
If the `--email` flag is supplied, parse a Google Calendar email from standard input and extract the event's eid from there.
2021-05-22event_id_from_base64(): Assume `event_id` is base64-encodedTeddy Wing
A base64-encoded string I tested with didn't pass the regex test, and was treated as an event ID even though it was an `eid`. Instead of testing whether the input is a base64-encoded string with regex, assume it's a base64-encoded string and try to decode it. If that fails, assume it's a regular event ID.
2021-05-22Revert Eid additionsTeddy Wing
This reverts commits: c2525d8e9b9bb671ce855c20f644c43e71e1e7ef 65aa6027a76a65d021a5833322b5d33143933202 It turns out we can't use the email address encoded into the base64 eid string because it's the organiser's email address, not the invitee's address.
2021-05-22Try to get user email from EidTeddy Wing
Tried getting the email from the base64-encoded eid string. Turns out, though, that the email address in the eid: 1. isn't complete (it's missing the last one or two characters of the email address as far as I can tell) 2. is not the invitee's email address, it's the organiser's email address For both of these reasons (particularly (2)), it looks like we can't actually use this method and will need to make the Event.get request after all.
2021-05-22Store the user email from base64-encoded `eid`sTeddy Wing
Get the user email so we can use it when patching the event. This will allow us to eliminate the Event.get request if an `eid` is given.
2021-05-22Support base64-encoded event `eid`sTeddy Wing
Event invitation emails include event ids encoded as "eid"s. These are base64-encoded strings of: {event_id} {user_email} Add a new function that decodes the ID from the base64 string if the input ID is base64-encoded. Otherwise, return the input event ID.
2021-05-22Get RSVP action from command line argumentsTeddy Wing
Fail with an error if no action is given. Use the provided action instead of the hard-coded "accepted" string.
2021-05-21Change spacing of command line argument parsingTeddy Wing
I like this better. More readable to have the variable assignments in the same column.
2021-05-21Parse command line options manuallyTeddy Wing
Decided to parse command line options manually so that if multiple event response status flags are passed, only the last one will be used.
2021-05-21Get event IDs from command line argumentsTeddy Wing
Allow multiple events to be handled at once.
2021-05-21Add command line option parsingTeddy Wing
2021-05-21Move RSVP code into a separate functionTeddy Wing
So I can put command line argument parsing in `main()`.
2021-05-21Eliminate copied error checksTeddy Wing
I'll set up my own error handling later.
2021-05-20Accept calendar eventTeddy Wing
In order to accept the event, we need to build an `Event` value with the data that should be patched into the original. That value is then passed in the `patch()` call to update the event. The email address of the current user is required. I couldn't figure out how best to get it, so I decided to keep the event `get()` call, and grab the authenticated user's email address from there. This means it requires two requests to accept the event, which is not ideal. Not sure if there's a better way to get that information.
2021-05-20Try accepting the eventTeddy Wing
Doesn't change the response status, but does patch the event. Turns out I'm not doing it correctly. I need to modify the event struct that gets passed to `patch()`, not send the attendees as a param.
2021-05-18Save OAuth2 tokens to diskTeddy Wing
So we don't ask for authorisation on every run.
2021-05-18Get a calendar event from Google CalendarTeddy Wing
Try out the `calendar3` API to get a single event from Google Calendar. Mostly copied the example code from the `google-calendar3` documentation: https://docs.rs/google-calendar3/2.0.4+20210327/google_calendar3/index.html#a-complete-example Modified it to get a single event, and to use the OAuth2 secret from `~/.google-service-cli/calendar3-secret.json`.
2021-05-18Generate new Rust v1.51.0 projectTeddy Wing
With: $ cargo init --bin