@@ -151,6 +151,8 @@ def as_json(self):
151151
152152
153153class NylasAPIObject (RestfulModel ):
154+ read_only_attrs = {"id" , "account_id" , "object" , "job_status_id" }
155+
154156 def __init__ (self , cls , api ):
155157 RestfulModel .__init__ (self , cls , api )
156158
@@ -638,6 +640,7 @@ class Calendar(NylasAPIObject):
638640
639641 def __init__ (self , api ):
640642 NylasAPIObject .__init__ (self , Calendar , api )
643+ self .read_only_attrs .update ({"is_primary" , "read_only" })
641644
642645 @property
643646 def events (self ):
@@ -674,6 +677,16 @@ class Event(NylasAPIObject):
674677
675678 def __init__ (self , api ):
676679 NylasAPIObject .__init__ (self , Event , api )
680+ self .read_only_attrs .update (
681+ {
682+ "ical_uid" ,
683+ "message_id" ,
684+ "owner" ,
685+ "status" ,
686+ "master_event_id" ,
687+ "original_start_time" ,
688+ }
689+ )
677690
678691 def as_json (self ):
679692 dct = NylasAPIObject .as_json (self )
@@ -804,6 +817,13 @@ class JobStatus(NylasAPIObject):
804817
805818 def __init__ (self , api ):
806819 NylasAPIObject .__init__ (self , JobStatus , api )
820+ self .read_only_attrs .update (
821+ {
822+ "action" ,
823+ "status" ,
824+ "original_data" ,
825+ }
826+ )
807827
808828 def is_successful (self ):
809829 return self .status == "successful"
@@ -871,13 +891,19 @@ class Component(NylasAPIObject):
871891 "created_at" : "created_at" ,
872892 "updated_at" : "updated_at" ,
873893 }
874- read_only_attrs = {"id" , "public_application_id" , "created_at" , "updated_at" }
875894
876895 collection_name = None
877896 api_root = "component"
878897
879898 def __init__ (self , api ):
880899 NylasAPIObject .__init__ (self , Component , api )
900+ self .read_only_attrs .update (
901+ {
902+ "public_application_id" ,
903+ "created_at" ,
904+ "updated_at" ,
905+ }
906+ )
881907
882908 def as_json (self ):
883909 dct = NylasAPIObject .as_json (self )
@@ -896,13 +922,13 @@ class Webhook(NylasAPIObject):
896922 "application_id" ,
897923 "version" ,
898924 )
899- read_only_attrs = {"id" , "application_id" , "version" }
900925
901926 collection_name = "webhooks"
902927 api_root = "a"
903928
904929 def __init__ (self , api ):
905930 NylasAPIObject .__init__ (self , Webhook , api )
931+ self .read_only_attrs .update ({"application_id" , "version" })
906932
907933 def as_json (self ):
908934 dct = {}
0 commit comments