1.1.3 • Published 5 months ago

pxsty.earthquakes v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

pxsty.earthquakes

pxsty.earthquakes, AFAD (Afet ve Acil Durum Yönetimi Başkanlığı) web sitesinden son depremleri çekmek için geliştirilmiş bir Node.js kütüphanesidir.

Kütüphaneyi, depremin 2. yılını anarken yeniliyorum. Vefat eden herkese Allah'tan rahmet, yaralanan herkese şifalar diliyorum. Ülkemiz için böyle acı dolu anların bir daha yaşanmaması dileğiyle.

Kurulum

npm install pxsty.earthquakes

veya

yarn add pxsty.earthquakes

Kullanım

TypeScript Örneği

import EarthquakeAPI from "pxsty.earthquakes";

const fetchEarthquakes = async () => {
  const response = await EarthquakeAPI.getAllEarthquakes();
  if (response.type === "SUCCESS") {
    console.log("Depremler:", response.data);
  } else {
    console.error("Veri çekme hatası!");
  }
};

fetchEarthquakes();

JavaScript Örneği

const EarthquakeAPI = require("pxsty.earthquakes").default;

async function fetchEarthquakes() {
  const response = await EarthquakeAPI.getAllEarthquakes();
  if (response.type === "SUCCESS") {
    console.log("Depremler:", response.data);
  } else {
    console.error("Veri çekme hatası!");
  }
}

fetchEarthquakes();

Dönen Veri Formatı

Başarılı bir istek aşağıdaki formatta bir dizi deprem verisi döndürür:

{
  "type": "SUCCESS",
  "data": [
    {
      "date": "2024-02-06 12:34:56",
      "latitude": 38.9637,
      "longitude": 35.2433,
      "depth": 10.2,
      "type": "ML",
      "size": 4.5,
      "place": "Ankara, Türkiye"
    }
  ]
}

Eğer hata oluşursa:

{
  "type": "ERROR",
  "data": []
}

Desteklenen Magnitüd Türleri

  • ML: Yerel magnitüd
  • MW: Moment magnitüdü

Lisans

MIT Lisansı altında sunulmaktadır.

1.1.1

5 months ago

1.1.0

5 months ago

1.1.3

5 months ago

1.1.2

5 months ago

0.0.3

2 years ago

0.0.2

2 years ago

1.0.0

2 years ago