Skip to content

Commit

Permalink
Merge pull request #171 from SpinlockLabs/tweak_binary_uploads
Browse files Browse the repository at this point in the history
Adjust deprecations and binary uploads
  • Loading branch information
robrbecker authored Oct 8, 2019
2 parents 46b909f + c828d67 commit 1ef8630
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/src/common/github.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class GitHub {
///
/// The future will pass the object returned from this function to the then method.
/// The default [convert] function returns the input object.
/// [body] is the data to send to the server.
/// [body] is the data to send to the server. Pass in a List<int> if you want to post binary body data. Everything else will have .toString() called on it and set as text content
/// [S] represents the input type.
/// [T] represents the type return from this function after conversion
Future<T> postJSON<S, T>(
Expand Down Expand Up @@ -291,7 +291,7 @@ class GitHub {
/// [path] can either be a path like '/repos' or a full url.
/// [headers] are HTTP Headers. If it doesn't exist, the 'Accept' and 'Authorization' headers are added.
/// [params] are query string parameters.
/// [body] is the body content of requests that take content.
/// [body] is the body content of requests that take content. Pass in a List<int> if you want to post binary body data. Everything else will have .toString() called on it and set as text content
///
Future<http.Response> request(
String method,
Expand Down Expand Up @@ -344,10 +344,10 @@ class GitHub {
var request = http.Request(method, Uri.parse(url.toString()));
request.headers.addAll(headers);
if (body != null) {
if (body is String) {
request.body = body;
} else {
if (body is List<int>) {
request.bodyBytes = body;
} else {
request.body = body.toString();
}
}

Expand Down
30 changes: 29 additions & 1 deletion lib/src/common/model/repos_releases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,30 @@ class Release {
@JsonKey(name: "draft")
bool isDraft;

/// Deprecated: Use isDraft instead
@Deprecated('Use isDraft')
@JsonKey(ignore: true)
bool get draft => isDraft;

/// Deprecated: Use isDraft instead
@Deprecated('Use isDraft')
@JsonKey(ignore: true)
set draft(bool b) => isDraft = b;

/// If the release is a pre-release.
/// Deprecated: Use isPrerelease instead
@Deprecated('Use isPrerelease')
@JsonKey(ignore: true)
bool get prerelease => isPrerelease;

/// If the release is a pre-release.
/// Deprecated: Use isPrerelease instead
@Deprecated('Use isPrerelease')
@JsonKey(ignore: true)
set prerelease(bool pr) => isPrerelease = pr;

/// If the release is a pre-release.
/// Deprecated: Use isPrerelease instead
@JsonKey(name: "prerelease")
bool isPrerelease;

Expand Down Expand Up @@ -184,16 +200,28 @@ class CreateRelease {
/// Release Body
String body;

/// Deprecated: Use isDraft instead
@Deprecated('Use isDraft')
@JsonKey(ignore: true)
bool get draft => isDraft;

/// Deprecated: Use isDraft instead
@Deprecated('Use isDraft')
@JsonKey(ignore: true)
set draft(bool d) => isDraft = d;

/// If the release is a draft
bool isDraft;

/// Deprecated: Use isPrerelease instead
@Deprecated('Use isPrerelease')
@JsonKey(ignore: true)
bool get prerelease => isPrerelease;

set prerelease(bool prerelease) => isPrerelease = prerelease;
/// Deprecated: Use isPrerelease instead
@Deprecated('Use isPrerelease')
@JsonKey(ignore: true)
set prerelease(bool pr) => isPrerelease = pr;

/// true to identify the release as a prerelease.
/// false to identify the release as a full release. Default: false
Expand Down
4 changes: 2 additions & 2 deletions lib/src/common/model/repos_releases.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1ef8630

Please sign in to comment.