Skip to content

Commit

Permalink
[NRR-6536] Rename Nylas v2 lib path (#5)
Browse files Browse the repository at this point in the history
* [NRR-6536] Rename Nylas v2 lib path

* Update .bumpversion.cfg

Co-authored-by: Caio Ariede <[email protected]>

* fix version

---------

Co-authored-by: Caio Ariede <[email protected]>
  • Loading branch information
winstonf88 and caioariede authored May 13, 2024
1 parent f273437 commit 861d799
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
commit = True
tag = True
current_version = 5.14.1
current_version = 5.14.1.0

[bumpversion:file:nylas/_client_sdk_version.py]
[bumpversion:file:nylasv2/_client_sdk_version.py]
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[run]
source = nylas
source = nylasv2
1 change: 0 additions & 1 deletion nylas/_client_sdk_version.py

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions nylasv2/_client_sdk_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__VERSION__ = "5.14.1.0"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from copy import copy

from nylas.client.restful_model_collection import RestfulModelCollection, CHUNK_SIZE
from nylas.client.restful_models import NylasAPIObject
from nylas.utils import AuthMethod
from nylasv2.client.restful_model_collection import RestfulModelCollection, CHUNK_SIZE
from nylasv2.client.restful_models import NylasAPIObject
from nylasv2.utils import AuthMethod
from enum import Enum


Expand Down
22 changes: 11 additions & 11 deletions nylas/client/client.py → nylasv2/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from urlobject import URLObject
import six
from six.moves.urllib.parse import urlencode
from nylas._client_sdk_version import __VERSION__
from nylas.client.delta_collection import DeltaCollection
from nylas.client.errors import MessageRejectedError, NylasApiError, RateLimitError
from nylas.client.outbox_models import Outbox
from nylas.client.restful_model_collection import RestfulModelCollection
from nylas.client.restful_models import (
from nylasv2._client_sdk_version import __VERSION__
from nylasv2.client.delta_collection import DeltaCollection
from nylasv2.client.errors import MessageRejectedError, NylasApiError, RateLimitError
from nylasv2.client.outbox_models import Outbox
from nylasv2.client.restful_model_collection import RestfulModelCollection
from nylasv2.client.restful_models import (
Calendar,
Contact,
Event,
Expand All @@ -35,12 +35,12 @@
Webhook,
Send,
)
from nylas.client.neural_api_models import Neural
from nylas.client.scheduler_restful_model_collection import (
from nylasv2.client.neural_api_models import Neural
from nylasv2.client.scheduler_restful_model_collection import (
SchedulerRestfulModelCollection,
)
from nylas.client.authentication_models import Authentication
from nylas.utils import timestamp_from_dt, create_request_body, AuthMethod, HttpMethod
from nylasv2.client.authentication_models import Authentication
from nylasv2.utils import timestamp_from_dt, create_request_body, AuthMethod, HttpMethod

DEBUG = environ.get("NYLAS_CLIENT_DEBUG")
API_SERVER = "https://api.nylas.com"
Expand Down Expand Up @@ -222,7 +222,7 @@ def token_for_code(self, code):
Exchange an authorization code for an access token
Args:
code (str): One-time authorization code from Nylas
code (str): One-time authorization code from nylasv2
Returns:
str: The access token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from requests import ReadTimeout

from nylas.client.delta_models import Delta, Deltas
from nylasv2.client.delta_models import Delta, Deltas


class DeltaCollection:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from nylas.client.restful_models import (
from nylasv2.client.restful_models import (
RestfulModel,
NylasAPIObject,
Contact,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from nylas.client.restful_models import RestfulModel, Message, File, Contact
from nylas.utils import HttpMethod
from nylasv2.client.restful_models import RestfulModel, Message, File, Contact
from nylasv2.utils import HttpMethod
import re


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime

from nylas.client.restful_models import RestfulModel, Draft
from nylas.utils import timestamp_from_dt
from nylasv2.client.restful_models import RestfulModel, Draft
from nylasv2.utils import timestamp_from_dt


class OutboxMessage(RestfulModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from copy import copy
from nylas.utils import convert_metadata_pairs_to_array
from nylasv2.utils import convert_metadata_pairs_to_array

CHUNK_SIZE = 50

Expand All @@ -8,7 +8,7 @@ class RestfulModelCollection(object):
def __init__(self, cls, api, filter=None, offset=0, **filters):
if filter:
filters.update(filter)
from nylas.client import APIClient
from nylasv2.client import APIClient

if not isinstance(api, APIClient):
raise Exception("Provided api was not an APIClient.")
Expand Down Expand Up @@ -111,7 +111,7 @@ def delete(self, id, data=None, **kwargs):
return self.api._delete_resource(self.model_class, id, data=data, **kwargs)

def search(self, q, limit=None, offset=None): # pylint: disable=invalid-name
from nylas.client.restful_models import (
from nylasv2.client.restful_models import (
Message,
Thread,
) # pylint: disable=cyclic-import
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from enum import Enum

from six import StringIO
from nylas.client.restful_model_collection import RestfulModelCollection
from nylas.client.errors import FileUploadError, UnSyncedError, NylasApiError
from nylas.utils import timestamp_from_dt, AuthMethod
from nylasv2.client.restful_model_collection import RestfulModelCollection
from nylasv2.client.errors import FileUploadError, UnSyncedError, NylasApiError
from nylasv2.utils import timestamp_from_dt, AuthMethod

# pylint: disable=attribute-defined-outside-init

Expand Down Expand Up @@ -989,15 +989,15 @@ def as_json(self, enforce_read_only=True):
@staticmethod
def verify_webhook_signature(nylas_signature, raw_body, client_secret):
"""
Verify incoming webhook signature came from Nylas
Verify incoming webhook signature came from nylasv2
Args:
nylas_signature (str): The signature to verify
raw_body (bytes | bytearray): The raw body from the payload
client_secret (str): Client secret of the app receiving the webhook
Returns:
bool: True if the webhook signature was verified from Nylas
bool: True if the webhook signature was verified from nylasv2
"""
digest = hmac.new(
str.encode(client_secret), msg=raw_body, digestmod=hashlib.sha256
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from nylas.client.restful_models import RestfulModel
from nylasv2.client.restful_models import RestfulModel


class SchedulerTimeSlot(RestfulModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import copy

from nylas.client.restful_model_collection import RestfulModelCollection
from nylas.client.restful_models import Scheduler
from nylas.client.scheduler_models import (
SchedulerTimeSlot,
from nylasv2.client.restful_model_collection import RestfulModelCollection
from nylasv2.client.restful_models import Scheduler
from nylasv2.client.scheduler_models import (
SchedulerBookingConfirmation,
SchedulerTimeSlot,
)


Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions nylas/services/tunnel.py → nylasv2/services/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import json
from threading import Thread

from nylas.client import APIClient
from nylas.client.restful_models import Webhook
from nylas.config import DEFAULT_REGION
from nylasv2.client import APIClient
from nylasv2.client.restful_models import Webhook
from nylasv2.config import DEFAULT_REGION


def open_webhook_tunnel(api, config):
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import sys
import re
import subprocess
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys

from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand

VERSION = ""
with open("nylas/_client_sdk_version.py", "r") as fd:
with open("nylasv2/_client_sdk_version.py", "r") as fd:
VERSION = re.search(
r'^__VERSION__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE
).group(1)
Expand Down Expand Up @@ -93,7 +93,7 @@ def main():
sys.exit()

setup(
name="nylas",
name="nylasv2",
version=VERSION,
packages=find_packages(),
install_requires=RUN_DEPENDENCIES,
Expand Down

0 comments on commit 861d799

Please sign in to comment.