$createNote_Request method
- @experimental
Returns a DynamiteRequest
backing the createNote operation.
Throws a DynamiteApiException
if the API call does not return an expected status code.
Parameters:
category
Defaults to""
.title
Defaults to""
.content
Defaults to""
.modified
Defaults to0
.favorite
Defaults to0
.
Status codes:
- 200
See:
- createNote for a method executing this request and parsing the response.
- $createNote_Serializer for a converter to parse the
Response
from an executed this request.
Implementation
@_i2.experimental
_i3.Request $createNote_Request({
String? category,
String? title,
String? content,
int? modified,
int? favorite,
}) {
final _parameters = <String, Object?>{};
var __category = _$jsonSerializers.serialize(category, specifiedType: const FullType(String));
__category ??= '';
_parameters['category'] = __category;
var __title = _$jsonSerializers.serialize(title, specifiedType: const FullType(String));
__title ??= '';
_parameters['title'] = __title;
var __content = _$jsonSerializers.serialize(content, specifiedType: const FullType(String));
__content ??= '';
_parameters['content'] = __content;
var __modified = _$jsonSerializers.serialize(modified, specifiedType: const FullType(int));
__modified ??= 0;
_parameters['modified'] = __modified;
var __favorite = _$jsonSerializers.serialize(favorite, specifiedType: const FullType(int));
__favorite ??= 0;
_parameters['favorite'] = __favorite;
final _path = _i4.UriTemplate('/index.php/apps/notes/api/v1/notes{?category*,title*,content*,modified*,favorite*}')
.expand(_parameters);
final _uri = Uri.parse('$baseURL$_path');
final _request = _i3.Request('post', _uri);
_request.headers['Accept'] = 'application/json';
// coverage:ignore-start
final authentication = _i5.IterableExtension(authentications)?.firstWhereOrNull(
(auth) => switch (auth) {
_i1.DynamiteHttpBasicAuthentication() => true,
_ => false,
},
);
if (authentication != null) {
_request.headers.addAll(
authentication.headers,
);
} else {
throw Exception('Missing authentication for basic_auth');
}
// coverage:ignore-end
return _request;
}