-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from mineral-dart/create_getters_for_all_prope…
…rties feat: Create getters for all properties
- Loading branch information
Showing
52 changed files
with
1,148 additions
and
1,172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,56 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:mineral/api.dart'; | ||
import 'package:mineral/src/api/client/client_presence.dart'; | ||
|
||
class Activity { | ||
String? label; | ||
GamePresence type; | ||
String? url; | ||
DateTime createdAt; | ||
Timestamp? timestamps; | ||
Snowflake? applicationId; | ||
String? details; | ||
String? state; | ||
String? _label; | ||
GamePresence _type; | ||
String? _url; | ||
DateTime _createdAt; | ||
Timestamp? _timestamps; | ||
Snowflake? _applicationId; | ||
String? _details; | ||
String? _state; | ||
// Emoji? emoji; | ||
// Party? party; | ||
// Asset? assets; | ||
// Secret? secrets; | ||
// Instance? instance; | ||
int? flags; | ||
int? _flags; | ||
// List<Button> buttons; | ||
|
||
Activity({ | ||
required this.label, | ||
required this.type, | ||
required this.url, | ||
required this.createdAt, | ||
required this.timestamps, | ||
required this.applicationId, | ||
required this.details, | ||
required this.state, | ||
required this.flags, | ||
}); | ||
Activity( | ||
this._label, | ||
this._type, | ||
this._url, | ||
this._createdAt, | ||
this._timestamps, | ||
this._applicationId, | ||
this._details, | ||
this._state, | ||
this._flags, | ||
); | ||
|
||
String? get label => _label; | ||
GamePresence get type => _type; | ||
String? get url => _url; | ||
DateTime get createdAt => _createdAt; | ||
Timestamp? get timestamps => _timestamps; | ||
Snowflake? get applicationId => _applicationId; | ||
String? get details => _details; | ||
String? get state => _state; | ||
int? get flags => _flags; | ||
|
||
factory Activity.from({ required dynamic payload }) { | ||
return Activity( | ||
label: payload['name'], | ||
type: GamePresence.values.firstWhere((status) => status.value == payload['type']), | ||
url: payload['url'], | ||
createdAt: DateTime.fromMillisecondsSinceEpoch(payload['created_at']), | ||
timestamps: payload['timestamps'] != null ? Timestamp.from(payload: payload['timestamps']) : null, | ||
applicationId: payload['application_id'], | ||
details: payload['details'], | ||
state: payload['state'], | ||
flags: payload['flags'] | ||
payload['name'], | ||
GamePresence.values.firstWhere((status) => status.value == payload['type']), | ||
payload['url'], | ||
DateTime.fromMillisecondsSinceEpoch(payload['created_at']), | ||
payload['timestamps'] != null ? Timestamp.from(payload: payload['timestamps']) : null, | ||
payload['application_id'], | ||
payload['details'], | ||
payload['state'], | ||
payload['flags'] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import 'package:mineral/api.dart'; | ||
|
||
class Application { | ||
Snowflake id; | ||
int flags; | ||
Snowflake _id; | ||
int _flags; | ||
|
||
Application({ required this.id, required this.flags }); | ||
Application(this._id, this._flags); | ||
|
||
Snowflake get id => _id; | ||
int get flags => _flags; | ||
|
||
factory Application.from(dynamic payload) { | ||
return Application( | ||
id: payload['id'], | ||
flags: payload['flags'] | ||
payload['id'], | ||
payload['flags'] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.