Skip to content

Commit

Permalink
Made Document Validate to return nullable result
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej-Hlatky committed Aug 24, 2024
1 parent 7de5786 commit e7cd91b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.3

* Fix "Document Validation" API - returning nullable type

## 0.4.2

* Update API client - Document Validation
Expand Down
2 changes: 1 addition & 1 deletion lib/src/autogram_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class AutogramService implements IAutogramService {
}

@override
Future<DocumentValidationResponseBody> getDocumentValidation(
Future<DocumentValidationResponseBody?> getDocumentValidation(
String documentId,
) {
return _autogram.documentsGuidValidateGet(guid: documentId).then(unwrap);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/iautogram_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ abstract class IAutogramService {

/// Requests a signature validation report of the document.
///
/// See <https://generator3.swagger.io/index.html?url=https://autogram.slovensko.digital/openapi.yaml#/Mobile2App/get_documents__guid__validation>
Future<DocumentValidationResponseBody> getDocumentValidation(
/// See <https://generator3.swagger.io/index.html?url=https://autogram.slovensko.digital/openapi.yaml#/Mobile2App/get_documents__guid__validate>
Future<DocumentValidationResponseBody?> getDocumentValidation(
String documentId,
);

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: autogram_sign
description: "Autogram service REST API client"
version: 0.4.2
version: 0.4.3
homepage: ""

environment:
Expand Down
8 changes: 8 additions & 0 deletions test/unwap_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ void main() {
expect(actual, "Test");
});

test('unwrap returns nullable value for 200 status code', () {
final httpResponse = http.Response('"Test"', 200);
final response = chopper.Response<String?>(httpResponse, "Test");
final actual = unwrap(response);

expect(actual, "Test");
});

test('unwrap returns nothing for 204 status code with no body', () {
final httpResponse = http.Response('', 204);
final response = chopper.Response<dynamic>(httpResponse, null);
Expand Down

0 comments on commit e7cd91b

Please sign in to comment.