 
         var components = URLComponents()
 
-        components.path = addStorefront(urlString: AppleMusicApi.searchPath)
+        components.path = AppleMusicApi.searchPath.addStorefront(storefront)
 
         // Construct query items
 

            components.queryItems = [query]
        }

        components.path = addStorefront(urlString: fetchPath).replacingOccurrences(of: "{id}", with: id)

        return components.url(relativeTo: baseApiUrl)!.absoluteURL
    }

    private func addStorefront(urlString: String) -> String {
        return urlString.replacingOccurrences(of: "{storefront}", with: storefront.rawValue)
    }

    // MARK: Construct requests


private extension String {
    func replaceSpacesWithPluses() -> String {
        return replacingOccurrences(of: " ", with: "+")
    }

    func addStorefront(_ storefront: Storefront) -> String {
        return replacingOccurrences(of: "{storefront}", with: storefront.rawValue)
    }

    func addId(_ id: String) -> String {
        return replacingOccurrences(of: "{id}", with: id)
    }

    func addMediaType(_ mediaType: MediaType) -> String {
        return replacingOccurrences(of: "{mediaType}", with: mediaType.rawValue)
    }
}
