Skip to content

Commit bb69836

Browse files
committed
3.3.1 updates
1 parent 060b042 commit bb69836

38 files changed

+71
-84
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [3.3.1] - 2022-12-28
2+
3+
* Fix updating meta for users
4+
* Dependency updates
5+
16
## [3.3.0] - 2022-09-01
27

38
* Dependency updates

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 2-Clause License
22

3-
Copyright (c) 2022, WooSignal Ltd
3+
Copyright (c) 2023, WooSignal Ltd
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In your flutter project add the dependency:
2828
``` dart
2929
dependencies:
3030
...
31-
wp_json_api: ^3.3.0
31+
wp_json_api: ^3.3.1
3232
```
3333

3434
### Usage example #

example/pubspec.lock

+12-19
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.8.2"
10+
version: "2.9.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,21 +21,14 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.2.0"
25-
charcode:
26-
dependency: transitive
27-
description:
28-
name: charcode
29-
url: "https://pub.dartlang.org"
30-
source: hosted
31-
version: "1.3.1"
24+
version: "1.2.1"
3225
clock:
3326
dependency: transitive
3427
description:
3528
name: clock
3629
url: "https://pub.dartlang.org"
3730
source: hosted
38-
version: "1.1.0"
31+
version: "1.1.1"
3932
collection:
4033
dependency: transitive
4134
description:
@@ -49,7 +42,7 @@ packages:
4942
name: fake_async
5043
url: "https://pub.dartlang.org"
5144
source: hosted
52-
version: "1.3.0"
45+
version: "1.3.1"
5346
flutter:
5447
dependency: "direct main"
5548
description: flutter
@@ -80,28 +73,28 @@ packages:
8073
name: matcher
8174
url: "https://pub.dartlang.org"
8275
source: hosted
83-
version: "0.12.11"
76+
version: "0.12.12"
8477
material_color_utilities:
8578
dependency: transitive
8679
description:
8780
name: material_color_utilities
8881
url: "https://pub.dartlang.org"
8982
source: hosted
90-
version: "0.1.4"
83+
version: "0.1.5"
9184
meta:
9285
dependency: transitive
9386
description:
9487
name: meta
9588
url: "https://pub.dartlang.org"
9689
source: hosted
97-
version: "1.7.0"
90+
version: "1.8.0"
9891
path:
9992
dependency: transitive
10093
description:
10194
name: path
10295
url: "https://pub.dartlang.org"
10396
source: hosted
104-
version: "1.8.1"
97+
version: "1.8.2"
10598
sky_engine:
10699
dependency: transitive
107100
description: flutter
@@ -113,7 +106,7 @@ packages:
113106
name: source_span
114107
url: "https://pub.dartlang.org"
115108
source: hosted
116-
version: "1.8.2"
109+
version: "1.9.0"
117110
stack_trace:
118111
dependency: transitive
119112
description:
@@ -134,21 +127,21 @@ packages:
134127
name: string_scanner
135128
url: "https://pub.dartlang.org"
136129
source: hosted
137-
version: "1.1.0"
130+
version: "1.1.1"
138131
term_glyph:
139132
dependency: transitive
140133
description:
141134
name: term_glyph
142135
url: "https://pub.dartlang.org"
143136
source: hosted
144-
version: "1.2.0"
137+
version: "1.2.1"
145138
test_api:
146139
dependency: transitive
147140
description:
148141
name: test_api
149142
url: "https://pub.dartlang.org"
150143
source: hosted
151-
version: "0.4.9"
144+
version: "0.4.12"
152145
typed_data:
153146
dependency: transitive
154147
description:

lib/enums/wp_auth_type.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/enums/wp_meta_data_action_type.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/enums/wp_route_type.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/empty_username_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/existing_user_email_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/existing_user_login_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/incorrect_password_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/invalid_email_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/invalid_nonce_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/invalid_params_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/invalid_user_token_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/invalid_username_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/user_already_exist_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/user_exists_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/username_taken_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/woocommerce_not_found_exception.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/helpers/typedefs.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wc_customer_info_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wc_customer_updated_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_nonce_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_nonce_verified_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_add_role_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_delete_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_info_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_info_updated_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_login_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_register_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_remove_role_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/responses/wp_user_reset_password_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/models/wp_meta_meta.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted
@@ -15,13 +15,13 @@
1515

1616
import 'package:wp_json_api/enums/wp_meta_data_action_type.dart';
1717

18-
class UserMetaDataItem {
18+
class WpMetaData {
1919
String? key;
20-
String? value;
20+
dynamic value;
2121
WPMetaDataActionType action;
2222
int? unique;
2323

24-
UserMetaDataItem(
24+
WpMetaData(
2525
{this.key,
2626
this.value,
2727
this.action = WPMetaDataActionType.Update,

lib/networking/network_manager.dart

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted
@@ -73,11 +73,6 @@ class WPAppNetworkManager {
7373
// Get nonce from WordPress
7474
WPNonceResponse wpNonceResponse = await wpNonce();
7575

76-
// throw exception if there's an error
77-
if (!(wpNonceResponse is WPNonceResponse)) {
78-
throw new InvalidNonceException();
79-
}
80-
8176
// Creates payload for login
8277
Map<String, dynamic> payload = {};
8378
if (username != null) payload["username"] = username;
@@ -120,11 +115,6 @@ class WPAppNetworkManager {
120115
// Get nonce from WordPress
121116
WPNonceResponse wpNonceResponse = await wpNonce();
122117

123-
// throw exception if nonce null
124-
if (!(wpNonceResponse is WPNonceResponse)) {
125-
throw InvalidNonceException();
126-
}
127-
128118
// Creates payload for register
129119
Map<String, dynamic> payload = {
130120
"email": email,
@@ -205,23 +195,22 @@ class WPAppNetworkManager {
205195

206196
/// Sends a request to update details for a WordPress user. Include a valid
207197
/// [userToken] to send a successful request. Optional parameters include
208-
/// a [firstName], [lastName], [displayName] and [UserMetaDataItem] to update
209-
/// meta data on the user.
198+
/// a [firstName], [lastName], [displayName] or [metaData] to update user's.
210199
///
211200
/// Returns a [WPUserInfoUpdatedResponse] future.
212201
/// Throws an [Exception] if fails.
213202
Future<WPUserInfoUpdatedResponse> wpUpdateUserInfo(userToken,
214203
{String? firstName,
215204
String? lastName,
216205
String? displayName,
217-
List<UserMetaDataItem>? wpUserMetaData}) async {
206+
List<WpMetaData>? metaData}) async {
218207
Map<String, dynamic> payload = {};
219208
if (firstName != null) payload["first_name"] = firstName;
220209
if (lastName != null) payload["last_name"] = lastName;
221210
if (displayName != null) payload["display_name"] = displayName;
222-
if (wpUserMetaData != null) {
211+
if (metaData != null) {
223212
payload['meta_data'] = {
224-
"items": wpUserMetaData.map((e) => e.toJson()).toList()
213+
"items": metaData.map((e) => e.toJson()).toList()
225214
};
226215
}
227216

lib/wp_json_api.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, WooSignal Ltd.
1+
// Copyright (c) 2023, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

0 commit comments

Comments
 (0)