Coder Social home page Coder Social logo

swinton / github-rest-apis-for-insomnia Goto Github PK

View Code? Open in Web Editor NEW
151.0 6.0 16.0 2.13 MB

💯 A complete set of GitHub REST API route specifications that can be imported straight into Insomnia REST Client

Home Page: https://npm.im/github-rest-apis-for-insomnia

License: ISC License

JavaScript 100.00%
insomnia github-api github-rest-v3 octokit-routes

github-rest-apis-for-insomnia's Introduction

💯github-rest-apis-for-insomnia

A complete set of GitHub REST API route specifications that can be imported straight into Insomnia REST Client.

run-in-insomnia Greenkeeper enabled

Usage

Run in Insomnia directly, or import manually, via Workspace ➡️ Import/Export ➡️ Import Data ➡️ From URL and entering https://git.io/github-v3-rest-api-for-insomnia:

github-rest-apis-for-insomnia

Generating the route specifications

npx github-rest-apis-for-insomnia

Credits

🙇 @octokit/routes for machine-readable, always up-to-date GitHub REST API route specifications.

Feedback

Please open an issue.

github-rest-apis-for-insomnia's People

Contributors

dependabot[bot] avatar greenkeeper[bot] avatar swinton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

github-rest-apis-for-insomnia's Issues

Allow customization through a .insomniarc

It would be nice if you could customize the generated JSON file, e.g. via some ~/.insomniarc, which would allow you to specify things like...

  1. A personal access token
  2. Details for OAuth2 app (client id, secret)
  3. Default authentication method

Potentially other things as well 🤔

Format of ~/.insomniarc would mimic the ~/.npmrc format.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

[Feature Reqest] Add `body` params for API calls

I'd love to find a way to populate the body of requests too for each endpoint in the routes directory. The way this would look would be by modifying the empty "body": {} to something like this:

"body": {
        "mimeType": "application/json",
        "text": "{\n\t\"ignored\": false\n}"
    },

Here would be an example of the full object for one of the calls.

{
      "parentId": "__FLD_2__",
      "_id": "__REQ_17__",
      "_type": "request",
      "name": "Set a thread subscription",
      "description": "This lets you subscribe or unsubscribe from a conversation.\n\nhttps://developer.github.com/v3/activity/notifications/#set-a-thread-subscription",
      "headers": [],
      "authentication": {
        "token": "{{ github_token  }}",
        "type": "bearer"
      },
      "method": "PUT",
      "url": "{{ github_api_root  }}/notifications/threads/{{ thread_id }}/subscription",
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"ignored\": false\n}"
    },
      "parameters": []
    },

I spent about 30 minutes doing this by hand and it was not a fun process. We may want to consider programmatically getting this information in there somehow (I'm sure some fancy sed/awk can help).

Then I realized you used the Octokit Routes so I think we would need to update something in Index.js to pull the body tag out instead of just populating it with an empty body as we do here

Thanks

🙏🏼, worked like a charm! 🔥

Set required preview headers

Some APIs cannot be used unless a preview header is set, for example: https://developer.github.com/v3/apps/#find-repository-installation

octokit/routes does include preview header information and whether they are required, it looks like this: https://github.com/octokit/routes/blob/a68368c16c9dad15f648d6448b28be9f3be5aa62/routes/api.github.com/apps/list-installations.json#L6-L12

I think it would be nice if the route definitions for Insomnia included the required preview headers

🦄 Auto-updating

Here is what I would do

  1. When running node ./index.js it currently logs the result to stdout. I would suggest to update routes/api.github.com/github-rest-apis-for-insomnia.json directly, using fs.writeFileSync()

  2. Install Greenkeeper to get automatic pull requests for dependency updates, as defined in package.json

  3. In your package.json, pin the version of @octokit/routes, so that Greenkeeper will send a pull request for every update, not only for major versions.

    - "@octokit/routes": "^18.6.2",
    + "@octokit/routes": "18.6.2",
  4. Use a GitHub action that runs node ./index.js on push, but only when branch name starts with ^greenkeeper/@octokit/routes.

  5. Commit the changes

    git commit routes -m "build: routes"
    
  6. Push changes to Greenkeeper’s pull request. I’m not sure what the command will exactly look like for GitHub actions, here is what I do from Travis for reference: https://github.com/octokit/rest.js/blob/fc4f087246c57b20a2e5040a766a417913023acc/.travis.yml#L100

Let me know if that helps :)

If you like, you could also directly merge the pull request from the action, but I for one like to review these pull requests, just in case.

Include params

It would be nice to include params with their defaults so these can be easily overridden.

E.g.

  1. per_page
  2. page

Params are already included in @octokit/routes

No environment created when importing API routes causing error

👋 I'm trying to set up Insomnia with the GitHub REST APIs and am running into the error:

Failed to render Request.authentication.token prior to sending

Renderer error:

attempted to output null or undefined value

Caused by the following field

Request.authentication.token

Based on the error, it seems there's no token. When importing, there seems to be no environment (besides base environment which is empty). When I right click on the GitHub v3 REST API folder that is created on import, and go to Environment I see the expected environment variables, but filling them in doesn't solve the error. I'm also unable to Generate Client Code which hangs on Generating code snippet....

Any help would be ✨ I had this all working great on my old Mac, but it was set up last year and now it doesn't seem to work.

Since octokit/routes is archived, should this use the OpenAPI Description instead?

👋 @swinton!

I recently imported this and noticed there were some missing routes. Reading up on https://github.com/octokit/routes, it's deprecated (latest: v30.0.3) in favor of the OpenAPI Description:

https://github.com/github/rest-api-description/

I'm wondering if this repo should use that instead? Not quite sure how much work it would take to port over, but thought to raise this so others who rely on this are aware!

Subscribe to octokit/routes repository_dispatch event for updates

Use a workflow similar to this one to regenerate Insomnia routes whenever a new octokit/routes release becomes available:

name: Update REST API endpoint methods
on:
  repository_dispatch:
    types: [octokit-routes-release]

jobs:
  update_routes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: actions/setup-node@v1
        with:
          node-version: "12.x"
        # try checking out routes-update branch. Ignore error if it does not exist
      - run: git checkout routes-update || true
      - run: npm ci
      - run: npm run update-endpoints
        env:
          VERSION: ${{ github.event.client_payload.version }}
      - name: Create Pull Request
        uses: gr2m/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          title: "🚧 GitHub REST Endpoints changed"
          body: |
            See what changed at https://github.com/octokit/routes/releases/latest.

            Make sure to update the commits so that the merge results in helpful release notes, see [Merging the Pull Request & releasing a new version](https://github.com/octokit/rest.js/blob/master/CONTRIBUTING.md#merging-the-pull-request--releasing-a-new-version).

            In general

            - Avoid breaking changes at all costs
            - If there are no typescript or code changes, use a `docs` prefix
            - If there are typescript changes but no code changes, use `fix(typescript)` prefix
            - If there are code changes, use `fix` if a problem was resolved, `feat` if new endpoints / parameters were added, and `feat(deprecation)` if a method was deprecated.
          branch: "routes-update"
          commit-message: "WIP octokit/routes updated"
          author: "Octokit Bot <[email protected]>"

Inspiration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.