romaklimenko / cluedin

CluedIn Python SDK
MIT License
3 stars 0 forks source link

GraphQL #4

Closed romaklimenko closed 1 year ago

romaklimenko commented 1 year ago
import cluedin

context = cluedin.utils.load(os.environ['CLUEDIN_CONTEXT'])

cluedin.load_token_into_context(context)

query = """
    query searchEntities($cursor: PagingCursor, $query: String, $pageSize: Int) {
      search(query: $query, sort: DATE, cursor: $cursor, pageSize: $pageSize) {
        totalResults
        cursor
        entries {
          id
          name
          entityType
        }
      }
    }
"""

variables = {
  "query": "entityType:/Infrastructure/User",
  "pageSize": 1
}

response = cluedin.gql.gql(context, query, variables)
romaklimenko commented 1 year ago

https://github.com/romaklimenko/cluedin/blob/13a4090d17735f3adfd3bc5ef59bd9582e5cfb86/cluedin/tests/test_gql.py#L7-L64