@@ -124,7 +124,7 @@ def get_plans(self, dateFrom=None, dateTo=None, id=None, accountId=None, account
124124 :param plannedTimeBreakdown: ~~~ search plans ~~~
125125 :param updatedFrom: ~~~ retrieve plans for user / retrieve plans for generic resource / search plans ~~~
126126 """
127-
127+
128128 if id :
129129 url = f"plans/{ id } "
130130 return self .get (url )
@@ -166,7 +166,7 @@ def get_plans(self, dateFrom=None, dateTo=None, id=None, accountId=None, account
166166 "to" : self ._resolve_date (dateTo ).isoformat (),
167167 "offset" : 0 ,
168168 "limit" : self ._limit
169- }
169+ }
170170 if accountIds :
171171 data ['accountIds' ] = accountIds
172172 if assigneeTypes :
@@ -185,17 +185,17 @@ def get_plans(self, dateFrom=None, dateTo=None, id=None, accountId=None, account
185185 data ['updatedFrom' ] = self ._resolve_date (updatedFrom ).isoformat ()
186186 url = "/plans/search"
187187 return self .post (url , data = data )
188- return
189-
188+ return
189+
190190 def get_plan (self , id ):
191191 return self .get_plans (id = id )
192-
192+
193193 def get_plan_for_user (self , accountId , plannedTimeBreakdown = None , dateFrom = None , dateTo = None , updatedFrom = None ):
194194 return self .get_plans (accountId = accountId , plannedTimeBreakdown = plannedTimeBreakdown , dateFrom = dateFrom , dateTo = dateTo , updatedFrom = updatedFrom )
195-
195+
196196 def get_plan_for_resource (self , genericResourceId , plannedTimeBreakdown = None , dateFrom = None , dateTo = None , updatedFrom = None ):
197197 return self .get_plans (genericResourceId = genericResourceId , plannedTimeBreakdown = plannedTimeBreakdown , dateFrom = dateFrom , dateTo = dateTo , updatedFrom = updatedFrom )
198-
198+
199199 def search_plans (self , dateFrom , dateTo , accountIds = None , assigneeTypes = None , genericResourceIds = None , planIds = None , planItemIds = None , planItemTypes = None , plannedTimeBreakdown = None , updatedFrom = None ):
200200 return self .get_plans (dateFrom = dateFrom , dateTo = dateTo , accountIds = accountIds , assigneeTypes = assigneeTypes , genericResourceIds = genericResourceIds , planIds = planIds , planItemIds = planItemIds , planItemTypes = planItemTypes , plannedTimeBreakdown = plannedTimeBreakdown , updatedFrom = updatedFrom )
201201
@@ -233,20 +233,20 @@ def create_plan(self, assigneeId, assigneeType, startDate, endDate, planItemId,
233233 data ['planApproval' ] = {
234234 "reviewerId" : planApprovalReviewerId ,
235235 "status" : "REQUESTED"
236- }
236+ }
237237 else :
238238 data ['planApproval' ] = {
239239 "reviewerId" : planApprovalReviewerId ,
240240 "status" : planApprovalStatus # Enum: "APPROVED" "REJECTED" "REQUESTED"
241- }
241+ }
242242 if recurrenceEndDate :
243243 data ['recurrenceEndDate' ] = recurrenceEndDate
244244 if rule :
245245 data ['rule' ] = rule # Enum: "NEVER" "WEEKLY" "BI_WEEKLY" "MONTHLY"
246246
247247 url = "/plans"
248248 return self .post (url , data = data )
249-
249+
250250 def update_plan (self , id , assigneeId , assigneeType , startDate , endDate , planItemId , planItemType , plannedSecondsPerDay , description = None , includeNonWorkingDays = None , planApprovalReviewerId = None , planApprovalStatus = None , recurrenceEndDate = None , rule = None ):
251251 """
252252 :param id:
@@ -282,12 +282,12 @@ def update_plan(self, id, assigneeId, assigneeType, startDate, endDate, planItem
282282 data ['planApproval' ] = {
283283 "reviewerId" : planApprovalReviewerId ,
284284 "status" : "REQUESTED"
285- }
285+ }
286286 else :
287287 data ['planApproval' ] = {
288288 "reviewerId" : planApprovalReviewerId ,
289289 "status" : planApprovalStatus # Enum: "APPROVED" "REJECTED" "REQUESTED"
290- }
290+ }
291291 if recurrenceEndDate :
292292 data ['recurrenceEndDate' ] = recurrenceEndDate
293293 if rule :
@@ -299,7 +299,7 @@ def update_plan(self, id, assigneeId, assigneeType, startDate, endDate, planItem
299299 def delete_plan (self , id ):
300300 url = f"/plans/{ id } "
301301 return self .delete (url )
302-
302+
303303 # Programs
304304 ## TBD
305305
@@ -573,3 +573,101 @@ def search_worklogs(self, dateFrom, dateTo, updatedFrom=None, authorIds=None, is
573573 url = f"/worklogs/search"
574574
575575 return self .post (url , params = params , data = data )
576+ def create_customer (self , key = None , name = None , data = None ):
577+ """
578+ Create customer
579+ :param key:
580+ :param name:
581+ """
582+
583+ # either provide data, or build from other params
584+ if (not (data )):
585+ data = {
586+ "key" : key ,
587+ "name" : name
588+ }
589+ url = f"/customers"
590+
591+ return self .post (url , data = data )
592+
593+ def update_customer (self , key = None , name = None , data = None ):
594+ """
595+ Update customer
596+ :param key:
597+ :param name:
598+ """
599+
600+ # either provide data, or build from other params
601+ if (not (data )):
602+ data = {
603+ "key" : key ,
604+ "name" : name
605+ }
606+
607+ url = f"/customers/{ key } "
608+
609+ return self .put (url , data = data )
610+
611+ def create_account (self , key = None , leadAccountId = None , name = None , status = None , categoryKey = None , contactAccountId = None , customerKey = None , externalContactName = None , isGlobal = None , data = None ):
612+ """
613+ Create account
614+ :param key:
615+ :param leadAccountId:
616+ :param name:
617+ :param status: # Enum: "CLOSED" "OPEN" "ARCHIVED"
618+ :param categoryKey:
619+ :param contactAccountId:
620+ :param customerKey:
621+ :param externalContactName:
622+ :param isGlobal:
623+ """
624+
625+ # either provide data, or build from other params
626+ if (not (data )):
627+ data = {
628+ "key" : key ,
629+ "leadAccountId" : leadAccountId ,
630+ "name" : name ,
631+ "status" : status ,
632+ "categoryKey" : categoryKey ,
633+ "contactAccountId" : contactAccountId ,
634+ "customerKey" : customerKey ,
635+ "externalContactName" : externalContactName ,
636+ "global" : isGlobal
637+ }
638+
639+ url = f"/accounts"
640+
641+ return self .post (url , data = data )
642+
643+ def update_account (self , key = None , leadAccountId = None , name = None , status = None , categoryKey = None , contactAccountId = None , customerKey = None , externalContactName = None , isGlobal = None , data = None ):
644+ """
645+ Create account
646+ :param key:
647+ :param leadAccountId:
648+ :param name:
649+ :param status: # Enum: "CLOSED" "OPEN" "ARCHIVED"
650+ :param categoryKey:
651+ :param contactAccountId:
652+ :param customerKey:
653+ :param externalContactName:
654+ :param isGlobal:
655+ """
656+
657+ # either provide data, or build from other params
658+ if (not (data )):
659+ data = {
660+ "key" : key ,
661+ "leadAccountId" : leadAccountId ,
662+ "name" : name ,
663+ "status" : status ,
664+ "categoryKey" : categoryKey ,
665+ "contactAccountId" : contactAccountId ,
666+ "customerKey" : customerKey ,
667+ "externalContactName" : externalContactName ,
668+ "global" : isGlobal
669+ }
670+
671+ url = f"/accounts/{ key } "
672+
673+ return self .put (url , data = data )
0 commit comments