Skip to content

Commit

Permalink
Changes to calendars and grants models and resources to not fail on d…
Browse files Browse the repository at this point in the history
…ecoding. (#300)

Co-authored-by: kiran.raju@nylas.com <kiran.raju@nylas.com>
  • Loading branch information
kraju3 and kiran.raju@nylas.com committed Oct 27, 2023
1 parent 17bf9c7 commit ef60314
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions nylas/models/availability.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import List, Literal

from dataclasses_json import dataclass_json
Expand Down Expand Up @@ -37,8 +37,8 @@ class GetAvailabilityResponse:
time_slots: The available time slots where a new meeting can be created for the requested preferences.
"""

order: List[str]
time_slots: List[TimeSlot]
order: List[str] = field(default_factory=list)


class MeetingBuffer(TypedDict):
Expand Down Expand Up @@ -74,7 +74,7 @@ class OpenHours(TypedDict):
timezone: str
start: str
end: str
extdates: List[str]
exdates: NotRequired[List[str]]


class AvailabilityRules(TypedDict):
Expand Down
4 changes: 2 additions & 2 deletions nylas/models/grants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import List, Any, Dict, Optional

from dataclasses_json import dataclass_json
Expand Down Expand Up @@ -30,8 +30,8 @@ class Grant:

id: str
provider: str
scope: List[str]
created_at: int
scope: List[str] = field(default_factory=list)
grant_status: Optional[str] = None
email: Optional[str] = None
user_agent: Optional[str] = None
Expand Down
5 changes: 2 additions & 3 deletions nylas/resources/calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,20 @@ def destroy(self, identifier: str, calendar_id: str) -> DeleteResponse:
)

def get_availability(
self, identifier: str, request_body: GetAvailabilityRequest
self, request_body: GetAvailabilityRequest
) -> Response[GetAvailabilityResponse]:
"""
Get availability for a Calendar.
Args:
identifier: The grant ID or email account to get availability for.
request_body: The request body to send to the API.
Returns:
Response: The availability response from the API.
"""
json_response = self._http_client._execute(
method="POST",
path=f"/v3/grants/{identifier}/calendar/availability",
path="/v3/calendars/availability",
request_body=request_body,
)

Expand Down
2 changes: 1 addition & 1 deletion nylas/resources/grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Grants(
UpdatableApiResource,
DestroyableApiResource,
):
def list(self, query_params: ListGrantsQueryParams) -> ListResponse[Grant]:
def list(self, query_params: ListGrantsQueryParams = None) -> ListResponse[Grant]:
"""
Return all Grants.
Expand Down

0 comments on commit ef60314

Please sign in to comment.