Comparing version 0.4.1 to 1.0.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [1.0.0](https://github.com/ffflorian/api-clients/tree/master/packages/crates.io/compare/crates.io@0.4.1...crates.io@1.0.0) (2019-07-17) | ||
### Features | ||
* Set ES6 as target and require Node >= 10.9 ([#130](https://github.com/ffflorian/api-clients/tree/master/packages/crates.io/issues/130)) ([42109dc](https://github.com/ffflorian/api-clients/tree/master/packages/crates.io/commit/42109dc)) | ||
### BREAKING CHANGES | ||
* Node.js >= 10.9 is required. | ||
## [0.4.1](https://github.com/ffflorian/api-clients/tree/master/packages/crates.io/compare/crates.io@0.4.0...crates.io@0.4.1) (2019-07-11) | ||
@@ -8,0 +24,0 @@ |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Endpoints_1 = require("../Endpoints"); | ||
var CratesAPI = /** @class */ (function () { | ||
function CratesAPI(apiClient, apiKey) { | ||
const Endpoints_1 = require("../Endpoints"); | ||
class CratesAPI { | ||
constructor(apiClient, apiKey) { | ||
this.apiClient = apiClient; | ||
@@ -24,8 +13,8 @@ this.apiKey = apiKey; | ||
*/ | ||
CratesAPI.prototype.following = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.following(packageName); | ||
following(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.following(packageName); | ||
if (!this.apiKey) { | ||
throw new Error('You need to set an API key to use this endpoint.'); | ||
} | ||
var additionalConfig = { | ||
const additionalConfig = { | ||
headers: { | ||
@@ -36,3 +25,3 @@ Authorization: this.apiKey, | ||
return this.apiClient.requestService.get(endpoint, additionalConfig); | ||
}; | ||
} | ||
/** | ||
@@ -42,6 +31,6 @@ * Retrieve the owners of a crate. | ||
*/ | ||
CratesAPI.prototype.getAuthors = function (packageName, version) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.authors(packageName, version); | ||
getAuthors(packageName, version) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.authors(packageName, version); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -51,6 +40,6 @@ * Retrieve information of a crate. | ||
*/ | ||
CratesAPI.prototype.getCrate = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.crate(packageName); | ||
getCrate(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.crate(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -61,9 +50,9 @@ * Retrieve a page of crates, optionally constrained by a query. | ||
*/ | ||
CratesAPI.prototype.getCrates = function (query, options) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.crates(); | ||
var additionalConfig = { | ||
params: __assign({}, options, { query: query }), | ||
getCrates(query, options) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.crates(); | ||
const additionalConfig = { | ||
params: Object.assign({}, options, { query }), | ||
}; | ||
return this.apiClient.requestService.get(endpoint, additionalConfig); | ||
}; | ||
} | ||
/** | ||
@@ -73,6 +62,6 @@ * Retrieve a download link for a certain version of a crate. | ||
*/ | ||
CratesAPI.prototype.getDownloadUrl = function (packageName, version) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.download(packageName, version); | ||
getDownloadUrl(packageName, version) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.download(packageName, version); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -82,6 +71,6 @@ * Retrieve the dependencies of a crate version. | ||
*/ | ||
CratesAPI.prototype.getDependencies = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.dependencies(packageName); | ||
getDependencies(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.dependencies(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -91,6 +80,6 @@ * Retrieve download stats for a crate. | ||
*/ | ||
CratesAPI.prototype.getDownloads = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.downloads(packageName); | ||
getDownloads(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.downloads(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -100,6 +89,6 @@ * Retrieve the owners of a crate. | ||
*/ | ||
CratesAPI.prototype.getOwners = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.owners(packageName); | ||
getOwners(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.owners(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -109,6 +98,6 @@ * Retrieve the reverse dependencies of a crate version. | ||
*/ | ||
CratesAPI.prototype.getReverseDependencies = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.reverseDependencies(packageName); | ||
getReverseDependencies(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.reverseDependencies(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -118,6 +107,6 @@ * Retrieve the team owner of a crate. | ||
*/ | ||
CratesAPI.prototype.getTeamOwner = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.ownerTeam(packageName); | ||
getTeamOwner(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.ownerTeam(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -127,6 +116,6 @@ * Retrieve the user owner of a crate. | ||
*/ | ||
CratesAPI.prototype.getUserOwner = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.ownerUser(packageName); | ||
getUserOwner(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.ownerUser(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -136,6 +125,6 @@ * Retrieve a specific version of a crate. | ||
*/ | ||
CratesAPI.prototype.getVersion = function (packageName, version) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.version(packageName, version); | ||
getVersion(packageName, version) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.version(packageName, version); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -145,6 +134,6 @@ * Retrieve all versions of a crate. | ||
*/ | ||
CratesAPI.prototype.getVersions = function (packageName) { | ||
var endpoint = Endpoints_1.Endpoint.Crates.versions(packageName); | ||
getVersions(packageName) { | ||
const endpoint = Endpoints_1.Endpoint.Crates.versions(packageName); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -154,8 +143,7 @@ * Set a new API key. | ||
*/ | ||
CratesAPI.prototype.setApiKey = function (apiKey) { | ||
setApiKey(apiKey) { | ||
this.apiKey = apiKey; | ||
}; | ||
return CratesAPI; | ||
}()); | ||
} | ||
} | ||
exports.CratesAPI = CratesAPI; | ||
//# sourceMappingURL=CratesAPI.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var api_client_1 = require("@ffflorian/api-client"); | ||
var api_1 = require("./api"); | ||
var Endpoints_1 = require("./Endpoints"); | ||
var CratesIO = /** @class */ (function () { | ||
function CratesIO(options) { | ||
const api_client_1 = require("@ffflorian/api-client"); | ||
const api_1 = require("./api"); | ||
const Endpoints_1 = require("./Endpoints"); | ||
class CratesIO { | ||
constructor(options) { | ||
this.options = typeof options === 'string' ? { apiKey: options } : options || {}; | ||
@@ -17,6 +17,6 @@ this.apiClient = new api_client_1.APIClient('https://crates.io/api/v1'); | ||
*/ | ||
CratesIO.prototype.summary = function () { | ||
var endpoint = Endpoints_1.Endpoint.summary(); | ||
summary() { | ||
const endpoint = Endpoints_1.Endpoint.summary(); | ||
return this.apiClient.requestService.get(endpoint); | ||
}; | ||
} | ||
/** | ||
@@ -26,5 +26,5 @@ * Set a new API URL. | ||
*/ | ||
CratesIO.prototype.setApiUrl = function (newUrl) { | ||
setApiUrl(newUrl) { | ||
this.apiClient.setApiUrl(newUrl); | ||
}; | ||
} | ||
/** | ||
@@ -34,9 +34,8 @@ * Set a new API key. | ||
*/ | ||
CratesIO.prototype.setApiKey = function (apiKey) { | ||
setApiKey(apiKey) { | ||
this.options.apiKey = apiKey; | ||
this.api.crates.setApiKey(apiKey); | ||
}; | ||
return CratesIO; | ||
}()); | ||
} | ||
} | ||
exports.CratesIO = CratesIO; | ||
//# sourceMappingURL=CratesIO.js.map |
@@ -5,67 +5,67 @@ "use strict"; | ||
(function (Endpoint) { | ||
var AUTHORS = 'authors'; | ||
var CRATES = 'crates'; | ||
var DEPENDENCIES = 'dependencies'; | ||
var DOWNLOAD = 'download'; | ||
var DOWNLOADS = 'downloads'; | ||
var FOLLOWING = 'following'; | ||
var OWNERS = 'owners'; | ||
var OWNER_TEAM = 'owner_team'; | ||
var OWNER_USER = 'owner_user'; | ||
var REVERSE_DEPENDENCIES = 'reverse_dependencies'; | ||
var SUMMARY = 'summary'; | ||
var VERSIONS = 'versions'; | ||
var encode = encodeURIComponent; | ||
var Crates; | ||
const AUTHORS = 'authors'; | ||
const CRATES = 'crates'; | ||
const DEPENDENCIES = 'dependencies'; | ||
const DOWNLOAD = 'download'; | ||
const DOWNLOADS = 'downloads'; | ||
const FOLLOWING = 'following'; | ||
const OWNERS = 'owners'; | ||
const OWNER_TEAM = 'owner_team'; | ||
const OWNER_USER = 'owner_user'; | ||
const REVERSE_DEPENDENCIES = 'reverse_dependencies'; | ||
const SUMMARY = 'summary'; | ||
const VERSIONS = 'versions'; | ||
const encode = encodeURIComponent; | ||
let Crates; | ||
(function (Crates) { | ||
function authors(packageName, version) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + encode(version) + "/" + AUTHORS; | ||
return `/${CRATES}/${encode(packageName)}/${encode(version)}/${AUTHORS}`; | ||
} | ||
Crates.authors = authors; | ||
function crate(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName); | ||
return `/${CRATES}/${encode(packageName)}`; | ||
} | ||
Crates.crate = crate; | ||
function crates() { | ||
return "/" + CRATES; | ||
return `/${CRATES}`; | ||
} | ||
Crates.crates = crates; | ||
function dependencies(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + DEPENDENCIES; | ||
return `/${CRATES}/${encode(packageName)}/${DEPENDENCIES}`; | ||
} | ||
Crates.dependencies = dependencies; | ||
function download(packageName, version) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + encode(version) + "/" + DOWNLOAD; | ||
return `/${CRATES}/${encode(packageName)}/${encode(version)}/${DOWNLOAD}`; | ||
} | ||
Crates.download = download; | ||
function downloads(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + DOWNLOADS; | ||
return `/${CRATES}/${encode(packageName)}/${DOWNLOADS}`; | ||
} | ||
Crates.downloads = downloads; | ||
function following(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + FOLLOWING; | ||
return `/${CRATES}/${encode(packageName)}/${FOLLOWING}`; | ||
} | ||
Crates.following = following; | ||
function owners(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + OWNERS; | ||
return `/${CRATES}/${encode(packageName)}/${OWNERS}`; | ||
} | ||
Crates.owners = owners; | ||
function ownerTeam(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + OWNER_TEAM; | ||
return `/${CRATES}/${encode(packageName)}/${OWNER_TEAM}`; | ||
} | ||
Crates.ownerTeam = ownerTeam; | ||
function ownerUser(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + OWNER_USER; | ||
return `/${CRATES}/${encode(packageName)}/${OWNER_USER}`; | ||
} | ||
Crates.ownerUser = ownerUser; | ||
function reverseDependencies(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + REVERSE_DEPENDENCIES; | ||
return `/${CRATES}/${encode(packageName)}/${REVERSE_DEPENDENCIES}`; | ||
} | ||
Crates.reverseDependencies = reverseDependencies; | ||
function version(packageName, version) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + encode(version); | ||
return `/${CRATES}/${encode(packageName)}/${encode(version)}`; | ||
} | ||
Crates.version = version; | ||
function versions(packageName) { | ||
return "/" + CRATES + "/" + encode(packageName) + "/" + VERSIONS; | ||
return `/${CRATES}/${encode(packageName)}/${VERSIONS}`; | ||
} | ||
@@ -75,3 +75,3 @@ Crates.versions = versions; | ||
function summary() { | ||
return "/" + SUMMARY; | ||
return `/${SUMMARY}`; | ||
} | ||
@@ -78,0 +78,0 @@ Endpoint.summary = summary; |
{ | ||
"author": "Florian Keller <github@floriankeller.de>", | ||
"dependencies": { | ||
"@ffflorian/api-client": "0.5.1" | ||
"@ffflorian/api-client": "1.0.0" | ||
}, | ||
@@ -13,2 +13,5 @@ "description": "A crates.io API client", | ||
}, | ||
"engines": { | ||
"node": ">= 10.9" | ||
}, | ||
"files": [ | ||
@@ -34,4 +37,4 @@ "dist" | ||
}, | ||
"version": "0.4.1", | ||
"gitHead": "f780bea9c48c3ce89768af6e745de0c0420b3a28" | ||
"version": "1.0.0", | ||
"gitHead": "ae7d683ef17a4b38818049e910a85a209be0f4ae" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
34572
588
+ Added@ffflorian/api-client@1.0.0(transitive)
- Removed@ffflorian/api-client@0.5.1(transitive)
Updated@ffflorian/api-client@1.0.0