-
Notifications
You must be signed in to change notification settings - Fork 120
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
Added Node SDK Folders API #501
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mrashed-dev
approved these changes
Nov 13, 2023
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.
Great PR @yifanplanet, thank you!
Merged
mrashed-dev
added a commit
that referenced
this pull request
Feb 5, 2024
# Description This PR is a culmination of all the PRs that contained v7-related development, with formal support for the Nylas API v3. This release is essentially the same as the v7.0.0-beta.5 release found on npm. Please refer to the readme for a quick start guide on using the new SDK, as well as links to the upgrade doc as well as the SDK reference docs. # Changelog * **BREAKING CHANGE**: Node SDK v7 supports the Nylas API v3 exclusively, dropping support for any endpoints that are not available in v3. * **BREAKING CHANGE**: Convert `Nylas` class from a static to a non-static class * **BREAKING CHANGE**: Officially support minimum Node 16 * **BREAKING CHANGE**: Dropped the use of 'Collections' in favor of 'Resources' * **BREAKING CHANGE**: Removed all REST calls from models and moved them directly into resources * **REMOVED**: Local Webhook development support is removed due to incompatibility * Rewrote the majority of SDK to be more modular and efficient * Removed the use of custom strings for serialization and deserialization, now automatically converting to camelCase and from the API's snake_case * Added support for both ES6 and CommonJS module systems * Created models for all API resources and endpoints, for all HTTP methods to reduce confusion on which fields are available for each endpoint * Created error classes for the different API errors as well as SDK-specific errors ================================================================== * Convert `Nylas` class from a static to a non-static class (#365) This PR converts the SDK's entry point, the Nylas class, from being static to non-static. The reason behind this change is to enable multiple configurations and more reuse of the Nylas object. Note that this also changes all the class's variables and functions to non-static. * Rename `confirmationEmailToHost` to `confirmationEmailsToHost` in `SchedulerBooking` (#384) "Emails" should be pluralized to align with the API. * [v7] Add defaults for Content-Type and Aceept headers for outgoing API requests (#415) This PR adds a default values for both the Content-Type and Accept headers for all outgoing connections to the Nylas API. * Officially support Node >= 16 (#428) This PR adds an engine entry for Node >= 16 as moving forward we are only supporting frameworks and languages that are currently supported. This PR also removes some code that was backwards compatible with Node < 10 and updates the github actions to only run on the supported LTS versions. This PR also sets up actions for changes incoming to the v7-staging branch, and removes webhook tunnel support as it will not be available on launch. * refactor(config): update config for v3 * build(npm): update jest * feat!: v7 skeleton * apiclient refactor * TW-2089 Create response models * TW-2089 Deserialize and validate response from API * camelCase stuff * util schema * overrides refactor * WIP calendars * build(npm): upgrade ts and jest * progress * calendars * instantiate calendars * calendar fix * apiclient changes * IT WORKS!!! * delete consolellog * replace grantId with identifier because you can get by grantId or email * add generalized casing function & add snake_case * fix query params support * remove calendar request schemas * change naming to identifier * fix queryparams * change metadatapair to record type * create grant resource * fix server url * nit * nit * update events schema * events resource * availabliity * next pagination helper * v7 refactoring and pagination * fix apiclient list validation * request types file * refactor response types * refactor resource schemas * refactor api client * implement next, pagination, and limit guarantee * refactor event types * refactor calendar types * refactor generator typing * Hosted auth (#440) * Hosted auth * Updated comments * Prettier fix * Updated providers query param for url creation * Updated struct * Updated url generation * fix request error handling * remove request validation from auth * fix error schema --------- Co-authored-by: Albert T <[email protected]> * Support authentication grant models and CRUD operations (#439) - Added grant models - Added grant CRUD operations - Abstracted resource methods and moved them into baseResource - Added update PATCH operation - Fixed method being discarded before outgoing calls * feat(auth): add scopes (#447) * Hosted auth * Updated comments * Prettier fix * Updated providers query param for url creation * Updated struct * Updated url generation * fix request error handling * remove request validation from auth * fix error schema * fix validation schemas * feat(auth): scopes * Add Webhook support (#450) This PR adds support for the Webhook schemas and models, enums for Webhook triggers, and all the Webhook API endpoints. * Delete returns 200 instead of 204 now (#454) The API was returning 204 for DELETE calls, now it returns 200 with a body. * Added token validation (#444) * PKCE auth (#453) * Added hosted auth (#451) * Added hosted auth * Hosted response fix * Update Event schema and subschemas (#452) This PR just provides updates to the fields for the Event schema and its subschemas, and also fixing the types and addressing todos. * Create initial unit tests (#458) This PR adds in unit tests for nylas.ts and apiClient. * Added hosted imap support (#464) * List & detect providers (#463) * Create test suite for calendars and auth (#459) * Prevent tests from being compiled by TS * Extend query params support to remaining CRUD func * Fix events - Calendar ID param required for all CRUD operations - Only when is required for creating an event - Update request body should make everything optional * AV-819 Create events test suite also used to test baseResource * Minor tweaks to the auth resource - prettier - documentation fixes - typos * Delete index.js * cleanup auth schema * simplify validating tokens * switch from str building to url building * url build for pcke and admin consent url * nit: remove async for non asnyc funcs * nit: add missing slash * AV-822 Created auth spec --------- Co-authored-by: Albert T <[email protected]> * fix(auth): errors (#465) * Auth test suite and refactor (#467) * Prevent tests from being compiled by TS * Extend query params support to remaining CRUD func * Fix events - Calendar ID param required for all CRUD operations - Only when is required for creating an event - Update request body should make everything optional * AV-819 Create events test suite also used to test baseResource * Minor tweaks to the auth resource - prettier - documentation fixes - typos * Delete index.js * cleanup auth schema * simplify validating tokens * switch from str building to url building * url build for pcke and admin consent url * nit: remove async for non asnyc funcs * nit: add missing slash * AV-822 Created auth spec * small refactor * Replace urlForAuthenticationIMAP Replaced with using urlForAuthentication and adding IMAPAuthConfig (with provider = imap enforced) to AuthConfig. * [v7] Node SDK v7 Pre-Beta Polish (#471) This PR brings the final major changes to the v7 SDK pre-beta, lots of cleanup for consistency and fixing some issues with the SDK. The list of things that were completed includes: - Implemented timeout - Implemented application + redirect URI support - Updating availability support to the newly redesigned endpoint - Removed Zod, replaced fully with TypeScript interfaces (easier to maintain) - Removed Provider Scopes (third party scopes can change thus hard to maintain) - Renamed "BaseResource" -> "Resource" - Renamed "ItemResponse", "ListResponse", "DeleteResponse" to "NylasResponse", "NylasListResponse", and "NylasDeleteResponse" - Renamed "schemas" -> "models" (no more zod, schemas may be re-introduced in the future if we have them) - Added missing create/update models - Fixed failing tests - Cleaned up repo, unused dependencies, and upgraded dependencies where possible * Added github action to generate SDK references (#475) * Generate SDK refernece GHA * Added docs command * Resource documentation for SDK reference (#476) This PR has documentation adds for all the resources. Also changes the following: - Refactor Auth to reflect the recent changes to the endpoints - Refactor Errors to support API + OAuth errors as well as timeout errors - Move availability into the calendar resource * Support ES Modules by making Nylas SDK a dual package (#477) This PR makes the Nylas SDK a dual package supporting both CommonJS and ES Module syntax. Now, the SDK's distribution package will include 3 directories: - lib/cjs: for CommonJS - lib/esm: for ES Modules - lib/types: for the TypeScript declaration files Furthermore we've also upgraded the tsconfig to target es2021 as it's the newest ECMAScript version that is fully supported by the minimum Node version supported by the SDK (v16). * Add SDK documentation for models and top-level files (#478) This PR adds documentation for the models and top-level files, completing the SDK reference. * v7.0.0-beta.1 Release (#479) This PR is for releasing the first beta of v7 on npm. * Get SDK version reliably (#480) Because of how we are building our SDK now with the ES Module addition in #477 it has caused importing the `package.json` file to be a bit more tricky given that it no longer exists one directory up. Instead we just generate a version file post-build and during the npm version call and we pull the version from that file. The file is written, and sources the version from, the package.json file. * [v7.0.0-beta.1] Fix ESM and CJS issues (#481) This PR addresses a couple of issues found with the nylas package since we've introduced both ESM and CJS support: - Add build step (script) that dynamically creates package.json files for each of the ESM and CJS modules. This prevents the `To load an ES module, set "type": "module" in the package.json or use the .mjs extension` error - Add ".js" file extension to all relative imports. This prevents the `ERR_MODULE_NOT_FOUND` error when using the SDK in an esmodule project. * v7.0.0-beta.2 Release (#482) * Changelog updates * 7.0.0-beta.2 * Add UPGRADE file (#483) This PR adds an upgrade doc for the Node SDK. Co-authored-by: Lrubin <[email protected]> * Create a webhook should return secret (#485) Creating a webhook should return a WebhookWithSecret response. * Add Free-Busy Support (#493) This PR adds support for the free busy endpoint. * Add Unit Tests for Node SDK v7 beta (#488) This PR fixes the current testing framework and adds many more. Our testing coverage is around 90% now. We now also have 2 new fixes that have been identified by the tests: * Fix path for destroying a redirect URI * Fix model for updating an Event * Add Messages, Drafts, and Smart Compose APIs support (#494) This PR adds support for messages, drafts, and smart compose APIs. * Add support for custom authentication, connectors, and credentials APIs (#497) Adds support for custom authentication, the connectors API and the credentials API. * v7.0.0 beta.3 Release (#500) * Update CHANGELOG.md * 7.0.0-beta.3 * Update CHANGELOG.md * Add Node SDK Folders API (#501) * Add support for attachments api (#505) * Attachments api * Added download method for returning stream * lint * PR Review request updates * Fix issue with form-data not importing correctly for ESM projects (#523) The npm package `form-data` has an issue with importing compatibility between CJS and ESM. Using `import * as FormData` or `import FormData` works only on cjs while `import { default as FormData }` works only on esm. We work around this now by checking if `default` exists on the importing object, and using it if it does, otherwise just use `FormData`. * Added Contacts API Support (#513) Contact group endpoint Co-authored-by: Mostafa Rashed <[email protected]> * Send RSVP support for Events API (#514) * Send RSVP support for Events API * Move `Grants` to `NylasClient` and custom authentication to `Auth` (#522)⚠️ This is a breaking change⚠️ This PR moves the following: * `Auth.grants()` to `NylasClient.grants()` * `Grants.create()` to `Auth.customAuthentication()` Functionality remains the same. * Fix typing errors in TrackingOptions and Connector (#525) Fix typing errors present in Connector and TrackingOptions. * Include email value for CodeExchange response (#526) The code exchange response should include an email value as well. Additionally, the provider detect endpoint was referencing the wrong path. Changed it to reflect the path mentioned here -> https://developer.nylas.com/docs/api/v3-beta/admin/#post-/v3/providers/detect * v7.0.0 beta.4 Release (#528) * Update CHANGELOG.md * 7.0.0-beta.4 * Update CHANGELOG.md * Fix missing `type` field in `Event` model (#530) Missing type field for Event responses made it hard to deal with this polymorphic field. * Changed `clientSecret` to optional for token exchange methods; defaults to API Key now (#531) clientSecret is not required if the API Key used for the SDK and the clientId belong to the same application. * Pre-GA Minor Fixes (#495) These minor fixes: - Export interfaces in resources - Fix Event models - Wrap `detectProvider` response around a `NylasResponse` - Added `default` event visibility value - Updated reminders field to match updated API schema - Updated all references to `File` to `Attachment` to match API schema - Fixes to drafts and sending messages - Removed `ContactType` enum as the API accepts any string * v7.0.0 beta.5 Release (#532) # Changelog * Added `default` event visibility value * Changed `clientSecret` to optional for token exchange methods; defaults to API Key now * Updated reminders field to match updated API schema * Updated all references to `File` to `Attachment` to match API schema * Fixes to the `Event` models * Fixes to drafts and sending messages * Removed `ContactType` enum as the API accepts any string Note, this is the final beta. * Update CHANGELOG.md * Delete LoggingInterface.ts * scrub references to the beta * 7.0.0 --------- Co-authored-by: Albert T <[email protected]> Co-authored-by: Albert T <[email protected]> Co-authored-by: Luka Bulatovic <[email protected]> Co-authored-by: Aaron de Mello <[email protected]> Co-authored-by: Lrubin <[email protected]> Co-authored-by: YIFAN WU <[email protected]> Co-authored-by: kraju3 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
JIRA
JIRA
JIRA
License
I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.