gs2 1.3.118 → 1.3.120
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/matchmaking/model/Namespace.d.ts +4 -0
- package/matchmaking/model/Namespace.js +16 -2
- package/matchmaking/model/Namespace.js.map +1 -1
- package/matchmaking/model/Namespace.ts +14 -0
- package/matchmaking/request/CreateNamespaceRequest.d.ts +4 -0
- package/matchmaking/request/CreateNamespaceRequest.js +16 -2
- package/matchmaking/request/CreateNamespaceRequest.js.map +1 -1
- package/matchmaking/request/CreateNamespaceRequest.ts +14 -0
- package/matchmaking/request/UpdateNamespaceRequest.d.ts +4 -0
- package/matchmaking/request/UpdateNamespaceRequest.js +16 -2
- package/matchmaking/request/UpdateNamespaceRequest.js.map +1 -1
- package/matchmaking/request/UpdateNamespaceRequest.ts +14 -0
- package/matchmaking/rest.js +6 -4
- package/matchmaking/rest.js.map +1 -1
- package/matchmaking/rest.ts +2 -0
- package/news/model/Content.d.ts +21 -0
- package/news/model/Content.js +76 -0
- package/news/model/Content.js.map +1 -0
- package/news/model/Content.ts +74 -0
- package/news/model/Output.d.ts +32 -0
- package/news/model/Output.js +177 -0
- package/news/model/Output.js.map +1 -0
- package/news/model/Output.ts +193 -0
- package/news/model/Progress.d.ts +39 -0
- package/news/model/Progress.js +185 -0
- package/news/model/Progress.js.map +1 -0
- package/news/model/Progress.ts +198 -0
- package/news/model/View.d.ts +18 -0
- package/news/model/View.js +76 -0
- package/news/model/View.js.map +1 -0
- package/news/model/View.ts +77 -0
- package/news/model/index.d.ts +5 -1
- package/news/model/index.js +9 -1
- package/news/model/index.js.map +1 -1
- package/news/model/index.ts +8 -0
- package/news/request/DescribeOutputsRequest.d.ts +33 -0
- package/news/request/DescribeOutputsRequest.js +111 -0
- package/news/request/DescribeOutputsRequest.js.map +1 -0
- package/news/request/DescribeOutputsRequest.ts +118 -0
- package/news/request/DescribeProgressesRequest.d.ts +29 -0
- package/news/request/DescribeProgressesRequest.js +97 -0
- package/news/request/DescribeProgressesRequest.js.map +1 -0
- package/news/request/DescribeProgressesRequest.ts +104 -0
- package/news/request/GetOutputRequest.d.ts +29 -0
- package/news/request/GetOutputRequest.js +97 -0
- package/news/request/GetOutputRequest.js.map +1 -0
- package/news/request/GetOutputRequest.ts +104 -0
- package/news/request/GetProgressRequest.d.ts +25 -0
- package/news/request/GetProgressRequest.js +83 -0
- package/news/request/GetProgressRequest.js.map +1 -0
- package/news/request/GetProgressRequest.ts +90 -0
- package/news/request/index.d.ts +5 -1
- package/news/request/index.js +9 -1
- package/news/request/index.js.map +1 -1
- package/news/request/index.ts +8 -0
- package/news/rest.d.ts +4 -0
- package/news/rest.js +96 -0
- package/news/rest.js.map +1 -1
- package/news/rest.ts +112 -0
- package/news/result/DescribeOutputsResult.d.ts +18 -0
- package/news/result/DescribeOutputsResult.js +67 -0
- package/news/result/DescribeOutputsResult.js.map +1 -0
- package/news/result/DescribeOutputsResult.ts +73 -0
- package/news/result/DescribeProgressesResult.d.ts +18 -0
- package/news/result/DescribeProgressesResult.js +67 -0
- package/news/result/DescribeProgressesResult.js.map +1 -0
- package/news/result/DescribeProgressesResult.ts +73 -0
- package/news/result/GetOutputResult.d.ts +14 -0
- package/news/result/GetOutputResult.js +48 -0
- package/news/result/GetOutputResult.js.map +1 -0
- package/news/result/GetOutputResult.ts +48 -0
- package/news/result/GetProgressResult.d.ts +14 -0
- package/news/result/GetProgressResult.js +48 -0
- package/news/result/GetProgressResult.js.map +1 -0
- package/news/result/GetProgressResult.ts +48 -0
- package/news/result/index.d.ts +5 -1
- package/news/result/index.js +9 -1
- package/news/result/index.js.map +1 -1
- package/news/result/index.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Output.js","sourceRoot":"","sources":["Output.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAGH,IAAM,SAAS,GAAW,4FAA4F,CAAC;AAEvH;IAAA;QACY,aA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AAC,UAAU,CAAC,CAAC;aAC9B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACtB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACtB,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1C,CAAC;IAEM,uBAAM,GAAb;QACI,OAAO;YACH,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE;YAC9B,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;YACtB,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE;SACnC,CAAC;IACN,CAAC;IACL,aAAC;AAAD,CAAC,AA7KD,IA6KC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2016 Game Server Services, Inc. or its affiliates. All Rights
|
|
3
|
+
Reserved.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
6
|
+
You may not use this file except in compliance with the License.
|
|
7
|
+
A copy of the License is located at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
or in the "license" file accompanying this file. This file is distributed
|
|
12
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
13
|
+
express or implied. See the License for the specific language governing
|
|
14
|
+
permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import IModel from '../../core/interface/IModel';
|
|
18
|
+
const grnFormat: string = "grn:gs2:{region}:{ownerId}:news:{namespaceName}:progress:{uploadToken}:output:{outputName}";
|
|
19
|
+
|
|
20
|
+
export default class Output implements IModel {
|
|
21
|
+
private outputId: string|null = null;
|
|
22
|
+
private name: string|null = null;
|
|
23
|
+
private text: string|null = null;
|
|
24
|
+
private createdAt: number|null = null;
|
|
25
|
+
|
|
26
|
+
public static getRegion(grn: string): string|null {
|
|
27
|
+
const match = grn.match(grnFormat
|
|
28
|
+
.replace('{region}', '(.*)')
|
|
29
|
+
.replace('{ownerId}', '.*')
|
|
30
|
+
.replace('{namespaceName}', '.*')
|
|
31
|
+
.replace('{uploadToken}', '.*')
|
|
32
|
+
.replace('{outputName}', '.*')
|
|
33
|
+
);
|
|
34
|
+
if (match) {
|
|
35
|
+
return match[1];
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public static getOwnerId(grn: string): string|null {
|
|
41
|
+
const match = grn.match(grnFormat
|
|
42
|
+
.replace('{region}', '.*')
|
|
43
|
+
.replace('{ownerId}', '(.*)')
|
|
44
|
+
.replace('{namespaceName}', '.*')
|
|
45
|
+
.replace('{uploadToken}', '.*')
|
|
46
|
+
.replace('{outputName}', '.*')
|
|
47
|
+
);
|
|
48
|
+
if (match) {
|
|
49
|
+
return match[1];
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public static getNamespaceName(grn: string): string|null {
|
|
55
|
+
const match = grn.match(grnFormat
|
|
56
|
+
.replace('{region}', '.*')
|
|
57
|
+
.replace('{ownerId}', '.*')
|
|
58
|
+
.replace('{namespaceName}', '(.*)')
|
|
59
|
+
.replace('{uploadToken}', '.*')
|
|
60
|
+
.replace('{outputName}', '.*')
|
|
61
|
+
);
|
|
62
|
+
if (match) {
|
|
63
|
+
return match[1];
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public static getUploadToken(grn: string): string|null {
|
|
69
|
+
const match = grn.match(grnFormat
|
|
70
|
+
.replace('{region}', '.*')
|
|
71
|
+
.replace('{ownerId}', '.*')
|
|
72
|
+
.replace('{namespaceName}', '.*')
|
|
73
|
+
.replace('{uploadToken}', '(.*)')
|
|
74
|
+
.replace('{outputName}', '.*')
|
|
75
|
+
);
|
|
76
|
+
if (match) {
|
|
77
|
+
return match[1];
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public static getOutputName(grn: string): string|null {
|
|
83
|
+
const match = grn.match(grnFormat
|
|
84
|
+
.replace('{region}', '.*')
|
|
85
|
+
.replace('{ownerId}', '.*')
|
|
86
|
+
.replace('{namespaceName}', '.*')
|
|
87
|
+
.replace('{uploadToken}', '.*')
|
|
88
|
+
.replace('{outputName}', '(.*)')
|
|
89
|
+
);
|
|
90
|
+
if (match) {
|
|
91
|
+
return match[1];
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public static isValid(grn: string): boolean {
|
|
97
|
+
if (this.getRegion(grn) == null || this.getRegion(grn) === '') {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (this.getOwnerId(grn) == null || this.getOwnerId(grn) === '') {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (this.getNamespaceName(grn) == null || this.getNamespaceName(grn) === '') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (this.getUploadToken(grn) == null || this.getUploadToken(grn) === '') {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (this.getOutputName(grn) == null || this.getOutputName(grn) === '') {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public static createGrn(
|
|
116
|
+
region: string|null,
|
|
117
|
+
ownerId: string|null,
|
|
118
|
+
namespaceName: string|null,
|
|
119
|
+
uploadToken: string|null,
|
|
120
|
+
outputName: string|null,
|
|
121
|
+
): string|null {
|
|
122
|
+
return grnFormat
|
|
123
|
+
.replace('{region}', region ?? '')
|
|
124
|
+
.replace('{ownerId}', ownerId ?? '')
|
|
125
|
+
.replace('{namespaceName}', namespaceName ?? '')
|
|
126
|
+
.replace('{uploadToken}', uploadToken ?? '')
|
|
127
|
+
.replace('{outputName}', outputName ?? '');
|
|
128
|
+
}
|
|
129
|
+
public getOutputId(): string|null {
|
|
130
|
+
return this.outputId;
|
|
131
|
+
}
|
|
132
|
+
public setOutputId(outputId: string|null) {
|
|
133
|
+
this.outputId = outputId;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
public withOutputId(outputId: string|null): this {
|
|
137
|
+
this.outputId = outputId;
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
public getName(): string|null {
|
|
141
|
+
return this.name;
|
|
142
|
+
}
|
|
143
|
+
public setName(name: string|null) {
|
|
144
|
+
this.name = name;
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
public withName(name: string|null): this {
|
|
148
|
+
this.name = name;
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
public getText(): string|null {
|
|
152
|
+
return this.text;
|
|
153
|
+
}
|
|
154
|
+
public setText(text: string|null) {
|
|
155
|
+
this.text = text;
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
public withText(text: string|null): this {
|
|
159
|
+
this.text = text;
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
public getCreatedAt(): number|null {
|
|
163
|
+
return this.createdAt;
|
|
164
|
+
}
|
|
165
|
+
public setCreatedAt(createdAt: number|null) {
|
|
166
|
+
this.createdAt = createdAt;
|
|
167
|
+
return this;
|
|
168
|
+
}
|
|
169
|
+
public withCreatedAt(createdAt: number|null): this {
|
|
170
|
+
this.createdAt = createdAt;
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public static fromDict(data: {[key: string]: any}): Output|null {
|
|
175
|
+
if (data == undefined || data == null) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
return new Output()
|
|
179
|
+
.withOutputId(data["outputId"])
|
|
180
|
+
.withName(data["name"])
|
|
181
|
+
.withText(data["text"])
|
|
182
|
+
.withCreatedAt(data["createdAt"]);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public toDict(): {[key: string]: any} {
|
|
186
|
+
return {
|
|
187
|
+
"outputId": this.getOutputId(),
|
|
188
|
+
"name": this.getName(),
|
|
189
|
+
"text": this.getText(),
|
|
190
|
+
"createdAt": this.getCreatedAt(),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import IModel from '../../core/interface/IModel';
|
|
2
|
+
export default class Progress implements IModel {
|
|
3
|
+
private progressId;
|
|
4
|
+
private uploadToken;
|
|
5
|
+
private generated;
|
|
6
|
+
private patternCount;
|
|
7
|
+
private createdAt;
|
|
8
|
+
private updatedAt;
|
|
9
|
+
static getRegion(grn: string): string | null;
|
|
10
|
+
static getOwnerId(grn: string): string | null;
|
|
11
|
+
static getNamespaceName(grn: string): string | null;
|
|
12
|
+
static getUploadToken(grn: string): string | null;
|
|
13
|
+
static isValid(grn: string): boolean;
|
|
14
|
+
static createGrn(region: string | null, ownerId: string | null, namespaceName: string | null, uploadToken: string | null): string | null;
|
|
15
|
+
getProgressId(): string | null;
|
|
16
|
+
setProgressId(progressId: string | null): this;
|
|
17
|
+
withProgressId(progressId: string | null): this;
|
|
18
|
+
getUploadToken(): string | null;
|
|
19
|
+
setUploadToken(uploadToken: string | null): this;
|
|
20
|
+
withUploadToken(uploadToken: string | null): this;
|
|
21
|
+
getGenerated(): number | null;
|
|
22
|
+
setGenerated(generated: number | null): this;
|
|
23
|
+
withGenerated(generated: number | null): this;
|
|
24
|
+
getPatternCount(): number | null;
|
|
25
|
+
setPatternCount(patternCount: number | null): this;
|
|
26
|
+
withPatternCount(patternCount: number | null): this;
|
|
27
|
+
getCreatedAt(): number | null;
|
|
28
|
+
setCreatedAt(createdAt: number | null): this;
|
|
29
|
+
withCreatedAt(createdAt: number | null): this;
|
|
30
|
+
getUpdatedAt(): number | null;
|
|
31
|
+
setUpdatedAt(updatedAt: number | null): this;
|
|
32
|
+
withUpdatedAt(updatedAt: number | null): this;
|
|
33
|
+
static fromDict(data: {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}): Progress | null;
|
|
36
|
+
toDict(): {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2016 Game Server Services, Inc. or its affiliates. All Rights
|
|
4
|
+
Reserved.
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
7
|
+
You may not use this file except in compliance with the License.
|
|
8
|
+
A copy of the License is located at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
or in the "license" file accompanying this file. This file is distributed
|
|
13
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
+
express or implied. See the License for the specific language governing
|
|
15
|
+
permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
var grnFormat = "grn:gs2:{region}:{ownerId}:news:{namespaceName}:progress:{uploadToken}";
|
|
19
|
+
var Progress = /** @class */ (function () {
|
|
20
|
+
function Progress() {
|
|
21
|
+
this.progressId = null;
|
|
22
|
+
this.uploadToken = null;
|
|
23
|
+
this.generated = null;
|
|
24
|
+
this.patternCount = null;
|
|
25
|
+
this.createdAt = null;
|
|
26
|
+
this.updatedAt = null;
|
|
27
|
+
}
|
|
28
|
+
Progress.getRegion = function (grn) {
|
|
29
|
+
var match = grn.match(grnFormat
|
|
30
|
+
.replace('{region}', '(.*)')
|
|
31
|
+
.replace('{ownerId}', '.*')
|
|
32
|
+
.replace('{namespaceName}', '.*')
|
|
33
|
+
.replace('{uploadToken}', '.*'));
|
|
34
|
+
if (match) {
|
|
35
|
+
return match[1];
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
Progress.getOwnerId = function (grn) {
|
|
40
|
+
var match = grn.match(grnFormat
|
|
41
|
+
.replace('{region}', '.*')
|
|
42
|
+
.replace('{ownerId}', '(.*)')
|
|
43
|
+
.replace('{namespaceName}', '.*')
|
|
44
|
+
.replace('{uploadToken}', '.*'));
|
|
45
|
+
if (match) {
|
|
46
|
+
return match[1];
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
Progress.getNamespaceName = function (grn) {
|
|
51
|
+
var match = grn.match(grnFormat
|
|
52
|
+
.replace('{region}', '.*')
|
|
53
|
+
.replace('{ownerId}', '.*')
|
|
54
|
+
.replace('{namespaceName}', '(.*)')
|
|
55
|
+
.replace('{uploadToken}', '.*'));
|
|
56
|
+
if (match) {
|
|
57
|
+
return match[1];
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
Progress.getUploadToken = function (grn) {
|
|
62
|
+
var match = grn.match(grnFormat
|
|
63
|
+
.replace('{region}', '.*')
|
|
64
|
+
.replace('{ownerId}', '.*')
|
|
65
|
+
.replace('{namespaceName}', '.*')
|
|
66
|
+
.replace('{uploadToken}', '(.*)'));
|
|
67
|
+
if (match) {
|
|
68
|
+
return match[1];
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
72
|
+
Progress.isValid = function (grn) {
|
|
73
|
+
if (this.getRegion(grn) == null || this.getRegion(grn) === '') {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (this.getOwnerId(grn) == null || this.getOwnerId(grn) === '') {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (this.getNamespaceName(grn) == null || this.getNamespaceName(grn) === '') {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (this.getUploadToken(grn) == null || this.getUploadToken(grn) === '') {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
};
|
|
87
|
+
Progress.createGrn = function (region, ownerId, namespaceName, uploadToken) {
|
|
88
|
+
return grnFormat
|
|
89
|
+
.replace('{region}', region !== null && region !== void 0 ? region : '')
|
|
90
|
+
.replace('{ownerId}', ownerId !== null && ownerId !== void 0 ? ownerId : '')
|
|
91
|
+
.replace('{namespaceName}', namespaceName !== null && namespaceName !== void 0 ? namespaceName : '')
|
|
92
|
+
.replace('{uploadToken}', uploadToken !== null && uploadToken !== void 0 ? uploadToken : '');
|
|
93
|
+
};
|
|
94
|
+
Progress.prototype.getProgressId = function () {
|
|
95
|
+
return this.progressId;
|
|
96
|
+
};
|
|
97
|
+
Progress.prototype.setProgressId = function (progressId) {
|
|
98
|
+
this.progressId = progressId;
|
|
99
|
+
return this;
|
|
100
|
+
};
|
|
101
|
+
Progress.prototype.withProgressId = function (progressId) {
|
|
102
|
+
this.progressId = progressId;
|
|
103
|
+
return this;
|
|
104
|
+
};
|
|
105
|
+
Progress.prototype.getUploadToken = function () {
|
|
106
|
+
return this.uploadToken;
|
|
107
|
+
};
|
|
108
|
+
Progress.prototype.setUploadToken = function (uploadToken) {
|
|
109
|
+
this.uploadToken = uploadToken;
|
|
110
|
+
return this;
|
|
111
|
+
};
|
|
112
|
+
Progress.prototype.withUploadToken = function (uploadToken) {
|
|
113
|
+
this.uploadToken = uploadToken;
|
|
114
|
+
return this;
|
|
115
|
+
};
|
|
116
|
+
Progress.prototype.getGenerated = function () {
|
|
117
|
+
return this.generated;
|
|
118
|
+
};
|
|
119
|
+
Progress.prototype.setGenerated = function (generated) {
|
|
120
|
+
this.generated = generated;
|
|
121
|
+
return this;
|
|
122
|
+
};
|
|
123
|
+
Progress.prototype.withGenerated = function (generated) {
|
|
124
|
+
this.generated = generated;
|
|
125
|
+
return this;
|
|
126
|
+
};
|
|
127
|
+
Progress.prototype.getPatternCount = function () {
|
|
128
|
+
return this.patternCount;
|
|
129
|
+
};
|
|
130
|
+
Progress.prototype.setPatternCount = function (patternCount) {
|
|
131
|
+
this.patternCount = patternCount;
|
|
132
|
+
return this;
|
|
133
|
+
};
|
|
134
|
+
Progress.prototype.withPatternCount = function (patternCount) {
|
|
135
|
+
this.patternCount = patternCount;
|
|
136
|
+
return this;
|
|
137
|
+
};
|
|
138
|
+
Progress.prototype.getCreatedAt = function () {
|
|
139
|
+
return this.createdAt;
|
|
140
|
+
};
|
|
141
|
+
Progress.prototype.setCreatedAt = function (createdAt) {
|
|
142
|
+
this.createdAt = createdAt;
|
|
143
|
+
return this;
|
|
144
|
+
};
|
|
145
|
+
Progress.prototype.withCreatedAt = function (createdAt) {
|
|
146
|
+
this.createdAt = createdAt;
|
|
147
|
+
return this;
|
|
148
|
+
};
|
|
149
|
+
Progress.prototype.getUpdatedAt = function () {
|
|
150
|
+
return this.updatedAt;
|
|
151
|
+
};
|
|
152
|
+
Progress.prototype.setUpdatedAt = function (updatedAt) {
|
|
153
|
+
this.updatedAt = updatedAt;
|
|
154
|
+
return this;
|
|
155
|
+
};
|
|
156
|
+
Progress.prototype.withUpdatedAt = function (updatedAt) {
|
|
157
|
+
this.updatedAt = updatedAt;
|
|
158
|
+
return this;
|
|
159
|
+
};
|
|
160
|
+
Progress.fromDict = function (data) {
|
|
161
|
+
if (data == undefined || data == null) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
return new Progress()
|
|
165
|
+
.withProgressId(data["progressId"])
|
|
166
|
+
.withUploadToken(data["uploadToken"])
|
|
167
|
+
.withGenerated(data["generated"])
|
|
168
|
+
.withPatternCount(data["patternCount"])
|
|
169
|
+
.withCreatedAt(data["createdAt"])
|
|
170
|
+
.withUpdatedAt(data["updatedAt"]);
|
|
171
|
+
};
|
|
172
|
+
Progress.prototype.toDict = function () {
|
|
173
|
+
return {
|
|
174
|
+
"progressId": this.getProgressId(),
|
|
175
|
+
"uploadToken": this.getUploadToken(),
|
|
176
|
+
"generated": this.getGenerated(),
|
|
177
|
+
"patternCount": this.getPatternCount(),
|
|
178
|
+
"createdAt": this.getCreatedAt(),
|
|
179
|
+
"updatedAt": this.getUpdatedAt(),
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
return Progress;
|
|
183
|
+
}());
|
|
184
|
+
exports.default = Progress;
|
|
185
|
+
//# sourceMappingURL=Progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.js","sourceRoot":"","sources":["Progress.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAGH,IAAM,SAAS,GAAW,wEAAwE,CAAC;AAEnG;IAAA;QACY,eAAU,GAAgB,IAAI,CAAC;QAC/B,gBAAW,GAAgB,IAAI,CAAC;QAChC,cAAS,GAAgB,IAAI,CAAC;QAC9B,iBAAY,GAAgB,IAAI,CAAC;QACjC,cAAS,GAAgB,IAAI,CAAC;QAC9B,cAAS,GAAgB,IAAI,CAAC;IA4K1C,CAAC;IA1KiB,kBAAS,GAAvB,UAAwB,GAAW;QAC/B,IAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS;aAC5B,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC;aAC3B,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;aAC1B,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;aAChC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAClC,CAAC;QACF,IAAI,KAAK,EAAE;YACP,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;SACnB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEa,mBAAU,GAAxB,UAAyB,GAAW;QAChC,IAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS;aAC5B,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC;aACzB,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;aAC5B,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;aAChC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAClC,CAAC;QACF,IAAI,KAAK,EAAE;YACP,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;SACnB;QACD,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IAAI,SAAS,IAAI,IAAI,IAAI,IAAI,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,IAAI,QAAQ,EAAE;aAChB,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAClC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACpC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;aAChC,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aACtC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;aAChC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1C,CAAC;IAEM,yBAAM,GAAb;QACI,OAAO;YACH,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE;YAClC,aAAa,EAAE,IAAI,CAAC,cAAc,EAAE;YACpC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE;YAChC,cAAc,EAAE,IAAI,CAAC,eAAe,EAAE;YACtC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE;YAChC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE;SACnC,CAAC;IACN,CAAC;IACL,eAAC;AAAD,CAAC,AAlLD,IAkLC"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2016 Game Server Services, Inc. or its affiliates. All Rights
|
|
3
|
+
Reserved.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
6
|
+
You may not use this file except in compliance with the License.
|
|
7
|
+
A copy of the License is located at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
or in the "license" file accompanying this file. This file is distributed
|
|
12
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
13
|
+
express or implied. See the License for the specific language governing
|
|
14
|
+
permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import IModel from '../../core/interface/IModel';
|
|
18
|
+
const grnFormat: string = "grn:gs2:{region}:{ownerId}:news:{namespaceName}:progress:{uploadToken}";
|
|
19
|
+
|
|
20
|
+
export default class Progress implements IModel {
|
|
21
|
+
private progressId: string|null = null;
|
|
22
|
+
private uploadToken: string|null = null;
|
|
23
|
+
private generated: number|null = null;
|
|
24
|
+
private patternCount: number|null = null;
|
|
25
|
+
private createdAt: number|null = null;
|
|
26
|
+
private updatedAt: number|null = null;
|
|
27
|
+
|
|
28
|
+
public static getRegion(grn: string): string|null {
|
|
29
|
+
const match = grn.match(grnFormat
|
|
30
|
+
.replace('{region}', '(.*)')
|
|
31
|
+
.replace('{ownerId}', '.*')
|
|
32
|
+
.replace('{namespaceName}', '.*')
|
|
33
|
+
.replace('{uploadToken}', '.*')
|
|
34
|
+
);
|
|
35
|
+
if (match) {
|
|
36
|
+
return match[1];
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public static getOwnerId(grn: string): string|null {
|
|
42
|
+
const match = grn.match(grnFormat
|
|
43
|
+
.replace('{region}', '.*')
|
|
44
|
+
.replace('{ownerId}', '(.*)')
|
|
45
|
+
.replace('{namespaceName}', '.*')
|
|
46
|
+
.replace('{uploadToken}', '.*')
|
|
47
|
+
);
|
|
48
|
+
if (match) {
|
|
49
|
+
return match[1];
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public static getNamespaceName(grn: string): string|null {
|
|
55
|
+
const match = grn.match(grnFormat
|
|
56
|
+
.replace('{region}', '.*')
|
|
57
|
+
.replace('{ownerId}', '.*')
|
|
58
|
+
.replace('{namespaceName}', '(.*)')
|
|
59
|
+
.replace('{uploadToken}', '.*')
|
|
60
|
+
);
|
|
61
|
+
if (match) {
|
|
62
|
+
return match[1];
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public static getUploadToken(grn: string): string|null {
|
|
68
|
+
const match = grn.match(grnFormat
|
|
69
|
+
.replace('{region}', '.*')
|
|
70
|
+
.replace('{ownerId}', '.*')
|
|
71
|
+
.replace('{namespaceName}', '.*')
|
|
72
|
+
.replace('{uploadToken}', '(.*)')
|
|
73
|
+
);
|
|
74
|
+
if (match) {
|
|
75
|
+
return match[1];
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public static isValid(grn: string): boolean {
|
|
81
|
+
if (this.getRegion(grn) == null || this.getRegion(grn) === '') {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (this.getOwnerId(grn) == null || this.getOwnerId(grn) === '') {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (this.getNamespaceName(grn) == null || this.getNamespaceName(grn) === '') {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (this.getUploadToken(grn) == null || this.getUploadToken(grn) === '') {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public static createGrn(
|
|
97
|
+
region: string|null,
|
|
98
|
+
ownerId: string|null,
|
|
99
|
+
namespaceName: string|null,
|
|
100
|
+
uploadToken: string|null,
|
|
101
|
+
): string|null {
|
|
102
|
+
return grnFormat
|
|
103
|
+
.replace('{region}', region ?? '')
|
|
104
|
+
.replace('{ownerId}', ownerId ?? '')
|
|
105
|
+
.replace('{namespaceName}', namespaceName ?? '')
|
|
106
|
+
.replace('{uploadToken}', uploadToken ?? '');
|
|
107
|
+
}
|
|
108
|
+
public getProgressId(): string|null {
|
|
109
|
+
return this.progressId;
|
|
110
|
+
}
|
|
111
|
+
public setProgressId(progressId: string|null) {
|
|
112
|
+
this.progressId = progressId;
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
public withProgressId(progressId: string|null): this {
|
|
116
|
+
this.progressId = progressId;
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
public getUploadToken(): string|null {
|
|
120
|
+
return this.uploadToken;
|
|
121
|
+
}
|
|
122
|
+
public setUploadToken(uploadToken: string|null) {
|
|
123
|
+
this.uploadToken = uploadToken;
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
public withUploadToken(uploadToken: string|null): this {
|
|
127
|
+
this.uploadToken = uploadToken;
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
public getGenerated(): number|null {
|
|
131
|
+
return this.generated;
|
|
132
|
+
}
|
|
133
|
+
public setGenerated(generated: number|null) {
|
|
134
|
+
this.generated = generated;
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
public withGenerated(generated: number|null): this {
|
|
138
|
+
this.generated = generated;
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
public getPatternCount(): number|null {
|
|
142
|
+
return this.patternCount;
|
|
143
|
+
}
|
|
144
|
+
public setPatternCount(patternCount: number|null) {
|
|
145
|
+
this.patternCount = patternCount;
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
public withPatternCount(patternCount: number|null): this {
|
|
149
|
+
this.patternCount = patternCount;
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
public getCreatedAt(): number|null {
|
|
153
|
+
return this.createdAt;
|
|
154
|
+
}
|
|
155
|
+
public setCreatedAt(createdAt: number|null) {
|
|
156
|
+
this.createdAt = createdAt;
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
public withCreatedAt(createdAt: number|null): this {
|
|
160
|
+
this.createdAt = createdAt;
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
public getUpdatedAt(): number|null {
|
|
164
|
+
return this.updatedAt;
|
|
165
|
+
}
|
|
166
|
+
public setUpdatedAt(updatedAt: number|null) {
|
|
167
|
+
this.updatedAt = updatedAt;
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
public withUpdatedAt(updatedAt: number|null): this {
|
|
171
|
+
this.updatedAt = updatedAt;
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public static fromDict(data: {[key: string]: any}): Progress|null {
|
|
176
|
+
if (data == undefined || data == null) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
return new Progress()
|
|
180
|
+
.withProgressId(data["progressId"])
|
|
181
|
+
.withUploadToken(data["uploadToken"])
|
|
182
|
+
.withGenerated(data["generated"])
|
|
183
|
+
.withPatternCount(data["patternCount"])
|
|
184
|
+
.withCreatedAt(data["createdAt"])
|
|
185
|
+
.withUpdatedAt(data["updatedAt"]);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
public toDict(): {[key: string]: any} {
|
|
189
|
+
return {
|
|
190
|
+
"progressId": this.getProgressId(),
|
|
191
|
+
"uploadToken": this.getUploadToken(),
|
|
192
|
+
"generated": this.getGenerated(),
|
|
193
|
+
"patternCount": this.getPatternCount(),
|
|
194
|
+
"createdAt": this.getCreatedAt(),
|
|
195
|
+
"updatedAt": this.getUpdatedAt(),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import IModel from '../../core/interface/IModel';
|
|
2
|
+
import Content from './Content';
|
|
3
|
+
export default class View implements IModel {
|
|
4
|
+
private contents;
|
|
5
|
+
private removeContents;
|
|
6
|
+
getContents(): Content[] | null;
|
|
7
|
+
setContents(contents: Content[] | null): this;
|
|
8
|
+
withContents(contents: Content[] | null): this;
|
|
9
|
+
getRemoveContents(): Content[] | null;
|
|
10
|
+
setRemoveContents(removeContents: Content[] | null): this;
|
|
11
|
+
withRemoveContents(removeContents: Content[] | null): this;
|
|
12
|
+
static fromDict(data: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}): View | null;
|
|
15
|
+
toDict(): {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
}
|