"""GraphQL utilities""" def format_label_participant( name, vendor_id, subaccount_id, spotify_id, apple_music_id): """Format a ParticipantCreateInput type for mutation Args: name: (str) The Proper name of the participant vendor_id: (int) The associated label ID subaccount_id: (int) The associated subaccount ID spotify_id: (str) The participant's Spotify ID apple_music_id: The participant's Apple ID Returns: dict: A dict of appropriately formatted key, value pairs. """ return { 'data': { 'name': name, 'spotifyId': spotify_id if spotify_id else None, 'appleMusicId': apple_music_id if apple_music_id else None, }, 'vendorId': vendor_id, 'subaccountId': subaccount_id if subaccount_id else 0, } def format_track_list_update_data( tuid_list, meta_language=None, rec_country_id=None, explicit=None, orig_rights_country=None, us_pub_ob=None): """Format data to uniformly update a list of tracks. Args: tuid_list: (list) A list of tuids meta_language: (str) A string abbreviation, like "JPN" rec_country_id: (int) A country id for the recording country explicit: (str) "Y" for explicit lyrics, "N" for clean orig_rights_country: (int) A country id for the orig copyright holder us_pub_ob: Returns: dict: a dict of appropriately formatted key, value pairs """ return { "update": { 'tracks': tuid_list, 'body': { 'metaLanguageCode': meta_language, 'recordingCountryId': rec_country_id, # 'publishing': { # 'usPublishingObligation': us_pub_ob, # }, 'originalRightsHolderCountryId': orig_rights_country } } } def format_project_name_data(project_id, project_name): """Format UpdateProjectInput type for mutation. Args: project_id: (int) The associated project ID project_name: (str) The project name Returns: dict: a dict of appropriately formatted key, value pairs """ return { "projectId": int(project_id), "name": project_name } def format_not_for_distribution(product_id, key): """Format UpdateProductInput type for mutation. Args: product_id: (int) The associated product ID key: (str) The value to set Returns: dict: a dict of appropriately formatted key, value pairs """ return { "productId": int(product_id), "notForDistribution": key } def format_approve_product(product_id): """Format ApproveProductInput type for mutation. Args: product_id: (int) The associated product ID Returns: dict: a dict of appropriately formatted key, value pairs """ return { "productId": int(product_id), }