vndb-api-kana
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("axios"));function r(t,e,r,n){return new(r||(r=Promise))((function(o,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function i(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,i)}c((n=n.apply(t,e||[])).next())}))}const n=t=>{if(200===(null==t?void 0:t.status))return null==t?void 0:t.data};function o(t,o){const s=(t=>{const r=e.default.create(t);return r.interceptors.response.use(n),r})(o);return(e={})=>r(this,void 0,void 0,(function*(){const{method:r,path:n}=t;switch(void 0!==e.fields&&(e.fields=e.fields.join(", ")),r){case"GET":return s.get(n,{params:e});case"POST":return s.post(n,e);default:throw new Error("Method not supported")}}))}var s=Object.freeze({__proto__:null,getVn:t=>o({path:"vn",method:"POST"},t)});var a=Object.freeze({__proto__:null,getCharacter:t=>o({path:"character",method:"POST"},t)});var i=Object.freeze({__proto__:null,getRelease:t=>o({path:"release",method:"POST"},t)});var c=Object.freeze({__proto__:null,getTag:t=>o({path:"tag",method:"POST"},t),getTrait:t=>o({path:"trait",method:"POST"},t)});var u=Object.freeze({__proto__:null,getProducer:t=>o({path:"producer",method:"POST"},t)}),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s),i),c),u),a);const p={baseURL:"https://api.vndb.org/kana",headers:{"Content-Type":"application/json"}};class d{constructor(t={}){this.apis={},this.config=Object.assign(Object.assign({},p),t),this.createApis()}createApis(){Object.entries(h).forEach((([t,e])=>{this.apis[t]=e(this.config)}))}rawRequest(t,e){return r(this,void 0,void 0,(function*(){return yield o(t,this.config)(e)}))}setAuth(t){this.auth=t,this.config.headers.Authorization=`TOKEN ${this.auth}`,this.createApis()}}const f=(new d).apis;exports.VNDBAPI=d,exports.api=f,exports.default=d; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("axios"));function r(t,e,r,n){return new(r||(r=Promise))((function(s,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function i(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,i)}c((n=n.apply(t,e||[])).next())}))}const n=t=>{if(200===(null==t?void 0:t.status))return null==t?void 0:t.data};function s(t,s,o){const a=(t=>{const r=e.default.create(t);return r.interceptors.response.use(n),r})(s);return(e={})=>r(this,void 0,void 0,(function*(){const{method:r,path:n}=t;if(void 0!==e.fields&&(e.fields=e.fields.join(", ")),o)return o(e,t,s);switch(r){case"GET":return a.get(n,{params:e});case"POST":return a.post(n,e);default:throw new Error("Method not supported")}}))}var o=Object.freeze({__proto__:null,getVn:(t,e)=>s({path:"vn",method:"POST"},t,e)});var a=Object.freeze({__proto__:null,getCharacter:(t,e)=>s({path:"character",method:"POST"},t,e)});var i=Object.freeze({__proto__:null,getRelease:(t,e)=>s({path:"release",method:"POST"},t,e)});var c=Object.freeze({__proto__:null,getTag:(t,e)=>s({path:"tag",method:"POST"},t,e),getTrait:(t,e)=>s({path:"trait",method:"POST"},t,e)});var u=Object.freeze({__proto__:null,getProducer:(t,e)=>s({path:"producer",method:"POST"},t,e)}),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),i),c),u),a);const p={baseURL:"https://api.vndb.org/kana",headers:{"Content-Type":"application/json"}};class d{constructor(t={}){this.apis={},this.config=Object.assign(Object.assign({},p),t),this.createApis()}createApis(t){Object.entries(h).forEach((([e,r])=>{this.apis[e]=r(this.config,t)}))}rawRequest(t,e){return r(this,void 0,void 0,(function*(){return yield s(t,this.config)(e)}))}setAuth(t){this.auth=t,this.config.headers.Authorization=`TOKEN ${this.auth}`,this.createApis()}use(t){this.createApis(t)}}const f=(new d).apis;exports.VNDBAPI=d,exports.api=f,exports.default=d; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -0,1 +1,2 @@ | ||
import { ApiPath as ApiPath$1 } from 'src/apis/createApis'; | ||
import * as axios from 'axios'; | ||
@@ -253,3 +254,3 @@ import { CreateAxiosDefaults } from 'axios'; | ||
*/ | ||
offical: boolean; | ||
official: boolean; | ||
/** | ||
@@ -916,5 +917,11 @@ * Boolean, whether this is the “main” title for the visual novel entry. Exactly one title has this flag set in the titles array and it’s always the title whose lang matches the VN’s olang field. This field is included for convenience, you can of course also use the olang field to grab the main title. | ||
}[keyof T]; | ||
type VnField = DeepPath<Vn>; | ||
type ReleaseField = DeepPath<Release$1>; | ||
type CharacterField = DeepPath<Character>; | ||
type ProducerField = DeepPath<Producer>; | ||
type TagField = DeepPath<Tag>; | ||
type TraitField = DeepPath<Trait>; | ||
interface VnRequest extends BaseQuery { | ||
filters: VnFilters; | ||
fields: DeepPath<Vn>[]; | ||
fields: VnField[]; | ||
sort?: 'id' | 'title' | 'released' | 'popularity' | 'rating' | 'votecount'; | ||
@@ -924,3 +931,3 @@ } | ||
filters: ReleaseFilters$1; | ||
fields: DeepPath<Release$1>[]; | ||
fields: ReleaseField[]; | ||
sort?: 'id' | 'title' | 'released'; | ||
@@ -930,3 +937,3 @@ } | ||
filters: CharacterFilters; | ||
fields: DeepPath<Character>[]; | ||
fields: CharacterField[]; | ||
sort?: 'id' | 'name'; | ||
@@ -936,3 +943,3 @@ } | ||
filters: ProducerFilters; | ||
fields: DeepPath<Producer>[]; | ||
fields: ProducerField[]; | ||
sort?: 'id' | 'name'; | ||
@@ -942,3 +949,3 @@ } | ||
filters: TagFilters; | ||
fields: DeepPath<Tag>[]; | ||
fields: TagField[]; | ||
sort?: 'id' | 'name' | 'vn_count'; | ||
@@ -948,5 +955,8 @@ } | ||
filters: TraitFilters; | ||
fields: DeepPath<Trait>[]; | ||
fields: TraitField[]; | ||
sort?: 'id' | 'name' | 'char_count'; | ||
} | ||
type UseRequest = <T, S>(params: T, path: ApiPath$1, | ||
/** default has BaseURL header */ | ||
config?: CreateAxiosDefaults) => Promise<S>; | ||
@@ -959,8 +969,8 @@ interface ApiPath { | ||
declare const _default: { | ||
getCharacter: (config: axios.CreateAxiosDefaults<any>) => (params?: CharacterRequest) => Promise<BaseResponse<Character>>; | ||
getProducer: (config: axios.CreateAxiosDefaults<any>) => (params?: ProducerRequest) => Promise<BaseResponse<Producer>>; | ||
getTag: (config: axios.CreateAxiosDefaults<any>) => (params?: TagRequest) => Promise<BaseResponse<Tag>>; | ||
getTrait: (config: axios.CreateAxiosDefaults<any>) => (params?: TraitRequest) => Promise<BaseResponse<Trait>>; | ||
getRelease: (config: axios.CreateAxiosDefaults<any>) => (params?: ReleaseRequest) => Promise<BaseResponse<Release>>; | ||
getVn: (config: axios.CreateAxiosDefaults<any>) => (params?: VnRequest) => Promise<BaseResponse<Vn>>; | ||
getCharacter: (config: axios.CreateAxiosDefaults<any>, use: UseRequest) => (params?: CharacterRequest) => Promise<BaseResponse<Character>>; | ||
getProducer: (config: axios.CreateAxiosDefaults<any>, use: UseRequest) => (params?: ProducerRequest) => Promise<BaseResponse<Producer>>; | ||
getTag: (config: axios.CreateAxiosDefaults<any>, use: UseRequest) => (params?: TagRequest) => Promise<BaseResponse<Tag>>; | ||
getTrait: (config: axios.CreateAxiosDefaults<any>, use: UseRequest) => (params?: TraitRequest) => Promise<BaseResponse<Trait>>; | ||
getRelease: (config: axios.CreateAxiosDefaults<any>, use: UseRequest) => (params?: ReleaseRequest) => Promise<BaseResponse<Release>>; | ||
getVn: (config: axios.CreateAxiosDefaults<any>, use: UseRequest) => (params?: VnRequest) => Promise<BaseResponse<Vn>>; | ||
}; | ||
@@ -978,2 +988,3 @@ | ||
setAuth(auth: string): void; | ||
use(use: UseRequest): void; | ||
} | ||
@@ -989,2 +1000,2 @@ declare const api: { | ||
export { BaseCharacterFilters, BaseProducerFilters, BaseQuery, BaseReleaseFilters, BaseResponse, BaseTagFilters, BaseTraitFilters, BaseVnFilters, Character, CharacterFilters, CharacterRequest, Producer, ProducerFilters, ProducerRequest, Release, ReleaseFilters, ReleaseRequest, Tag, TagFilters, TagRequest, Trait, TraitFilters, TraitInCharacter, TraitRequest, VNDBAPI, Vn, VnFilters, VnInCharacter, VnInRelease, VnRequest, api, VNDBAPI as default }; | ||
export { BaseCharacterFilters, BaseProducerFilters, BaseQuery, BaseReleaseFilters, BaseResponse, BaseTagFilters, BaseTraitFilters, BaseVnFilters, Character, CharacterField, CharacterFilters, CharacterRequest, Producer, ProducerField, ProducerFilters, ProducerRequest, Release, ReleaseField, ReleaseFilters, ReleaseRequest, Tag, TagField, TagFilters, TagRequest, Trait, TraitField, TraitFilters, TraitInCharacter, TraitRequest, UseRequest, VNDBAPI, Vn, VnField, VnFilters, VnInCharacter, VnInRelease, VnRequest, api, VNDBAPI as default }; |
@@ -1,2 +0,2 @@ | ||
import t from"axios";function e(t,e,n,r){return new(n||(n=Promise))((function(o,s){function a(t){try{c(r.next(t))}catch(t){s(t)}}function i(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,i)}c((r=r.apply(t,e||[])).next())}))}const n=t=>{if(200===(null==t?void 0:t.status))return null==t?void 0:t.data};function r(r,o){const s=(e=>{const r=t.create(e);return r.interceptors.response.use(n),r})(o);return(t={})=>e(this,void 0,void 0,(function*(){const{method:e,path:n}=r;switch(void 0!==t.fields&&(t.fields=t.fields.join(", ")),e){case"GET":return s.get(n,{params:t});case"POST":return s.post(n,t);default:throw new Error("Method not supported")}}))}var o=Object.freeze({__proto__:null,getVn:t=>r({path:"vn",method:"POST"},t)});var s=Object.freeze({__proto__:null,getCharacter:t=>r({path:"character",method:"POST"},t)});var a=Object.freeze({__proto__:null,getRelease:t=>r({path:"release",method:"POST"},t)});var i=Object.freeze({__proto__:null,getTag:t=>r({path:"tag",method:"POST"},t),getTrait:t=>r({path:"trait",method:"POST"},t)});var c=Object.freeze({__proto__:null,getProducer:t=>r({path:"producer",method:"POST"},t)}),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),a),i),c),s);const u={baseURL:"https://api.vndb.org/kana",headers:{"Content-Type":"application/json"}};class p{constructor(t={}){this.apis={},this.config=Object.assign(Object.assign({},u),t),this.createApis()}createApis(){Object.entries(h).forEach((([t,e])=>{this.apis[t]=e(this.config)}))}rawRequest(t,n){return e(this,void 0,void 0,(function*(){return yield r(t,this.config)(n)}))}setAuth(t){this.auth=t,this.config.headers.Authorization=`TOKEN ${this.auth}`,this.createApis()}}const d=(new p).apis;export{p as VNDBAPI,d as api,p as default}; | ||
import t from"axios";function e(t,e,n,r){return new(n||(n=Promise))((function(s,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function i(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,i)}c((r=r.apply(t,e||[])).next())}))}const n=t=>{if(200===(null==t?void 0:t.status))return null==t?void 0:t.data};function r(r,s,o){const a=(e=>{const r=t.create(e);return r.interceptors.response.use(n),r})(s);return(t={})=>e(this,void 0,void 0,(function*(){const{method:e,path:n}=r;if(void 0!==t.fields&&(t.fields=t.fields.join(", ")),o)return o(t,r,s);switch(e){case"GET":return a.get(n,{params:t});case"POST":return a.post(n,t);default:throw new Error("Method not supported")}}))}var s=Object.freeze({__proto__:null,getVn:(t,e)=>r({path:"vn",method:"POST"},t,e)});var o=Object.freeze({__proto__:null,getCharacter:(t,e)=>r({path:"character",method:"POST"},t,e)});var a=Object.freeze({__proto__:null,getRelease:(t,e)=>r({path:"release",method:"POST"},t,e)});var i=Object.freeze({__proto__:null,getTag:(t,e)=>r({path:"tag",method:"POST"},t,e),getTrait:(t,e)=>r({path:"trait",method:"POST"},t,e)});var c=Object.freeze({__proto__:null,getProducer:(t,e)=>r({path:"producer",method:"POST"},t,e)}),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s),a),i),c),o);const u={baseURL:"https://api.vndb.org/kana",headers:{"Content-Type":"application/json"}};class p{constructor(t={}){this.apis={},this.config=Object.assign(Object.assign({},u),t),this.createApis()}createApis(t){Object.entries(h).forEach((([e,n])=>{this.apis[e]=n(this.config,t)}))}rawRequest(t,n){return e(this,void 0,void 0,(function*(){return yield r(t,this.config)(n)}))}setAuth(t){this.auth=t,this.config.headers.Authorization=`TOKEN ${this.auth}`,this.createApis()}use(t){this.createApis(t)}}const d=(new p).apis;export{p as VNDBAPI,d as api,p as default}; | ||
//# sourceMappingURL=index.mjs.js.map |
{ | ||
"name": "vndb-api-kana", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"license": "MIT", | ||
@@ -13,3 +13,3 @@ "author": "TachibanaKimika", | ||
}, | ||
"description": "common toolkit", | ||
"description": "api wrapper for vndb.org", | ||
"files": [ | ||
@@ -24,3 +24,3 @@ "dist" | ||
"keywords": [ | ||
"vndb" | ||
"vndb", "erogame", "visual novel" | ||
], | ||
@@ -27,0 +27,0 @@ "repository": { |
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
57913
1004