Comments (6)
OH, I just realized that the baseUrl
option might be a problem with GitHub Enterprise. I'll look into fixing it, but for the time being, try to set it to just https://mygithubenterprise.com/api
from core.js.
Assuming the plugins were on Pika, you would use them like this
<script type="module">
import { retryPlugin } from "https://cdn.pika.dev/@octokit/plugin-retry";
import { throttlePlugin } from "https://cdn.pika.dev/@octokit/plugin-throttling";
import { Octokit } from "https://cdn.pika.dev/@octokit/core";
const MyOctokit = Octokit.plugin([retryPlugin, throttlePlugin])
const octokit = new MyOctokit()
</script>
Note that the throttle plugin will not be helpful for GraphQL at this point, it has its own rate limiting independent of http requests.
And for retries, I was told to try a graphql request once in case in timed out, as a temporary index might have been created and the 2nd request might be able to respond within the 10s timeout. That is currently not implemented in the retry plugin.
I'll happily take pull requests that make the plugins pika-compatible. Here is a plugin that can be used as reference: https://github.com/octokit/plugin-paginate-rest.js. I cannot work on it myself until the next year, I'm afraid
I want to paginate graphql queries without having to write a lot of code
I did not found a simple solution for that bit yet. I've shared some insights in my comment here: octokit/graphql.js#61 (comment)
from core.js.
All the plugins are now published to pika, the code shown above should just work ™️ Let me know if you run into any problems
from core.js.
Unfortunately the plugins are not yet published to Pika, but it's something I'm working on right now.
@octokit/graphql
is no a plugin though, it's a standalone library. But the good news is that it's already built into @octokit/core
, so you can just do this:
import { Octokit } from 'https://cdn.pika.dev/@octokit/core'
const octokit = new Octokit({
auth: '1234',
baseUrl: 'https://mygithubenterprise.com/api/graphql',
previews: ['cloak-preview', 'mercy-preview']
})
octokit.graphql(`... your query here ...`)
Does that work for you?
from core.js.
@gr2m Thanks for the replies. I was going off of this comment on @octokit/graphql
: octokit/graphql.js#61 (comment)
Basically, I want to paginate graphql queries without having to write a lot of code. I'm also interested in using the retry and throttling plugins, so my basic question is still unanswered. Assuming the plugins were on Pika, how would I use them from the browser?
from core.js.
@gr2m That makes sense. I'm afraid much of this is out of my league (I'm not really a JS/ES/TS dev), so I'll wait patiently for a solution. Thanks for the explanation and all your work on this project. It has really helped me.
from core.js.
Related Issues (20)
- [FEAT]: Escape slash in request parameters to `--` HOT 3
- [DOCS]: Error response schema HOT 3
- [BUG]: Uncaught ReferenceError: global is not defined HOT 7
- [BUG]: octokit.graphql gives increasing number of duplicate HOT 1
- [BUG]: can not intercept requests with nock HOT 2
- [BUG]: Octokit version 4.2.2 has a breaking change dependency upgrade HOT 2
- https://github.com/ietf-tools/datatracker/commit/e68b9cf60c0f6771e40ed73a4f59aa47cacbb854
- Re-enable tests in `@octokit/core` using fetch dispatchers HOT 2
- Avoid JSON.stringify hack when testing responses of fetch-mock HOT 7
- Replace `toStrictEqual` with `JSON.stringify` Response assertions with `toEqual` in `core.js` HOT 1
- [BUG]: Unexpected token '{' in Safari pre 16.3 HOT 4
- [BUG]: Rest call to delete comment returns 404 HOT 3
- [MAINT]: Replace lolex with @sinon/fake-timers HOT 2
- [BUG]: OctokitOptions declared locally but not exported HOT 7
- [QUESTION] Is there an alternative version of this project written in c#? HOT 2
- [BUG]: The type of 'data' field in OctokitResponse type is an object but type hinting show it's an array HOT 2
- [BUG]: Commit not found when it exists HOT 2
- [BUG]: `No "exports" main defined` in version 6.0.1 HOT 5
- [BUG/ASK for HELP]: Issues with `@octokit/[email protected]+` when using `ncc` to bundle code HOT 6
- [BUG]: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in HOT 24
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.js.