Skip to content

Commit ad1eab7

Browse files
authored
Add shop.yml, module.yml support (#986)
1 parent e907af0 commit ad1eab7

File tree

11 files changed

+253
-5
lines changed

11 files changed

+253
-5
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2023 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
plugins {
18+
id("sdk.openapi")
19+
id("sdk.publish")
20+
}
21+
22+
openApiGenerate {
23+
inputSpec.set("$rootDir/line-openapi/module.yml")
24+
apiPackage.set("com.linecorp.bot.module.client")
25+
modelPackage.set("com.linecorp.bot.module.model")
26+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2023 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
package com.linecorp.bot.module.client;
18+
19+
import com.linecorp.bot.client.base.exception.AbstractLineClientException;
20+
21+
import okhttp3.Response;
22+
23+
/**
24+
* An API call exception for module API.
25+
*/
26+
@SuppressWarnings("serial")
27+
public class LineModuleClientException extends AbstractLineClientException {
28+
public LineModuleClientException(Response response) {
29+
super(response, "An error occurred.");
30+
}
31+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2023 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
package com.linecorp.bot.module.client;
18+
19+
import java.io.IOException;
20+
21+
import com.linecorp.bot.client.base.AbstractExceptionBuilder;
22+
23+
import okhttp3.Response;
24+
25+
public class LineModuleExceptionBuilder extends AbstractExceptionBuilder<Object> {
26+
public LineModuleExceptionBuilder() {
27+
super(Object.class);
28+
}
29+
30+
@Override
31+
protected IOException buildException(Response response, Object errorBody) {
32+
return new LineModuleClientException(response);
33+
}
34+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<configuration>
2+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
3+
<encoder>
4+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
5+
</encoder>
6+
</appender>
7+
8+
<root level="info">
9+
<appender-ref ref="STDOUT" />
10+
</root>
11+
</configuration>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2023 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
plugins {
18+
id("sdk.openapi")
19+
id("sdk.publish")
20+
}
21+
22+
openApiGenerate {
23+
inputSpec.set("$rootDir/line-openapi/shop.yml")
24+
apiPackage.set("com.linecorp.bot.shop.client")
25+
modelPackage.set("com.linecorp.bot.shop.model")
26+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2023 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
package com.linecorp.bot.shop.client;
18+
19+
import com.linecorp.bot.client.base.exception.AbstractLineClientException;
20+
21+
import okhttp3.Response;
22+
23+
/**
24+
* An API call exception for shop API.
25+
*/
26+
@SuppressWarnings("serial")
27+
public class ShopClientException extends AbstractLineClientException {
28+
/**
29+
* An error summary.
30+
*/
31+
private final String error;
32+
33+
public ShopClientException(Response response, String error) {
34+
super(response, "error='" + error);
35+
this.error = error;
36+
}
37+
38+
public String getError() {
39+
return error;
40+
}
41+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2023 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
package com.linecorp.bot.shop.client;
18+
19+
import java.io.IOException;
20+
21+
import com.linecorp.bot.client.base.AbstractExceptionBuilder;
22+
import com.linecorp.bot.shop.model.ErrorResponse;
23+
24+
import okhttp3.Response;
25+
26+
public class ShopExceptionBuilder extends AbstractExceptionBuilder<ErrorResponse> {
27+
public ShopExceptionBuilder() {
28+
super(ErrorResponse.class);
29+
}
30+
31+
@Override
32+
protected IOException buildException(Response response, ErrorResponse errorBody) {
33+
return new ShopClientException(response, errorBody.message());
34+
}
35+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<configuration>
2+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
3+
<encoder>
4+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
5+
</encoder>
6+
</appender>
7+
8+
<root level="info">
9+
<appender-ref ref="STDOUT" />
10+
</root>
11+
</configuration>

settings.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ dependencyResolutionManagement {
3939
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
4040

4141
// core components
42-
include("line-bot-parser")
4342
include("line-bot-jackson")
43+
include("line-bot-parser")
4444

4545
// openapi based webhook
4646
include("line-bot-webhook")
@@ -51,6 +51,8 @@ include("clients:line-bot-insight-client")
5151
include("clients:line-bot-manage-audience-client")
5252
include("clients:line-bot-messaging-api-client")
5353
include("clients:line-bot-module-attach-client")
54+
include("clients:line-bot-module-client")
55+
include("clients:line-bot-shop-client")
5456
include("clients:line-channel-access-token-client")
5557
include("clients:line-liff-client")
5658

@@ -61,10 +63,10 @@ include("spring-boot:line-bot-spring-boot-web")
6163
include("spring-boot:line-bot-spring-boot-webmvc")
6264

6365
// samples
66+
include("samples:sample-manage-audience")
6467
include("samples:sample-spring-boot-echo")
6568
include("samples:sample-spring-boot-echo-kotlin")
6669
include("samples:sample-spring-boot-kitchensink")
67-
include("samples:sample-manage-audience")
6870

6971
// integration test
7072
include("line-bot-integration-test")

spring-boot/line-bot-spring-boot-client/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ dependencies {
2424
annotationProcessor(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
2525

2626
api(project(":clients:line-bot-client-base"))
27-
api(project(":clients:line-liff-client"))
2827
api(project(":clients:line-bot-insight-client"))
29-
api(project(":clients:line-channel-access-token-client"))
3028
api(project(":clients:line-bot-manage-audience-client"))
3129
api(project(":clients:line-bot-messaging-api-client"))
3230
api(project(":clients:line-bot-module-attach-client"))
33-
api(project(":clients:line-bot-client-base"))
31+
api(project(":clients:line-bot-module-client"))
32+
api(project(":clients:line-bot-shop-client"))
33+
api(project(":clients:line-channel-access-token-client"))
34+
api(project(":clients:line-liff-client"))
3435

3536
implementation("org.springframework.boot:spring-boot-autoconfigure")
3637
implementation("org.springframework.boot:spring-boot-starter")

0 commit comments

Comments
 (0)