Giter Site home page Giter Site logo

gitgroup-api's Introduction

Developer Guide

GitHub API

Repositories
This application will be able to read and write all public and private repository data. This includes the following:

  • Code
  • Issues
  • Pull requests
  • Wikis
  • Settings
  • Webhooks and services
  • Deploy keys
  • Collaboration invites

API referrence

How to Start The Server

You need clone this repository first, then install dependencies.

> cd gitgroup-api
> npm install

When you develop this project, you can just use ts-node in order to run the server.

npm run dev

When you test the code.

npm run test

The following commands are just required when you distribute the app

npm run build
npm run start

API list

Project

  • POST http://localhost:8000/project/new

    • Function: Create a new project.
    • body: {*name, *description, *repositories}
    • Note:
      • Header should have {authorization: user_access_token}.
    • Response:
      {
          "_id": "user_mongodb_id",
          "node_id": "user_github_node_id",
          "name": "user_name",
          "projects": [
              {
                  "_id": "created_project_mongodb_id",
                  "kanbanIds": [],
                  "repositories": [{
                          "_id": "repository_mongodb_id",
                          "repository_id": "repository_github_id",
                          "name": "repository_name",
                          "owner_id": "owner_name",
                          "description": "repository_description",
                          "_url": "https://github.com/username/repositoryname"
                      }],
                  "name": "created_project_name",
                  "description": "created_project_description",
                  "owner_id": "owner_github_node_id"
              }
          ],
          "repository": []
      }
  • http://localhost:8000/project/name/:projectId

    • Function: Get the project name with given the project ID.
    • Response:
      project_name
      

Repository

  • GET http://localhost:8000/repos
    • Function: Get all the repositories of the user
    • Response:
      [
          {
              "repository_id": "repository_github_node_id",
              "name": "repository_name",
              "owner_id": "owner_name",
              "description": "repository_description",
              "_url": "https://github.com/owner_name/repository_name",
              "issues": [
                  {
                      "issueId": "issue_github_node_id",
                      "title": "issue_title",
                      "body": "issue_body",
                      "owner": "owner_name",
                      "repos": "repository_name",
                      "state": "open",
                      "number": 1
                  }
              ]
          }
      ]
      

User

  • GET http://localhost:8000/user
    • Function: Get the user information who holds this authorization token
    • Response:
      {
          "id": "user_github_node_id",
          "name": "user_name",
          "repositories": [
              {
                  "repository_id": "repository_github_node_id",
                  "name": "repository_name",
                  "owner_id": "owner_name",
                  "description": "repository_description",
                  "_url": "https://github.com/owner_name/repository_name",
                  "issues": [
                      {
                          "issueId": "issue_github_node_id",
                          "title": "issue_title",
                          "body": "issue_body",
                          "owner": "owner_name",
                          "repos": "repository_name",
                          "state": "open",
                          "number": 1
                      }
                  ]
              }
          ],
          "projects": [
              {
                  "id": "project_mongo_id",
                  "name": "project_name",
                  "ownerId": "owner_github_node_id"
              }
          ]
      }

Issue

  • GET /host/issues/:username/:repository_name
    • Function: Get all the issues for the repository.
    • Response:
      [
          {
              "issueId": "issue_github_node_id",
              "title": "issue_name",
              "body": "issue_body",
              "owner": "owner_name",
              "repos": "repository_name",
              "state": "open",
              "number": 1
          }
      ]
  • GET http://localhost:8000/issues/project-issues/:username/:projectId
    • Function: Get all the issues for the given project ID.
    • Response:
      [
          {
              "issueId": "issue_github_node_id",
              "title": "issue_name",
              "body": "issue_body",
              "owner": "owner_name",
              "repos": "repository_name",
              "state": "open",
              "number": 1
          }
      ]
  • GET http://localhost:8000/close/:userName/:reposName/:issueId
    • Function: Close the issue.

Card

Kanban

gitgroup-api's People

Contributors

runbo94 avatar xuyingc avatar

Watchers

Eitelkit avatar

gitgroup-api's Issues

cannot authorize the github api

Problems occur at
./lib/models/userModel.ts
./lib/tests/models/userModel.test.ts

I got the GitHub api url from "./config/default.json" and access token from environment variable. But I cannot access GitHub api. So I tried to use postman to access the api, then I get the following error message.

wechat screenshot_20181019173235

Implement the Owner and Collaborator class

Owner and Collaborator should be created under ./lib/models/.
Its test should created under ./lib/tests/models/

the getMe() method should be removed to the Owner class and the Owner and Collaborator should inherit from the User class.

Implement the Repository Class

Repository should be created in ./lib/models/repositoryModel.ts.
Its test should created in ./lib/tests/models/repositoryModel.test.ts

Help me to fix a bug. I cannot store the data to the mongodb.

 FAIL  lib/tests/models/projectModel.test.ts
  test saveToMongo() function
    × should save the project to the mongodb and set its id (19ms)

   test saveToMongo() function  should save the project to the mongodb and set its id

    expect(received).toEqual(expected)

    Expected value to equal:
      "string"
    Received:
      "undefined"

      17 |     const projectObj: Project = new Project("test name");
      18 |     projectObj.saveToMongo();
    > 19 |     expect(typeof projectObj.getId()).toEqual("string");
         |                                       ^
      20 |   });
      21 | });
      22 |

      at Object.it (lib/tests/models/projectModel.test.ts:19:39)

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.