Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google/quick add #4

Merged
merged 48 commits into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2a809a0
Login branch initial commit
Gautime May 28, 2019
2c27edf
Basic Message Printing
Gautime May 28, 2019
140654e
Login/Logout Api Call
Gautime May 29, 2019
7ba90b4
Resolved minor errors
Gautime May 30, 2019
3f7f3e4
Improved url
Gautime May 30, 2019
43f6f85
Changed response_type
Gautime May 30, 2019
2aaecca
Added the auth link as the message
Gautime May 30, 2019
86cf471
Webhook Endpoint
Gautime Jun 4, 2019
372ec52
Changed workflow
Gautime Jun 5, 2019
29a9bf1
Corrected typo
Gautime Jun 5, 2019
e824d92
Add token id to app persistence
Gautime Jun 5, 2019
f49b6b5
Updated files
Gautime Jun 5, 2019
c1e3a6f
Changed Webhook method
Gautime Jun 5, 2019
1203322
Updated api call
Gautime Jun 5, 2019
981ddf0
Access token received
Gautime Jun 6, 2019
9a4a156
Included user credentials, success login message
Gautime Jun 7, 2019
5b1caf8
Added access token in app persistence and updated Readme
Gautime Jun 10, 2019
34d0d0d
Updated persistence
Gautime Jun 10, 2019
01c699a
Update README.md
Gautime Jun 10, 2019
b25c4f6
Logged access token inside GCGetter
Gautime Jun 10, 2019
79ec838
Merge remote-tracking branch 'Apps.Google.Calendar/google/login' into…
Gautime Jun 10, 2019
b3d7ee8
Added logout feature
Gautime Jun 12, 2019
4cc39db
View Event call added
Gautime Jun 12, 2019
1e888ed
Display title, start and end time of events
Gautime Jun 13, 2019
9d952ee
Date - Time format changed
Gautime Jun 14, 2019
ce1d552
Create event implemented
Gautime Jun 15, 2019
f81ab63
Error message if event creation fails
Gautime Jun 15, 2019
0e261ea
Added redirect uri config setting
Gautime Jun 18, 2019
7ea1aa4
Added link with each view event for update/delete
Gautime Jun 19, 2019
3273112
Update README.md
Gautime Jun 19, 2019
2fd9de4
Update README.md
Gautime Jun 19, 2019
fd8c5a4
Merge branch 'master' into google/create-private
Gautime Jun 22, 2019
af44f54
Resolved conflicts
Gautime Jun 23, 2019
1811ffd
Merge branch 'master' into google/create-private
Gautime Jun 24, 2019
893fa3f
Create LICENSE
Gautime Jun 24, 2019
f423c23
Quickadd Added
Gautime Jul 3, 2019
310ccb7
Changed naming convention
Gautime Jul 3, 2019
5d1f9e2
Update README.md
Gautime Jul 3, 2019
6743748
Merge branch 'master' into google/quick-add
Gautime Jul 3, 2019
ec2b555
Update README.md
Gautime Jul 3, 2019
5fcda42
Updated changes
Gautime Jul 4, 2019
1c8429c
Merge remote-tracking branch 'Apps.Google.Calendar/google/quick-add' …
Gautime Jul 4, 2019
ad4f65d
Updated persistence
Gautime Jul 5, 2019
6425639
Fix typo on variable name
d-gubert Jul 13, 2019
61fff55
Revert "Fix typo on variable name"
d-gubert Jul 13, 2019
ada1154
Merge branch 'master' into google/quick-add
Gautime Jul 26, 2019
36cd28b
Merge branch 'master' into google/quick-add
Gautime Jul 26, 2019
1cbc944
Google/calendar list (#5)
Gautime Aug 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 2 additions & 12 deletions Commands/GCCommands.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { IHttp, IModify, IPersistence, IRead } from '@rocket.chat/apps-engine/definition/accessors';
import { ISlashCommand, ISlashCommandPreview, ISlashCommandPreviewItem, SlashCommandContext } from '@rocket.chat/apps-engine/definition/slashcommands';
import { GoogleCalendarApp } from '../GoogleCalendar';
import { GCGetter } from '../helpers/GSGetter';
import { ApiEndpoint, IApiEndpointInfo, IApiRequest, IApiResponse } from '@rocket.chat/apps-engine/definition/api';
import { AppPersistence } from '../helpers/persistence';
import { IUser } from '@rocket.chat/apps-engine/definition/users';



export class GCCommand implements ISlashCommand {

public command = 'calendar';
Expand All @@ -25,16 +22,9 @@ export class GCCommand implements ISlashCommand {
try {


const loginstatus = await this.app.getGCGetter().login(this.app.getLogger(), read, http, modify, context, persis);

msg.setText('Slashcommand executed');
// await modify.getCreator().finish(msg);
modify.getNotifier().notifyUser(context.getSender(), msg.getMessage());


const login_status = await this.app.getGCGetter().login(this.app.getLogger(), read, http, modify, context, persis);
} catch (e) {
this.app.getLogger().error('Failed sending login url', e);
//msg.setText('An error occurred when trying to send the login url:disappointed_relieved:');
this.app.getLogger().error('Failed executing slashcommand', e);
}

}
Expand Down
2 changes: 0 additions & 2 deletions GoogleCalendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export class GoogleCalendarApp extends App {
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
super(info, logger, accessors);
this.gcGetter = new GCGetter();
//this.webhook= new WebhookEndpoint(this);

}
public getGCGetter(): GCGetter {
Expand Down Expand Up @@ -81,7 +80,6 @@ export class GoogleCalendarApp extends App {
i18nDescription: 'Customize_Redirect_URI',
});


await configuration.slashCommands.provideSlashCommand(new GCCommand(this));

}
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ Integrates google calendar with your Rocket.Chat server.
* Authenticate to your gmail account from inside your Rocket.Chat.
* Create your private events in your google calendar fom your Rocket.Chat using just a slashcommand.
* View and update your private events using just a slashcommand.
* Create a quick event using *quickadd* slashcommand.
* View all the calendars present on your profile and can even select any one of those calendars to work with.
* Get reminders and notifications of events.
* Create public events inside a room inviting all the users inside the room.

## How to use it?
* Download or clone the repository to your local system.
* Get your local Rocket.Chat server running.
* Navigate inside the folder using terminal.
* Run command `rc-apps deploy --url http://localhost:3000 --username {your_username} --password {your_password}`
* This gets the app installed in your local server, now navigate to app screen inside Options -> Administration -> Apps -> Google Calendar
* Activate the app and put in the credentials and start using it inside any of your room!

## Quick Start Guide

Expand All @@ -21,7 +30,19 @@ Integrates google calendar with your Rocket.Chat server.

* `/calendar logout` : Once you are done with viewing, creating your calendar events and wants to log out of the gmail account, use this command and it will log you out and redirect to your home page.

* `/calendar view` : Once the authentication is successful, you can use this command to view the private events on your calendar. Events will be displayed with title, date, start time and end time. You will also get the link, which you can click on and it will take directly to your calendar where you can udpate or delete that event.

* `/calendar create "Title" "Date" "Start time" "Endtime"` : This command can be used to create a private on your primary calendar, where Title is the title of the event you are creating, and date should be in format YYYY-MM-DD and time in 24 hours format.

* `/calendar logout` : Once you are done with viewing, creating your calendar events and wants to log out of the gmail account, use this command and it will log you out and redirect to your home page.

* `/calendar quickadd {title of the event}` - This slashcommand can be used to create an event starting from time the slashcommand is called to one hour in duration.

* `/calendar list` - Shows you the list of the calendars that are present on your user profile. For each calendar there is a button, which you can click and decide which calendar to communicate with and that calendar will be used for fetching and editing events (though this is optional, Google Calendar app uses your primary calendar by default.)

* `/calendar invite "Title" "Date" "Starttime" "Endtime" ` - This slashcommand will create public events which will include inviting all the users present inside the room (in which command is called) to this event. All the users will receive the event invite through e-mails. They can respond to that invite and the organizer will receive their response notifications via e-mails.

### Feedback and Suggestions
Contribute to this repository by opening an issue if you have any feedback or suggestions for improvements or even some feature request!


8 changes: 4 additions & 4 deletions helpers/GCResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import { HttpStatusCode, IHttp, ILogger, IRead } from '@rocket.chat/apps-engine/
import { IApiRequest } from '@rocket.chat/apps-engine/definition/api';

export class GCResults {
public atoken: string;
public acess_token: string;
Gautime marked this conversation as resolved.
Show resolved Hide resolved

constructor(data?: any) {

if (data) {
this.atoken = data.access_token as string;
this.acess_token = data.access_token as string;
}
}

public result(): string {
if (!this.atoken) {
if (!this.acess_token) {
throw new Error('Invalid result');
}
return this.atoken;
return this.acess_token;
}

}