-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup_api.dart
164 lines (147 loc) · 4.82 KB
/
setup_api.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of influxdb_client_api;
class SetupApi {
SetupApi(this.apiClient);
final ApiClient apiClient;
/// Check if database has default user, org, bucket
///
/// Returns `true` if no default user, organization, or bucket has been created.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] zapTraceSpan:
/// OpenTracing span context
Future<Response> getSetupWithHttpInfo({
String? zapTraceSpan,
}) async {
final path = r'/setup';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (zapTraceSpan != null) {
headerParams[r'Zap-Trace-Span'] = parameterToString(zapTraceSpan);
}
const authNames = <String>[
'BasicAuthentication',
'QuerystringAuthentication',
'TokenAuthentication'
];
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes[0],
authNames,
);
}
/// Check if database has default user, org, bucket
///
/// Returns `true` if no default user, organization, or bucket has been created.
///
/// Parameters:
///
/// * [String] zapTraceSpan:
/// OpenTracing span context
Future<IsOnboarding> getSetup({String? zapTraceSpan}) async {
final response = await getSetupWithHttpInfo(zapTraceSpan: zapTraceSpan);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'IsOnboarding',
) as IsOnboarding;
}
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
/// Set up initial user, org and bucket
///
/// Post an onboarding request to set up initial user, org and bucket.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [OnboardingRequest] onboardingRequest (required):
/// Source to create
///
/// * [String] zapTraceSpan:
/// OpenTracing span context
Future<Response> postSetupWithHttpInfo(
OnboardingRequest onboardingRequest, {
String? zapTraceSpan,
}) async {
final path = r'/setup';
// ignore: prefer_final_locals
Object? postBody = onboardingRequest;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (zapTraceSpan != null) {
headerParams[r'Zap-Trace-Span'] = parameterToString(zapTraceSpan);
}
const authNames = <String>[
'BasicAuthentication',
'QuerystringAuthentication',
'TokenAuthentication'
];
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes[0],
authNames,
);
}
/// Set up initial user, org and bucket
///
/// Post an onboarding request to set up initial user, org and bucket.
///
/// Parameters:
///
/// * [OnboardingRequest] onboardingRequest (required):
/// Source to create
///
/// * [String] zapTraceSpan:
/// OpenTracing span context
Future<OnboardingResponse> postSetup(OnboardingRequest onboardingRequest,
{String? zapTraceSpan}) async {
final response = await postSetupWithHttpInfo(onboardingRequest,
zapTraceSpan: zapTraceSpan);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'OnboardingResponse',
) as OnboardingResponse;
}
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}