Skip to content

Commit 558f06f

Browse files
feat(specs): add with transformation helpers (generated)
algolia/api-clients-automation#4931 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 75ee6b9 commit 558f06f

File tree

8 files changed

+320
-0
lines changed

8 files changed

+320
-0
lines changed

packages/client_search/lib/algolia_client_search.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export 'src/model/dictionary_type.dart';
5959
export 'src/model/edit.dart';
6060
export 'src/model/edit_type.dart';
6161
export 'src/model/error_base.dart';
62+
export 'src/model/event.dart';
63+
export 'src/model/event_status.dart';
64+
export 'src/model/event_type.dart';
6265
export 'src/model/exact_on_single_word_query.dart';
6366
export 'src/model/exhaustive.dart';
6467
export 'src/model/facet_hits.dart';
@@ -159,6 +162,7 @@ export 'src/model/user_highlight_result.dart';
159162
export 'src/model/user_hit.dart';
160163
export 'src/model/user_id.dart';
161164
export 'src/model/value.dart';
165+
export 'src/model/watch_response.dart';
162166
export 'src/model/widgets.dart';
163167
export 'src/model/with_primary.dart';
164168

packages/client_search/lib/src/deserialize.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ import 'package:algolia_client_search/src/model/dictionary_type.dart';
5252
import 'package:algolia_client_search/src/model/edit.dart';
5353
import 'package:algolia_client_search/src/model/edit_type.dart';
5454
import 'package:algolia_client_search/src/model/error_base.dart';
55+
import 'package:algolia_client_search/src/model/event.dart';
56+
import 'package:algolia_client_search/src/model/event_status.dart';
57+
import 'package:algolia_client_search/src/model/event_type.dart';
5558
import 'package:algolia_client_search/src/model/exact_on_single_word_query.dart';
5659
import 'package:algolia_client_search/src/model/exhaustive.dart';
5760
import 'package:algolia_client_search/src/model/facet_hits.dart';
@@ -152,6 +155,7 @@ import 'package:algolia_client_search/src/model/user_highlight_result.dart';
152155
import 'package:algolia_client_search/src/model/user_hit.dart';
153156
import 'package:algolia_client_search/src/model/user_id.dart';
154157
import 'package:algolia_client_search/src/model/value.dart';
158+
import 'package:algolia_client_search/src/model/watch_response.dart';
155159
import 'package:algolia_client_search/src/model/widgets.dart';
156160
import 'package:algolia_client_search/src/model/with_primary.dart';
157161

