@@ -439,6 +439,41 @@ def create_late_policy(self, **kwargs):
439439
440440 return LatePolicy (self ._requester , late_policy_json ["late_policy" ])
441441
442+ def create_lti_resource_link (self , url , title = None , custom = None , ** kwargs ):
443+ """
444+ Create a new LTI resource link.
445+
446+ :calls: `POST /api/v1/courses/:course_id/lti_resource_links \
447+ <https://canvas.instructure.com/doc/api/lti_resource_links.html#method.lti/resource_links.create>`_
448+
449+ :param course_id: The ID of the course.
450+ :type course_id: `int`
451+ :param url: The launch URL for the resource link.
452+ :type url: `str`
453+ :param title: The title of the resource link.
454+ :type title: `str`, optional
455+ :param custom: Custom parameters to send to the tool.
456+ :type custom: `dict`, optional
457+
458+ :rtype: :class:`canvasapi.lti_resource_link.LTIResourceLink`
459+ """
460+
461+ if not url :
462+ raise RequiredFieldMissing ("The 'url' paramter is required." )
463+
464+ kwargs ["url" ] = url
465+ if title :
466+ kwargs ["title" ] = title
467+ if custom :
468+ kwargs ["custom" ] = custom
469+
470+ response = self ._requester .request (
471+ "POST" ,
472+ f"courses/{ self .id } /lti_resource_links" ,
473+ _kwargs = combine_kwargs (** kwargs ),
474+ )
475+ return LTIResourceLink (self ._requester , response .json ())
476+
442477 def create_module (self , module , ** kwargs ):
443478 """
444479 Create a new module.
@@ -1646,6 +1681,48 @@ def get_licenses(self, **kwargs):
16461681 _kwargs = combine_kwargs (** kwargs ),
16471682 )
16481683
1684+ def get_lti_resource_link (self , lti_resource_link , ** kwargs ):
1685+ """
1686+ Return details about the specified resource link.
1687+
1688+ :calls: `GET /api/v1/courses/:course_id/lti_resource_links/:id \
1689+ <https://canvas.instructure.com/doc/api/lti_resource_links.html#method.lti/resource_links.show>`_
1690+
1691+ :param lti_resource_link: The object or ID of the LTI resource link.
1692+ :type lti_resource_link: :class:`canvasapi.lti_resource_link.LTIResourceLink` or int
1693+
1694+ :rtype: :class:`canvasapi.lti_resource_link.LTIResourceLink`
1695+ """
1696+
1697+ lti_resource_link_id = obj_or_id (
1698+ lti_resource_link , "lti_resource_link" , (LTIResourceLink ,)
1699+ )
1700+
1701+ response = self ._requester .request (
1702+ "GET" ,
1703+ f"courses/{ self .id } /lti_resource_links/{ lti_resource_link_id } " ,
1704+ _kwargs = combine_kwargs (** kwargs ),
1705+ )
1706+ return LTIResourceLink (self ._requester , response .json ())
1707+
1708+ def get_lti_resource_links (self , ** kwargs ):
1709+ """
1710+ Returns all LTI resource links for this course as a PaginatedList.
1711+
1712+ :calls: `GET /api/v1/courses/:course_id/lti_resource_links \
1713+ <https://canvas.instructure.com/doc/api/lti_resource_links.html#method.lti/resource_links.index>`_
1714+
1715+ :rtype: :class:`canvasapi.paginated_list.PaginatedList`
1716+ """
1717+
1718+ return PaginatedList (
1719+ LTIResourceLink ,
1720+ self ._requester ,
1721+ "GET" ,
1722+ f"courses/{ self .id } /lti_resource_links" ,
1723+ kwargs = combine_kwargs (** kwargs ),
1724+ )
1725+
16491726 def get_migration_systems (self , ** kwargs ):
16501727 """
16511728 Return a list of migration systems.
@@ -2763,83 +2840,6 @@ def upload(self, file: FileOrPathLike, **kwargs):
27632840 self ._requester , "courses/{}/files" .format (self .id ), file , ** kwargs
27642841 ).start ()
27652842
2766- def get_lti_resource_links (self , ** kwargs ):
2767- """
2768- Returns all LTI resource links for this course as a PaginatedList.
2769-
2770- :calls: `GET /api/v1/courses/:course_id/lti_resource_links \
2771- <https://canvas.instructure.com/doc/api/lti_resource_links.html#method.lti/resource_links.index>`_
2772-
2773- :rtype: :class:`canvasapi.paginated_list.PaginatedList`
2774- """
2775-
2776- return PaginatedList (
2777- LTIResourceLink ,
2778- self ._requester ,
2779- "GET" ,
2780- f"courses/{ self .id } /lti_resource_links" ,
2781- kwargs = combine_kwargs (** kwargs ),
2782- )
2783-
2784- def get_lti_resource_link (self , lti_resource_link , ** kwargs ):
2785- """
2786- Return details about the specified resource link.
2787-
2788- :calls: `GET /api/v1/courses/:course_id/lti_resource_links/:id \
2789- <https://canvas.instructure.com/doc/api/lti_resource_links.html#method.lti/resource_links.show>`_
2790-
2791- :param lti_resource_link: The object or ID of the LTI resource link.
2792- :type lti_resource_link: :class:`canvasapi.lti_resource_link.LTIResourceLink` or int
2793-
2794- :rtype: :class:`canvasapi.lti_resource_link.LTIResourceLink`
2795- """
2796-
2797- lti_resource_link_id = obj_or_id (
2798- lti_resource_link , "lti_resource_link" , (LTIResourceLink ,)
2799- )
2800-
2801- response = self ._requester .request (
2802- "GET" ,
2803- f"courses/{ self .id } /lti_resource_links/{ lti_resource_link_id } " ,
2804- _kwargs = combine_kwargs (** kwargs ),
2805- )
2806- return LTIResourceLink (self ._requester , response .json ())
2807-
2808- def create_lti_resource_link (self , url , title = None , custom = None , ** kwargs ):
2809- """
2810- Create a new LTI resource link.
2811-
2812- :calls: `POST /api/v1/courses/:course_id/lti_resource_links \
2813- <https://canvas.instructure.com/doc/api/lti_resource_links.html#method.lti/resource_links.create>`_
2814-
2815- :param course_id: The ID of the course.
2816- :type course_id: `int`
2817- :param url: The launch URL for the resource link.
2818- :type url: `str`
2819- :param title: The title of the resource link.
2820- :type title: `str`, optional
2821- :param custom: Custom parameters to send to the tool.
2822- :type custom: `dict`, optional
2823-
2824- :rtype: :class:`canvasapi.lti_resource_link.LTIResourceLink`
2825- """
2826-
2827- if not url :
2828- raise RequiredFieldMissing ("The 'url' paramter is required." )
2829-
2830- kwargs ["url" ] = url
2831- if title :
2832- kwargs ["title" ] = title
2833- if custom :
2834- kwargs ["custom" ] = custom
2835-
2836- response = self ._requester .request (
2837- "POST" ,
2838- f"courses/{ self .id } /lti_resource_links" ,
2839- _kwargs = combine_kwargs (** kwargs ),
2840- )
2841- return LTIResourceLink (self ._requester , response .json ())
2842-
28432843
28442844class CourseNickname (CanvasObject ):
28452845 def __str__ (self ):
0 commit comments