Skip to content

Commit a201cd8

Browse files
committed
[ Edit, Add ] edited and updated docs of model model directory files code
1 parent 85b4b6b commit a201cd8

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

lib/src/core/models/image/image/image.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ export 'sub_models/data.dart';
66

77
@immutable
88
final class OpenAIImageModel {
9-
/// The time the image was created.
9+
/// The time the image was [created].
1010
final DateTime created;
1111

1212
/// The data of the image.
1313
final List<OpenAIImageData> data;
1414

15+
/// Weither the image have some [data].
16+
bool get haveData => data.isNotEmpty;
17+
1518
@override
1619
int get hashCode => created.hashCode ^ data.hashCode;
1720

lib/src/core/models/image/image/sub_models/data.dart

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
import 'package:meta/meta.dart';
22

3+
/// {@template openai_image_data_model}
4+
/// This class is used to represent an OpenAI image data.
5+
/// {@endtemplate}
36
@immutable
47
final class OpenAIImageData {
5-
/// The URL of the image.
8+
/// The [URL] of the image.
69
final String? url;
710

8-
/// the [OpenAIImageResponseFormat] b64Json data
11+
/// The [b64Json] data.
912
final String? b64Json;
1013

11-
///
14+
/// The revised prompt.
1215
final String? revisedPrompt;
1316

17+
/// Weither the image have a [URL] result.
18+
bool get haveUrl => url != null;
19+
20+
/// Weither the image have a [b64Json] result.
21+
bool get haveB64Json => b64Json != null;
22+
23+
/// Weither the image have a revised prompt.
24+
bool get haveRevisedPrompt => revisedPrompt != null;
25+
1426
@override
15-
int get hashCode => url.hashCode;
27+
int get hashCode => url.hashCode ^ b64Json.hashCode ^ revisedPrompt.hashCode;
1628

1729
/// This class is used to represent an OpenAI image data.
1830
const OpenAIImageData({

lib/src/core/models/model/model.dart

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,27 @@ import 'package:meta/meta.dart';
33

44
import 'sub_models/permission.dart';
55

6+
/// {@template openai_model_model}
7+
/// This class is used to represent an OpenAI model.
8+
/// {@endtemplate}
69
@immutable
710
final class OpenAIModelModel {
8-
/// The ID of the model.
11+
/// The [id]entifier of the model.
912
final String id;
1013

1114
/// The name of the organization that owns the model.
1215
final String ownedBy;
1316

14-
/// The permissions of the model.
17+
/// The [permission]s of the model.
1518
final List<OpenAIModelModelPermission>? permission;
1619

20+
/// Weither the model have at least one permission in [permission].
21+
bool get havePermission => permission != null;
22+
1723
@override
18-
int get hashCode => id.hashCode ^ ownedBy.hashCode;
24+
int get hashCode => id.hashCode ^ ownedBy.hashCode ^ permission.hashCode;
1925

20-
/// This class is used to represent an OpenAI model.
26+
/// {@macro openai_model_model}
2127
const OpenAIModelModel({
2228
required this.id,
2329
required this.ownedBy,
@@ -43,7 +49,8 @@ final class OpenAIModelModel {
4349
}
4450

4551
@override
46-
String toString() => 'OpenAIModelModel(id: $id, ownedBy: $ownedBy)';
52+
String toString() =>
53+
'OpenAIModelModel(id: $id, ownedBy: $ownedBy, permission: $permission)';
4754

4855
@override
4956
bool operator ==(covariant OpenAIModelModel other) {

lib/src/core/models/model/sub_models/permission.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import 'package:meta/meta.dart';
22

3+
/// {@template openai_model_model_permission}
4+
/// This class is used to represent an OpenAI model permission.
5+
/// {@endtemplate}
36
@immutable
47
final class OpenAIModelModelPermission {
5-
/// The ID of the permission.
8+
/// The [id]entifier of the permission.
69
final String? id;
710

8-
/// The time the permission was created.
11+
/// The time the permission was [created].
912
final DateTime? created;
1013

1114
/// Whether the permission allows the user to create engines.

0 commit comments

Comments
 (0)