@30nama/sdk 1.1.7 → 1.2.0

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.
@@ -1 +1,2 @@
1
1
  export * from './videoContent';
2
+ export * from './news';
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./videoContent"), exports);
18
+ __exportStar(require("./news"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,yCAAsB"}
@@ -0,0 +1,21 @@
1
+ import { BaseResponse } from '../types';
2
+ import { IArticle } from '../../entities/IArticle';
3
+ type NewsPagination = {
4
+ count: number;
5
+ previous_page?: number;
6
+ next_page: string;
7
+ last_page: number;
8
+ data: IArticle[];
9
+ };
10
+ export declare function newsBaseHome(this: any): Promise<BaseResponse<{
11
+ review: IArticle[];
12
+ news: IArticle[];
13
+ }> | undefined>;
14
+ export declare function newsDetail(this: any, id: number): Promise<BaseResponse<IArticle> | undefined>;
15
+ type NewsCategory = 'announcement' | 'interview_and_review' | 'news';
16
+ export declare function newsList(this: any, page: number, category: NewsCategory): Promise<BaseResponse<NewsPagination> | undefined>;
17
+ export declare function newsSearch(this: any, page: number, search_text: string): Promise<BaseResponse<NewsPagination> | undefined>;
18
+ export declare function newsVideoContent(this: any, video_content_id: string): Promise<BaseResponse<{
19
+ news: IArticle;
20
+ }> | undefined>;
21
+ export {};
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.newsVideoContent = exports.newsSearch = exports.newsList = exports.newsDetail = exports.newsBaseHome = void 0;
13
+ const request_1 = require("../request");
14
+ const servicePath = 'news';
15
+ function newsBaseHome() {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const This = this;
18
+ This.log('info', 'Running action: newsBaseHome');
19
+ const req = new request_1.default(`news/base_home`, this);
20
+ req.withService(servicePath);
21
+ req.withMethod('get');
22
+ const response = (yield req.execute());
23
+ // TODO: remove-enforced-success
24
+ if (response) {
25
+ response.result = true;
26
+ response.success = true;
27
+ }
28
+ return response;
29
+ });
30
+ }
31
+ exports.newsBaseHome = newsBaseHome;
32
+ function newsDetail(id) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const This = this;
35
+ This.log('info', 'Running action: newsDetail');
36
+ const req = new request_1.default(`news/detail`, this);
37
+ req.withService(servicePath);
38
+ req.withMethod('get');
39
+ const response = (yield req.execute({ news_id: id }));
40
+ // TODO: remove-enforced-success
41
+ if (response) {
42
+ response.result = true;
43
+ response.success = true;
44
+ }
45
+ return response;
46
+ });
47
+ }
48
+ exports.newsDetail = newsDetail;
49
+ function newsList(page, category) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const This = this;
52
+ This.log('info', 'Running action: newsList');
53
+ const req = new request_1.default(`news/list`, this);
54
+ req.withService(servicePath);
55
+ req.withMethod('get');
56
+ const response = (yield req.execute({ page, category }));
57
+ // TODO: remove-enforced-success
58
+ if (response) {
59
+ response.result = true;
60
+ response.success = true;
61
+ }
62
+ return response;
63
+ });
64
+ }
65
+ exports.newsList = newsList;
66
+ function newsSearch(page, search_text) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const This = this;
69
+ This.log('info', 'Running action: newsSearch');
70
+ const req = new request_1.default(`news/search`, this);
71
+ req.withService(servicePath);
72
+ req.withMethod('get');
73
+ const response = (yield req.execute({ page, search_text }));
74
+ // TODO: remove-enforced-success
75
+ if (response) {
76
+ response.result = true;
77
+ response.success = true;
78
+ }
79
+ return response;
80
+ });
81
+ }
82
+ exports.newsSearch = newsSearch;
83
+ function newsVideoContent(video_content_id) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const This = this;
86
+ This.log('info', 'Running action: newsVideoContent');
87
+ const req = new request_1.default(`news/video_content`, this);
88
+ req.withService(servicePath);
89
+ req.withMethod('get');
90
+ const response = (yield req.execute({ video_content_id }));
91
+ // TODO: remove-enforced-success
92
+ if (response) {
93
+ response.result = true;
94
+ response.success = true;
95
+ }
96
+ return response;
97
+ });
98
+ }
99
+ exports.newsVideoContent = newsVideoContent;
100
+ //# sourceMappingURL=news.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"news.js","sourceRoot":"","sources":["../../../src/api/services/news.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wCAAgC;AAGhC,MAAM,WAAW,GAAG,MAAM,CAAA;AAK1B,SAAsB,YAAY;;QAC9B,MAAM,IAAI,GAAG,IAAW,CAAA;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAA;QAChD,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAA;QAC/C,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;QAC5B,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAErB,MAAM,QAAQ,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,EAAE,CAAuE,CAAA;QAE5G,gCAAg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AAC,CAAiD,CAAA;QAE1G,gCAAgC;QAChC,IAAI,QAAQ,EAAE,CAAC;YACX,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAA;YACtB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAA;QAC3B,CAAC;QAED,OAAO,QAAQ,CAAA;IACnB,CAAC;CAAA;AAhBD,4CAgBC"}
@@ -20,12 +20,14 @@ export type API = {
20
20
  type SuccessResponse<Data> = {
21
21
  status_code: number;
22
22
  result: true;
23
+ success: true;
23
24
  message?: string;
24
25
  data: Data;
25
26
  };
26
27
  type ErrorResponse = {
27
28
  status_code: number;
28
29
  result: false;
30
+ success: false;
29
31
  message?: string;
30
32
  errors: any[];
31
33
  };
@@ -0,0 +1,37 @@
1
+ import BaseEntity from './BaseEntity';
2
+ interface INewsAttach {
3
+ id: number;
4
+ type: string;
5
+ order: number;
6
+ alt: string;
7
+ attach_link: {
8
+ id: number;
9
+ format: string;
10
+ size: string;
11
+ file_path: string;
12
+ };
13
+ }
14
+ interface INewsContent {
15
+ id: number;
16
+ language: string;
17
+ title: string;
18
+ excerpt: string;
19
+ content: string;
20
+ create_time: string;
21
+ }
22
+ export declare class IArticle extends BaseEntity {
23
+ id: number;
24
+ status: string;
25
+ comment_status: string;
26
+ publish_date: string;
27
+ edit_time: string;
28
+ category: string;
29
+ news_attaches: INewsAttach[];
30
+ news_content: INewsContent[];
31
+ related_news: IArticle[];
32
+ video_content_ids: {
33
+ video_content_id: string;
34
+ }[];
35
+ constructor(partial: Partial<IArticle>);
36
+ }
37
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IArticle = void 0;
4
+ const BaseEntity_1 = require("./BaseEntity");
5
+ class IArticle extends BaseEntity_1.default {
6
+ constructor(partial) {
7
+ super();
8
+ Object.assign(this, partial);
9
+ }
10
+ }
11
+ exports.IArticle = IArticle;
12
+ //# sourceMappingURL=IArticle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IArticle.js","sourceRoot":"","sources":["../../src/entities/IArticle.ts"],"names":[],"mappings":";;;AAAA,6CAAqC;AAwBrC,MAAa,QAAS,SAAQ,oBAAU;IAYpC,YAAY,OAA0B;QAClC,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACJ;AAhBD,4BAgBC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@30nama/sdk",
3
3
  "description": "30nama SDK for Node.js",
4
- "version": "1.1.7",
4
+ "version": "1.2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [