Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track download wrong url #21

Closed
stact opened this issue Dec 27, 2023 · 2 comments · Fixed by #22
Closed

Track download wrong url #21

stact opened this issue Dec 27, 2023 · 2 comments · Fixed by #22

Comments

@stact
Copy link

stact commented Dec 27, 2023

Related to the guidelines about tracking downloads it must call a specific endpoint.

https://help.unsplash.com/en/articles/2511245-unsplash-api-guidelines

What we have:
Screenshot 2023-12-27 at 20 42 28

Related to the guideline:

{
  "id": "LBI7cgq3pbM",
  "width": 5245,
  "height": 3497,
  "color": "#60544D",
  "urls": { ... },
  "user": { ... },
  "links": {
    "self": "https://api.unsplash.com/photos/LBI7cgq3pbM",
    "html": "https://unsplash.com/photos/LBI7cgq3pbM",
    "download": "https://unsplash.com/photos/LBI7cgq3pbM/download", // don't use this property
    "download_location": "https://api.unsplash.com/photos/LBI7cgq3pbM/download?ixid=MnwxMTc4ODl8MHwxfHNlYXJjaHwxfHxwdXBweXxlbnwwfHx8fDE2MTc3NTA2MTM" // use this one ;)
  }
}

Maybe instead of String id, we need to have String download_location

Temporary fix:

Request<TrackPhotoDownload> download(String downloadLocation) {
  final url = Uri.parse(downloadLocation);

  return Request(
    client: _client,
    httpRequest: http.Request('GET', url),
    isPublicAction: true,
    bodyDeserializer: (dynamic json) => TrackPhotoDownload.fromJson(json as Map<String, dynamic>),
  );
}
@blaugold blaugold linked a pull request Jan 2, 2024 that will close this issue
@blaugold
Copy link
Owner

blaugold commented Jan 2, 2024

Thanks for reporting this!

@blaugold
Copy link
Owner

blaugold commented Jan 2, 2024

Version 2.2.0 with support for passing location to Photos.download has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants