{"id":9824849,"url":"https://github.com/opencomponents/oc-graphql-client","last_synced_at":"2025-04-14T17:11:09.442Z","repository":{"id":57313211,"uuid":"82296875","full_name":"opencomponents/oc-graphql-client","owner":"opencomponents","description":"OpenComponents Apollo client plugin for GraphQL","archived":false,"fork":false,"pushed_at":"2020-05-02T04:57:27.000Z","size":54,"stargazers_count":10,"open_issues_count":5,"forks_count":3,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-05-28T13:21:25.911Z","etag":null,"topics":["graphql","oc-plugin","opencomponents"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opencomponents.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-17T12:49:06.000Z","updated_at":"2023-04-15T01:20:02.000Z","dependencies_parsed_at":"2022-09-20T23:10:42.044Z","dependency_job_id":null,"html_url":"https://github.com/opencomponents/oc-graphql-client","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-graphql-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-graphql-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-graphql-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-graphql-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opencomponents","download_url":"https://codeload.github.com/opencomponents/oc-graphql-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923764,"owners_count":21183954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","oc-plugin","opencomponents"],"created_at":"2024-05-18T01:04:18.956Z","updated_at":"2025-04-14T17:11:09.407Z","avatar_url":"https://github.com/opencomponents.png","language":"JavaScript","readme":"oc-graphql-client [![Build Status](https://travis-ci.org/opencomponents/oc-graphql-client.svg?branch=master)](https://travis-ci.org/opencomponents/oc-graphql-client)\n==========\n\n## NOTICE!\n- The current released version (3.*) does not use the Apollo client due to memory consumption issues.\n- The client does not expose a querybuilder, instead just use a raw string as the examples does.\n\n----\n\nA [OpenComponents](https://github.com/opentable/oc) plugin that expose the a graphql client for interacting with a GraphQL based server.\n\n## Requirements:\n- OC Registry\n- GraphQL Server\n- Node \u003e= v6\n\n## Install\n\n````javascript\nyarn add oc-graphql-client\n````\n\n## Registry setup\n\nMore info about integrating OC plugins: [here](https://github.com/opentable/oc/wiki/Registry#plugins)\n\n````javascript\n...\nvar registry = new oc.registry(configuration);\n\nregistry.register({\n  name: 'graphqlClient',\n  register: require('oc-graphql-client'),\n  options: {\n    serverUrl: 'http://graphql-server.hosts.com'\n  }\n}, function(err){\n  if(err){\n    console.log('plugin initialisation failed:', err);\n  } else {\n    console.log('graphql client now available');\n  }\n});\n\n...\n\nregistry.start(callback);\n````\n\n\n## Register API\n\n|parameter|type|mandatory|description|\n|---------|----|---------|-----------|\n|serverUrl|`string`|yes|The Url for the GraphQL server|\n\n## Usage\n\nExample for a components' server.js:\n\n````javascript\n\nmodule.exports.data = function(context, callback){\n  const query = `\n  query restaurantInfo($id: Int!) {\n      restaurant(id: $id) {\n        name\n    }\n  }`;\n\n  const headers = {\n    'accept-language': 'en-US, en'\n  };\n\n  context.plugins.graphql.query({ query, variables: { id: 4 } }, headers, timeout)\n    .then(res =\u003e { ... })\n    .catch(err =\u003e { ... })\n````\n\n## API\n\n|parameter|type|mandatory|description|\n|---------|----|---------|-----------|\n|options|`object`|yes|A composite of the query \u0026 variables to pass to GraphQL server|\n|headers|`object`|no|The headers to pass down to unerlying services|\n|timeout|`int`|no|The timeout in ms. It defaults to OS default |\n\n## Contributing\n\nPR's are welcome!\n\n## License\n\nMIT\n","funding_links":[],"categories":["Registry Plugins/Utilities"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencomponents%2Foc-graphql-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopencomponents%2Foc-graphql-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencomponents%2Foc-graphql-client/lists"}