#!/usr/bin/env python3 import json import sys from rsc import RSCAuth, RSCGraphQL def explore_oracle_types(): """Explore Oracle-related types in the GraphQL schema""" auth = RSCAuth() gql = RSCGraphQL(auth) # Get information about the OracleDatabase type print("Exploring OracleDatabase type...") try: result = gql.get_type_info("OracleDatabase") oracle_db_type = result['data']['__type'] if oracle_db_type: print(f"Type: {oracle_db_type['name']}") print(f"Kind: {oracle_db_type['kind']}") print(f"Description: {oracle_db_type.get('description', 'No description')}") print("\nFields:") for field in oracle_db_type.get('fields', []): print(f" - {field['name']}: {field['description'] or 'No description'}") field_type = field['type'] type_name = field_type.get('name') or (field_type.get('ofType', {}).get('name') if field_type.get('ofType') else 'Unknown') print(f" Type: {type_name}") else: print("OracleDatabase type not found") except Exception as e: print(f"Error exploring OracleDatabase type: {e}") def list_available_types(): """List all available types in the schema""" auth = RSCAuth() gql = RSCGraphQL(auth) print("Getting available types...") try: result = gql.introspect_schema() types = result['data']['__schema']['types'] oracle_types = [t for t in types if t.get('name') and 'Oracle' in t['name']] print(f"\nFound {len(oracle_types)} Oracle-related types:") for t in sorted(oracle_types, key=lambda x: x['name']): print(f" - {t['name']} ({t['kind']})") # Also look for LogicalPath related types logical_types = [t for t in types if t.get('name') and 'Logical' in t['name'].lower()] if logical_types: print(f"\nFound {len(logical_types)} Logical-related types:") for t in logical_types: print(f" - {t['name']} ({t['kind']})") except Exception as e: print(f"Error listing types: {e}") if __name__ == "__main__": if len(sys.argv) > 1: type_name = sys.argv[1] auth = RSCAuth() gql = RSCGraphQL(auth) try: result = gql.get_type_info(type_name) print(json.dumps(result, indent=2)) except Exception as e: print(f"Error: {e}", file=sys.stderr) sys.exit(1) else: list_available_types()