Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 891 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 891 Bytes

World Time Wrapper

This is a simple wrapper for the World Time API. This crate is based on the WorldTimeAPI wrapper by Dulatr.

Installation

You can integrate AnsiStyle into your project using Swift Package Manager (SPM). Simply add it as a dependency in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/martial-plains/worldtimeapi-rs.git", branch: "main")
]

Example

import WorldTimeAPI

@main
struct Main {
  static func main() async {
    do {
      let client = try await Client(endpoint: .timezone)
      let requests = ["area": "America", "location": "New_York"]

      // Returns DateTimeJson
      let response = try await client.get(payload: requests)

      print(response)

    } catch {
      print(error.localizedDescription)
    }

  }
}