Git Product home page Git Product logo

octohat's Introduction

Octohat

Build Status Hackage

A well tested, GitHub API client for Haskell using wreq as a backend.

The project uses Stackage to maintain build stability.

Currently supported endpoints

Members

module Network.Octohat.Members

  • Add teams to an organization addTeamToOrganization

  • Delete teams from an organization deleteTeamFromOrganization

  • List all members from an organization membersForOrganization

  • List all members from a team, using the team id membersForTeam

  • List all teams from an organization teamsForOrganization

  • Add members to a team addMemberToTeam

  • Delete members from a team deleteMemberFromTeam

  • List Public Keys for a user publicKeysForUser

Instructions

To install:

cabal sandbox init
cabal install --only-dep --enable-test -jN

where N = <the number of cores in your machine>

To build:

cabal build

Then run the test suite:

CAUTION: Use tokens of a test user, not your own account since the test suite clears state on Github before it runs (i.e., it will delete everything in your github account).

You need to set some environment variables.

Set SANDBOX_ORGANIZATION to an organization you don't care about, since the tests will delete all the teams within that organization

Set TEST_ACCOUNT_ONE to a test account member of the Owners teams in $SANDBOX_ORGANIZATION

Set TEST_ACCOUNT_TWO to another test account member of the Owners teams in $SANDBOX_ORGANIZATION

Set TEST_ACCOUNT_THREE to yet another test account member of the Owners teams in $SANDBOX_ORGANIZATION

Set GITHUB_TOKEN to an API token from $TEST_ACCOUNT_ONE. The token scopes should include full admin privileges and the ability to write public keys.

You can these variables either directly or put them in .GITHUB_SANDBOX. Either way they must be set to run the tests. Finally run the tests with:

cabal test

Demo

After you have built the binaries using cabal build you should have an executable file named .dist/build/abc/abc. This provides a rather basic interface to the GitHub API. The tool expects the environment variable GITHUB_TOKEN to be set to a GitHub token with permissions to modify an organization. Some of the operations supported: (each subcommand has its own --help page)

dist/build/abc/abc --help

Some options

Usage: abc COMMAND
  GitHub client to manage teams. Please specify your token as GITHUB_TOKEN

Available options:
  -h,--help                Show this help text

Available commands:
  list-teams               List teams in a organization
  members-in               List members in team and organization
  add-to-team              Add users to a team
  delete-user              Delete a user from a team

License

MIT, see the LICENSE file.

octohat's People

Contributors

finlay avatar jsl avatar juanpaucar avatar wojtekmach avatar

Stargazers

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

Watchers

 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

octohat's Issues

Pagination design

Has anyone thought about the pagination issue ? What is the best design ?

https://developer.github.com/v3/#pagination

I would like the getRequestTo function to be able to keep asking for pages until all the data is sourced. I am going to work on that now. This would hide the pagination API though, if someone wanted to use it.

Advantage is that no other functions need to change.

Cache dependencies

Travis is taking too long to build the project (8 minutes for GHC 7.4.2, 7.6.3, and 7.10.2, and 11 minutes for GHC 7.8.4). We can use the new container-based infrastructure (see #35) and add a way to cache dependencies as described in multi-ghc-travis.

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.