mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Add media=software
query item to lookup URL to improve results.
Reorder query items for both lookup URLs & search URLs. Partial #561 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
6c5a277ad9
commit
280b38dfe8
2 changed files with 7 additions and 4 deletions
|
@ -40,13 +40,14 @@ extension StoreSearch {
|
||||||
components.queryItems = [
|
components.queryItems = [
|
||||||
URLQueryItem(name: "media", value: "software"),
|
URLQueryItem(name: "media", value: "software"),
|
||||||
URLQueryItem(name: "entity", value: entity.rawValue),
|
URLQueryItem(name: "entity", value: entity.rawValue),
|
||||||
URLQueryItem(name: "term", value: appName),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if let country {
|
if let country {
|
||||||
components.queryItems!.append(URLQueryItem(name: "country", value: country))
|
components.queryItems!.append(URLQueryItem(name: "country", value: country))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
components.queryItems!.append(URLQueryItem(name: "term", value: appName))
|
||||||
|
|
||||||
return components.url
|
return components.url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ extension StoreSearch {
|
||||||
}
|
}
|
||||||
|
|
||||||
components.queryItems = [
|
components.queryItems = [
|
||||||
URLQueryItem(name: "id", value: "\(appID)"),
|
URLQueryItem(name: "media", value: "software"),
|
||||||
URLQueryItem(name: "entity", value: "desktopSoftware"),
|
URLQueryItem(name: "entity", value: "desktopSoftware"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -68,6 +69,8 @@ extension StoreSearch {
|
||||||
components.queryItems!.append(URLQueryItem(name: "country", value: country))
|
components.queryItems!.append(URLQueryItem(name: "country", value: country))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
components.queryItems!.append(URLQueryItem(name: "id", value: "\(appID)"))
|
||||||
|
|
||||||
return components.url
|
return components.url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,13 @@ public class MasStoreSearchSpec: QuickSpec {
|
||||||
expect {
|
expect {
|
||||||
MasStoreSearch().searchURL(for: "myapp", inCountry: "US")?.absoluteString
|
MasStoreSearch().searchURL(for: "myapp", inCountry: "US")?.absoluteString
|
||||||
}
|
}
|
||||||
== "https://itunes.apple.com/search?media=software&entity=desktopSoftware&term=myapp&country=US"
|
== "https://itunes.apple.com/search?media=software&entity=desktopSoftware&country=US&term=myapp"
|
||||||
}
|
}
|
||||||
it("contains the encoded app name") {
|
it("contains the encoded app name") {
|
||||||
expect {
|
expect {
|
||||||
MasStoreSearch().searchURL(for: "My App", inCountry: "US")?.absoluteString
|
MasStoreSearch().searchURL(for: "My App", inCountry: "US")?.absoluteString
|
||||||
}
|
}
|
||||||
== "https://itunes.apple.com/search?media=software&entity=desktopSoftware&term=My%20App&country=US"
|
== "https://itunes.apple.com/search?media=software&entity=desktopSoftware&country=US&term=My%20App"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
describe("store") {
|
describe("store") {
|
||||||
|
|
Loading…
Reference in a new issue