File tree 2 files changed +15
-3
lines changed
packages/registrar_client/lib 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ class Farm {
8
8
final List <Node >? nodes;
9
9
final int twinID;
10
10
final String ? updatedAt;
11
+ final String ? stellarAddress;
11
12
12
13
Farm ({
13
14
this .createdAt,
@@ -16,6 +17,7 @@ class Farm {
16
17
required farmName,
17
18
this .nodes,
18
19
required twinID,
20
+ this .stellarAddress,
19
21
this .updatedAt,
20
22
}) : farmName = _validateFarmName (farmName),
21
23
twinID = _validateTwinId (twinID);
@@ -30,6 +32,7 @@ class Farm {
30
32
? (json['nodes' ] as List ).map ((node) => Node .fromJson (node)).toList ()
31
33
: null ,
32
34
twinID: json['twin_id' ],
35
+ stellarAddress: json['stellar_address' ],
33
36
updatedAt: json['updated_at' ],
34
37
);
35
38
}
@@ -42,6 +45,7 @@ class Farm {
42
45
'farm_name' : farmName,
43
46
'nodes' : nodes ?? [],
44
47
'twin_id' : twinID,
48
+ 'stellar_address' : stellarAddress,
45
49
'updated_at' : updatedAt,
46
50
};
47
51
}
Original file line number Diff line number Diff line change @@ -27,10 +27,18 @@ class Farms {
27
27
return List <Farm >.from (response.map ((farm) => Farm .fromJson (farm)));
28
28
}
29
29
30
- Future <dynamic > update (int twinID, int farmID, String farmName) async {
30
+ Future <dynamic > update (int twinID, int farmID,
31
+ {String ? farmName, String ? stellarAddress}) async {
32
+ if (farmName == null && stellarAddress == null ) {
33
+ return ;
34
+ }
31
35
final header = createAuthHeader (twinID, _client.privateKey);
32
- final response = await _client.patch (
33
- path: '$path /$farmID ' , body: {'farm_name' : farmName}, headers: header);
36
+ final body = {
37
+ if (farmName != null ) 'farm_name' : farmName,
38
+ if (stellarAddress != null ) 'stellar_address' : stellarAddress
39
+ };
40
+ final response =
41
+ await _client.patch (path: '$path /$farmID ' , body: body, headers: header);
34
42
return response;
35
43
}
36
44
}
You can’t perform that action at this time.
0 commit comments