feat: [VAN-986] Add amplitude API (#30675)
* feat: [VAN-986] Add amplitude API * feat: add suggestion * feat: add spinner Co-authored-by: Zainab Amir <zainab.amir@arbisoft.com>
This commit is contained in:
@@ -739,3 +739,33 @@ def get_programs_for_organization(organization):
|
||||
Retrieve list of program uuids authored by a given organization
|
||||
"""
|
||||
return cache.get(PROGRAMS_BY_ORGANIZATION_CACHE_KEY_TPL.format(org_key=organization))
|
||||
|
||||
|
||||
def get_course_data(course_key_str):
|
||||
"""
|
||||
Retrieve information about the course with the given course key.
|
||||
|
||||
Arguments:
|
||||
course_key_str: key for the course about which we are retrieving information.
|
||||
|
||||
Returns:
|
||||
dict with details about specified course.
|
||||
"""
|
||||
user, catalog_integration = check_catalog_integration_and_get_user(error_message_field='Course UUID')
|
||||
if user:
|
||||
api_client = get_catalog_api_client(user)
|
||||
base_api_url = get_catalog_api_base_url()
|
||||
if course_key_str:
|
||||
course_cache_key = f'{catalog_integration.CACHE_KEY}.course.{course_key_str}'
|
||||
data = get_api_data(
|
||||
catalog_integration,
|
||||
'courses',
|
||||
resource_id=course_key_str,
|
||||
api_client=api_client,
|
||||
base_api_url=base_api_url,
|
||||
cache_key=course_cache_key if catalog_integration.is_cache_enabled else None,
|
||||
long_term_cache=True,
|
||||
many=False,
|
||||
)
|
||||
if data:
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user