Skip to content

Commit

Permalink
change const name
Browse files Browse the repository at this point in the history
  • Loading branch information
fajarlubis committed Dec 22, 2023
1 parent a3fa7ef commit 34e99fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion affected_earthquake.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import (
"time"
)

// TODO add exponential backoff algorithm

func AffectedEarthQuake() ([]*EarthQuakeData, error) {
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/TEWS/gempadirasakan.json", BMKG_URL), nil)
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/gempadirasakan.json", _BMKG), nil)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion const.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gempago

const (
BMKG_URL = "https://data.bmkg.go.id/DataMKG"
_BMKG = "https://data.bmkg.go.id/DataMKG/TEWS"
_USGS = ""
)
4 changes: 2 additions & 2 deletions latest_earthquake.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func LatestEarthQuake() (*EarthQuakeData, error) {
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/TEWS/autogempa.json", BMKG_URL), nil)
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/autogempa.json", _BMKG), nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func LatestEarthQuake() (*EarthQuakeData, error) {
earthQuakeData.Potential = data.InfoGempa.Gempa.Potensi
earthQuakeData.AffectedRegion = data.InfoGempa.Gempa.Dirasakan

earthQuakeData.Shakemap = fmt.Sprintf("%s/TEWS/%s", BMKG_URL, data.InfoGempa.Gempa.Shakemap)
earthQuakeData.Shakemap = fmt.Sprintf("%s/%s", _BMKG, data.InfoGempa.Gempa.Shakemap)

return &earthQuakeData, nil
}
2 changes: 1 addition & 1 deletion recents_earthquake.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func RecentsEarthQuake() ([]*EarthQuakeData, error) {
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/TEWS/gempaterkini.json", BMKG_URL), nil)
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/gempaterkini.json", _BMKG), nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 34e99fc

Please sign in to comment.