diff --git a/bbcli/cli.py b/bbcli/cli.py index f1b10fb5e86e2ac16c1baa32d874150fffc3344c..4ec36defe5c876fba9ad1eab7f6f010fc94286d4 100644 --- a/bbcli/cli.py +++ b/bbcli/cli.py @@ -135,7 +135,7 @@ create.add_command(create_document) create.add_command(create_file) create.add_command(create_web_link) create.add_command(create_folder) -# create.add_command(create_courselink) +create.add_command(create_courselink) create.add_command(upload_attachment) create.add_command(create_assignment_from_contents) diff --git a/bbcli/commands/contents.py b/bbcli/commands/contents.py index 32b729005f2f7125225b8b19c24274ce6b64dd71..d75f1ce961ece6fb6b3de965ea00003234e3c202 100644 --- a/bbcli/commands/contents.py +++ b/bbcli/commands/contents.py @@ -198,8 +198,8 @@ def create_folder(ctx: click.core.Context, course_id: str, parent_id: str, title @click.command(name='course-link', help='Create course link content\n\nRedirects user to the target content') @click.option('-c', '--course', 'course_id', required=True, type=str, help='COURSE ID') @click.option('-f', '--folder', 'parent_id', required=True, type=str, help='FOLDER ID') +@click.option('-t', '--target', 'target_id', required=True, type=str, help='TARGET ID') @click.argument('title', required=True, type=str) -@click.argument('target_id', required=True, type=str) @click.option('-j', '--json', 'print_json', required=False, is_flag=True, help='Print the data in json format') @click.option('-md', '--markdown', required=False, is_flag=True, help='Use this flag if you want to use markdown in body') @standard_options diff --git a/bbcli/services/contents_services.py b/bbcli/services/contents_services.py index e56f09841a64e811555ef583e73e99fbdefa4b5c..d82379bd9f6f17c872709b9abcb74ad3f5edaa88 100644 --- a/bbcli/services/contents_services.py +++ b/bbcli/services/contents_services.py @@ -189,7 +189,6 @@ def create_folder(session: requests.Session, course_id: str, parent_id: str,titl return response -# TODO:FUNKER IKKE PGA targetType def create_courselink(session: requests.Session, course_id: str, parent_id: str, title: str, target_id: str, standard_options: StandardOptions, is_markdown: bool) -> Dict: diff --git a/bbcli/services/utils/content_builder.py b/bbcli/services/utils/content_builder.py index e02bb4a805060663f57fc9cebd3dda0930ead46c..3526ad4421aa9231a398325a4eb2c2fc0c305174 100644 --- a/bbcli/services/utils/content_builder.py +++ b/bbcli/services/utils/content_builder.py @@ -71,7 +71,7 @@ class Builder(ABC): # ModulePage @abstractmethod - def add_content_handler_courselink(self, target_id: str, target_type: str = 'Unset') -> Builder: + def add_content_handler_courselink(self, target_id: str, target_type: str = 'Forum') -> Builder: pass @@ -204,7 +204,7 @@ class ContentBuilder(Builder): }) return self - def add_content_handler_courselink(self, target_id: str, target_type: str = 'Unset') -> Builder: + def add_content_handler_courselink(self, target_id: str, target_type: str = 'Content') -> Builder: self._product.add({ 'contentHandler': { 'id': 'resource/x-bb-courselink',