Skip to content

Commit

Permalink
Nylas V3 Apex language SDK initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lincoln Rychecky authored and Lincoln Rychecky committed Aug 16, 2024
1 parent a0661e7 commit 2f03dd6
Show file tree
Hide file tree
Showing 112 changed files with 16,135 additions and 131 deletions.
7 changes: 7 additions & 0 deletions .forceignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/jsconfig.json

**/tsconfig.json

**/.eslintrc.json

**/*.ts
156 changes: 27 additions & 129 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,131 +1,29 @@
###### Nylas Developing #####
# Used to store sync snapshots. See redwood/admin/snapshot
.snapshots

# Used to store local data generated from dev runs like logs and message
# parts
.dev_data

# Used by nylas/services/sync/scripts/compare-account-status
account_statuses.*


###### Nylas Testing #####
# Unit test / coverage reports
.cache
.coverage
.hypothesis
nosetests.xml
pytestdebug.log
.pytest_cache
.test_data/

###### Nylas Building #####
# Ignorable Debian files when dpkg runs
debian/cloud-core*
debian/debhelper-build-stamp
debian/.debhelper
debian/files
build/

# Build dirs for FaaS systems (e.g. AWS Lambda)
fn_build/


###### Python #####
# Ignore common virtualenv names
venv
.venv
venv3
.venv3

# Created when installing python packages
*.egg
*.egg-info
.Python
bin/wheel
pip-log.txt
pip-selfcheck.json

# Ignore Python binary files & metadata
*.py[cod]
__pycache__

# Used for mypy linter
.mypy_cache

# pycharm
.idea/

# autoflake
.magicindex.json


###### Javascript #####
node_modules
lerna-debug.log
npm-debug.log
yarn-error.log
package-lock.json

###### OS #####
# Ignore Mac folder metadata
580 B
# This file is used for Git repositories to specify intentionally untracked files that Git should ignore.
# If you are not using git, you can delete this file. For more information see: https://git-scm.com/docs/gitignore
# Salesforce cache
.sfdx/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Dependency directories
node_modules/
# Eslint cache
.eslintcache
# MacOS system files
.DS_Store

# Vagrant
.vagrant

# Translations
*.mo

# vim temporary files
*.swp
*.swo

# emacs files
*~
*#

# ctags
tags
TAGS
.tags
.tags1

# terraform state directories
.terraform/
*.tfstate.backup
.terraform

# terragrunt exclusions
.terragrunt-cache/
provider.tf
backend.tf

# Ignore local vimrcs
.vimrc
.vemv/

# Ignore VS Code files
.vscode

# For Ack ignores that aren't in .gitignore
.ignore

###### Infrastructure ######
# Ansible
.boto
vault-password-file.txt
.vaults.txt
.ansible-test

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

# testing area
area51

###### Docker ######
!.docker/**
# Windows system files
Thumbs.db
ehthumbs.db
[Dd]esktop.ini
$RECYCLE.BIN/
# Visual Studio Code IDE
.vscode/
# IlluminatedCloud IDE
*.iml
.idea/
IlluminatedCloud/
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# StandardTemplate
Standard template with branch protections
# Salesforce DX Project: Next Steps

Now that you’ve created a Salesforce DX project, what’s next? Here are some documentation resources to get you started.

## How Do You Plan to Deploy Your Changes?

Do you want to deploy a set of changes, or create a self-contained application? Choose a [development model](https://developer.salesforce.com/tools/vscode/en/user-guide/development-models).

## Configure Your Salesforce DX Project

The `sfdx-project.json` file contains useful configuration information for your project. See [Salesforce DX Project Configuration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm) in the _Salesforce DX Developer Guide_ for details about this file.

## Read All About It

- [Salesforce Extensions Documentation](https://developer.salesforce.com/tools/vscode/)
- [Salesforce CLI Setup Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm)
- [Salesforce DX Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_intro.htm)
- [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm)
13 changes: 13 additions & 0 deletions config/project-scratch-def.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"orgName": "lincolnrychecky company",
"edition": "Developer",
"features": ["EnableSetPasswordInApi"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
}
}
}
8 changes: 8 additions & 0 deletions force-app/main/default/aura/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": ["@salesforce/eslint-plugin-aura"],
"extends": ["plugin:@salesforce/eslint-plugin-aura/recommended"],
"rules": {
"vars-on-top": "off",
"no-unused-expressions": "off"
}
}
74 changes: 74 additions & 0 deletions force-app/main/default/classes/NylasAPIException.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* @description : Nylas API V3 custom exception class
* @author : Lincoln Rychecky
* @last modified on : 07-17-2024
* @last modified by : Lincoln Rychecky
**/
public class NylasAPIException extends Exception {
private String error;
private String errorDescription;
private String errorUri;
private Integer errorCode;

// Constructor to set the error details
public NylasAPIException(
String error,
String errorDescription,
String errorUri,
Integer errorCode
) {
String customMessage =
'Error: ' +
error +
'\n' +
'Description: ' +
errorDescription +
'\n' +
'URI: ' +
errorUri +
'\n' +
'Code: ' +
errorCode;

// this.message = customMessage;
this.error = error;
this.errorDescription = errorDescription;
this.errorUri = errorUri;
this.errorCode = errorCode;
}

// Override getMessage to include detailed error information
public override String getMessage() {
return this.errorDescription;
}

// Getters for each property, in case they need to be accessed individually
public String getError() {
return error;
}

public String getErrorDescription() {
return errorDescription;
}

public String getErrorUri() {
return errorUri;
}

public Integer getErrorCode() {
return errorCode;
}

public static void throwNylasAPIExceptionFromResponse(String responseBody) {
Map<String, Object> errorResponse = (Map<String, Object>) JSON.deserializeUntyped(
responseBody
);

String error = (String) errorResponse.get('error');
String errorDescription = (String) errorResponse.get('error_description');
String errorUri = (String) errorResponse.get('error_uri');
Integer errorCode = (Integer) errorResponse.get('error_code');

throw new NylasAPIException(error, errorDescription, errorUri, errorCode);
}
}
5 changes: 5 additions & 0 deletions force-app/main/default/classes/NylasAPIException.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>61.0</apiVersion>
<status>Active</status>
</ApexClass>
Loading

0 comments on commit 2f03dd6

Please sign in to comment.