类 AstroCloudClient
java.lang.Object
com.apiworks.astro.AstroCloudClient
- 所有已实现的接口:
AutoCloseable
Java 版 ApiWorks 星盘 API 客户端(同步)。
封装了星盘服务的所有 HTTP 接口:
- 所有请求都会携带头部
X-App-Id、X-App-Key - 基础网关默认为
DEFAULT_BASE_URL - 所有方法返回
ApiResp<T>,其中code=0表示成功
- chart:全部
/chart/*端点,如本命盘、行运盘、三限、次限等 - sign:
/mySign、/signs、/signs/{id}、/signs/{id}/compat - scope:日/周/月/年运势
/scope/day|week|month|year - event:行运事件
/event/transit - bazi:八字命盘/流盘/合盘/总结
/bazi/natal|flow|match|summary - ziwei:紫微命盘/运限/解读
/ziwei/natal|chart|detail - naks:星宿关系
/naks/relations - report:桃花/周运/年运/合盘/财运报告
/report/*
com.apiworks.astro.model.requests.*、
com.apiworks.astro.model.responses.* 包中按需扩展。
使用完毕后可调用 close() 关闭内部线程池,避免进程退出时出现线程未结束的 warning
(例如通过 mvn exec:java 运行示例时)。长期运行的应用可复用同一客户端,不必每次关闭。
-
字段概要
字段 -
构造器概要
构造器构造器说明AstroCloudClient(String appId, String appKey) AstroCloudClient(String appId, String appKey, String baseUrl, long timeoutMillis) -
方法概要
修饰符和类型方法说明baziFlow(BaziFlowQry qry) POST/bazi/flow- 八字流盘(带目标日期)。baziMatch(BaziMatchQry qry) POST/bazi/match- 八字合盘(两个人)。baziNatal(BaziNatalQry qry) POST/bazi/natal- 八字命盘。baziSummary(BaziNatalQry qry) POST/bazi/summary- 八字总结。POST/chart/comparison- 比较盘。POST/chart/composeSecLimit- 组合次限盘。POST/chart/composeTripleLimit- 组合三限盘。POST/chart/composite- 组合盘。POST/chart/current- 当前天象盘。POST/chart/firdaria- 法达盘(Firdaria)。POST/chart/lunarReturn- 月回归盘。chartMarks(DoublePointQry qry) POST/chart/marks- Marks(马科)盘。POST/chart/marksSecLimit- 马科次限盘。POST/chart/marksTripleLimit- 马科三限盘。chartNatal(SinglePointQry qry) POST/chart/natal- 本命盘。POST/chart/secondaryLimit- 次限盘(Secondary progression)。POST/chart/smallLimit- 小限盘。POST/chart/solarArc- 日弧盘(Solar arc)。POST/chart/solarReturn- 日回归盘(太阳回归)。POST/chart/timesMidPoint- 中点盘。POST/chart/tmpSecLimit- 临时次限盘。POST/chart/tmpTripleLimit- 临时三限盘。POST/chart/transit- 行运盘。POST/chart/tripleLimit- 三限盘。voidclose()关闭客户端占用的线程池与连接池,避免进程退出时 OkHttp 线程未结束的 warning。eventTransit(ScopeQryReq qry) POST/event/transit- 行运事件列表。POST/mySign/{uid}- 用户星座(包含简要运势)。naksRelations(NaksQry qry) POST/naks/relations- 星宿关系(本命 / 值日 / 与他人的关系)。GET/report/{uid}/{serialNo}- 获取报告 JSON 内容。byte[]reportGetHtml(String uid, String serialNo) GET/report/{uid}/{serialNo}/html- 获取报告 HTML 内容(字节数组)。reportRomantic(RomanticCreateQry romanticCreateQry) POST/report/romantic- 桃花报告(恋爱/吸引力)。POST/report/together- 合盘报告。POST/report/wealth- 财运报告。POST/report/weeklyScope- 周运报告。POST/report/yearlyScope- 年运报告。scopeDay(String uid, ScopeQryReq qry) POST/scope/day/{uid}- 日运势。scopeMonth(String uid, ScopeQryReq qry) POST/scope/month/{uid}- 月运势。scopeWeek(String uid, ScopeQryReq qry) POST/scope/week/{uid}- 周运势。scopeYear(String uid, ScopeQryReq qry) POST/scope/year/{uid}- 年运势。signCompat(String signId) GET/signs/{signId}/compat- 星座配对关系。GET/signs/{signId}- 星座详情。GET/signs- 星座列表。ziweiChart(ZiweiQry qry) POST/ziwei/chart- 紫微运限盘(带流年/流月等)。ziweiDetail(ZiweiQry qry) POST/ziwei/detail- 紫微运限 + 解读。ziweiNatal(ZiweiNatalQry qry) POST/ziwei/natal- 紫微本命盘。
-
字段详细资料
-
DEFAULT_BASE_URL
- 另请参阅:
-
-
构造器详细资料
-
AstroCloudClient
-
AstroCloudClient
-
-
方法详细资料
-
close
public void close()关闭客户端占用的线程池与连接池,避免进程退出时 OkHttp 线程未结束的 warning。 调用后本客户端不可再使用。- 指定者:
close在接口中AutoCloseable
-
chartNatal
POST/chart/natal- 本命盘。- 参数:
qry- 单点星盘查询参数(出生时间 + 地理位置等)- 返回:
- 本命盘数据封装在
ApiResp<AstroDataVo>中 - 抛出:
IOException- 网络或反序列化异常
-
chartCurrent
POST/chart/current- 当前天象盘。 用于计算当前时间/地点的行星位置。- 抛出:
IOException
-
chartTransit
POST/chart/transit- 行运盘。 使用出生点 + 行运点两组时间地点。- 抛出:
IOException
-
chartComparison
POST/chart/comparison- 比较盘。- 抛出:
IOException
-
chartComposite
POST/chart/composite- 组合盘。- 抛出:
IOException
-
chartTimesMidPoint
POST/chart/timesMidPoint- 中点盘。- 抛出:
IOException
-
chartMarks
POST/chart/marks- Marks(马科)盘。- 抛出:
IOException
-
chartLunarReturn
POST/chart/lunarReturn- 月回归盘。- 抛出:
IOException
-
chartSolarReturn
POST/chart/solarReturn- 日回归盘(太阳回归)。- 抛出:
IOException
-
chartTripleLimit
POST/chart/tripleLimit- 三限盘。 单点 + 行运日期。- 抛出:
IOException
-
chartSecondaryLimit
POST/chart/secondaryLimit- 次限盘(Secondary progression)。- 抛出:
IOException
-
chartFirdaria
POST/chart/firdaria- 法达盘(Firdaria)。- 抛出:
IOException
-
chartSmallLimit
POST/chart/smallLimit- 小限盘。- 抛出:
IOException
-
chartSolarArc
POST/chart/solarArc- 日弧盘(Solar arc)。- 抛出:
IOException
-
chartComposeTripleLimit
POST/chart/composeTripleLimit- 组合三限盘。- 抛出:
IOException
-
chartComposeSecLimit
POST/chart/composeSecLimit- 组合次限盘。- 抛出:
IOException
-
chartMarksTripleLimit
POST/chart/marksTripleLimit- 马科三限盘。- 抛出:
IOException
-
chartMarksSecLimit
POST/chart/marksSecLimit- 马科次限盘。- 抛出:
IOException
-
chartTmpTripleLimit
POST/chart/tmpTripleLimit- 临时三限盘。- 抛出:
IOException
-
chartTmpSecLimit
POST/chart/tmpSecLimit- 临时次限盘。- 抛出:
IOException
-
scopeDay
POST/scope/day/{uid}- 日运势。- 参数:
uid- 业务方用户 ID(用于个性化缓存与透传)- 抛出:
IOException
-
scopeWeek
POST/scope/week/{uid}- 周运势。- 抛出:
IOException
-
scopeMonth
POST/scope/month/{uid}- 月运势。- 抛出:
IOException
-
scopeYear
POST/scope/year/{uid}- 年运势。- 抛出:
IOException
-
eventTransit
POST/event/transit- 行运事件列表。- 抛出:
IOException
-
mySign
POST/mySign/{uid}- 用户星座(包含简要运势)。- 抛出:
IOException
-
signsList
GET/signs- 星座列表。- 抛出:
IOException
-
signInfo
GET/signs/{signId}- 星座详情。- 抛出:
IOException
-
signCompat
GET/signs/{signId}/compat- 星座配对关系。- 抛出:
IOException
-
baziNatal
POST/bazi/natal- 八字命盘。- 抛出:
IOException
-
baziFlow
POST/bazi/flow- 八字流盘(带目标日期)。- 抛出:
IOException
-
baziMatch
POST/bazi/match- 八字合盘(两个人)。- 抛出:
IOException
-
baziSummary
POST/bazi/summary- 八字总结。- 抛出:
IOException
-
ziweiNatal
POST/ziwei/natal- 紫微本命盘。- 抛出:
IOException
-
ziweiChart
POST/ziwei/chart- 紫微运限盘(带流年/流月等)。- 抛出:
IOException
-
ziweiDetail
POST/ziwei/detail- 紫微运限 + 解读。- 抛出:
IOException
-
naksRelations
POST/naks/relations- 星宿关系(本命 / 值日 / 与他人的关系)。- 抛出:
IOException
-
reportRomantic
public ApiResp<AstroReportVo> reportRomantic(RomanticCreateQry romanticCreateQry) throws IOException POST/report/romantic- 桃花报告(恋爱/吸引力)。创建报告任务并返回流水号。- 抛出:
IOException
-
reportWeeklyScope
POST/report/weeklyScope- 周运报告。- 抛出:
IOException
-
reportYearlyScope
POST/report/yearlyScope- 年运报告。- 抛出:
IOException
-
reportTogether
POST/report/together- 合盘报告。- 抛出:
IOException
-
reportWealth
POST/report/wealth- 财运报告。- 抛出:
IOException
-
reportGet
GET/report/{uid}/{serialNo}- 获取报告 JSON 内容。- 抛出:
IOException
-
reportGetHtml
GET/report/{uid}/{serialNo}/html- 获取报告 HTML 内容(字节数组)。- 抛出:
IOException
-