Comparing version 0.1.0 to 0.1.1
@@ -1,2 +0,2 @@ | ||
import { AuthorsResult, CrateResult, DependenciesResult, DownloadsResult, ReverseDependenciesResult, SearchOptions, SearchResult, TeamsResult, UrlResult, UsersResult, Version } from '../interfaces/'; | ||
import { AuthorsResult, CrateResult, DependenciesResult, DownloadsResult, FollowingResult, ReverseDependenciesResult, SearchOptions, SearchResult, TeamsResult, UrlResult, UsersResult, Version } from '../interfaces/'; | ||
import { RequestService } from '../RequestService'; | ||
@@ -10,2 +10,7 @@ export declare class CratesAPI { | ||
*/ | ||
following(packageName: string): Promise<FollowingResult>; | ||
/** | ||
* Retrieve the owners of a crate. | ||
* @param packageName The package name | ||
*/ | ||
getAuthors(packageName: string, version: string): Promise<AuthorsResult>; | ||
@@ -12,0 +17,0 @@ /** |
@@ -23,2 +23,10 @@ "use strict"; | ||
*/ | ||
CratesAPI.prototype.following = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.following(packageName); | ||
return this.requestService.get(endpoint); | ||
}; | ||
/** | ||
* Retrieve the owners of a crate. | ||
* @param packageName The package name | ||
*/ | ||
CratesAPI.prototype.getAuthors = function (packageName, version) { | ||
@@ -25,0 +33,0 @@ var endpoint = Endpoints_1.Endpoint.Crates.authors(packageName, version); |
@@ -10,2 +10,3 @@ export declare namespace Endpoint { | ||
function downloads(packageName: string): string; | ||
function following(packageName: string): string; | ||
function owners(packageName: string): string; | ||
@@ -12,0 +13,0 @@ function ownerTeam(packageName: string): string; |
@@ -10,2 +10,3 @@ "use strict"; | ||
var DOWNLOADS = 'downloads'; | ||
var FOLLOWING = 'following'; | ||
var OWNERS = 'owners'; | ||
@@ -48,2 +49,6 @@ var OWNER_TEAM = 'owner_team'; | ||
Crates.downloads = downloads; | ||
function following(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + FOLLOWING; | ||
} | ||
Crates.following = following; | ||
function owners(packageName) { | ||
@@ -50,0 +55,0 @@ return "/" + CRATES + "/" + encode(packageName) + "/" + OWNERS; |
export interface Crate { | ||
badges: string[] | null; | ||
badges: { | ||
[key: string]: { | ||
[key: string]: string; | ||
}; | ||
} | null; | ||
categories: string | null; | ||
@@ -4,0 +8,0 @@ created_at: string; |
@@ -17,4 +17,4 @@ export interface ClientOptions { | ||
export interface RequestOptions extends SearchOptions { | ||
apiKey?: string; | ||
query?: string; | ||
token?: string; | ||
} |
import { Category, Crate, Dependency, Download, Keyword, Team, User, Version } from '.'; | ||
export interface AuthorsResult { | ||
meta: { | ||
names: string[]; | ||
}; | ||
users: string[]; | ||
} | ||
export interface CrateResult { | ||
@@ -7,8 +13,2 @@ categories: Category[]; | ||
} | ||
export interface VersionsResult { | ||
versions: Version[]; | ||
} | ||
export interface VersionResult { | ||
version: Version; | ||
} | ||
export interface DependenciesResult { | ||
@@ -20,7 +20,4 @@ dependencies: Dependency[]; | ||
} | ||
export interface AuthorsResult { | ||
meta: { | ||
names: string[]; | ||
}; | ||
users: string[]; | ||
export interface FollowingResult { | ||
following: boolean; | ||
} | ||
@@ -47,1 +44,7 @@ export interface ReverseDependenciesResult extends DependenciesResult, VersionResult { | ||
} | ||
export interface VersionsResult { | ||
versions: Version[]; | ||
} | ||
export interface VersionResult { | ||
version: Version; | ||
} |
@@ -61,15 +61,16 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var params, config, _a, data, headers, status, contentType, error_1; | ||
var config, _a, data, headers, status, contentType, error_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
params = parameters || {}; | ||
if (this.apiKey) { | ||
params.apiKey = this.apiKey; | ||
} | ||
config = { | ||
method: method, | ||
params: params, | ||
params: parameters, | ||
url: this.apiUrl + endpoint, | ||
}; | ||
if (this.apiKey) { | ||
config.headers = { | ||
Authorization: this.apiKey, | ||
}; | ||
} | ||
_b.label = 1; | ||
@@ -76,0 +77,0 @@ case 1: |
@@ -44,3 +44,3 @@ { | ||
}, | ||
"version": "0.1.0" | ||
"version": "0.1.1" | ||
} |
@@ -35,3 +35,3 @@ # crates.io.js [![npm version](https://img.shields.io/npm/v/crates.io.svg?style=flat)](https://www.npmjs.com/package/crates.io) [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=ffflorian/crates.io.js)](https://dependabot.com) | ||
.then(data => { | ||
console.log(data); | ||
... | ||
}); | ||
@@ -38,0 +38,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
45569
820
0