UNPKG

@dww/graphiql-code-exporter

Version:

Export working code snippets from GraphiQL queries

18 lines (17 loc) 673 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { name: 'sgqlc', language: 'Python', prismLanguage: 'python', options: [], generate: function generate(_ref) { var serverUrl = _ref.serverUrl, headers = _ref.headers, variables = _ref.variables, operation = _ref.operation; return '\nfrom sgqlc.endpoint.http import HTTPEndpoint\n\nserverUrl = \'' + serverUrl + '\'\n\nquery = \'\'\'\n' + operation + '\n\'\'\'\n\nendpoint = HTTPEndpoint(serverUrl, ' + JSON.stringify(headers, null, 2) + ')\ndata = endpoint(query, ' + JSON.stringify(variables, null, 2) + ')\n\nprint(data)\n'; } };