@gw2me/client 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ interface AccountsResponse {
31
31
  accounts: {
32
32
  id: string;
33
33
  name: string;
34
+ verified: boolean;
34
35
  }[];
35
36
  }
36
37
  interface SubtokenResponse {
@@ -55,6 +56,7 @@ interface AuthorizationUrlParams {
55
56
  code_challenge_method?: 'S256';
56
57
  prompt?: 'none' | 'consent';
57
58
  include_granted_scopes?: boolean;
59
+ verified_accounts_only?: boolean;
58
60
  }
59
61
  interface AuthTokenParams {
60
62
  code: string;
@@ -77,10 +79,10 @@ declare class Gw2MeClient {
77
79
  private client_id;
78
80
  private client_secret?;
79
81
  constructor({ client_id, client_secret }: ClientInfo, options?: Partial<Options> | undefined);
80
- getAuthorizationUrl({ redirect_uri, scopes, state, code_challenge, code_challenge_method, prompt, include_granted_scopes }: AuthorizationUrlParams): string;
82
+ getAuthorizationUrl({ redirect_uri, scopes, state, code_challenge, code_challenge_method, prompt, include_granted_scopes, verified_accounts_only, }: AuthorizationUrlParams): string;
81
83
  getAccessToken({ code, redirect_uri, code_verifier }: AuthTokenParams): Promise<TokenResponse>;
82
84
  refreshToken({ refresh_token }: RefreshTokenParams): Promise<TokenResponse>;
83
85
  api(access_token: string): Gw2MeApi;
84
86
  }
85
87
 
86
- export { AccountsResponse, AuthTokenParams, AuthorizationUrlParams, ClientInfo, Gw2MeApi, Gw2MeClient, Options, RefreshTokenParams, Scope, SubtokenResponse, TokenResponse, UserResponse };
88
+ export { type AccountsResponse, type AuthTokenParams, type AuthorizationUrlParams, type ClientInfo, Gw2MeApi, Gw2MeClient, type Options, type RefreshTokenParams, Scope, type SubtokenResponse, type TokenResponse, type UserResponse };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var k=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)k(n,t,{get:e[t],enumerable:!0})},b=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of T(e))!A.call(n,i)&&i!==t&&k(n,i,{get:()=>e[i],enumerable:!(s=R(e,i))||s.enumerable});return n};var U=n=>b(k({},"__esModule",{value:!0}),n);var W=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)};var g=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)};var c=(n,e,t)=>(W(n,e,"access private method"),t);var w=(n,e,t)=>new Promise((s,i)=>{var a=r=>{try{p(t.next(r))}catch(m){i(m)}},u=r=>{try{p(t.throw(r))}catch(m){i(m)}},p=r=>r.done?s(r.value):Promise.resolve(r.value).then(a,u);p((t=t.apply(n,e)).next())});var $={};y($,{Gw2MeApi:()=>d,Gw2MeClient:()=>P,Scope:()=>x});module.exports=U($);var x=(o=>(o.Identify="identify",o.Email="email",o.GW2_Account="gw2:account",o.GW2_Inventories="gw2:inventories",o.GW2_Characters="gw2:characters",o.GW2_Tradingpost="gw2:tradingpost",o.GW2_Wallet="gw2:wallet",o.GW2_Unlocks="gw2:unlocks",o.GW2_Pvp="gw2:pvp",o.GW2_Builds="gw2:builds",o.GW2_Progression="gw2:progression",o.GW2_Guilds="gw2:guilds",o))(x||{});var h,_,d=class{constructor(e,t){this.access_token=e;this.options=t;g(this,h)}user(){return fetch(`${c(this,h,_).call(this)}api/user`,{headers:{Authorization:`Bearer ${this.access_token}`},cache:"no-store"}).then(e=>e.json())}accounts(){return fetch(`${c(this,h,_).call(this)}api/accounts`,{headers:{Authorization:`Bearer ${this.access_token}`},cache:"no-store"}).then(e=>e.json())}subtoken(e){return fetch(`${c(this,h,_).call(this)}api/accounts/${e}/subtoken`,{headers:{Authorization:`Bearer ${this.access_token}`},cache:"no-store"}).then(t=>t.json())}};h=new WeakSet,_=function(){var e;return((e=this.options)==null?void 0:e.url)||"https://gw2.me/"};var l,f,P=class{constructor({client_id:e,client_secret:t},s){this.options=s;g(this,l);this.client_id=e,this.client_secret=t}getAuthorizationUrl({redirect_uri:e,scopes:t,state:s,code_challenge:i,code_challenge_method:a,prompt:u,include_granted_scopes:p}){let r=new URLSearchParams({client_id:this.client_id,response_type:"code",redirect_uri:e,scope:t.join(" ")});return s&&r.append("state",s),i&&a&&(r.append("code_challenge",i),r.append("code_challenge_method",a)),u&&r.append("prompt",u),p&&r.append("include_granted_scopes","true"),`${c(this,l,f).call(this)}oauth2/authorize?${r.toString()}`}getAccessToken(i){return w(this,arguments,function*({code:e,redirect_uri:t,code_verifier:s}){let a=new URLSearchParams({grant_type:"authorization_code",code:e,client_id:this.client_id,redirect_uri:t});return this.client_secret&&a.set("client_secret",this.client_secret),s&&a.set("code_verifier",s),yield fetch(`${c(this,l,f).call(this)}api/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a,cache:"no-store"}).then(p=>p.json())})}refreshToken(t){return w(this,arguments,function*({refresh_token:e}){if(!this.client_secret)throw new Error("client_secret required");let s=new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:this.client_id,client_secret:this.client_secret});return yield fetch(`${c(this,l,f).call(this)}api/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s,cache:"no-store"}).then(a=>a.json())})}api(e){return new d(e,this.options)}};l=new WeakSet,f=function(){var e;return((e=this.options)==null?void 0:e.url)||"https://gw2.me/"};0&&(module.exports={Gw2MeApi,Gw2MeClient,Scope});
1
+ "use strict";var k=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var b=(n,e)=>{for(var t in e)k(n,t,{get:e[t],enumerable:!0})},v=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of R(e))!T.call(n,s)&&s!==t&&k(n,s,{get:()=>e[s],enumerable:!(r=y(e,s))||r.enumerable});return n};var A=n=>v(k({},"__esModule",{value:!0}),n);var U=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)};var g=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)};var p=(n,e,t)=>(U(n,e,"access private method"),t);var w=(n,e,t)=>new Promise((r,s)=>{var a=c=>{try{h(t.next(c))}catch(o){s(o)}},d=c=>{try{h(t.throw(c))}catch(o){s(o)}},h=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,d);h((t=t.apply(n,e)).next())});var W={};b(W,{Gw2MeApi:()=>_,Gw2MeClient:()=>P,Scope:()=>x});module.exports=A(W);var x=(i=>(i.Identify="identify",i.Email="email",i.GW2_Account="gw2:account",i.GW2_Inventories="gw2:inventories",i.GW2_Characters="gw2:characters",i.GW2_Tradingpost="gw2:tradingpost",i.GW2_Wallet="gw2:wallet",i.GW2_Unlocks="gw2:unlocks",i.GW2_Pvp="gw2:pvp",i.GW2_Builds="gw2:builds",i.GW2_Progression="gw2:progression",i.GW2_Guilds="gw2:guilds",i))(x||{});var l,f,_=class{constructor(e,t){this.access_token=e;this.options=t;g(this,l)}user(){return fetch(`${p(this,l,f).call(this)}api/user`,{headers:{Authorization:`Bearer ${this.access_token}`},cache:"no-store"}).then(e=>e.json())}accounts(){return fetch(`${p(this,l,f).call(this)}api/accounts`,{headers:{Authorization:`Bearer ${this.access_token}`},cache:"no-store"}).then(e=>e.json())}subtoken(e){return fetch(`${p(this,l,f).call(this)}api/accounts/${e}/subtoken`,{headers:{Authorization:`Bearer ${this.access_token}`},cache:"no-store"}).then(t=>t.json())}};l=new WeakSet,f=function(){var e;return((e=this.options)==null?void 0:e.url)||"https://gw2.me/"};var u,m,P=class{constructor({client_id:e,client_secret:t},r){this.options=r;g(this,u);this.client_id=e,this.client_secret=t}getAuthorizationUrl({redirect_uri:e,scopes:t,state:r,code_challenge:s,code_challenge_method:a,prompt:d,include_granted_scopes:h,verified_accounts_only:c}){let o=new URLSearchParams({client_id:this.client_id,response_type:"code",redirect_uri:e,scope:t.join(" ")});return r&&o.append("state",r),s&&a&&(o.append("code_challenge",s),o.append("code_challenge_method",a)),d&&o.append("prompt",d),h&&o.append("include_granted_scopes","true"),c&&o.append("verified_accounts_only","true"),`${p(this,u,m).call(this)}oauth2/authorize?${o.toString()}`}getAccessToken(s){return w(this,arguments,function*({code:e,redirect_uri:t,code_verifier:r}){let a=new URLSearchParams({grant_type:"authorization_code",code:e,client_id:this.client_id,redirect_uri:t});return this.client_secret&&a.set("client_secret",this.client_secret),r&&a.set("code_verifier",r),yield fetch(`${p(this,u,m).call(this)}api/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a,cache:"no-store"}).then(h=>h.json())})}refreshToken(t){return w(this,arguments,function*({refresh_token:e}){if(!this.client_secret)throw new Error("client_secret required");let r=new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:this.client_id,client_secret:this.client_secret});return yield fetch(`${p(this,u,m).call(this)}api/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r,cache:"no-store"}).then(a=>a.json())})}api(e){return new _(e,this.options)}};u=new WeakSet,m=function(){var e;return((e=this.options)==null?void 0:e.url)||"https://gw2.me/"};0&&(module.exports={Gw2MeApi,Gw2MeClient,Scope});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw2me/client",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "gw2.me client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,11 +34,11 @@
34
34
  "homepage": "https://github.com/gw2treasures/gw2.me#readme",
35
35
  "devDependencies": {
36
36
  "@tsconfig/recommended": "1.0.3",
37
- "@typescript-eslint/eslint-plugin": "6.7.5",
38
- "@typescript-eslint/parser": "6.7.5",
39
- "eslint": "8.51.0",
40
- "tsup": "7.2.0",
41
- "typescript": "5.2.2",
42
- "undici-types": "5.26.3"
37
+ "@typescript-eslint/eslint-plugin": "6.14.0",
38
+ "@typescript-eslint/parser": "6.14.0",
39
+ "eslint": "8.56.0",
40
+ "tsup": "8.0.1",
41
+ "typescript": "5.3.3",
42
+ "undici-types": "6.0.1"
43
43
  }
44
44
  }