Comparing version 1.3.0 to 1.4.0
@@ -131,3 +131,3 @@ /// <reference types="node" /> | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -142,3 +142,3 @@ * | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -153,3 +153,3 @@ * | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -156,0 +156,0 @@ * |
@@ -8,3 +8,30 @@ 'use strict'; | ||
var axios = _interopDefault(require('axios')); | ||
var deprecated = _interopDefault(require('deprecated-decorator')); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
function __decorate(decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
} | ||
function __metadata(metadataKey, metadataValue) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
} | ||
class ApiError extends Error { | ||
@@ -109,3 +136,3 @@ constructor(response) { | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -119,6 +146,17 @@ * | ||
async getShipsWithRarity(rarity) { | ||
throw new Error("getShipsWithRarity() is deprecated, use getShips(orderBy: Order, value: string) instead"); | ||
try { | ||
const response = await axios.get(`${this.baseUrl}/ships?orderBy=rarity&rarity=${rarity}`, this._axiosOptions); | ||
return response.data.ships; | ||
} | ||
catch (error) { | ||
if (error.response && error.response.data) { | ||
throw new ApiError(error.response.data); | ||
} | ||
else { | ||
throw error; | ||
} | ||
} | ||
} | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -132,6 +170,17 @@ * | ||
async getShipsWithType(type) { | ||
throw new Error("getShipsWithType() is deprecated, use getShips(orderBy: Order, value: string) instead"); | ||
try { | ||
const response = await axios.get(`${this.baseUrl}/ships?orderBy=type&type=${type}`, this._axiosOptions); | ||
return response.data.ships; | ||
} | ||
catch (error) { | ||
if (error.response && error.response.data) { | ||
throw new ApiError(error.response.data); | ||
} | ||
else { | ||
throw error; | ||
} | ||
} | ||
} | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -145,3 +194,14 @@ * | ||
async getShipsWithAffiliation(affiliation) { | ||
throw new Error("getShipsWithAffiliation() is deprecated, use getShips(orderBy: Order, value: string) instead"); | ||
try { | ||
const response = await axios.get(`${this.baseUrl}/ships?orderBy=affiliation&affiliation=${affiliation}`, this._axiosOptions); | ||
return response.data.ships; | ||
} | ||
catch (error) { | ||
if (error.response && error.response.data) { | ||
throw new ApiError(error.response.data); | ||
} | ||
else { | ||
throw error; | ||
} | ||
} | ||
} | ||
@@ -171,2 +231,20 @@ /** | ||
} | ||
__decorate([ | ||
deprecated("getShip", "1.3.0"), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String]), | ||
__metadata("design:returntype", Promise) | ||
], AzurLane.prototype, "getShipsWithRarity", null); | ||
__decorate([ | ||
deprecated("getShip", "1.3.0"), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String]), | ||
__metadata("design:returntype", Promise) | ||
], AzurLane.prototype, "getShipsWithType", null); | ||
__decorate([ | ||
deprecated("getShip", "1.3.0"), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String]), | ||
__metadata("design:returntype", Promise) | ||
], AzurLane.prototype, "getShipsWithAffiliation", null); | ||
@@ -173,0 +251,0 @@ exports.ApiError = ApiError; |
{ | ||
"name": "azurlane", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Api wrapper for the azur lane api", | ||
@@ -49,3 +49,4 @@ "main": "lib/index", | ||
"dependencies": { | ||
"axios": "^0.19.0" | ||
"axios": "^0.19.0", | ||
"deprecated-decorator": "^0.1.6" | ||
}, | ||
@@ -52,0 +53,0 @@ "devDependencies": { |
@@ -0,1 +1,27 @@ | ||
<div align="center"> | ||
<br /> | ||
<p> | ||
<a href="https://discord.gg/p895czC"> | ||
<img src="https://discordapp.com/api/guilds/240059867744698368/embed.png" alt="Discord server" /> | ||
</a> | ||
<a href="https://www.npmjs.com/package/azurlane"> | ||
<img src="https://img.shields.io/npm/v/azurlane.svg?maxAge=3600" alt="NPM version" /> | ||
</a> | ||
<a href="https://www.npmjs.com/package/azurlane"> | ||
<img src="https://img.shields.io/npm/dt/azurlane.svg?maxAge=3600" alt="NPM downloads" /> | ||
</a> | ||
<a href="https://david-dm.org/KurozeroPB/azurlane"> | ||
<img src="https://img.shields.io/david/kurozeropb/azurlane.svg?maxAge=3600" alt="Dependencies" /> | ||
</a> | ||
<a href="https://www.patreon.com/Kurozero"> | ||
<img src="https://img.shields.io/badge/donate-patreon-F96854.svg" alt="Patreon" /> | ||
</a> | ||
</p> | ||
<p> | ||
<a href="https://nodei.co/npm/azurlane/"> | ||
<img src="https://nodei.co/npm/azurlane.png?downloads=true&stars=true" alt="NPM info" /> | ||
</a> | ||
</p> | ||
</div> | ||
# AzurLane | ||
@@ -26,54 +52,9 @@ Api wrapper for my azur lane api | ||
## Ship Data | ||
```json | ||
{ | ||
"id": "224", | ||
"names": { | ||
"full": "IJN Akagi (cn: 凰; jp: 赤城)", | ||
"en": "IJN Akagi", | ||
"cn": "凰", | ||
"jp": "赤城" | ||
}, | ||
"thumbnail": "https://azurlane.koumakan.jp/w/images/3/3f/AkagiIcon.png", | ||
"skins": [ | ||
{ | ||
"title": "Default", | ||
"image": "https://azurlane.koumakan.jp/w/images/thumb/0/06/Akagi.png/600px-Akagi.png" | ||
}, | ||
{ | ||
"title": "Paradise Amaryllis", | ||
"image": "https://azurlane.koumakan.jp/w/images/thumb/3/39/AkagiSummer.png/600px-AkagiSummer.png" | ||
}, | ||
{ | ||
"title": "Plum and Snow", | ||
"image": "https://azurlane.koumakan.jp/w/images/thumb/d/d0/AkagiNew_Year.png/533px-AkagiNew_Year.png" | ||
}, | ||
{ | ||
"title": "Deep Crimson Poppy", | ||
"image": "https://azurlane.koumakan.jp/w/images/thumb/6/65/AkagiPledge.png/505px-AkagiPledge.png" | ||
} | ||
], | ||
"buildTime": "Drop Only", | ||
"rarity": "Super Rare", | ||
"stars": { | ||
"value": "★★★☆☆☆", | ||
"count": 3 | ||
}, | ||
"class": "Akagi", | ||
"nationality": "Sakura Empire", | ||
"hullType": "Aircraft Carrier" | ||
} | ||
``` | ||
## Docs | ||
- Module Docs: https://kurozeropb.github.io/AzurLane/ | ||
- Api Docs: https://kurozeropb.github.io/al-api/ | ||
## Build Time Data | ||
```json | ||
{ | ||
"time": "00:24:00", | ||
"ships": [ | ||
"Foxhound", | ||
"Fortune", | ||
"Dace", | ||
"Albacore" | ||
] | ||
} | ||
``` | ||
I recommend looking at the api docs to see what data is returned before spamming the api with useless requests only to see what it actually returns. | ||
## Support | ||
![discord](https://discordapp.com/api/v6/guilds/240059867744698368/widget.png?style=banner2) |
@@ -8,3 +8,3 @@ import typescript from "rollup-plugin-typescript2"; | ||
plugins: [typescript()], | ||
external: ["axios"], | ||
external: ["axios", "deprecated-decorator"], | ||
output: [ | ||
@@ -11,0 +11,0 @@ { |
import axios, { AxiosRequestConfig } from "axios"; | ||
import deprecated from "deprecated-decorator"; | ||
import { ApiError } from "./interfaces/base"; | ||
@@ -104,3 +105,3 @@ import { IConstruction, IBuildResponse } from "./interfaces/build"; | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -113,8 +114,18 @@ * | ||
*/ | ||
@deprecated("getShip", "1.3.0") | ||
public async getShipsWithRarity(rarity: string): Promise<IBaseShip[]> { | ||
throw new Error("getShipsWithRarity() is deprecated, use getShips(orderBy: Order, value: string) instead"); | ||
try { | ||
const response = await axios.get<IShipsResponse>(`${this.baseUrl}/ships?orderBy=rarity&rarity=${rarity}`, this._axiosOptions); | ||
return response.data.ships; | ||
} catch (error) { | ||
if (error.response && error.response.data) { | ||
throw new ApiError(error.response.data); | ||
} else { | ||
throw error; | ||
} | ||
} | ||
} | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -127,8 +138,18 @@ * | ||
*/ | ||
@deprecated("getShip", "1.3.0") | ||
public async getShipsWithType(type: string): Promise<IBaseShip[]> { | ||
throw new Error("getShipsWithType() is deprecated, use getShips(orderBy: Order, value: string) instead"); | ||
try { | ||
const response = await axios.get<IShipsResponse>(`${this.baseUrl}/ships?orderBy=type&type=${type}`, this._axiosOptions); | ||
return response.data.ships; | ||
} catch (error) { | ||
if (error.response && error.response.data) { | ||
throw new ApiError(error.response.data); | ||
} else { | ||
throw error; | ||
} | ||
} | ||
} | ||
/** | ||
* @deprecated | ||
* @deprecated Deprecated since 1.3.0 use getShips() instead, this method will be remove in 2.0.0 | ||
* @since 1.2.0 | ||
@@ -141,4 +162,14 @@ * | ||
*/ | ||
@deprecated("getShip", "1.3.0") | ||
public async getShipsWithAffiliation(affiliation: string): Promise<IBaseShip[]> { | ||
throw new Error("getShipsWithAffiliation() is deprecated, use getShips(orderBy: Order, value: string) instead"); | ||
try { | ||
const response = await axios.get<IShipsResponse>(`${this.baseUrl}/ships?orderBy=affiliation&affiliation=${affiliation}`, this._axiosOptions); | ||
return response.data.ships; | ||
} catch (error) { | ||
if (error.response && error.response.data) { | ||
throw new ApiError(error.response.data); | ||
} else { | ||
throw error; | ||
} | ||
} | ||
} | ||
@@ -145,0 +176,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
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
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
648864
54
3273
2
1
59
+ Addeddeprecated-decorator@^0.1.6
+ Addeddeprecated-decorator@0.1.6(transitive)