Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zunda-pixel/tripadvisor-swift
Tripadvisor API Swift Library
https://github.com/zunda-pixel/tripadvisor-swift
swift tripadvisor
Last synced: 22 days ago
JSON representation
Tripadvisor API Swift Library
- Host: GitHub
- URL: https://github.com/zunda-pixel/tripadvisor-swift
- Owner: zunda-pixel
- License: apache-2.0
- Created: 2024-03-01T14:54:24.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-19T06:28:34.000Z (about 2 months ago)
- Last Synced: 2024-12-02T13:05:37.696Z (about 1 month ago)
- Topics: swift, tripadvisor
- Language: Swift
- Homepage:
- Size: 76.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tripadvisor Kit
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fzunda-pixel%2Ftripadvisor-swift%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/zunda-pixel/tripadvisor-swift)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fzunda-pixel%2Ftripadvisor-swift%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/zunda-pixel/tripadvisor-swift)Tripadvisor Kit for [Tripadivisor API](https://tripadvisor-content-api.readme.io)
## Search Locations
```swift
import TripadvisorKitlet api = TripadvisorAPI(apiKey: "API_KEY")
let query = "Location Name"
let locations = try await api.searchLocations(query: query)
print(locations)
``````shell
[
Location(
id: 13331376,
name: "Apple Park Visitor Center",
description: nil,
webURL: nil,
address: Address(
street1: "10600 N Tantau Ave",
street2: nil,
city: "Cupertino",
state: "California",
country: "United States",
postalCode: "95014-0739",
addressString: "10600 N Tantau Ave, Cupertino, CA 95014-0739"
),
ancestors: nil,,,
),
]
```## Search Near Locations
```swift
let point = Location.Point(latitude: 35.652832, longitude: 139.839478)
let locations = try await api.searchNearLocations(point: point)
```## Get Location Review
```swift
let locationId: Location.ID = "13331376"
let reviews = try await api.locationReviews(id: locationId)
```## Get Loaction Photos
```swift
let locationId: Location.ID = "13331376"
let photos = try await api.locationPhotos(id: locationId)
```## Get Loaction Detail
```swift
let locationId: Location.ID = "13331376"
let location = try await api.locationDetail(id: locationId)
```