FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
astro-api-java-client/src/App.java at master · astrologyapi/astro-api-java-client · GitHub
astrologyapi
/
astro-api-java-client
Public
Notifications
You must be signed in to change notification settings
Fork
6
Star
2
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
astro-api-java-client
/
src
/
App.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (47 loc) · 1.78 KB
Breadcrumbs
astro-api-java-client
/
src
/
App.java
Copy path
File metadata and controls
58 lines (47 loc) · 1.78 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// App.java
import
java
.
util
.
HashMap
;
import
java
.
util
.
Map
;
import
com
.
fasterxml
.
jackson
.
databind
.
JsonNode
;
// from Jackson
// If not in a package, no 'package' declaration is needed.
public
class
App
{
public
static
void
main
(
String
[]
args
) {
// Example usage:
String
userID
=
System
.
getenv
(
"ASTROLOGY_API_USER_ID"
);
String
apiKey
=
System
.
getenv
(
"ASTROLOGY_API_KEY"
);
AstrologyAPIClient
client
=
new
AstrologyAPIClient
(
userID
,
apiKey
);
String
zodiacName
=
"aries"
;
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"timezone"
,
5.5
);
JsonNode
response
=
client
.
customCall
(
"sun_sign_prediction/daily/"
+
zodiacName
,
data
,
"json"
);
if
(
response
!=
null
) {
System
.
out
.
println
(
"Response:
\n
"
+
response
.
toPrettyString
());
}
else
{
System
.
err
.
println
(
"Failed to retrieve data."
);
}
// Example usage for PDF:
Map
<
String
,
Object
>
pdfData
=
new
HashMap
<>();
pdfData
.
put
(
"name"
,
"Your Name"
);
pdfData
.
put
(
"day"
,
8
);
pdfData
.
put
(
"month"
,
12
);
pdfData
.
put
(
"year"
,
2023
);
pdfData
.
put
(
"hour"
,
5
);
pdfData
.
put
(
"minute"
,
30
);
pdfData
.
put
(
"latitude"
,
12.34
);
pdfData
.
put
(
"longitude"
,
56.78
);
pdfData
.
put
(
"timezone"
,
5.5
);
pdfData
.
put
(
"language"
,
"en"
);
JsonNode
pdfResponse
=
client
.
customCallPdf
(
"premium_kundli_report"
,
pdfData
);
if
(
pdfResponse
!=
null
) {
System
.
out
.
println
(
"PDF Response:
\n
"
+
pdfResponse
.
toPrettyString
());
}
else
{
System
.
err
.
println
(
"Failed to retrieve PDF data."
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL