UNPKG

3.02 kBMarkdownView Raw
1# COA client library for Node.js
2
3[![npm (scoped)](https://img.shields.io/npm/v/@motionpicture/coa-service.svg)](https://www.npmjs.com/package/@motionpicture/coa-service)
4[![CircleCI](https://circleci.com/gh/motionpicture/coa-service.svg?style=shield)](https://circleci.com/gh/motionpicture/coa-service)
5[![Coverage Status](https://coveralls.io/repos/github/motionpicture/coa-service/badge.svg?branch=master)](https://coveralls.io/github/motionpicture/coa-service?branch=master)
6[![Dependency Status](https://img.shields.io/david/motionpicture/coa-service.svg)](https://david-dm.org/motionpicture/coa-service)
7[![Known Vulnerabilities](https://snyk.io/test/github/motionpicture/coa-service/badge.svg)](https://snyk.io/test/github/motionpicture/coa-service)
8[![npm](https://img.shields.io/npm/dm/@motionpicture/coa-service.svg)](https://nodei.co/npm/@motionpicture/coa-service/)
9
10Node.jsでCOAサービスを使うためのライブラリです。
11
12## Table of contents
13
14* [Specification](#specification)
15* [Usage](#usage)
16* [Example](#code-samples)
17* [Documentation](#documentation)
18* [License](#license)
19
20## Specification
21
22COA APIの仕様で注意すべき点は以下の通りです。
23
24* 正常時レスポンスにはstatusが含まれるが、0以外のステータスはない。
25* カタカナは全角統一(半角はありえない)
26* 仮予約番号と購入番号の型はnumberで統一。
27* 座席番号は半角と全角を区別する、
28* 購入番号は劇場内でユニーク、劇場コード合わせれば全体でユニーク。
29* 購入番号は連番かどうか
30 * 仮予約番号は連番だが、購入番号は仮予約番号と同じ番号。よって、仮予約で止めたり、仮予約のキャンセルが発生すると、空き番号が発生しうる。
31* 購入番号は最大8桁。 最大番号(99999999)を超える時点で1に戻る。
32* 劇場コードは、基本的に3桁(001、018等)だが、場合によっては1桁や2桁(1、18等)の表示になっていることはあるかもしれない、とのこと。
33* 座席の解放については、基幹システム側では何も行っていない。
34
35## Usage
36
37```shell
38npm install @motionpicture/coa-service
39```
40
41```js
42const COA = require('@motionpicture/coa-service');
43```
44
45### Environment variables
46
47| Name | Required | Value | Purpose |
48| ------- | -------- | ------------- | ------- |
49| `DEBUG` | false | coa-service:* | Debug |
50
51### 劇場情報を取得する
52
53```js
54const COA = require('@motionpicture/coa-service');
55
56const masterService = new COA.service.Master({
57 endpoint: '',
58 auth: new COA.auth.RefreshTokenClient({
59 endpoint: '',
60 refreshToken: ''
61 })
62});
63
64masterService.theater({
65 theaterCode: '123'
66})
67 .then(console.log)
68 .catch(console.error);
69```
70
71## Code Samples
72
73Code sample are [here](https://github.com/motionpicture/coa-service/tree/master/example).
74
75## Documentation
76
77`npm run doc` emits typedoc to ./docs.
78
79## License
80
81UNLICENSED