libraries.io
Advanced tools
Comparing version 1.1.0 to 1.2.0
import { RequestService } from '../../RequestService'; | ||
import { Contributor, LibrariesIOResult, PaginationOptions, Project, Repository } from '../../interfaces/'; | ||
import { Contributor, LibrariesIOResult, PaginationOptions, Project, Repository, PlatformType } from '../../interfaces/'; | ||
export declare class GitHubUserAPI { | ||
@@ -41,3 +41,3 @@ private readonly requestService; | ||
getDependencies(userName: string, options?: PaginationOptions): Promise<LibrariesIOResult<Project[]>>; | ||
getDependencies(userName: string, platform?: string, options?: PaginationOptions): Promise<LibrariesIOResult<Project[]>>; | ||
getDependencies(userName: string, platform?: PlatformType, options?: PaginationOptions): Promise<LibrariesIOResult<Project[]>>; | ||
} |
import { RequestService } from '../RequestService'; | ||
import { Contributor, LibrariesIOResult, PaginationOptions, Project, ProjectUsage, ProjectWithDependencies, Repository, SearchOptions } from '../interfaces/'; | ||
import { Contributor, LibrariesIOResult, PaginationOptions, PlatformType, Project, ProjectUsage, ProjectWithDependencies, Repository, SearchOptions } from '../interfaces/'; | ||
export declare class ProjectAPI { | ||
@@ -12,3 +12,3 @@ private readonly requestService; | ||
*/ | ||
getProject(platform: string, projectName: string): Promise<LibrariesIOResult<Project>>; | ||
getProject(platform: PlatformType, projectName: string): Promise<LibrariesIOResult<Project>>; | ||
/** | ||
@@ -21,3 +21,3 @@ * Get a list of dependencies for a version of a project, pass `latest` as version to get dependency info for the latest available version | ||
*/ | ||
getProjectWithDependencies(platform: string, projectName: string, projectVersion: string): Promise<LibrariesIOResult<ProjectWithDependencies>>; | ||
getProjectWithDependencies(platform: PlatformType, projectName: string, projectVersion: string): Promise<LibrariesIOResult<ProjectWithDependencies>>; | ||
/** | ||
@@ -30,3 +30,3 @@ * Get packages that have at least one version that depends on a given project. | ||
*/ | ||
getDependendents(platform: string, projectName: string, options?: PaginationOptions): Promise<LibrariesIOResult<Project[]>>; | ||
getDependendents(platform: PlatformType, projectName: string, options?: PaginationOptions): Promise<LibrariesIOResult<Project[]>>; | ||
/** | ||
@@ -38,3 +38,3 @@ * Get repositories that depend on a given project. | ||
*/ | ||
getDependendentRepositories(platform: string, projectName: string, options?: PaginationOptions): Promise<LibrariesIOResult<Repository[]>>; | ||
getDependendentRepositories(platform: PlatformType, projectName: string, options?: PaginationOptions): Promise<LibrariesIOResult<Repository[]>>; | ||
/** | ||
@@ -47,3 +47,3 @@ * Get users that have contributed to a given project. | ||
*/ | ||
getContributors(platform: string, projectName: string, options?: PaginationOptions): Promise<LibrariesIOResult<Contributor[]>>; | ||
getContributors(platform: PlatformType, projectName: string, options?: PaginationOptions): Promise<LibrariesIOResult<Contributor[]>>; | ||
/** | ||
@@ -55,3 +55,3 @@ * Get breakdown of SourceRank score for a given project. | ||
*/ | ||
getSourceRank(platform: string, projectName: string): Promise<LibrariesIOResult<number>>; | ||
getSourceRank(platform: PlatformType, projectName: string): Promise<LibrariesIOResult<number>>; | ||
/** | ||
@@ -62,3 +62,3 @@ * Get breakdown of version usage for a given project. | ||
*/ | ||
getUsage(platform: string, projectName: string): Promise<LibrariesIOResult<ProjectUsage>>; | ||
getUsage(platform: PlatformType, projectName: string): Promise<LibrariesIOResult<ProjectUsage>>; | ||
/** | ||
@@ -65,0 +65,0 @@ * Search for projects. |
import { RequestService } from '../RequestService'; | ||
import { LibrariesIOHeaders, LibrariesIOResult, PaginationOptions, PreReleaseOptions, Subscription } from '../interfaces/'; | ||
import { LibrariesIOHeaders, LibrariesIOResult, PaginationOptions, PlatformType, PreReleaseOptions, Subscription } from '../interfaces/'; | ||
export declare class UserAPI { | ||
@@ -12,3 +12,3 @@ private readonly requestService; | ||
*/ | ||
getSubscription(platform: string, projectName: string): Promise<LibrariesIOResult<Subscription | null>>; | ||
getSubscription(platform: PlatformType, projectName: string): Promise<LibrariesIOResult<Subscription | null>>; | ||
/** | ||
@@ -27,3 +27,3 @@ * List packages that a user is subscribed to recieved notifications about new releases. | ||
*/ | ||
subscribe(platform: string, projectName: string, options?: PreReleaseOptions): Promise<LibrariesIOResult<Subscription>>; | ||
subscribe(platform: PlatformType, projectName: string, options?: PreReleaseOptions): Promise<LibrariesIOResult<Subscription>>; | ||
/** | ||
@@ -35,3 +35,3 @@ * Stop receiving release notifications from a project. | ||
*/ | ||
unsubscribe(platform: string, projectName: string): Promise<LibrariesIOHeaders>; | ||
unsubscribe(platform: PlatformType, projectName: string): Promise<LibrariesIOHeaders>; | ||
/** | ||
@@ -44,3 +44,3 @@ * Update the options for a subscription. | ||
*/ | ||
updateSubscription(platform: string, projectName: string, options?: PreReleaseOptions): Promise<LibrariesIOResult<Subscription>>; | ||
updateSubscription(platform: PlatformType, projectName: string, options?: PreReleaseOptions): Promise<LibrariesIOResult<Subscription>>; | ||
} |
@@ -16,2 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var interfaces_1 = require("./interfaces/"); | ||
var APIException = /** @class */ (function (_super) { | ||
@@ -85,7 +86,7 @@ __extends(APIException, _super); | ||
switch (error.response.status) { | ||
case 403: | ||
case interfaces_1.HttpStatus.FORBIDDEN: | ||
return new AuthenticationError(error.message, serverMessage); | ||
case 404: | ||
case interfaces_1.HttpStatus.NOT_FOUND: | ||
return new NotFoundError(error.message, serverMessage); | ||
case 429: | ||
case interfaces_1.HttpStatus.TOO_MANY_REQUESTS: | ||
return new RateLimitError(error.message, serverMessage); | ||
@@ -92,0 +93,0 @@ default: |
@@ -8,2 +8,3 @@ "use strict"; | ||
__export(require("./APIException")); | ||
__export(require("./interfaces/")); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Options")); | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
licenses?: string[]; | ||
platforms?: string[]; | ||
platforms?: PlatformType[]; | ||
} | ||
@@ -28,4 +28,11 @@ export interface ClientOptions { | ||
apiKey?: string; | ||
platform?: string; | ||
platform?: PlatformType; | ||
query?: string; | ||
} | ||
export declare type HttpMethod = 'delete' | 'get' | 'post' | 'put'; | ||
export declare enum HttpStatus { | ||
'FORBIDDEN' = 403, | ||
'NOT_FOUND' = 404, | ||
'TOO_MANY_REQUESTS' = 429 | ||
} | ||
export declare type PlatformType = 'alcatraz' | 'atom' | 'bower' | 'cargo' | 'carthage' | 'clojars' | 'cocoapods' | 'cpan' | 'cran' | 'dub' | 'elm' | 'emacs' | 'go' | 'hackage' | 'haxelib' | 'hex' | 'homebrew' | 'inqlude' | 'julia' | 'maven' | 'meteor' | 'nimble' | 'npm' | 'nuget' | 'packagist' | 'platformio' | 'pub' | 'puppet' | 'purescript' | 'pypi' | 'racket' | 'rubygems' | 'sublime' | 'swiftpm' | 'wordpress'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var HttpStatus; | ||
(function (HttpStatus) { | ||
HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN"; | ||
HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND"; | ||
HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS"; | ||
})(HttpStatus = exports.HttpStatus || (exports.HttpStatus = {})); | ||
//# sourceMappingURL=Options.js.map |
@@ -0,1 +1,2 @@ | ||
import { PlatformType } from './Options'; | ||
export interface Project { | ||
@@ -37,3 +38,3 @@ dependent_repos_count: number; | ||
outdated: boolean; | ||
platform: string; | ||
platform: PlatformType; | ||
project_name: string; | ||
@@ -40,0 +41,0 @@ requirements: string; |
/// <reference types="node" /> | ||
import { URL } from 'url'; | ||
import { ClientOptions, LibrariesIOHeaders, LibrariesIOResult, RequestOptions } from './interfaces/'; | ||
export declare type HttpMethod = 'delete' | 'get' | 'post' | 'put'; | ||
export declare class RequestService { | ||
@@ -6,0 +5,0 @@ private apiUrl; |
@@ -35,3 +35,2 @@ { | ||
"clear:docs": "rimraf docs", | ||
"deploy:docs": "git subtree push --prefix docs origin gh-pages", | ||
"dist": "yarn clear && yarn build", | ||
@@ -43,3 +42,3 @@ "dist:docs": "yarn clear:docs && yarn build:docs && nodetouch docs/.nojekyll", | ||
"types": "dist/index.d.ts", | ||
"version": "1.1.0" | ||
"version": "1.2.0" | ||
} |
@@ -9,2 +9,8 @@ # libraries.io.js [![Build Status](https://api.travis-ci.org/ffflorian/libraries.io.js.svg?branch=master)](https://travis-ci.org/ffflorian/libraries.io.js/) [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=ffflorian/libraries.io.js)](https://dependabot.com) | ||
### Installation | ||
Run `yarn add @ffflorian/xkcdjs` or `npm install @ffflorian/xkcdjs`. | ||
### Example | ||
```ts | ||
@@ -16,3 +22,13 @@ import {LibrariesIO} from 'libraries.io'; | ||
librariesIO.api.project.getProject('npm', 'grunt') | ||
.then(data => { | ||
.then(response => { | ||
// | ||
}) | ||
librariesIO.api.project.search('grunt', { | ||
filter: { | ||
platforms: ['npm'], | ||
licenses: ['MIT'] | ||
} | ||
}) | ||
.then(projects => { | ||
// ... | ||
@@ -22,3 +38,3 @@ }) | ||
librariesIO.api.github.user.getUser('ffflorian') | ||
.then(data => { | ||
.then(user => { | ||
// ... | ||
@@ -28,6 +44,10 @@ }) | ||
librariesIO.api.platform.getPlatforms({page: 2, perPage: 5}) | ||
.then(data => { | ||
.then(platforms => { | ||
// ... | ||
}) | ||
librariesIO.api.user.subscribe('npm', 'grunt') | ||
.then(subscription => { | ||
// ... | ||
}) | ||
``` | ||
@@ -34,0 +54,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77095
1263
57