3 个版本
0.1.3 | 2023 年 6 月 22 日 |
---|---|
0.1.2 | 2023 年 6 月 22 日 |
0.1.1 | 2023 年 2 月 5 日 |
#2124 in 网页开发
每月 23 次下载
43KB
661 行
yelp-fusion-rs
Yelp Fusion API 的 Rust 库。
功能
示例
根据自定义标准搜索企业!
YELP_FUSION_API_KEY=<api_key>cargo run--示例企业搜索
#[tokio::main]
async fn main() -> Result<(), Error> {
let yelp_fusion_api_key = env::var("YELP_FUSION_API_KEY").expect("no Yelp Fusion API key");
let yelp_fusion_client: YelpFusion = YelpFusion::new(yelp_fusion_api_key, None);
let business_search_payload: BusinessSearchPayload = BusinessSearchPayload::builder()
.coordinates(Coordinates::new(37.772_484, -122.396_68))
.radius(1609)
.categories(vec![String::from("mexican"), String::from("sandwiches")])
.limit(50)
.price(HashSet::from([
PriceType::OneDollar,
PriceType::TwoDollar,
PriceType::ThreeDollar,
PriceType::FourDollar,
]))
.open_now(false)
.build()
.unwrap();
let business_search_response: BusinessSearchResponse = yelp_fusion_client
.business_search(business_search_payload)
.await?;
println!(
"{}",
serde_json::to_string(&business_search_response).unwrap()
);
Ok(())
}
更多示例,请查看 示例目录。
开发者
使用:Rust 1.65
构建。
项目正在积极维护 - 即使没有最近的提交!如果需要更新库,请提交问题/错误请求!
功能请求
实现其余功能:企业、事件、分类端点
目前,我只使用了 Yelp Fusion API 的企业搜索端点,因此我没有优先开发其他企业、事件和分类端点。
我完全打算实现所有这些功能,以便这个库能够执行 Yelp Fusion API 所允许的所有操作。
如果您对任何这些端点有迫切需求,请通过 Github 上的问题向我发起 ping,我会知道优先处理这项工作。如果您非常勇敢并且/或真的需要实现这些端点,请发送 pull request :)
命令
makelint
- 通过
cargo fmt
对代码库进行 lint。
- 通过
maketest
- 通过
cargofmt
cargocheck
cargo clippy
(具有极端严格的默认值)cargotest
.
- 通过
致谢
由 Todd Everett Griffin 使用 🤬 和 🥲 制作。
yelp-fusion-rs
采用 MIT 许可协议开源。
依赖项
~6–18MB
~269K SLoC