@@ -475,3 +475,143 @@ def get_test_files(self, assignment_id: int) -> requests.Response:
475475 the assignment with id <assignment_id>.
476476 """
477477 return requests .get (self ._url (f"assignments/{ assignment_id } /test_files" ), headers = self ._auth_header )
478+
479+ @parse_response ("json" )
480+ def get_starter_file_entries (self , assignment_id : int , starter_file_group_id : int ) -> requests .Response :
481+ """
482+ Return the name of all entries for a given starter file group. Entries are file or directory names.
483+ """
484+ return requests .get (
485+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } /entries" ),
486+ headers = self ._auth_header ,
487+ )
488+
489+ @parse_response ("json" )
490+ def create_starter_file (
491+ self , assignment_id : int , starter_file_group_id : int , file_path : str , contents : Union [str , bytes ]
492+ ) -> requests .Response :
493+ """
494+ Upload a starter file to the starter file group with id=<starter_file_group_id> for assignment with
495+ id=<assignment_id>. The file_path should be a relative path from the starter file group's root directory.
496+ """
497+ files = {"file_content" : (file_path , contents )}
498+ params = {"filename" : file_path }
499+ return requests .post (
500+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } /create_file" ),
501+ params = params ,
502+ files = files ,
503+ headers = self ._auth_header ,
504+ )
505+
506+ @parse_response ("json" )
507+ def create_starter_folder (
508+ self , assignment_id : int , starter_file_group_id : int , folder_path : str
509+ ) -> requests .Response :
510+ """
511+ Create a folder for the the starter file group with id=<starter_file_group_id> for assignment with
512+ id=<assignment_id>. The file_path should be a relative path from the starter file group's root directory.
513+ """
514+ params = {"folder_path" : folder_path }
515+ return requests .post (
516+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } /create_folder" ),
517+ params = params ,
518+ headers = self ._auth_header ,
519+ )
520+
521+ @parse_response ("json" )
522+ def remove_starter_file (self , assignment_id : int , starter_file_group_id : int , file_path : str ) -> requests .Response :
523+ """
524+ Remove a starter file from the starter file group with id=<starter_file_group_id> for assignment with
525+ id=<assignment_id>. The file_path should be a relative path from the starter file group's root directory.
526+ """
527+ params = {"filename" : file_path }
528+ return requests .delete (
529+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } /remove_file" ),
530+ params = params ,
531+ headers = self ._auth_header ,
532+ )
533+
534+ @parse_response ("json" )
535+ def remove_starter_folder (
536+ self , assignment_id : int , starter_file_group_id : int , folder_path : str
537+ ) -> requests .Response :
538+ """
539+ Remove a folder from the starter file group with id=<starter_file_group_id> for assignment with
540+ id=<assignment_id>. The file_path should be a relative path from the starter file group's root directory.
541+ """
542+ params = {"folder_path" : folder_path }
543+ return requests .delete (
544+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } /remove_folder" ),
545+ params = params ,
546+ headers = self ._auth_header ,
547+ )
548+
549+ @parse_response ("content" )
550+ def download_starter_file_entries (self , assignment_id : int , starter_file_group_id : int ) -> requests .Response :
551+ """
552+ Return the content of a zipfile containing the content of all starter files from the starter file group with
553+ id=<starter_file_group_id>.
554+ """
555+ return requests .get (
556+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } /download_entries" ),
557+ headers = self ._auth_header ,
558+ )
559+
560+ @parse_response ("json" )
561+ def get_starter_file_groups (self , assignment_id : int ) -> requests .Response :
562+ """
563+ Return all starter file groups for the assignment with id=<assignment_id>
564+ """
565+ return requests .get (self ._url (f"assignments/{ assignment_id } /starter_file_groups" ), headers = self ._auth_header )
566+
567+ @parse_response ("json" )
568+ def create_starter_file_group (self , assignment_id : int ) -> requests .Response :
569+ """
570+ Create a starter file groups for the assignment with id=<assignment_id>
571+ """
572+ return requests .post (self ._url (f"assignments/{ assignment_id } /starter_file_groups" ), headers = self ._auth_header )
573+
574+ @parse_response ("json" )
575+ def get_starter_file_group (self , assignment_id : int , starter_file_group_id : int ) -> requests .Response :
576+ """
577+ Return the starter file group with id=<starter_file_group_id> for the assignment with id=<assignment_id>
578+ """
579+ return requests .get (
580+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } " ),
581+ headers = self ._auth_header ,
582+ )
583+
584+ @parse_response ("json" )
585+ def update_starter_file_group (
586+ self ,
587+ assignment_id : int ,
588+ starter_file_group_id : int ,
589+ name : Optional [str ] = None ,
590+ entry_rename : Optional [str ] = None ,
591+ use_rename : Optional [bool ] = None ,
592+ ) -> requests .Response :
593+ """
594+ Update the starter file group with id=<starter_file_group_id> for the assignment with id=<assignment_id>
595+ """
596+ params = {}
597+ if name is not None :
598+ params ["name" ] = name
599+ if entry_rename is not None :
600+ params ["entry_rename" ] = entry_rename
601+ if use_rename is not None :
602+ params ["use_rename" ] = use_rename
603+ return requests .put (
604+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } " ),
605+ params = params ,
606+ headers = self ._auth_header ,
607+ )
608+
609+ @parse_response ("json" )
610+ def delete_starter_file_group (self , assignment_id : int , starter_file_group_id : int ) -> requests .Response :
611+ """
612+ Delete the starter file group with id=<starter_file_group_id> for the assignment with id=<assignment_id>
613+ """
614+ return requests .delete (
615+ self ._url (f"assignments/{ assignment_id } /starter_file_groups/{ starter_file_group_id } " ),
616+ headers = self ._auth_header ,
617+ )
0 commit comments