Skip to content

Commit

Permalink
Add return type for send RSVP (#556)
Browse files Browse the repository at this point in the history
Send RSVP used to just return a request_id in the response, now it can return an error object in the event of a partial success where the send RSVP request is executed but the email was not sent.
  • Loading branch information
mrashed-dev authored Apr 15, 2024
1 parent 049c8c7 commit 30b8060
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Changelog

### Unreleased
* Add response type to `sendRsvp`
* Add support for adding custom headers to outgoing requests
* Add support for custom headers field for drafts and messages
* Rename incorrect `type` field in `When` models to `object`
* Fix inaccuracy in `ReminderOverride` model

### 7.2.1 / 2024-03-05
* Improved message sending and draft create/update performance
Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const config = {
},
},
clearMocks: true,
collectCoverage: true,
overageReporters: ['text', 'cobertura'],
};

module.exports = config;
10 changes: 10 additions & 0 deletions src/models/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ListQueryParams } from './listQueryParams.js';
import { Subset } from '../utils.js';
import { NylasBaseResponse } from './response.js';
import { NylasApiErrorResponseData } from './error.js';

/**
* Interface representing a Nylas Event object.
Expand Down Expand Up @@ -197,6 +199,14 @@ export type SendRsvpRequest = {
status: RsvpStatus;
};

/**
* Interface representing the response from sending RSVP to an event.
* @property sendIcsError If the send-rsvp request succeeded but the ICS email could not be sent, this will contain the error.
*/
export interface SendRsvpResponse extends NylasBaseResponse {
sendIcsError?: NylasApiErrorResponseData;
}

/**
* Interface representing the query parameters for listing events.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/resources/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ListEventQueryParams,
SendRsvpQueryParams,
SendRsvpRequest,
SendRsvpResponse,
UpdateEventQueryParams,
UpdateEventRequest,
} from '../models/events.js';
Expand Down Expand Up @@ -191,7 +192,7 @@ export class Events extends Resource {
requestBody,
queryParams,
overrides,
}: SendRsvpParams & Overrides): Promise<NylasBaseResponse> {
}: SendRsvpParams & Overrides): Promise<SendRsvpResponse> {
return super._create({
path: `/v3/grants/${identifier}/events/${eventId}/send-rsvp`,
queryParams,
Expand Down

0 comments on commit 30b8060

Please sign in to comment.