@@ -311,6 +315,12 @@ ReturnType deserialize<ReturnType, BaseType>(dynamic value, String targetType,
311315
return EditType.fromJson(value) as ReturnType;
312316
case 'ErrorBase':
313317
return ErrorBase.fromJson(value as Map<String, dynamic>) as ReturnType;
318+
case 'Event':
319+
return Event.fromJson(value as Map<String, dynamic>) as ReturnType;
320+
case 'EventStatus':
321+
return EventStatus.fromJson(value) as ReturnType;
322+
case 'EventType':
323+
return EventType.fromJson(value) as ReturnType;
314324
case 'ExactOnSingleWordQuery':
315325
return ExactOnSingleWordQuery.fromJson(value) as ReturnType;
316326
case 'Exhaustive':
@@ -573,6 +583,9 @@ ReturnType deserialize<ReturnType, BaseType>(dynamic value, String targetType,
573583
return UserId.fromJson(value as Map<String, dynamic>) as ReturnType;
574584
case 'Value':
575585
return Value.fromJson(value as Map<String, dynamic>) as ReturnType;
586+
case 'WatchResponse':
587+
return WatchResponse.fromJson(value as Map<String, dynamic>)
588+
as ReturnType;
576589
case 'Widgets':
577590
return Widgets.fromJson(value as Map<String, dynamic>) as ReturnType;
578591
case 'WithPrimary':
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
// ignore_for_file: unused_element
3+
import 'package:algolia_client_search/src/model/event_status.dart';
4+
import 'package:algolia_client_search/src/model/event_type.dart';
5+
6+
import 'package:json_annotation/json_annotation.dart';
7+
8+
part 'event.g.dart';
9+
10+
@JsonSerializable()
11+
final class Event {
12+
/// Returns a new [Event] instance.
13+
const Event({
14+
required this.eventID,
15+
required this.runID,
16+
required this.status,
17+
required this.type,
18+
required this.batchSize,
19+
this.data,
20+
required this.publishedAt,
21+
});
22+
23+
/// Universally unique identifier (UUID) of an event.
24+
@JsonKey(name: r'eventID')
25+
final String eventID;
26+
27+
/// Universally unique identifier (UUID) of a task run.
28+
@JsonKey(name: r'runID')
29+
final String runID;
30+
31+
@JsonKey(name: r'status')
32+
final EventStatus? status;
33+
34+
@JsonKey(name: r'type')
35+
final EventType type;
36+
37+
/// The extracted record batch size.
38+
// minimum: 0
39+
@JsonKey(name: r'batchSize')
40+
final int batchSize;
41+
42+
@JsonKey(name: r'data')
43+
final Map<String, Object>? data;
44+
45+
/// Date of publish RFC 3339 format.
46+
@JsonKey(name: r'publishedAt')
47+
final String publishedAt;
48+
49+
@override
50+
bool operator ==(Object other) =>
51+
identical(this, other) ||
52+
other is Event &&
53+
other.eventID == eventID &&
54+
other.runID == runID &&
55+
other.status == status &&
56+
other.type == type &&
57+
other.batchSize == batchSize &&
58+
other.data == data &&
59+
other.publishedAt == publishedAt;
60+
61+
@override
62+
int get hashCode =>
63+
eventID.hashCode +
64+
runID.hashCode +
65+
(status == null ? 0 : status.hashCode) +
66+
type.hashCode +
67+
batchSize.hashCode +
68+
(data == null ? 0 : data.hashCode) +
69+
publishedAt.hashCode;
70+
71+
factory Event.fromJson(Map<String, dynamic> json) => _$EventFromJson(json);
72+
73+
Map<String, dynamic> toJson() => _$EventToJson(this);
74+
75+
@override
76+
String toString() {
77+
return toJson().toString();
78+
}
79+
}

packages/client_search/lib/src/model/event.g.dart

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
// ignore_for_file: unused_element
3+
import 'package:json_annotation/json_annotation.dart';
4+
5+
@JsonEnum(valueField: 'raw')
6+
enum EventStatus {
7+
created(r'created'),
8+
started(r'started'),
9+
retried(r'retried'),
10+
failed(r'failed'),
11+
succeeded(r'succeeded'),
12+
critical(r'critical');
13+
14+
const EventStatus(this.raw);
15+
final dynamic raw;
16+
17+
dynamic toJson() => raw;
18+
19+
static EventStatus fromJson(dynamic json) {
20+
for (final value in values) {
21+
if (value.raw == json) return value;
22+
}
23+
throw ArgumentError.value(json, "raw", "No enum value with that value");
24+
}
25+
26+
@override
27+
String toString() => raw.toString();
28+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
// ignore_for_file: unused_element
3+
import 'package:json_annotation/json_annotation.dart';
4+
5+
@JsonEnum(valueField: 'raw')
6+
enum EventType {
7+
fetch(r'fetch'),
8+
record(r'record'),
9+
log(r'log'),
10+
transform(r'transform');
11+
12+
const EventType(this.raw);
13+
final dynamic raw;
14+
15+
dynamic toJson() => raw;
16+
17+
static EventType fromJson(dynamic json) {
18+
for (final value in values) {
19+
if (value.raw == json) return value;
20+
}
21+
throw ArgumentError.value(json, "raw", "No enum value with that value");
22+
}
23+
24+
@override
25+
String toString() => raw.toString();
26+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
// ignore_for_file: unused_element
3+
import 'package:algolia_client_search/src/model/event.dart';
4+
5+
import 'package:json_annotation/json_annotation.dart';
6+
7+
part 'watch_response.g.dart';
8+
9+
@JsonSerializable()
10+
final class WatchResponse {
11+
/// Returns a new [WatchResponse] instance.
12+
const WatchResponse({
13+
required this.runID,
14+
this.eventID,
15+
this.data,
16+
this.events,
17+
this.message,
18+
this.createdAt,
19+
});
20+
21+
/// Universally unique identifier (UUID) of a task run.
22+
@JsonKey(name: r'runID')
23+
final String runID;
24+
25+
/// Universally unique identifier (UUID) of an event.
26+
@JsonKey(name: r'eventID')
27+
final String? eventID;
28+
29+
/// This field is always null when used with the Push endpoint. When used for a source discover or source validate run, it will include the sampled data of the source.
30+
@JsonKey(name: r'data')
31+
final List<Object>? data;
32+
33+
/// in case of error, observability events will be added to the response.
34+
@JsonKey(name: r'events')
35+
final List<Event>? events;
36+
37+
/// a message describing the outcome of the operation that has been ran (push, discover or validate) run.
38+
@JsonKey(name: r'message')
39+
final String? message;
40+
41+
/// Date of creation in RFC 3339 format.
42+
@JsonKey(name: r'createdAt')
43+
final String? createdAt;
44+
45+
@override
46+
bool operator ==(Object other) =>
47+
identical(this, other) ||
48+
other is WatchResponse &&
49+
other.runID == runID &&
50+
other.eventID == eventID &&
51+
other.data == data &&
52+
other.events == events &&
53+
other.message == message &&
54+
other.createdAt == createdAt;
55+
56+
@override
57+
int get hashCode =>
58+
runID.hashCode +
59+
eventID.hashCode +
60+
data.hashCode +
61+
events.hashCode +
62+
message.hashCode +
63+
createdAt.hashCode;
64+
65+
factory WatchResponse.fromJson(Map<String, dynamic> json) =>
66+
_$WatchResponseFromJson(json);
67+
68+
Map<String, dynamic> toJson() => _$WatchResponseToJson(this);
69+
70+
@override
71+
String toString() {
72+
return toJson().toString();
73+
}
74+
}

packages/client_search/lib/src/model/watch_response.g.dart

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)