docs: Clean up dart documentations

Changing to `code` blocks where it cant be resolved to [stuff] things.
This commit is contained in:
Krille Fear 2021-03-16 12:32:21 +00:00
parent 9626c64993
commit 9bef8452d3
15 changed files with 47 additions and 47 deletions

View File

@ -27,11 +27,11 @@ coverage:
- ln -s /usr/lib/dart/bin/pub /usr/bin/ - ln -s /usr/lib/dart/bin/pub /usr/bin/
- useradd -m test - useradd -m test
- chown -R 'test:' '.' - chown -R 'test:' '.'
- chmod +x ./prepare.sh - chmod +x ./scripts/prepare.sh
- chmod +x ./test.sh - chmod +x ./scripts/test.sh
- rm -r example - rm -r example
- ./prepare.sh test - ./scripts/prepare.sh test
- ./test.sh test - ./scripts/test.sh test
artifacts: artifacts:
paths: paths:
- coverage/ - coverage/
@ -50,9 +50,6 @@ coverage_without_olm:
- apt update - apt update
- apt install -y dart - apt install -y dart
- ln -s /usr/lib/dart/bin/pub /usr/bin/ - ln -s /usr/lib/dart/bin/pub /usr/bin/
- useradd -m test
- chown -R 'test:' '.'
- chmod +x ./test.sh
- pub get - pub get
- pub run test - pub run test
@ -72,11 +69,11 @@ e2ee_test:
- ln -s /usr/lib/dart/bin/pub /usr/bin/ - ln -s /usr/lib/dart/bin/pub /usr/bin/
- useradd -m test - useradd -m test
- chown -R 'test:' '.' - chown -R 'test:' '.'
- chmod +x ./prepare.sh - chmod +x ./scripts/prepare.sh
- chmod +x ./test_driver.sh - chmod +x ./scripts/test_driver.sh
- printf "abstract class TestUser {\n static const String homeserver = '$TEST_HOMESERVER';\n static const String username = '$TEST_USER1';\n static const String username2 = '$TEST_USER2';\n static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart - printf "abstract class TestUser {\n static const String homeserver = '$TEST_HOMESERVER';\n static const String username = '$TEST_USER1';\n static const String username2 = '$TEST_USER2';\n static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart
- su -c ./prepare.sh test - su -c ./scripts/prepare.sh test
- su -c ./test_driver.sh test - su -c ./scripts/test_driver.sh test
timeout: 16m timeout: 16m
resource_group: e2ee_test resource_group: e2ee_test
@ -94,14 +91,14 @@ build_api_doc:
tags: tags:
- docker - docker
stage: builddocs stage: builddocs
image: cirrusci/flutter image: registry.gitlab.com/famedly/containers/flutter-dockerimages:stable
script: script:
- flutter pub global activate dartdoc
- export PATH="$PATH":"/opt/flutter/flutter/.pub-cache/bin"
- dartdoc --exclude "dart:async,dart:collection,dart:convert,dart:core,dart:developer,dart:io,dart:isolate,dart:math,dart:typed_data,dart:ui" - dartdoc --exclude "dart:async,dart:collection,dart:convert,dart:core,dart:developer,dart:io,dart:isolate,dart:math,dart:typed_data,dart:ui"
artifacts: artifacts:
paths: paths:
- doc/api/ - doc/api/
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
build_doc: build_doc:
tags: tags:

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/// Matrix SDK encryption specific extension
library encryption; library encryption;
export 'encryption/encryption.dart'; export 'encryption/encryption.dart';

View File

@ -200,7 +200,7 @@ class SSSS {
getKey(keyId)?.algorithm == AlgorithmTypes.secretStorageV1AesHmcSha2; getKey(keyId)?.algorithm == AlgorithmTypes.secretStorageV1AesHmcSha2;
/// Creates a new secret storage key, optional encrypts it with [passphrase] /// Creates a new secret storage key, optional encrypts it with [passphrase]
/// and stores it in the user's [accountData]. /// and stores it in the user's `accountData`.
Future<OpenSSSS> createKey([String passphrase]) async { Future<OpenSSSS> createKey([String passphrase]) async {
Uint8List privateKey; Uint8List privateKey;
final content = SecretStorageKeyContent(); final content = SecretStorageKeyContent();

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/// Matrix SDK written in pure Dart.
library famedlysdk; library famedlysdk;
export 'package:matrix_api_lite/matrix_api_lite.dart'; export 'package:matrix_api_lite/matrix_api_lite.dart';

View File

@ -311,8 +311,8 @@ class Client extends MatrixApi {
/// Checks the supported versions of the Matrix protocol and the supported /// Checks the supported versions of the Matrix protocol and the supported
/// login types. Throws an exception if the server is not compatible with the /// login types. Throws an exception if the server is not compatible with the
/// client and sets [homeserver] to [serverUrl] if it is. Supports the types [Uri] /// client and sets [homeserver] to [homeserverUrl] if it is. Supports the
/// and [String]. /// types `Uri` and `String`.
Future<WellKnownInformation> checkHomeserver(dynamic homeserverUrl, Future<WellKnownInformation> checkHomeserver(dynamic homeserverUrl,
{bool checkWellKnown = true}) async { {bool checkWellKnown = true}) async {
try { try {
@ -1452,7 +1452,7 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
bool _sortLock = false; bool _sortLock = false;
/// If [true] then unread rooms are pinned at the top of the room list. /// If `true` then unread rooms are pinned at the top of the room list.
bool pinUnreadRooms; bool pinUnreadRooms;
/// The compare function how the rooms should be sorted internally. By default /// The compare function how the rooms should be sorted internally. By default
@ -1731,9 +1731,9 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
} }
} }
/// Sends a raw to_device event with a [eventType], a [txnId] and a content [data]. /// Sends a raw to_device event with a [eventType], a [txnId] and a content
/// Before sending, it tries to re-send potentially queued to_device events and adds /// [messages]. Before sending, it tries to re-send potentially queued
/// the current one to the queue, should it fail. /// to_device events and adds the current one to the queue, should it fail.
@override @override
Future<void> sendToDevice( Future<void> sendToDevice(
String eventType, String eventType,
@ -1776,7 +1776,7 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
return; return;
} }
/// Sends an encrypted [message] of this [type] to these [deviceKeys]. /// Sends an encrypted [message] of this [eventType] to these [deviceKeys].
Future<void> sendToDeviceEncrypted( Future<void> sendToDeviceEncrypted(
List<DeviceKeys> deviceKeys, List<DeviceKeys> deviceKeys,
String eventType, String eventType,
@ -1804,9 +1804,10 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
eventType, messageId ?? generateUniqueTransactionId(), data); eventType, messageId ?? generateUniqueTransactionId(), data);
} }
/// Sends an encrypted [message] of this [type] to these [deviceKeys]. This request happens /// Sends an encrypted [message] of this [eventType] to these [deviceKeys].
/// partly in the background and partly in the foreground. It automatically chunks sending /// This request happens partly in the background and partly in the
/// to device keys based on activity /// foreground. It automatically chunks sending to device keys based on
/// activity.
Future<void> sendToDeviceEncryptedChunked( Future<void> sendToDeviceEncryptedChunked(
List<DeviceKeys> deviceKeys, List<DeviceKeys> deviceKeys,
String eventType, String eventType,

View File

@ -346,7 +346,7 @@ class Event extends MatrixEvent {
/// Whether the client is allowed to redact this event. /// Whether the client is allowed to redact this event.
bool get canRedact => senderId == room.client.userID || room.canRedact; bool get canRedact => senderId == room.client.userID || room.canRedact;
/// Redacts this event. Returns [ErrorResponse] on error. /// Redacts this event. Throws `ErrorResponse` on error.
Future<dynamic> redact({String reason, String txid}) => Future<dynamic> redact({String reason, String txid}) =>
room.redactEvent(eventId, reason: reason, txid: txid); room.redactEvent(eventId, reason: reason, txid: txid);

View File

@ -69,9 +69,9 @@ class Room {
/// The number of users with membership of invite. /// The number of users with membership of invite.
int mInvitedMemberCount; int mInvitedMemberCount;
/// The room states are a key value store of the key ([type],[state_key]) => State(event). /// The room states are a key value store of the key (`type`,`state_key`) => State(event).
/// In a lot of cases the [state_key] might be an empty string. You **should** use the /// In a lot of cases the `state_key` might be an empty string. You **should** use the
/// methods [getState] and [setState] to interact with the room states. /// methods `getState()` and `setState()` to interact with the room states.
Map<String, Map<String, Event>> states = {}; Map<String, Map<String, Event>> states = {};
/// Key-Value store for ephemerals. /// Key-Value store for ephemerals.
@ -1531,7 +1531,7 @@ class Room {
return resp; return resp;
} }
/// Redacts this event. Returns [ErrorResponse] on error. /// Redacts this event. Throws `ErrorResponse` on error.
Future<String> redactEvent(String eventId, Future<String> redactEvent(String eventId,
{String reason, String txid}) async { {String reason, String txid}) async {
// Create new transaction id // Create new transaction id
@ -1808,7 +1808,7 @@ class Room {
} }
/// Whether this is an extinct room which has been archived in favor of a new /// Whether this is an extinct room which has been archived in favor of a new
/// room which replaces this. Use [getLegacyRoomInformations] to get more /// room which replaces this. Use `getLegacyRoomInformations()` to get more
/// informations about it if this is true. /// informations about it if this is true.
bool get isExtinct => getState(EventTypes.RoomTombstone) != null; bool get isExtinct => getState(EventTypes.RoomTombstone) != null;

View File

@ -27,9 +27,9 @@ import 'utils/room_update.dart';
typedef onTimelineUpdateCallback = void Function(); typedef onTimelineUpdateCallback = void Function();
typedef onTimelineInsertCallback = void Function(int insertID); typedef onTimelineInsertCallback = void Function(int insertID);
/// Represents the timeline of a room. The callbacks [onUpdate], [onDelete], /// Represents the timeline of a room. The callback [onUpdate] will be triggered
/// [onInsert] and [onResort] will be triggered automatically. The initial /// automatically. The initial
/// event list will be retreived when created by the [room.getTimeline] method. /// event list will be retreived when created by the `room.getTimeline()` method.
class Timeline { class Timeline {
final Room room; final Room room;
final List<Event> events; final List<Event> events;

View File

@ -21,15 +21,15 @@ import 'dart:async';
import '../../famedlysdk.dart'; import '../../famedlysdk.dart';
extension CommandsClientExtension on Client { extension CommandsClientExtension on Client {
/// Add a command to the command handler. [command] is its name, and [callback] is the /// Add a command to the command handler. `command` is its name, and `callback` is the
/// callback to invoke /// callback to invoke
void addCommand( void addCommand(
String command, FutureOr<String> Function(CommandArgs) callback) { String command, FutureOr<String> Function(CommandArgs) callback) {
commands[command.toLowerCase()] = callback; commands[command.toLowerCase()] = callback;
} }
/// Parse and execute a string, [msg] is the input. Optionally [inReplyTo] is the event being /// Parse and execute a string, `msg` is the input. Optionally `inReplyTo` is the event being
/// replied to and [editEventId] is the eventId of the event being replied to /// replied to and `editEventId` is the eventId of the event being replied to
Future<String> parseAndRunCommand(Room room, String msg, Future<String> parseAndRunCommand(Room room, String msg,
{Event inReplyTo, String editEventId, String txid}) async { {Event inReplyTo, String editEventId, String txid}) async {
final args = CommandArgs( final args = CommandArgs(

View File

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
const Set<String> VALID_SIGILS = {'@', '!', '#', '\$', '+'};
const int MAX_LENGTH = 255;
extension MatrixIdExtension on String { extension MatrixIdExtension on String {
static const Set<String> VALID_SIGILS = {'@', '!', '#', '\$', '+'};
static const int MAX_LENGTH = 255;
List<String> _getParts() { List<String> _getParts() {
final s = substring(1); final s = substring(1);
final ix = s.indexOf(':'); final ix = s.indexOf(':');

View File

@ -34,8 +34,8 @@ class RoomUpdate {
// The number of unread highlighted notifications. // The number of unread highlighted notifications.
final num highlight_count; final num highlight_count;
/// If there are too much new messages, the [homeserver] will only send the /// If there are too much new messages, the `homeserver` will only send the
/// last X (default is 10) messages and set the [limitedTimelinbe] flag to true. /// last X (default is 10) messages and set the `limitedTimeline` flag to true.
final bool limitedTimeline; final bool limitedTimeline;
/// Represents the current position of the client in the room history. /// Represents the current position of the client in the room history.

View File

@ -28,10 +28,10 @@ extension MxcUriExtension on Uri {
: '' : ''
: toString(); : toString();
/// Returns a scaled thumbnail link to this content with the given [width] and /// Returns a scaled thumbnail link to this content with the given `width` and
/// [height]. [method] can be [ThumbnailMethod.crop] or /// `height`. `method` can be `ThumbnailMethod.crop` or
/// [ThumbnailMethod.scale] and defaults to [ThumbnailMethod.scale]. /// `ThumbnailMethod.scale` and defaults to `ThumbnailMethod.scale`.
/// If [animated] (default false) is set to true, an animated thumbnail is requested /// If `animated` (default false) is set to true, an animated thumbnail is requested
/// as per MSC2705. Thumbnails only animate if the media repository supports that. /// as per MSC2705. Thumbnails only animate if the media repository supports that.
String getThumbnail(Client matrix, String getThumbnail(Client matrix,
{num width, {num width,