def search_files_interactive(api: MyrientAPI): """Interactive file search""" print("\n--- SEARCH FILES ---") query = input("Enter search term: ").strip() if not query: print("Search term cannot be empty") return system = input("Filter by system (optional, press Enter to skip): ").strip() system = system if system else None print(f"\nSearching for '{query}'...") results = api.search_files(query, system) if not results: print("No results found.") return print(f"\nFound {len(results)} results:") print("-" * 80) for i, file in enumerate(results[:20], 1): # Show first 20 results print(f"{i}. Name: {file.get('name', 'N/A')}") print(f" System: {file.get('system', 'N/A')}") print(f" Size: {file.get('size', 'N/A')} bytes") print(f" ID: {file.get('id', 'N/A')}") print("-" * 80)
def print_menu(): """Display main menu""" print("\n" + "="*50) print("MYRIENT API TEXT INTERFACE") print("="*50) print("1. Search for files") print("2. List available systems") print("3. Get file information") print("4. Get download link") print("5. Exit") print("-"*50) myrient api
def main(): """Main program loop""" api = MyrientAPI() print("Myrient API Text Interface") print("Note: This is an unofficial interface") actions = { '1': search_files_interactive, '2': list_systems_interactive, '3': get_file_info_interactive, '4': get_download_link_interactive, } while True: print_menu() choice = input("\nEnter your choice (1-5): ").strip() if choice == '5': print("Goodbye!") break elif choice in actions: actions[choice](api) else: print("Invalid choice. Please try again.") input("\nPress Enter to continue...") List available systems") print("3