Rename src/plugins/github/{api,porcelain} (#231)

I also added a module-level docstring for the porcelain.
This commit is contained in:
Dandelion Mané 2018-05-07 19:18:01 -07:00 committed by GitHub
parent 9b3019434d
commit ed1adc7b37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 8 deletions

View File

@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`GitHub porcelain API has wrappers for Authors 1`] = `2`;
exports[`GitHub porcelain has wrappers for Authors 1`] = `2`;
exports[`GitHub porcelain API has wrappers for Authors 2`] = `
exports[`GitHub porcelain has wrappers for Authors 2`] = `
Object {
"address": Object {
"id": "https://github.com/decentralion",
@ -17,9 +17,9 @@ Object {
}
`;
exports[`GitHub porcelain API has wrappers for Comments 1`] = `3`;
exports[`GitHub porcelain has wrappers for Comments 1`] = `3`;
exports[`GitHub porcelain API has wrappers for Comments 2`] = `
exports[`GitHub porcelain has wrappers for Comments 2`] = `
Object {
"address": Object {
"id": "https://github.com/sourcecred/example-github/issues/6#issuecomment-373768442",
@ -33,7 +33,7 @@ Object {
}
`;
exports[`GitHub porcelain API has wrappers for Issues 1`] = `
exports[`GitHub porcelain has wrappers for Issues 1`] = `
Object {
"address": Object {
"id": "https://github.com/sourcecred/example-github/issues/1",
@ -49,7 +49,7 @@ Object {
}
`;
exports[`GitHub porcelain API has wrappers for PullRequests Merged 1`] = `
exports[`GitHub porcelain has wrappers for PullRequests Merged 1`] = `
Object {
"address": Object {
"id": "https://github.com/sourcecred/example-github/pull/3",

View File

@ -1,5 +1,18 @@
// @flow
/*
* This module contains "Porcelain" for working with GitHub graphs. By
* "Porcelain", we mean it is a much more convenient and polished API. It
* allows accessing GitHub graph data via a familiar object-oriented API,
* rather than needing to use the specific graph-based methods in the
* underlying graph.
*
* In general, the porcelain module provides wrapper objects that contain the
* entire GitHub graph, and a pointer to a particular entity in that graph.
* Creating the wrappers is extremely cheap; all actual computation (e.g.
* finding the body or author of a post) is done lazily when that information
* is requested.
*/
import stringify from "json-stable-stringify";
import {Graph} from "../../core/graph";

View File

@ -2,7 +2,7 @@
import {parse} from "./parser";
import exampleRepoData from "./demoData/example-github.json";
import {Porcelain, Issue, PullRequest, Comment, Author} from "./api";
import {Porcelain, Issue, PullRequest, Comment, Author} from "./porcelain";
import {
AUTHOR_NODE_TYPE,
COMMENT_NODE_TYPE,
@ -12,7 +12,7 @@ import {
PULL_REQUEST_REVIEW_COMMENT_NODE_TYPE,
} from "./types";
describe("GitHub porcelain API", () => {
describe("GitHub porcelain", () => {
const graph = parse(exampleRepoData);
const porcelain = new Porcelain(graph);
const repo = porcelain.repository("sourcecred", "example-github");