Giter Club home page Giter Club logo

package-github's Introduction

Ballerina GitHub Endpoint

GitHub brings together the world's largest community of developers to discover, share, and build better software. From open source projects to private team repositories, GitHub is an all-in-one platform for collaborative development.

GitHub connector provides a Ballerina API to access the GitHub GraphQL API. The connector has built-in support to handle OAuth2.0, provides auto completion and type conversions. The following sections explains how to use Ballerina GitHub4 connector. You can refer the [GitHub GraphQL API v4.0] (https://developer.github.com/v4/) to learn more about the API.

Ballerina Version GitHub API Version
0.970.0 v4

Ballerina GitHub Endpoint Overview

Prerequisites

Download the ballerina distribution.

Getting started

  • Clone the repository by running the following command
git clone https://github.com/wso2-ballerina/package-github
  • Initialize the ballerina project.
ballerina init

Working with GitHub Endpoint Actions

All the actions return objects or github4:GitClientError. If the action was a success, then the requested object will be returned while the github:GitClientError will be empty and vice-versa.

Example
  • Request
    import wso2/github4;

    public function main (string[] args) {
        endpoint github4:Client githubClient {
            clientConfig: {
                auth:{
                    scheme:"oauth",
                    accessToken:config:getAsString("GITHUB_TOKEN")
                }
            }
        };
    
        github4:Repository repository = {};
        var repo = githubClient -> getRepository("wso2-ballerina/package-github");
        match repo {
            github4:Repository rep => {
                repository = rep;
            }
            github4:GitClientError err => {
                io:println(err);
            }
        }
    
        io:println(repository);
    }
    
  • Response object
public type Repository {
    string id;
    string name;
    string createdAt;
    string updatedAt;
    string description;
    int forkCount;
    boolean hasIssuesEnabled;
    boolean hasWikiEnabled;
    string homepageUrl;
    boolean isArchived;
    boolean isFork;
    boolean isLocked;
    boolean isMirror;
    boolean isPrivate;
    string license;
    string lockReason;
    string mirrorUrl;
    string url;
    string sshUrl;
    RepositoryOwner owner;
    Language primaryLanguage;
}

package-github's People

Contributors

vlgunarathne avatar muthulee avatar keerthu avatar biruntha avatar ldclakmal avatar tharindunm avatar maheshika avatar sivaramya avatar

Watchers

James Cloos avatar  avatar

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.