$createNote_Request method

  1. @experimental
Request $createNote_Request({
  1. String? category,
  2. String? title,
  3. String? content,
  4. int? modified,
  5. int? favorite,
})

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 to 0.
  • favorite Defaults to 0.

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 = 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;
}