Files
youzan-datahub/docs/餐饮零售数据中台/有赞接口/0.sdk.txt

99 lines
3.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-对于Java包更推荐使用Maven工具安装管理。
参照以下代码示例更新最新版本在Maven中直接引用即可并且请在settings.xml中引入有赞云maven仓库。
<dependency>
<groupId>com.youzan.cloud</groupId>
<artifactId>open-sdk-core</artifactId>
<version>1.0.28-RELEASE</version>
</dependency>
<dependency>
<groupId>com.youzan.cloud</groupId>
<artifactId>open-sdk-gen</artifactId>
<version>1.0.22.80701202109281055-RELEASE</version>
</dependency>
<mirrors>
<mirror>
<id>youzan-nexus-snapshot</id>
<name>Maven Repository Mirror running on maven.youzanyun.com</name>
<url>http://maven.youzanyun.com/repository/maven-public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>dev</id>
<repositories>
<repository>
<id>public</id>
<name>public repository</name>
<url>https://maven.youzanyun.com/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>public repository</name>
<url>https://maven.youzanyun.com/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
【说明】
-SDK使用的是OkHttp3已经暴露了对应的配置方法可自行根据业务进行配置参考如下示例。
OkHttpClient.Builder builder = new OkHttpClient.Builder().readTimeout(5, TimeUnit.HOURS);
HttpConfig httpConfig = HttpConfig.builder().OkHttpClientBuilder(builder).build();
YouZanClient youZanClient = new DefaultYZClient(httpConfig);
-Java open SDK依赖包引入示例如下。
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.54</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.15.0</version>
</dependency>