Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

repository-provider

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

repository-provider

abstract interface to git repository providers like github bitbucket


Version published
Weekly downloads
961
increased by9.95%
Maintainers
1
Weekly downloads
 
Created

npm Greenkeeper semantic-release styled with prettier Build Status codecov.io Coverage Status Known Vulnerabilities GitHub Issues Stories in Ready Dependency Status devDependency Status docs XO code style downloads Commitizen friendly

repository-provider

abstract interface to git repository providers like github bitbucket

Example

import { GithubProvider } from 'repository-provider';

const provider = new GithubProvider({ token: 'xxx' });

const repository = await provider.repository('myuser/myrepo');
const branch = await repository.branch('master');
const files = await branch.list();

Derived Providers

list by repository-provider keyword

API

Table of Contents

Provider

Extends Owner

Base repository provider acts as a source of repositories

Parameters

Properties

repositoryGroup

Lookup a repository group

Parameters

Returns Promise<RepositoryGroup>

createRepositoryGroup

Create a new repository group

Parameters

Returns Promise<RepositoryGroup>

repository

Lookup a repository in the provider and all of its repository groups

Parameters

Returns Promise<Repository>

branch

Lookup a branch in the provider and all of its repository groups

Parameters

Returns Promise<Branch>

repositoryGroupClass

Returns Class repository group class used by the Provider

rateLimitReached

Is our rate limit reached. By default we have no rate limit

Returns boolean always false

name

Deliver the provider name

Returns string class name by default

provider

we are our own provider

Returns Provider this

defaultOptions

Default configuration options

Returns Object

optionsFromEnvironment

Extract options suitable for the constructor form the given set of environment variables

Parameters

Returns Object undefined if no suitable environment variables have been found

options

Pepare configuration by mixing together defaultOptions with actual options

Parameters

Returns Object combined options

Branch

Abstract branch

Parameters

Properties

defaultOptions

options

defaultOptions

options

defaultOptions

options

OneTimeInititalizer

enshures tha _initialize() will be called only once

Owner

Collection of repositories

Properties

Repository

Abstract repository

Parameters

  • owner Owner
  • name string (#branch) will be removed
  • options Object
    • options.description string? human readable description
    • options.id string? internal id

Properties

description

the description of the repository content.

Returns string

description

the description of the repository group.

Returns string

id

unique id within the provider.

Returns string

id

unique id within the provider.

Returns string

PullRequest

Abstract pull request Repository#addPullRequest

Parameters

Properties

provider

Returns Provider

delete

Delete the pull request from the Repository.

Returns Promise

merge

Merge the pull request

decline

Decline the pull request

title

the one line description of the pull request.

Returns string

body

the description of the pull request.

Returns string

state

state of the pull request.

Returns string

RepositoryGroup

Extends Owner

Abstract repository as a collection

Parameters

Properties

repositoryClass

By default we use the providers implementation.

Returns Class as defined in the provider

branchClass

By default we use the providers implementation.

Returns Class as defined in the provider

contentClass

By default we use the providers implementation.

Returns Class as defined in the provider

pullRequestClass

By default we use the providers implementation.

Returns Class as defined in the provider

Content

Representation of one file or directory entry

Parameters

  • path string file name inside of the repository
  • content (string | Buffer | Stream) (optional, default undefined)
  • type string type of the content (optional, default "blob")
  • mode string file permissions (optional, default "100644")

Properties

emptyContent

Parameters

Returns Content

propertiesFromOptions

  • See: Object.definedProperties()

create properties from options and default options

Parameters

install

With npm do:

npm install repository-provider

license

BSD-2-Clause

FAQs

Package last updated on 15 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts