@cinerino/sdk 11.0.0-alpha.5 → 11.0.0-alpha.7

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.
@@ -22,7 +22,7 @@ async function main() {
22
22
  });
23
23
  const result = await eventSeriesService.projectFields({
24
24
  page: 1,
25
- limit: 100,
25
+ limit: 1,
26
26
  typeOf: client.factory.eventType.ScreeningEventSeries,
27
27
  sort: {
28
28
  startDate: client.factory.sortType.Ascending
@@ -203,7 +203,25 @@ async function main() {
203
203
 
204
204
  console.log('confirming transaction...');
205
205
 
206
- let confirmResult = await placeOrderService.confirmWithMiminalResponse({ id: transaction.id });
206
+ let confirmResult = await placeOrderService.confirmWithMiminalResponse({
207
+ id: transaction.id,
208
+ sendEmailMessage: true,
209
+ potentialActions: {
210
+ order: {
211
+ potentialActions: {
212
+ sendOrder: {
213
+ potentialActions: {
214
+ sendEmailMessage: [
215
+ {
216
+ object: { template: '| Date/Time of T' }
217
+ }
218
+ ]
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }
224
+ });
207
225
  console.log('transaction confirmed', confirmResult);
208
226
 
209
227
  // 何度確定をコールしても冪等
@@ -0,0 +1,61 @@
1
+ import * as querystring from 'querystring';
2
+
3
+ // tslint:disable:no-console
4
+ interface IAuthConfig {
5
+ auth0Domain: string;
6
+ clientId: string;
7
+ clientSecret: string;
8
+ }
9
+
10
+ // 環境変数から機密情報を取得することを強く推奨します
11
+ const config: IAuthConfig = {
12
+ auth0Domain: String(process.env.ST_AUTHORIZE_SERVER_DOMAIN),
13
+ clientId: String(process.env.ST_CLIENT_ID),
14
+ clientSecret: String(process.env.ST_CLIENT_SECRET)
15
+ // scopes: process.env.OKTA_SCOPES || 'api_access_scope openid', // 必要なスコープを指定
16
+ // authServerId: 'aussd9v86wlIar3cX697', // デフォルト承認サーバーを使用する場合はコメントアウトまたは指定しない
17
+ };
18
+
19
+ export async function getToken() {
20
+ try {
21
+ const form = {
22
+ scope: [],
23
+ state: '',
24
+ grant_type: 'client_credentials',
25
+ // aws_client_metadata
26
+ aws_client_metadata: JSON.stringify({ projectId: 'cinerino', applicationType: 'SoftwareApplication' })
27
+ };
28
+ const secret = Buffer.from(`${config.clientId}:${config.clientSecret}`, 'utf8')
29
+ .toString('base64');
30
+ const options: RequestInit = {
31
+ credentials: 'include',
32
+ body: querystring.stringify(form),
33
+ method: 'POST',
34
+ headers: {
35
+ Authorization: `Basic ${secret}`,
36
+ 'Content-Type': 'application/x-www-form-urlencoded'
37
+ }
38
+ };
39
+ const response = await fetch(`https://${config.auth0Domain}/oauth2/token`, options);
40
+
41
+ if (!response.ok) {
42
+ console.log(await response.json());
43
+ throw new Error('Network response was not ok');
44
+ }
45
+
46
+ const data = await response.json();
47
+ console.log(data);
48
+
49
+ return data;
50
+ } catch (error) {
51
+ console.error('Error fetching token:', error);
52
+ }
53
+ }
54
+
55
+ async function main() {
56
+ const token = await getToken();
57
+ console.log(token);
58
+ }
59
+
60
+ main()
61
+ .catch(console.error);
@@ -0,0 +1,29 @@
1
+ // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
+ // import * as moment from 'moment';
3
+
4
+ const project = { id: String(process.env.PROJECT_ID) };
5
+
6
+ export async function main() {
7
+ console.log('sending preglight request...');
8
+ const response = await fetch(`${<string>process.env.ST_API_ADMIN_ENDPOINT}/projects/${project.id}/sellers?limit=10&page=1`, {
9
+ method: 'OPTIONS'
10
+ });
11
+ if (!response.ok) {
12
+ throw new Error('Network response was not ok');
13
+ }
14
+ const data = await response.text();
15
+ // tslint:disable-next-line:no-null-keyword
16
+ console.dir(data, { depth: null });
17
+
18
+ response.headers.forEach((value, key) => {
19
+ console.log('headers:', key, '->', value);
20
+ });
21
+ }
22
+
23
+ main()
24
+ .then(() => {
25
+ console.log('main processed.');
26
+ })
27
+ .catch((err) => {
28
+ console.error(err);
29
+ });
@@ -3,13 +3,12 @@
3
3
 
4
4
  const project = { id: String(process.env.PROJECT_ID) };
5
5
 
6
- async function main() {
6
+ export async function main() {
7
7
  console.log('searching sellers...');
8
- const response = await fetch(`${<string>process.env.ST_API_ADMIN_ENDPOINT}/sellers?limit=10&page=1`, {
8
+ const response = await fetch(`${<string>process.env.ST_API_ADMIN_ENDPOINT}/projects/${project.id}/sellers?limit=10&page=1`, {
9
9
  method: 'GET',
10
10
  headers: {
11
- authorization: `Bearer ${process.env.SAMPLE_ACCESS_TOKEN}`,
12
- 'X-Project-ID': project.id
11
+ authorization: `Bearer ${process.env.SAMPLE_ACCESS_TOKEN}`
13
12
  }
14
13
  });
15
14
  if (!response.ok) {
@@ -20,6 +19,10 @@ async function main() {
20
19
  // tslint:disable-next-line:no-null-keyword
21
20
  console.dir(data, { depth: null });
22
21
  console.log(data.length, 'data found.');
22
+
23
+ response.headers.forEach((value, key) => {
24
+ console.log('headers:', key, '->', value);
25
+ });
23
26
  }
24
27
 
25
28
  main()
@@ -5,7 +5,7 @@
5
5
  import * as httpStatus from 'http-status';
6
6
  import * as moment from 'moment';
7
7
 
8
- import * as client from '../../../lib/index';
8
+ import * as client from '../../../../lib/index';
9
9
 
10
10
  // tslint:disable-next-line:max-func-body-length
11
11
  async function main() {
@@ -0,0 +1,47 @@
1
+ // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
+ import * as client from '../../../../lib/index';
3
+
4
+ const eventId = 'cmd2cxcw5';
5
+
6
+ let auth: client.auth.ClientCredentials | undefined;
7
+
8
+ async function main() {
9
+ if (auth === undefined) {
10
+ auth = await client.auth.ClientCredentials.createInstance({
11
+ domain: <string>process.env.ST_AUTHORIZE_SERVER_DOMAIN,
12
+ clientId: <string>process.env.ST_CLIENT_ID,
13
+ clientSecret: <string>process.env.ST_CLIENT_SECRET,
14
+ scopes: [],
15
+ state: 'teststate'
16
+ });
17
+ }
18
+
19
+ console.log('座席を検索しています...');
20
+ const qs = new URLSearchParams({
21
+ limit: '10',
22
+ page: '1'
23
+ }).toString();
24
+ const response = await fetch(
25
+ `${<string>process.env.ST_API_ENDPOINT}/events/ScreeningEvent/${eventId}/seats?${qs}`, {
26
+ method: 'GET',
27
+ headers: {
28
+ authorization: `Bearer ${await auth.getAccessToken()}`
29
+ }
30
+
31
+ });
32
+ if (!response.ok) {
33
+ console.dir(await response.json());
34
+ throw new Error('Network response was not ok');
35
+ }
36
+ const data = await response.json();
37
+ // tslint:disable-next-line:no-null-keyword
38
+ console.dir(data, { depth: null });
39
+ console.log(data.length, 'data found.');
40
+ }
41
+ main()
42
+ .then(() => {
43
+ console.log('main processed.');
44
+ })
45
+ .catch((err) => {
46
+ console.error(err);
47
+ });
@@ -2,7 +2,7 @@
2
2
  import * as httpStatus from 'http-status';
3
3
  // import * as moment from 'moment';
4
4
 
5
- import * as client from '../../../lib/index';
5
+ import * as client from '../../../../lib/index';
6
6
 
7
7
  // tslint:disable-next-line:max-func-body-length
8
8
  async function main() {
@@ -1,7 +1,7 @@
1
1
  // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
2
  import * as moment from 'moment';
3
3
 
4
- import * as client from '../../../lib/index';
4
+ import * as client from '../../../../lib/index';
5
5
 
6
6
  let auth: client.auth.ClientCredentials | undefined;
7
7
 
@@ -2,7 +2,7 @@
2
2
  import * as httpStatus from 'http-status';
3
3
  // import * as moment from 'moment';
4
4
 
5
- import * as client from '../../../lib/index';
5
+ import * as client from '../../../../lib/index';
6
6
 
7
7
  // tslint:disable-next-line:max-func-body-length
8
8
  async function main() {
@@ -2,7 +2,7 @@
2
2
  import * as httpStatus from 'http-status';
3
3
  // import * as moment from 'moment';
4
4
 
5
- import * as client from '../../../lib/index';
5
+ import * as client from '../../../../lib/index';
6
6
 
7
7
  // tslint:disable-next-line:max-func-body-length
8
8
  async function main() {
@@ -8,7 +8,9 @@ export declare class ActionService extends Service {
8
8
  /**
9
9
  * アクション検索
10
10
  */
11
- search<T extends factory.actionType>(params: factory.action.ISearchConditions): Promise<ISearchResult<IAction<T>[]>>;
11
+ search<T extends factory.actionType>(params: Omit<factory.action.ISearchConditions, 'typeOf'> & {
12
+ typeOf?: factory.actionType;
13
+ }): Promise<ISearchResult<IAction<T>[]>>;
12
14
  findById<T extends factory.actionType>(params: {
13
15
  id: string;
14
16
  typeOf: T;
@@ -1,6 +1,6 @@
1
1
  import * as factory from '../factory';
2
2
  import { Service } from '../service';
3
- declare type IIdentity = factory.creativeWork.certification.webApplication.ICertification;
3
+ declare type IIdentity = factory.creativeWork.certification.softwareApplication.ICertification | factory.creativeWork.certification.webApplication.ICertification;
4
4
  interface ISavingIdentity {
5
5
  clientId: string;
6
6
  clientSecret: string;