Skip to content

Commit 57126a1

Browse files
NANASHI0X74nanashi0x74
andauthored
Add getters for private default Headers and authentications (#8509)
* add getters for default headermap and auths * regenerate samples, make shebangs portable * Revert making shebangs portable This reverts commit ec60f60. Co-authored-by: nanashi0x74 <[email protected]>
1 parent a968fb1 commit 57126a1

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

modules/openapi-generator/src/main/resources/dart2/api_client.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class ApiClient {
4949
_defaultHeaderMap[key] = value;
5050
}
5151

52+
Map<String,String> get defaultHeaderMap => _defaultHeaderMap;
53+
/// returns an unmodifiable view of the authentications, since none should be added
54+
/// nor deleted
55+
Map<String, Authentication> get authentications =>
56+
Map.unmodififiable(_authentications);
57+
5258
dynamic deserialize(String json, String targetType, {bool growable}) {
5359
// Remove all spaces. Necessary for reg expressions as well.
5460
targetType = targetType.replaceAll(' ', '');

samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class ApiClient {
4242
_defaultHeaderMap[key] = value;
4343
}
4444

45+
Map<String,String> get defaultHeaderMap => _defaultHeaderMap;
46+
/// returns an unmodifiable view of the authentications, since none should be added
47+
/// nor deleted
48+
Map<String, Authentication> get authentications =>
49+
Map.unmodififiable(_authentications);
50+
4551
dynamic deserialize(String json, String targetType, {bool growable}) {
4652
// Remove all spaces. Necessary for reg expressions as well.
4753
targetType = targetType.replaceAll(' ', '');

samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class ApiClient {
4242
_defaultHeaderMap[key] = value;
4343
}
4444

45+
Map<String,String> get defaultHeaderMap => _defaultHeaderMap;
46+
/// returns an unmodifiable view of the authentications, since none should be added
47+
/// nor deleted
48+
Map<String, Authentication> get authentications =>
49+
Map.unmodififiable(_authentications);
50+
4551
dynamic deserialize(String json, String targetType, {bool growable}) {
4652
// Remove all spaces. Necessary for reg expressions as well.
4753
targetType = targetType.replaceAll(' ', '');

samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ class ApiClient {
4545
_defaultHeaderMap[key] = value;
4646
}
4747

48+
Map<String,String> get defaultHeaderMap => _defaultHeaderMap;
49+
/// returns an unmodifiable view of the authentications, since none should be added
50+
/// nor deleted
51+
Map<String, Authentication> get authentications =>
52+
Map.unmodififiable(_authentications);
53+
4854
dynamic deserialize(String json, String targetType, {bool growable}) {
4955
// Remove all spaces. Necessary for reg expressions as well.
5056
targetType = targetType.replaceAll(' ', '');

0 commit comments

Comments
 (0)