Code Monkey home page Code Monkey logo

octokit.cr's Introduction

Octokit

Crystal toolkit for the GitHub API.

Note: This is in the very early stages of development. The GitHub API is expansive and there is a lot to do to get this up and running. For a list of API connections that have been completed and are still to come, see the Roadmap

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  octokit:
    github: watzon/octokit.cr
  1. Run shards install

Usage

require "octokit"

# Create a new Octokit Client
# Your password should be your Personal Access Token (PAT)
github = Octokit.client("watzon", "PASSWORD")

# Also, you can authenticate this way:
# github = Octokit.client("watzon", access_token: "PAT")

# Fetch information about the logged in user
pp github.user

# Fetch information about another user
pp github.user("asterite")

There are way too many options to list here, even at this early stage. For more usage examples see the documentation.

Roadmap

There are a lot of pieces of the GitHub API to cover. Here are the ones that need to be working before this shard is considered v1.0 ready.

I am trying to complete what I deem the most important ones first so that this shard can be immediately useful. Keep in mind, however, that the API may change at any time.

Contributing

I don't only welcome contributions, I beg for them. If this is a library that might help you out please, help me by forking this repo and porting one of the many APIs that's not checked above. Thank you!

  1. Fork it (https://github.com/watzon/octokit/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Thanks

Thanks to all of the maintainers of octokit/octokit.rb who made this so much easier on me. This library is a port of the ruby library and I've tried to keep the APIs as similar as possible.

octokit.cr's People

Contributors

curquiza avatar mipmip avatar watzon avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

octokit.cr's Issues

Testing framework.

Having tests will make it easier to contribute. Maybe octokit could use the same framework setup as gitlab.cr?

Error when doing the Getting Started

In test.cr:

require "octokit"

# Create a new Octokit Client
github = Octokit.client("curquiza", "password")

# Fetch information about the logged in user
pp github.user

# Fetch information about another user
pp github.user("asterite")

puts "Hello"

shards.yml:

name: crystal-test
version: 0.1.0

authors:
  - your-name-here <your-email-here>

targets:
  crystal-test:
    main: src/crystal-test.cr

dependencies:
  octokit:
    github: watzon/octokit.cr

crystal: 0.35.1

license: MIT

Run crystal run test.cr:

$ crystal run src/crystal-test.cr
In /usr/local/Cellar/crystal/0.35.1_1/src/logger.cr:124:3

 124 | def initialize(@io : IO?, @level = Severity::INFO, @formatter = DEFAULT_FORMATTER, @progname = "")
       ^---------
Warning: Deprecated Logger#initialize. Use `Log` module instead

A total of 1 warnings were found.
Fetching repositories
Unhandled exception: Missing hash key: HTTP::Headers::Key(@name="X-GitHub-OTP") (KeyError)
  from ../../../../../usr/local/Cellar/crystal/0.35.1_1/src/hash.cr:1030:9 in '[]'
  from ../../../../../usr/local/Cellar/crystal/0.35.1_1/src/http/headers.cr:71:5 in '[]'
  from lib/octokit/src/octokit/error.cr:202:34 in 'required_header'
  from lib/octokit/src/octokit/error.cr:54:10 in 'error_for_401'
  from lib/octokit/src/octokit/error.cr:19:37 in 'from_response'
  from lib/octokit/src/octokit/connection.cr:160:9 in 'handle_error'
  from lib/octokit/src/octokit/connection.cr:137:7 in 'request'
  from lib/octokit/src/octokit/connection.cr:268:18 in 'fetch_page'
  from lib/octokit/src/octokit/connection.cr:289:9 in 'fetch_next'
  from lib/octokit/src/octokit/connection.cr:245:11 in 'fetch_all'
  from lib/octokit/src/octokit.cr:53:9 in '__crystal_main'
  from ../../../../../usr/local/Cellar/crystal/0.35.1_1/src/crystal/main.cr:105:5 in 'main_user_code'
  from ../../../../../usr/local/Cellar/crystal/0.35.1_1/src/crystal/main.cr:91:7 in 'main'
  from ../../../../../usr/local/Cellar/crystal/0.35.1_1/src/crystal/main.cr:114:3 in 'main'

Failure when running tests

On master, when doing:

$ shards install
...
$ crystal spec

....

In lib/halite/src/halite/features/logging/json.cr:47:28

 47 | @request_time = Time.now
                           ^--
Error: undefined method 'now' for Time.class

Did you mean 'new'?

Labels

Hello!
I would like to do the labels methods.
Any tips or things to know before starting? ๐Ÿ˜„ I'm not sure to understand how the tests work in this package for example.

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.