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

repository-provider

Package Overview
Dependencies
Maintainers
1
Versions
662
Alerts
File Explorer

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

  • 6.0.0
  • Source
  • npm
  • Socket score

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

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 that _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

internal id.

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

locked

locked state of the pull request.

Returns boolean

merged

merged state of the pull request.

Returns boolean

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 All paths are asolute (no leading '/') and build with '/'

Parameters

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

Properties

isDirectory

Returns boolean true is content represents a directory

isFile

Returns boolean true is content represents a blob (plain old file)

toString

Deliver content as string

Returns string content

toStream

Deliver content as stream

Returns ReadableStream content

equals

compare against other content

Parameters

Returns boolean true if other describes the same content

emptyContent

Create empty content (file)

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

Keywords

FAQs

Package last updated on 23 Oct 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc