Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add js client samples #1

Closed
wants to merge 5 commits into from

Conversation

oshikawatkm
Copy link
Contributor

js clientのサンプルコードを追加しました。

js/addresses.js Outdated
let access_token = ""

let defaultClient = TapyrusApi.ApiClient.instance;
defaultClient.defaultHeaders = { Authorization: `Bearer ${access_token}` }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is no problem here so far. It is good to consider improving the authentication method in later steps.

@rantan
Copy link
Contributor

rantan commented Jun 16, 2021

I tried the below steps to run the js scripts. How about adding README doc in the /js directory?

  1. Generate js client codes according to Feature/setup document #2
  2. Build and install npm package as a global package
$ cd /path/to/generated/js/client
$ npm install
$ npm link
$ npm build
$ npm install .
  1. Link the installed package to here
$ cd /path/to/tapyrus-api-client-examples/js
$ npm link tapyrus_api
  1. Run the scripts
$ node addresses.js

@rantan
Copy link
Contributor

rantan commented Jun 16, 2021

Promise 化する関数を挟んで利用していますが、example としては Promise 化せずにそのまま使うほうが良いかと思いました。
サンプルコードの中で機能を拡張するのはサンプルコードの範囲を超えている気がしますので。

Promise 化したくなる気持ちはすごくわかりますが。

@rantan
Copy link
Contributor

rantan commented Jun 16, 2021

Typescript 版のクライアントだと Promise を使った API が生成されるようです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants