gazu 1.0.0__py2.py3-none-any.whl → 1.0.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gazu/__version__.py +1 -1
- gazu/entity.py +12 -0
- gazu/person.py +208 -0
- gazu/playlist.py +166 -0
- gazu/project.py +405 -0
- gazu/search.py +35 -0
- gazu/task.py +404 -10
- gazu/user.py +316 -0
- {gazu-1.0.0.dist-info → gazu-1.0.2.dist-info}/METADATA +3 -5
- {gazu-1.0.0.dist-info → gazu-1.0.2.dist-info}/RECORD +13 -12
- {gazu-1.0.0.dist-info → gazu-1.0.2.dist-info}/WHEEL +0 -0
- {gazu-1.0.0.dist-info → gazu-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {gazu-1.0.0.dist-info → gazu-1.0.2.dist-info}/top_level.txt +0 -0
gazu/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.2"
|
gazu/entity.py
CHANGED
|
@@ -114,6 +114,18 @@ def new_entity_type(name, client=default):
|
|
|
114
114
|
return raw.create("entity-types", data, client=client)
|
|
115
115
|
|
|
116
116
|
|
|
117
|
+
def remove_entity_type(entity_type, client=default):
|
|
118
|
+
"""
|
|
119
|
+
Remove given entity type from database.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
entity_type (dict / str): Entity type to remove.
|
|
123
|
+
"""
|
|
124
|
+
entity_type = normalize_model_parameter(entity_type)
|
|
125
|
+
path = "data/entity-types/%s" % entity_type["id"]
|
|
126
|
+
return raw.delete(path, client=client)
|
|
127
|
+
|
|
128
|
+
|
|
117
129
|
def remove_entity(entity, force=False, client=default):
|
|
118
130
|
"""
|
|
119
131
|
Remove given entity from database.
|
gazu/person.py
CHANGED
|
@@ -446,3 +446,211 @@ def invite_person(person, client=default):
|
|
|
446
446
|
"actions/persons/%s/invite" % (person["id"]),
|
|
447
447
|
client=client,
|
|
448
448
|
)
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
@cache
|
|
452
|
+
def get_time_spents_by_date(person, date, client=default):
|
|
453
|
+
"""
|
|
454
|
+
Get time spents for a person on a specific date.
|
|
455
|
+
|
|
456
|
+
Args:
|
|
457
|
+
person (dict / ID): The person dict or id.
|
|
458
|
+
date (str): Date in YYYY-MM-DD format.
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
list: Time spents for the date.
|
|
462
|
+
"""
|
|
463
|
+
person = normalize_model_parameter(person)
|
|
464
|
+
return raw.get(
|
|
465
|
+
"data/persons/%s/time-spents/by-date" % person["id"],
|
|
466
|
+
params={"date": date},
|
|
467
|
+
client=client,
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
@cache
|
|
472
|
+
def get_week_time_spents(person, year, week, client=default):
|
|
473
|
+
"""
|
|
474
|
+
Get time spents for a person for a specific week.
|
|
475
|
+
|
|
476
|
+
Args:
|
|
477
|
+
person (dict / ID): The person dict or id.
|
|
478
|
+
year (int): Year.
|
|
479
|
+
week (int): Week number.
|
|
480
|
+
|
|
481
|
+
Returns:
|
|
482
|
+
list: Time spents for the week.
|
|
483
|
+
"""
|
|
484
|
+
person = normalize_model_parameter(person)
|
|
485
|
+
return raw.get(
|
|
486
|
+
"data/persons/%s/time-spents/week/%s/%s" % (person["id"], year, week),
|
|
487
|
+
client=client,
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
@cache
|
|
492
|
+
def get_year_time_spents(person, year, client=default):
|
|
493
|
+
"""
|
|
494
|
+
Get time spents for a person for a specific year.
|
|
495
|
+
|
|
496
|
+
Args:
|
|
497
|
+
person (dict / ID): The person dict or id.
|
|
498
|
+
year (int): Year.
|
|
499
|
+
|
|
500
|
+
Returns:
|
|
501
|
+
list: Time spents for the year.
|
|
502
|
+
"""
|
|
503
|
+
person = normalize_model_parameter(person)
|
|
504
|
+
return raw.get(
|
|
505
|
+
"data/persons/%s/time-spents/year/%s" % (person["id"], year),
|
|
506
|
+
client=client,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
@cache
|
|
511
|
+
def get_day_offs(person, client=default):
|
|
512
|
+
"""
|
|
513
|
+
Get day offs for a person.
|
|
514
|
+
|
|
515
|
+
Args:
|
|
516
|
+
person (dict / ID): The person dict or id.
|
|
517
|
+
|
|
518
|
+
Returns:
|
|
519
|
+
list: Day offs for the person.
|
|
520
|
+
"""
|
|
521
|
+
person = normalize_model_parameter(person)
|
|
522
|
+
return raw.fetch_all(
|
|
523
|
+
"persons/%s/day-offs" % person["id"], client=client
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
@cache
|
|
528
|
+
def get_week_day_offs(person, year, week, client=default):
|
|
529
|
+
"""
|
|
530
|
+
Get day offs for a person for a specific week.
|
|
531
|
+
|
|
532
|
+
Args:
|
|
533
|
+
person (dict / ID): The person dict or id.
|
|
534
|
+
year (int): Year.
|
|
535
|
+
week (int): Week number.
|
|
536
|
+
|
|
537
|
+
Returns:
|
|
538
|
+
list: Day offs for the week.
|
|
539
|
+
"""
|
|
540
|
+
person = normalize_model_parameter(person)
|
|
541
|
+
return raw.get(
|
|
542
|
+
"data/persons/%s/day-offs/week/%s/%s" % (person["id"], year, week),
|
|
543
|
+
client=client,
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
@cache
|
|
548
|
+
def get_month_day_offs(person, year, month, client=default):
|
|
549
|
+
"""
|
|
550
|
+
Get day offs for a person for a specific month.
|
|
551
|
+
|
|
552
|
+
Args:
|
|
553
|
+
person (dict / ID): The person dict or id.
|
|
554
|
+
year (int): Year.
|
|
555
|
+
month (int): Month number.
|
|
556
|
+
|
|
557
|
+
Returns:
|
|
558
|
+
list: Day offs for the month.
|
|
559
|
+
"""
|
|
560
|
+
person = normalize_model_parameter(person)
|
|
561
|
+
return raw.get(
|
|
562
|
+
"data/persons/%s/day-offs/month/%s/%s"
|
|
563
|
+
% (person["id"], year, str(month).zfill(2)),
|
|
564
|
+
client=client,
|
|
565
|
+
)
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
@cache
|
|
569
|
+
def get_year_day_offs(person, year, client=default):
|
|
570
|
+
"""
|
|
571
|
+
Get day offs for a person for a specific year.
|
|
572
|
+
|
|
573
|
+
Args:
|
|
574
|
+
person (dict / ID): The person dict or id.
|
|
575
|
+
year (int): Year.
|
|
576
|
+
|
|
577
|
+
Returns:
|
|
578
|
+
list: Day offs for the year.
|
|
579
|
+
"""
|
|
580
|
+
person = normalize_model_parameter(person)
|
|
581
|
+
return raw.get(
|
|
582
|
+
"data/persons/%s/day-offs/year/%s" % (person["id"], year),
|
|
583
|
+
client=client,
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
def add_person_to_department(person, department, client=default):
|
|
588
|
+
"""
|
|
589
|
+
Add a person to a department.
|
|
590
|
+
|
|
591
|
+
Args:
|
|
592
|
+
person (dict / ID): The person dict or id.
|
|
593
|
+
department (dict / ID): The department dict or id.
|
|
594
|
+
|
|
595
|
+
Returns:
|
|
596
|
+
dict: Response information.
|
|
597
|
+
"""
|
|
598
|
+
person = normalize_model_parameter(person)
|
|
599
|
+
department = normalize_model_parameter(department)
|
|
600
|
+
return raw.post(
|
|
601
|
+
"data/persons/%s/departments" % person["id"],
|
|
602
|
+
{"department_id": department["id"]},
|
|
603
|
+
client=client,
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
def remove_person_from_department(person, department, client=default):
|
|
608
|
+
"""
|
|
609
|
+
Remove a person from a department.
|
|
610
|
+
|
|
611
|
+
Args:
|
|
612
|
+
person (dict / ID): The person dict or id.
|
|
613
|
+
department (dict / ID): The department dict or id.
|
|
614
|
+
|
|
615
|
+
Returns:
|
|
616
|
+
Response: Request response object.
|
|
617
|
+
"""
|
|
618
|
+
person = normalize_model_parameter(person)
|
|
619
|
+
department = normalize_model_parameter(department)
|
|
620
|
+
return raw.delete(
|
|
621
|
+
"data/persons/%s/departments/%s" % (person["id"], department["id"]),
|
|
622
|
+
client=client,
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
def disable_two_factor_authentication(person, client=default):
|
|
627
|
+
"""
|
|
628
|
+
Disable two factor authentication for a person.
|
|
629
|
+
|
|
630
|
+
Args:
|
|
631
|
+
person (dict / ID): The person dict or id.
|
|
632
|
+
|
|
633
|
+
Returns:
|
|
634
|
+
Response: Request response object.
|
|
635
|
+
"""
|
|
636
|
+
person = normalize_model_parameter(person)
|
|
637
|
+
return raw.delete(
|
|
638
|
+
"data/persons/%s/two-factor-authentication" % person["id"],
|
|
639
|
+
client=client,
|
|
640
|
+
)
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
def clear_person_avatar(person, client=default):
|
|
644
|
+
"""
|
|
645
|
+
Clear avatar for a person.
|
|
646
|
+
|
|
647
|
+
Args:
|
|
648
|
+
person (dict / ID): The person dict or id.
|
|
649
|
+
|
|
650
|
+
Returns:
|
|
651
|
+
Response: Request response object.
|
|
652
|
+
"""
|
|
653
|
+
person = normalize_model_parameter(person)
|
|
654
|
+
return raw.delete(
|
|
655
|
+
"data/persons/%s/avatar" % person["id"], client=client
|
|
656
|
+
)
|
gazu/playlist.py
CHANGED
|
@@ -253,3 +253,169 @@ def update_entity_preview(
|
|
|
253
253
|
if persist:
|
|
254
254
|
update_playlist(playlist, client=client)
|
|
255
255
|
return playlist
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
@cache
|
|
259
|
+
def delete_playlist(playlist, client=default):
|
|
260
|
+
"""
|
|
261
|
+
Delete a playlist.
|
|
262
|
+
|
|
263
|
+
Args:
|
|
264
|
+
playlist (dict / ID): The playlist dict or id.
|
|
265
|
+
|
|
266
|
+
Returns:
|
|
267
|
+
Response: Request response object.
|
|
268
|
+
"""
|
|
269
|
+
playlist = normalize_model_parameter(playlist)
|
|
270
|
+
return raw.delete("data/playlists/%s" % playlist["id"], client=client)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
@cache
|
|
274
|
+
def get_entity_previews(playlist, client=default):
|
|
275
|
+
"""
|
|
276
|
+
Get entity previews for a playlist.
|
|
277
|
+
|
|
278
|
+
Args:
|
|
279
|
+
playlist (dict / ID): The playlist dict or id.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
list: Entity previews for the playlist.
|
|
283
|
+
"""
|
|
284
|
+
playlist = normalize_model_parameter(playlist)
|
|
285
|
+
return raw.fetch_all(
|
|
286
|
+
"playlists/%s/entity-previews" % playlist["id"], client=client
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
@cache
|
|
291
|
+
def get_build_job(build_job, client=default):
|
|
292
|
+
"""
|
|
293
|
+
Get a build job.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
build_job (dict / ID): The build job dict or id.
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
dict: Build job information.
|
|
300
|
+
"""
|
|
301
|
+
build_job = normalize_model_parameter(build_job)
|
|
302
|
+
return raw.fetch_one("playlists/build-jobs", build_job["id"], client=client)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def remove_build_job(build_job, client=default):
|
|
306
|
+
"""
|
|
307
|
+
Delete a build job.
|
|
308
|
+
|
|
309
|
+
Args:
|
|
310
|
+
build_job (dict / ID): The build job dict or id.
|
|
311
|
+
|
|
312
|
+
Returns:
|
|
313
|
+
Response: Request response object.
|
|
314
|
+
"""
|
|
315
|
+
build_job = normalize_model_parameter(build_job)
|
|
316
|
+
return raw.delete(
|
|
317
|
+
"data/playlists/build-jobs/%s" % build_job["id"], client=client
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
@cache
|
|
322
|
+
def all_build_jobs_for_project(project, client=default):
|
|
323
|
+
"""
|
|
324
|
+
Get all build jobs for a project.
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
project (dict / ID): The project dict or id.
|
|
328
|
+
|
|
329
|
+
Returns:
|
|
330
|
+
list: All build jobs for the project.
|
|
331
|
+
"""
|
|
332
|
+
project = normalize_model_parameter(project)
|
|
333
|
+
return raw.fetch_all(
|
|
334
|
+
"projects/%s/build-jobs" % project["id"], client=client
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def build_playlist_movie(playlist, client=default):
|
|
339
|
+
"""
|
|
340
|
+
Build a movie for a playlist.
|
|
341
|
+
|
|
342
|
+
Args:
|
|
343
|
+
playlist (dict / ID): The playlist dict or id.
|
|
344
|
+
|
|
345
|
+
Returns:
|
|
346
|
+
dict: Build job information.
|
|
347
|
+
"""
|
|
348
|
+
playlist = normalize_model_parameter(playlist)
|
|
349
|
+
return raw.post(
|
|
350
|
+
"data/playlists/%s/build-movie" % playlist["id"], {}, client=client
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def download_playlist_build(playlist, build_job, file_path, client=default):
|
|
355
|
+
"""
|
|
356
|
+
Download a playlist build.
|
|
357
|
+
|
|
358
|
+
Args:
|
|
359
|
+
playlist (dict / ID): The playlist dict or id.
|
|
360
|
+
build_job (dict / ID): The build job dict or id.
|
|
361
|
+
file_path (str): The location to store the file on the hard drive.
|
|
362
|
+
|
|
363
|
+
Returns:
|
|
364
|
+
Response: Request response object.
|
|
365
|
+
"""
|
|
366
|
+
playlist = normalize_model_parameter(playlist)
|
|
367
|
+
build_job = normalize_model_parameter(build_job)
|
|
368
|
+
path = "data/playlists/%s/build-jobs/%s/download" % (
|
|
369
|
+
playlist["id"],
|
|
370
|
+
build_job["id"],
|
|
371
|
+
)
|
|
372
|
+
return raw.download(path, file_path, client=client)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def download_playlist_zip(playlist, file_path, client=default):
|
|
376
|
+
"""
|
|
377
|
+
Download a playlist as a zip file.
|
|
378
|
+
|
|
379
|
+
Args:
|
|
380
|
+
playlist (dict / ID): The playlist dict or id.
|
|
381
|
+
file_path (str): The location to store the file on the hard drive.
|
|
382
|
+
|
|
383
|
+
Returns:
|
|
384
|
+
Response: Request response object.
|
|
385
|
+
"""
|
|
386
|
+
playlist = normalize_model_parameter(playlist)
|
|
387
|
+
path = "data/playlists/%s/download/zip" % playlist["id"]
|
|
388
|
+
return raw.download(path, file_path, client=client)
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
def generate_temp_playlist(project, data, client=default):
|
|
392
|
+
"""
|
|
393
|
+
Generate a temporary playlist.
|
|
394
|
+
|
|
395
|
+
Args:
|
|
396
|
+
project (dict / ID): The project dict or id.
|
|
397
|
+
data (dict): Playlist generation data.
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
dict: Generated temporary playlist.
|
|
401
|
+
"""
|
|
402
|
+
project = normalize_model_parameter(project)
|
|
403
|
+
return raw.post(
|
|
404
|
+
"data/projects/%s/playlists/temp" % project["id"], data, client=client
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
def notify_clients_playlist_ready(playlist, client=default):
|
|
409
|
+
"""
|
|
410
|
+
Notify clients that a playlist is ready.
|
|
411
|
+
|
|
412
|
+
Args:
|
|
413
|
+
playlist (dict / ID): The playlist dict or id.
|
|
414
|
+
|
|
415
|
+
Returns:
|
|
416
|
+
dict: Notification response.
|
|
417
|
+
"""
|
|
418
|
+
playlist = normalize_model_parameter(playlist)
|
|
419
|
+
return raw.post(
|
|
420
|
+
"data/playlists/%s/notify" % playlist["id"], {}, client=client
|
|
421
|
+
)
|