Skip to content

Commit ddbe61b

Browse files
committed
Implement getArchiveLink
1 parent 7a4fc11 commit ddbe61b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/src/common/repos_service.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,15 @@ class RepositoriesService extends Service {
311311

312312
// TODO: Implement updateFile: https://developer.github.com/v3/repos/contents/#update-a-file
313313
// TODO: Implement deleteFile: https://developer.github.com/v3/repos/contents/#delete-a-file
314-
// TODO: Implement getArchiveLink: https://developer.github.com/v3/repos/contents/#get-archive-link
314+
315+
/// Gets an archive link for the specified repository and reference.
316+
///
317+
/// API docs: https://developer.github.com/v3/repos/contents/#get-archive-link
318+
Future<String> getArchiveLink(RepositorySlug slug, String ref, {String format: "tarball"}) {
319+
return _github.request("GET", "/repos/${slug.fullName}/${format}/${ref}", statusCode: 302).then((response) {
320+
return response.headers["Location"];
321+
});
322+
}
315323

316324
/// Lists the forks of the specified repository.
317325
///
@@ -504,7 +512,7 @@ class RepositoriesService extends Service {
504512
return _github.postJSON("/repos/${slug.fullName}/statuses/${ref}",
505513
body: request.toJSON(), convert: RepositoryStatus.fromJSON);
506514
}
507-
515+
508516
/// Gets a Combined Status for the specified repository and ref.
509517
///
510518
/// API docs: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy