Coder Social home page Coder Social logo

bconnorwhite / coveralls-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 623 KB

API client for coveralls.io

Home Page: https://connorwhite.org/github/coveralls-api

TypeScript 100.00%
lcov coveralls-api typescript typescript-definitions stringify

coveralls-api's Introduction

coveralls-api

npm typescript Coverage Status GitHub stars Twitter Follow

API client for coveralls.io.

To use coveralls-api, you will need a personal token. Personal tokens can be created on the Coveralls account page.

Full documentation:

Installation

yarn add coveralls-api
npm install coveralls-api

API

Create Repo

Usage

import Coveralls from "coveralls-api";

const coveralls = new Coveralls(token);

coveralls.createRepo({
  service: "github",
  name: "my-repo-name"
}).then((response) => {
  // ...
});

Types

function createRepo(args: CreateRepoArgs): Promise<CreateRepoResponse | undefined>;

type CreateRepoArgs = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
}

type CreateRepoResponse = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
  created_at: string;
  updated_at: string;
}

type Service = "github" | "bitbucket" | "gitlab" | "stash" | "manual";

Get Repo

Usage

import Coveralls from "coveralls-api";

const coveralls = new Coveralls(token);

coveralls.getRepo("github", "my-github-user", "my-repo-name").then((response) => {
  // ...
});

Types

function updateRepo(
  service: Service,
  user: string,
  name: string
): Promise<GetRepoReponse | undefined>

type GetRepoResponse = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
  created_at: string;
  updated_at: string;
  id: number;
  has_badge: boolean;
  token?: string;
}

Update Repo

Usage

import Coveralls from "coveralls-api";

const coveralls = new Coveralls(token);

coveralls.updateRepo("github", "my-github-user", "my-repo-name", {
  comment_on_pull_requests: true,
  send_build_status: false
}).then((response) => {
  // ...
});

Types

function updateRepo(
  service: Service,
  user: string,
  name: string,
  args: UpdateRepoArgs
): Promise<UpdateRepoReponse | undefined>

type UpdateRepoArgs = {
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
}

type UpdateRepoResponse = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
  created_at: string;
  updated_at: string;
}

Post Job

Usage

import Coveralls from "coveralls-api";

const coveralls = new Coveralls(token);

// From LCOV file:
coveralls.postJob("github", "my-github-user", "my-repo-name", {
  lcov_path: "coverage/lcov.info"
}).then((response) => {
  // ...
});

// From source files:
coveralls.postJob("github", "my-github-user", "my-repo-name", {
  source_files: [{
    name: ...
  }, ...]
}).then((response) => {
  // ...
});

Types

function postJob(service: Service, user: string, name: string, args: PostJobArgs | PostJobFromLCOVArgs): Promise<PostJobResponse>;

export type PostJobFromLCOVArgs = {
  lcov_path: string;
} & BaseJobArgs;

export type PostJobArgs = {
  source_files: SourceFile[];
} & BaseJobArgs;

export type SourceFile = {
  name: string;
  source_digest: string;
  coverage: (number | null)[];
  branches?: number[];
  source?: string;
}

type BaseJobArgs = {
  service_name?: string;
  service_number?: string;
  service_job_id?: string;
  service_pull_request?: string;
  parallel?: boolean;
  flag_name?: string;
  git?: {
    head?: {
      id?: string;
      committer_name?: string;
      committer_email?: string;
      message?: string;
      author_name?: string;
      author_email?: string;
    };
    branch?: string;
    remotes?: {
      name?: string;
      url?: string;
    }[];
  };
  commit_sha?: string;
  run_at?: Date | string;
}

Dependenciesdependencies


Dev DependenciesDavid


License license

MIT

coveralls-api's People

Contributors

bconnorwhite avatar

Stargazers

 avatar

Watchers

 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.