@atomic-solutions/wordpress-api-client 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.cjs +10 -321
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -312
- package/dist/client/index.js.map +1 -1
- package/dist/http/index.d.cts +3 -3
- package/dist/http/index.d.ts +3 -3
- package/dist/index.cjs +143 -422
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -381
- package/dist/index.js.map +1 -1
- package/dist/testing/index.cjs +10 -321
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +1 -312
- package/dist/testing/index.js.map +1 -1
- package/dist/{types-BTo088EY.d.cts → types-TIxx-tHQ.d.cts} +1 -1
- package/dist/{types-8pbwmNdu.d.ts → types-Yb4991oO.d.ts} +1 -1
- package/package.json +4 -6
- package/dist/schemas/index.cjs +0 -414
- package/dist/schemas/index.cjs.map +0 -1
- package/dist/schemas/index.d.cts +0 -1339
- package/dist/schemas/index.d.ts +0 -1339
- package/dist/schemas/index.js +0 -376
- package/dist/schemas/index.js.map +0 -1
- package/dist/user.schema-eeUHQ4sI.d.cts +0 -10614
- package/dist/user.schema-eeUHQ4sI.d.ts +0 -10614
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
|
-
var
|
|
4
|
+
var wordpress = require('@atomic-solutions/schemas/wordpress');
|
|
5
|
+
var common = require('@atomic-solutions/schemas/common');
|
|
5
6
|
|
|
6
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
8
|
|
|
@@ -698,384 +699,13 @@ var setupErrorInterceptor = (axiosInstance, config, client) => {
|
|
|
698
699
|
}
|
|
699
700
|
);
|
|
700
701
|
};
|
|
701
|
-
var addressSchema = zod.z.object({
|
|
702
|
-
/** First name */
|
|
703
|
-
first_name: zod.z.string().min(1, "First name is required"),
|
|
704
|
-
/** Last name */
|
|
705
|
-
last_name: zod.z.string().min(1, "Last name is required"),
|
|
706
|
-
/** Company name (optional) */
|
|
707
|
-
company: zod.z.string(),
|
|
708
|
-
/** Address line 1 */
|
|
709
|
-
address_1: zod.z.string().min(1, "Address is required"),
|
|
710
|
-
/** Address line 2 (optional) */
|
|
711
|
-
address_2: zod.z.string(),
|
|
712
|
-
/** City */
|
|
713
|
-
city: zod.z.string().min(1, "City is required"),
|
|
714
|
-
/** State/Province/Region */
|
|
715
|
-
state: zod.z.string(),
|
|
716
|
-
/** Postal code */
|
|
717
|
-
postcode: zod.z.string().min(1, "Postal code is required"),
|
|
718
|
-
/** Country code (ISO 3166-1 alpha-2) */
|
|
719
|
-
country: zod.z.string(),
|
|
720
|
-
/** Phone number */
|
|
721
|
-
phone: zod.z.string().min(1, "Phone number is required")
|
|
722
|
-
});
|
|
723
|
-
var addressSchemaNonMandatory = zod.z.object({
|
|
724
|
-
/** First name */
|
|
725
|
-
first_name: zod.z.string(),
|
|
726
|
-
/** Last name */
|
|
727
|
-
last_name: zod.z.string(),
|
|
728
|
-
/** Company name (optional) */
|
|
729
|
-
company: zod.z.string(),
|
|
730
|
-
/** Address line 1 */
|
|
731
|
-
address_1: zod.z.string(),
|
|
732
|
-
/** Address line 2 (optional) */
|
|
733
|
-
address_2: zod.z.string(),
|
|
734
|
-
/** City */
|
|
735
|
-
city: zod.z.string(),
|
|
736
|
-
/** State/Province/Region */
|
|
737
|
-
state: zod.z.string(),
|
|
738
|
-
/** Postal code */
|
|
739
|
-
postcode: zod.z.string(),
|
|
740
|
-
/** Country code (ISO 3166-1 alpha-2) */
|
|
741
|
-
country: zod.z.string(),
|
|
742
|
-
/** Phone number */
|
|
743
|
-
phone: zod.z.string()
|
|
744
|
-
});
|
|
745
|
-
addressSchema.extend({
|
|
746
|
-
/** Email address (required for billing) */
|
|
747
|
-
email: zod.z.string().email("Valid email is required")
|
|
748
|
-
});
|
|
749
|
-
addressSchemaNonMandatory.extend({
|
|
750
|
-
/** Email address (can be null for guest carts) */
|
|
751
|
-
email: zod.z.string().nullable()
|
|
752
|
-
});
|
|
753
|
-
var moneySchema = zod.z.object({
|
|
754
|
-
/** Currency code (e.g., 'USD', 'EUR', 'BAM') */
|
|
755
|
-
currency_code: zod.z.string(),
|
|
756
|
-
/** Currency symbol (e.g., '$', '€', 'KM') */
|
|
757
|
-
currency_symbol: zod.z.string(),
|
|
758
|
-
/** Number of decimal places (e.g., 2 for dollars/euros) */
|
|
759
|
-
currency_minor_unit: zod.z.number(),
|
|
760
|
-
/** Decimal separator character (e.g., '.', ',') */
|
|
761
|
-
currency_decimal_separator: zod.z.string(),
|
|
762
|
-
/** Thousands separator character (e.g., ',', '.') */
|
|
763
|
-
currency_thousand_separator: zod.z.string(),
|
|
764
|
-
/** Currency symbol prefix (empty if symbol is suffix) */
|
|
765
|
-
currency_prefix: zod.z.string(),
|
|
766
|
-
/** Currency symbol suffix (empty if symbol is prefix) */
|
|
767
|
-
currency_suffix: zod.z.string()
|
|
768
|
-
});
|
|
769
|
-
var paginationParamsSchema = zod.z.object({
|
|
770
|
-
/** Current page number */
|
|
771
|
-
page: zod.z.number().int().positive().optional(),
|
|
772
|
-
/** Items per page */
|
|
773
|
-
per_page: zod.z.number().int().positive().max(100).optional(),
|
|
774
|
-
/** Offset for pagination */
|
|
775
|
-
offset: zod.z.number().int().nonnegative().optional(),
|
|
776
|
-
/** Sort order */
|
|
777
|
-
order: zod.z.enum(["asc", "desc"]).optional(),
|
|
778
|
-
/** Field to sort by */
|
|
779
|
-
orderby: zod.z.string().optional()
|
|
780
|
-
});
|
|
781
|
-
zod.z.object({
|
|
782
|
-
/** Total number of items */
|
|
783
|
-
total: zod.z.number(),
|
|
784
|
-
/** Total number of pages */
|
|
785
|
-
totalPages: zod.z.number(),
|
|
786
|
-
/** Current page */
|
|
787
|
-
currentPage: zod.z.number(),
|
|
788
|
-
/** Items per page */
|
|
789
|
-
perPage: zod.z.number()
|
|
790
|
-
});
|
|
791
|
-
var JwtLoginInputSchema = zod.z.object({
|
|
792
|
-
username: zod.z.string(),
|
|
793
|
-
password: zod.z.string()
|
|
794
|
-
});
|
|
795
|
-
var JwtTokenResponseSchema = zod.z.object({
|
|
796
|
-
token: zod.z.string(),
|
|
797
|
-
user_email: zod.z.string(),
|
|
798
|
-
user_nicename: zod.z.string(),
|
|
799
|
-
user_display_name: zod.z.string()
|
|
800
|
-
});
|
|
801
|
-
var JwtValidateResponseSchema = zod.z.object({
|
|
802
|
-
code: zod.z.string(),
|
|
803
|
-
data: zod.z.object({
|
|
804
|
-
status: zod.z.number()
|
|
805
|
-
})
|
|
806
|
-
});
|
|
807
|
-
var JwtErrorResponseSchema = zod.z.object({
|
|
808
|
-
code: zod.z.string(),
|
|
809
|
-
message: zod.z.string(),
|
|
810
|
-
data: zod.z.object({
|
|
811
|
-
status: zod.z.number()
|
|
812
|
-
}).optional()
|
|
813
|
-
});
|
|
814
|
-
var RenderedContentSchema = zod.z.object({
|
|
815
|
-
rendered: zod.z.string(),
|
|
816
|
-
protected: zod.z.boolean().optional()
|
|
817
|
-
});
|
|
818
|
-
var GuidSchema = zod.z.object({
|
|
819
|
-
rendered: zod.z.string()
|
|
820
|
-
});
|
|
821
|
-
var PostStatusSchema = zod.z.enum([
|
|
822
|
-
"publish",
|
|
823
|
-
"future",
|
|
824
|
-
"draft",
|
|
825
|
-
"pending",
|
|
826
|
-
"private",
|
|
827
|
-
"trash",
|
|
828
|
-
"auto-draft",
|
|
829
|
-
"inherit"
|
|
830
|
-
]);
|
|
831
|
-
var HalLinkItemSchema = zod.z.object({
|
|
832
|
-
href: zod.z.string(),
|
|
833
|
-
embeddable: zod.z.boolean().optional(),
|
|
834
|
-
templated: zod.z.boolean().optional()
|
|
835
|
-
});
|
|
836
|
-
var HalLinksSchema = zod.z.object({
|
|
837
|
-
self: zod.z.array(HalLinkItemSchema).optional(),
|
|
838
|
-
collection: zod.z.array(HalLinkItemSchema).optional(),
|
|
839
|
-
about: zod.z.array(HalLinkItemSchema).optional(),
|
|
840
|
-
author: zod.z.array(HalLinkItemSchema).optional(),
|
|
841
|
-
replies: zod.z.array(HalLinkItemSchema).optional(),
|
|
842
|
-
"wp:featuredmedia": zod.z.array(HalLinkItemSchema).optional(),
|
|
843
|
-
"wp:attachment": zod.z.array(HalLinkItemSchema).optional(),
|
|
844
|
-
"wp:term": zod.z.array(HalLinkItemSchema).optional(),
|
|
845
|
-
"wp:post_type": zod.z.array(HalLinkItemSchema).optional(),
|
|
846
|
-
curies: zod.z.array(
|
|
847
|
-
zod.z.object({
|
|
848
|
-
name: zod.z.string(),
|
|
849
|
-
href: zod.z.string(),
|
|
850
|
-
templated: zod.z.boolean()
|
|
851
|
-
})
|
|
852
|
-
).optional()
|
|
853
|
-
}).passthrough();
|
|
854
|
-
var WordPressBaseSchema = zod.z.object({
|
|
855
|
-
id: zod.z.number(),
|
|
856
|
-
date: zod.z.string(),
|
|
857
|
-
date_gmt: zod.z.string(),
|
|
858
|
-
modified: zod.z.string(),
|
|
859
|
-
modified_gmt: zod.z.string(),
|
|
860
|
-
slug: zod.z.string(),
|
|
861
|
-
status: zod.z.string(),
|
|
862
|
-
type: zod.z.string(),
|
|
863
|
-
link: zod.z.string(),
|
|
864
|
-
_links: HalLinksSchema.optional()
|
|
865
|
-
});
|
|
866
|
-
var CategorySchema = zod.z.object({
|
|
867
|
-
id: zod.z.number(),
|
|
868
|
-
count: zod.z.number(),
|
|
869
|
-
description: zod.z.string().optional(),
|
|
870
|
-
link: zod.z.string(),
|
|
871
|
-
name: zod.z.string(),
|
|
872
|
-
slug: zod.z.string(),
|
|
873
|
-
taxonomy: zod.z.string(),
|
|
874
|
-
parent: zod.z.number(),
|
|
875
|
-
meta: zod.z.any().optional(),
|
|
876
|
-
_links: HalLinksSchema.optional()
|
|
877
|
-
});
|
|
878
|
-
var CategoriesListSchema = zod.z.array(CategorySchema);
|
|
879
|
-
var CategoryParamsSchema = paginationParamsSchema.extend({
|
|
880
|
-
context: zod.z.enum(["view", "embed", "edit"]).optional(),
|
|
881
|
-
search: zod.z.string().optional(),
|
|
882
|
-
exclude: zod.z.array(zod.z.number()).optional(),
|
|
883
|
-
include: zod.z.array(zod.z.number()).optional(),
|
|
884
|
-
hide_empty: zod.z.boolean().optional(),
|
|
885
|
-
parent: zod.z.number().optional(),
|
|
886
|
-
post: zod.z.number().optional(),
|
|
887
|
-
slug: zod.z.string().optional()
|
|
888
|
-
});
|
|
889
|
-
var TagSchema = zod.z.object({
|
|
890
|
-
id: zod.z.number(),
|
|
891
|
-
count: zod.z.number(),
|
|
892
|
-
description: zod.z.string().optional(),
|
|
893
|
-
link: zod.z.string(),
|
|
894
|
-
name: zod.z.string(),
|
|
895
|
-
slug: zod.z.string(),
|
|
896
|
-
taxonomy: zod.z.string(),
|
|
897
|
-
meta: zod.z.any().optional(),
|
|
898
|
-
_links: HalLinksSchema.optional()
|
|
899
|
-
});
|
|
900
|
-
var TagsListSchema = zod.z.array(TagSchema);
|
|
901
|
-
var MediaSizeSchema = zod.z.object({
|
|
902
|
-
file: zod.z.string(),
|
|
903
|
-
width: zod.z.number(),
|
|
904
|
-
height: zod.z.number(),
|
|
905
|
-
filesize: zod.z.number().optional(),
|
|
906
|
-
mime_type: zod.z.string(),
|
|
907
|
-
source_url: zod.z.string()
|
|
908
|
-
});
|
|
909
|
-
var MediaSizesSchema = zod.z.object({
|
|
910
|
-
thumbnail: MediaSizeSchema.optional(),
|
|
911
|
-
medium: MediaSizeSchema.optional(),
|
|
912
|
-
medium_large: MediaSizeSchema.optional(),
|
|
913
|
-
large: MediaSizeSchema.optional(),
|
|
914
|
-
full: MediaSizeSchema.optional()
|
|
915
|
-
}).passthrough();
|
|
916
|
-
var ImageMetaSchema = zod.z.object({
|
|
917
|
-
aperture: zod.z.string().optional(),
|
|
918
|
-
credit: zod.z.string().optional(),
|
|
919
|
-
camera: zod.z.string().optional(),
|
|
920
|
-
caption: zod.z.string().optional(),
|
|
921
|
-
created_timestamp: zod.z.string().optional(),
|
|
922
|
-
copyright: zod.z.string().optional(),
|
|
923
|
-
focal_length: zod.z.string().optional(),
|
|
924
|
-
iso: zod.z.string().optional(),
|
|
925
|
-
shutter_speed: zod.z.string().optional(),
|
|
926
|
-
title: zod.z.string().optional(),
|
|
927
|
-
orientation: zod.z.string().optional(),
|
|
928
|
-
keywords: zod.z.array(zod.z.string()).optional()
|
|
929
|
-
});
|
|
930
|
-
var MediaDetailsSchema = zod.z.object({
|
|
931
|
-
width: zod.z.number(),
|
|
932
|
-
height: zod.z.number(),
|
|
933
|
-
file: zod.z.string(),
|
|
934
|
-
filesize: zod.z.number().optional(),
|
|
935
|
-
sizes: MediaSizesSchema,
|
|
936
|
-
image_meta: ImageMetaSchema.optional()
|
|
937
|
-
});
|
|
938
|
-
var MediaSchema = zod.z.object({
|
|
939
|
-
id: zod.z.number(),
|
|
940
|
-
date: zod.z.string(),
|
|
941
|
-
date_gmt: zod.z.string(),
|
|
942
|
-
guid: GuidSchema,
|
|
943
|
-
modified: zod.z.string(),
|
|
944
|
-
modified_gmt: zod.z.string(),
|
|
945
|
-
slug: zod.z.string(),
|
|
946
|
-
status: zod.z.string(),
|
|
947
|
-
type: zod.z.string(),
|
|
948
|
-
link: zod.z.string(),
|
|
949
|
-
title: RenderedContentSchema,
|
|
950
|
-
author: zod.z.number(),
|
|
951
|
-
comment_status: zod.z.string(),
|
|
952
|
-
ping_status: zod.z.string(),
|
|
953
|
-
template: zod.z.string().optional(),
|
|
954
|
-
meta: zod.z.any().optional(),
|
|
955
|
-
description: RenderedContentSchema,
|
|
956
|
-
caption: RenderedContentSchema,
|
|
957
|
-
alt_text: zod.z.string(),
|
|
958
|
-
media_type: zod.z.string(),
|
|
959
|
-
mime_type: zod.z.string(),
|
|
960
|
-
media_details: MediaDetailsSchema,
|
|
961
|
-
post: zod.z.number().nullable(),
|
|
962
|
-
source_url: zod.z.string(),
|
|
963
|
-
_links: HalLinksSchema.optional()
|
|
964
|
-
});
|
|
965
|
-
var MediaListSchema = zod.z.array(MediaSchema);
|
|
966
|
-
var PostSchema = zod.z.object({
|
|
967
|
-
id: zod.z.number(),
|
|
968
|
-
date: zod.z.string(),
|
|
969
|
-
date_gmt: zod.z.string(),
|
|
970
|
-
guid: GuidSchema,
|
|
971
|
-
modified: zod.z.string(),
|
|
972
|
-
modified_gmt: zod.z.string(),
|
|
973
|
-
slug: zod.z.string(),
|
|
974
|
-
status: zod.z.string(),
|
|
975
|
-
type: zod.z.string(),
|
|
976
|
-
link: zod.z.string(),
|
|
977
|
-
title: RenderedContentSchema,
|
|
978
|
-
content: RenderedContentSchema,
|
|
979
|
-
excerpt: RenderedContentSchema,
|
|
980
|
-
author: zod.z.number(),
|
|
981
|
-
featured_media: zod.z.number(),
|
|
982
|
-
comment_status: zod.z.string(),
|
|
983
|
-
ping_status: zod.z.string(),
|
|
984
|
-
sticky: zod.z.boolean(),
|
|
985
|
-
template: zod.z.string(),
|
|
986
|
-
format: zod.z.string(),
|
|
987
|
-
meta: zod.z.any().optional(),
|
|
988
|
-
categories: zod.z.array(zod.z.number()),
|
|
989
|
-
tags: zod.z.array(zod.z.number()).optional(),
|
|
990
|
-
_links: HalLinksSchema.optional()
|
|
991
|
-
});
|
|
992
|
-
var PostsListSchema = zod.z.array(PostSchema);
|
|
993
|
-
var PostParamsSchema = paginationParamsSchema.extend({
|
|
994
|
-
context: zod.z.enum(["view", "embed", "edit"]).optional(),
|
|
995
|
-
search: zod.z.string().optional(),
|
|
996
|
-
after: zod.z.string().optional(),
|
|
997
|
-
before: zod.z.string().optional(),
|
|
998
|
-
author: zod.z.union([zod.z.number(), zod.z.array(zod.z.number())]).optional(),
|
|
999
|
-
author_exclude: zod.z.array(zod.z.number()).optional(),
|
|
1000
|
-
exclude: zod.z.array(zod.z.number()).optional(),
|
|
1001
|
-
include: zod.z.array(zod.z.number()).optional(),
|
|
1002
|
-
categories: zod.z.union([zod.z.number(), zod.z.array(zod.z.number())]).optional(),
|
|
1003
|
-
categories_exclude: zod.z.array(zod.z.number()).optional(),
|
|
1004
|
-
tags: zod.z.union([zod.z.number(), zod.z.array(zod.z.number())]).optional(),
|
|
1005
|
-
tags_exclude: zod.z.array(zod.z.number()).optional(),
|
|
1006
|
-
sticky: zod.z.boolean().optional()
|
|
1007
|
-
});
|
|
1008
|
-
var EmbeddedPostSchema = zod.z.object({
|
|
1009
|
-
id: zod.z.number(),
|
|
1010
|
-
title: zod.z.string(),
|
|
1011
|
-
content: zod.z.string(),
|
|
1012
|
-
featured_image: zod.z.string().optional(),
|
|
1013
|
-
published_date: zod.z.string(),
|
|
1014
|
-
categories: zod.z.array(
|
|
1015
|
-
zod.z.object({
|
|
1016
|
-
id: zod.z.number(),
|
|
1017
|
-
name: zod.z.string(),
|
|
1018
|
-
slug: zod.z.string(),
|
|
1019
|
-
taxonomy: zod.z.string().optional(),
|
|
1020
|
-
description: zod.z.string().optional(),
|
|
1021
|
-
parent: zod.z.number().optional(),
|
|
1022
|
-
count: zod.z.number().optional()
|
|
1023
|
-
})
|
|
1024
|
-
).optional()
|
|
1025
|
-
});
|
|
1026
|
-
var EmbeddedPostsListSchema = zod.z.array(EmbeddedPostSchema);
|
|
1027
|
-
var AvatarUrlsSchema = zod.z.object({
|
|
1028
|
-
"24": zod.z.string().optional(),
|
|
1029
|
-
"48": zod.z.string().optional(),
|
|
1030
|
-
"96": zod.z.string().optional()
|
|
1031
|
-
});
|
|
1032
|
-
var UserSchema = zod.z.object({
|
|
1033
|
-
id: zod.z.number(),
|
|
1034
|
-
username: zod.z.string().optional(),
|
|
1035
|
-
// Only in edit context
|
|
1036
|
-
name: zod.z.string(),
|
|
1037
|
-
first_name: zod.z.string().optional(),
|
|
1038
|
-
last_name: zod.z.string().optional(),
|
|
1039
|
-
email: zod.z.string().optional(),
|
|
1040
|
-
// Only for current user or admin
|
|
1041
|
-
url: zod.z.string(),
|
|
1042
|
-
description: zod.z.string(),
|
|
1043
|
-
link: zod.z.string(),
|
|
1044
|
-
locale: zod.z.string().optional(),
|
|
1045
|
-
// Only for current user
|
|
1046
|
-
nickname: zod.z.string().optional(),
|
|
1047
|
-
// Only in edit context
|
|
1048
|
-
slug: zod.z.string(),
|
|
1049
|
-
registered_date: zod.z.string().optional(),
|
|
1050
|
-
// Only in edit context
|
|
1051
|
-
roles: zod.z.array(zod.z.string()).optional(),
|
|
1052
|
-
// Only in edit context
|
|
1053
|
-
capabilities: zod.z.record(zod.z.boolean()).optional(),
|
|
1054
|
-
// Only in edit context
|
|
1055
|
-
extra_capabilities: zod.z.record(zod.z.boolean()).optional(),
|
|
1056
|
-
// Only in edit context
|
|
1057
|
-
avatar_urls: AvatarUrlsSchema.optional(),
|
|
1058
|
-
meta: zod.z.any().optional(),
|
|
1059
|
-
_links: HalLinksSchema.optional()
|
|
1060
|
-
});
|
|
1061
|
-
var UsersListSchema = zod.z.array(UserSchema);
|
|
1062
|
-
var CurrentUserSchema = UserSchema.extend({
|
|
1063
|
-
username: zod.z.string(),
|
|
1064
|
-
email: zod.z.string(),
|
|
1065
|
-
locale: zod.z.string(),
|
|
1066
|
-
nickname: zod.z.string(),
|
|
1067
|
-
registered_date: zod.z.string(),
|
|
1068
|
-
roles: zod.z.array(zod.z.string())
|
|
1069
|
-
});
|
|
1070
|
-
|
|
1071
|
-
// src/api/auth.ts
|
|
1072
702
|
var createAuthAPI = (axios2, options) => ({
|
|
1073
703
|
/**
|
|
1074
704
|
* Login with username/password and get JWT token
|
|
1075
705
|
*/
|
|
1076
706
|
async login(input) {
|
|
1077
707
|
const response = await axios2.post(ENDPOINTS.JWT_TOKEN, input);
|
|
1078
|
-
return handleApiResponse(response, JwtTokenResponseSchema, options);
|
|
708
|
+
return handleApiResponse(response, wordpress.JwtTokenResponseSchema, options);
|
|
1079
709
|
},
|
|
1080
710
|
/**
|
|
1081
711
|
* Validate current JWT token
|
|
@@ -1091,51 +721,45 @@ var createAuthAPI = (axios2, options) => ({
|
|
|
1091
721
|
}
|
|
1092
722
|
}
|
|
1093
723
|
});
|
|
1094
|
-
|
|
1095
|
-
// src/api/categories.ts
|
|
1096
724
|
var createCategoriesAPI = (axios2, options) => ({
|
|
1097
725
|
/**
|
|
1098
726
|
* Get list of categories with pagination
|
|
1099
727
|
*/
|
|
1100
728
|
async list(params) {
|
|
1101
729
|
const response = await axios2.get(ENDPOINTS.CATEGORIES, { params });
|
|
1102
|
-
return handlePaginatedApiResponse(response, CategoriesListSchema, params, options);
|
|
730
|
+
return handlePaginatedApiResponse(response, wordpress.CategoriesListSchema, params, options);
|
|
1103
731
|
},
|
|
1104
732
|
/**
|
|
1105
733
|
* Get single category by ID
|
|
1106
734
|
*/
|
|
1107
735
|
async get(id) {
|
|
1108
736
|
const response = await axios2.get(ENDPOINTS.CATEGORY(id));
|
|
1109
|
-
return handleApiResponse(response, CategorySchema, options);
|
|
737
|
+
return handleApiResponse(response, wordpress.CategorySchema, options);
|
|
1110
738
|
}
|
|
1111
739
|
});
|
|
1112
|
-
|
|
1113
|
-
// src/api/media.ts
|
|
1114
740
|
var createMediaAPI = (axios2, options) => ({
|
|
1115
741
|
/**
|
|
1116
742
|
* Get single media item by ID
|
|
1117
743
|
*/
|
|
1118
744
|
async get(id) {
|
|
1119
745
|
const response = await axios2.get(ENDPOINTS.MEDIA_ITEM(id));
|
|
1120
|
-
return handleApiResponse(response, MediaSchema, options);
|
|
746
|
+
return handleApiResponse(response, wordpress.MediaSchema, options);
|
|
1121
747
|
}
|
|
1122
748
|
});
|
|
1123
|
-
|
|
1124
|
-
// src/api/posts.ts
|
|
1125
749
|
var createPostsAPI = (axios2, options) => ({
|
|
1126
750
|
/**
|
|
1127
751
|
* Get list of posts with pagination
|
|
1128
752
|
*/
|
|
1129
753
|
async list(params) {
|
|
1130
754
|
const response = await axios2.get(ENDPOINTS.POSTS, { params });
|
|
1131
|
-
return handlePaginatedApiResponse(response, PostsListSchema, params, options);
|
|
755
|
+
return handlePaginatedApiResponse(response, wordpress.PostsListSchema, params, options);
|
|
1132
756
|
},
|
|
1133
757
|
/**
|
|
1134
758
|
* Get single post by ID
|
|
1135
759
|
*/
|
|
1136
760
|
async get(id) {
|
|
1137
761
|
const response = await axios2.get(ENDPOINTS.POST(id));
|
|
1138
|
-
return handleApiResponse(response, PostSchema, options);
|
|
762
|
+
return handleApiResponse(response, wordpress.PostSchema, options);
|
|
1139
763
|
},
|
|
1140
764
|
/**
|
|
1141
765
|
* Get single post by slug
|
|
@@ -1144,26 +768,24 @@ var createPostsAPI = (axios2, options) => ({
|
|
|
1144
768
|
const response = await axios2.get(ENDPOINTS.POSTS, {
|
|
1145
769
|
params: { slug, per_page: 1 }
|
|
1146
770
|
});
|
|
1147
|
-
const posts = handleApiResponse(response, PostsListSchema, options);
|
|
771
|
+
const posts = handleApiResponse(response, wordpress.PostsListSchema, options);
|
|
1148
772
|
return posts[0] || null;
|
|
1149
773
|
}
|
|
1150
774
|
});
|
|
1151
|
-
|
|
1152
|
-
// src/api/users.ts
|
|
1153
775
|
var createUsersAPI = (axios2, options) => ({
|
|
1154
776
|
/**
|
|
1155
777
|
* Get current authenticated user
|
|
1156
778
|
*/
|
|
1157
779
|
async me() {
|
|
1158
780
|
const response = await axios2.get(ENDPOINTS.USERS_ME);
|
|
1159
|
-
return handleApiResponse(response, CurrentUserSchema, options);
|
|
781
|
+
return handleApiResponse(response, wordpress.CurrentUserSchema, options);
|
|
1160
782
|
},
|
|
1161
783
|
/**
|
|
1162
784
|
* Get user by ID
|
|
1163
785
|
*/
|
|
1164
786
|
async get(id) {
|
|
1165
787
|
const response = await axios2.get(ENDPOINTS.USER(id));
|
|
1166
|
-
return handleApiResponse(response, UserSchema, options);
|
|
788
|
+
return handleApiResponse(response, wordpress.UserSchema, options);
|
|
1167
789
|
}
|
|
1168
790
|
});
|
|
1169
791
|
|
|
@@ -1206,42 +828,141 @@ var createClient = (config) => {
|
|
|
1206
828
|
return client;
|
|
1207
829
|
};
|
|
1208
830
|
|
|
1209
|
-
exports
|
|
1210
|
-
|
|
831
|
+
Object.defineProperty(exports, "AvatarUrlsSchema", {
|
|
832
|
+
enumerable: true,
|
|
833
|
+
get: function () { return wordpress.AvatarUrlsSchema; }
|
|
834
|
+
});
|
|
835
|
+
Object.defineProperty(exports, "CategoriesListSchema", {
|
|
836
|
+
enumerable: true,
|
|
837
|
+
get: function () { return wordpress.CategoriesListSchema; }
|
|
838
|
+
});
|
|
839
|
+
Object.defineProperty(exports, "CategoryParamsSchema", {
|
|
840
|
+
enumerable: true,
|
|
841
|
+
get: function () { return wordpress.CategoryParamsSchema; }
|
|
842
|
+
});
|
|
843
|
+
Object.defineProperty(exports, "CategorySchema", {
|
|
844
|
+
enumerable: true,
|
|
845
|
+
get: function () { return wordpress.CategorySchema; }
|
|
846
|
+
});
|
|
847
|
+
Object.defineProperty(exports, "CurrentUserSchema", {
|
|
848
|
+
enumerable: true,
|
|
849
|
+
get: function () { return wordpress.CurrentUserSchema; }
|
|
850
|
+
});
|
|
851
|
+
Object.defineProperty(exports, "EmbeddedPostSchema", {
|
|
852
|
+
enumerable: true,
|
|
853
|
+
get: function () { return wordpress.EmbeddedPostSchema; }
|
|
854
|
+
});
|
|
855
|
+
Object.defineProperty(exports, "EmbeddedPostsListSchema", {
|
|
856
|
+
enumerable: true,
|
|
857
|
+
get: function () { return wordpress.EmbeddedPostsListSchema; }
|
|
858
|
+
});
|
|
859
|
+
Object.defineProperty(exports, "GuidSchema", {
|
|
860
|
+
enumerable: true,
|
|
861
|
+
get: function () { return wordpress.GuidSchema; }
|
|
862
|
+
});
|
|
863
|
+
Object.defineProperty(exports, "HalLinkItemSchema", {
|
|
864
|
+
enumerable: true,
|
|
865
|
+
get: function () { return wordpress.HalLinkItemSchema; }
|
|
866
|
+
});
|
|
867
|
+
Object.defineProperty(exports, "HalLinksSchema", {
|
|
868
|
+
enumerable: true,
|
|
869
|
+
get: function () { return wordpress.HalLinksSchema; }
|
|
870
|
+
});
|
|
871
|
+
Object.defineProperty(exports, "ImageMetaSchema", {
|
|
872
|
+
enumerable: true,
|
|
873
|
+
get: function () { return wordpress.ImageMetaSchema; }
|
|
874
|
+
});
|
|
875
|
+
Object.defineProperty(exports, "JwtErrorResponseSchema", {
|
|
876
|
+
enumerable: true,
|
|
877
|
+
get: function () { return wordpress.JwtErrorResponseSchema; }
|
|
878
|
+
});
|
|
879
|
+
Object.defineProperty(exports, "JwtLoginInputSchema", {
|
|
880
|
+
enumerable: true,
|
|
881
|
+
get: function () { return wordpress.JwtLoginInputSchema; }
|
|
882
|
+
});
|
|
883
|
+
Object.defineProperty(exports, "JwtTokenResponseSchema", {
|
|
884
|
+
enumerable: true,
|
|
885
|
+
get: function () { return wordpress.JwtTokenResponseSchema; }
|
|
886
|
+
});
|
|
887
|
+
Object.defineProperty(exports, "JwtValidateResponseSchema", {
|
|
888
|
+
enumerable: true,
|
|
889
|
+
get: function () { return wordpress.JwtValidateResponseSchema; }
|
|
890
|
+
});
|
|
891
|
+
Object.defineProperty(exports, "MediaDetailsSchema", {
|
|
892
|
+
enumerable: true,
|
|
893
|
+
get: function () { return wordpress.MediaDetailsSchema; }
|
|
894
|
+
});
|
|
895
|
+
Object.defineProperty(exports, "MediaListSchema", {
|
|
896
|
+
enumerable: true,
|
|
897
|
+
get: function () { return wordpress.MediaListSchema; }
|
|
898
|
+
});
|
|
899
|
+
Object.defineProperty(exports, "MediaSchema", {
|
|
900
|
+
enumerable: true,
|
|
901
|
+
get: function () { return wordpress.MediaSchema; }
|
|
902
|
+
});
|
|
903
|
+
Object.defineProperty(exports, "MediaSizeSchema", {
|
|
904
|
+
enumerable: true,
|
|
905
|
+
get: function () { return wordpress.MediaSizeSchema; }
|
|
906
|
+
});
|
|
907
|
+
Object.defineProperty(exports, "MediaSizesSchema", {
|
|
908
|
+
enumerable: true,
|
|
909
|
+
get: function () { return wordpress.MediaSizesSchema; }
|
|
910
|
+
});
|
|
911
|
+
Object.defineProperty(exports, "PostParamsSchema", {
|
|
912
|
+
enumerable: true,
|
|
913
|
+
get: function () { return wordpress.PostParamsSchema; }
|
|
914
|
+
});
|
|
915
|
+
Object.defineProperty(exports, "PostSchema", {
|
|
916
|
+
enumerable: true,
|
|
917
|
+
get: function () { return wordpress.PostSchema; }
|
|
918
|
+
});
|
|
919
|
+
Object.defineProperty(exports, "PostStatusSchema", {
|
|
920
|
+
enumerable: true,
|
|
921
|
+
get: function () { return wordpress.PostStatusSchema; }
|
|
922
|
+
});
|
|
923
|
+
Object.defineProperty(exports, "PostsListSchema", {
|
|
924
|
+
enumerable: true,
|
|
925
|
+
get: function () { return wordpress.PostsListSchema; }
|
|
926
|
+
});
|
|
927
|
+
Object.defineProperty(exports, "RenderedContentSchema", {
|
|
928
|
+
enumerable: true,
|
|
929
|
+
get: function () { return wordpress.RenderedContentSchema; }
|
|
930
|
+
});
|
|
931
|
+
Object.defineProperty(exports, "TagSchema", {
|
|
932
|
+
enumerable: true,
|
|
933
|
+
get: function () { return wordpress.TagSchema; }
|
|
934
|
+
});
|
|
935
|
+
Object.defineProperty(exports, "TagsListSchema", {
|
|
936
|
+
enumerable: true,
|
|
937
|
+
get: function () { return wordpress.TagsListSchema; }
|
|
938
|
+
});
|
|
939
|
+
Object.defineProperty(exports, "UserSchema", {
|
|
940
|
+
enumerable: true,
|
|
941
|
+
get: function () { return wordpress.UserSchema; }
|
|
942
|
+
});
|
|
943
|
+
Object.defineProperty(exports, "UsersListSchema", {
|
|
944
|
+
enumerable: true,
|
|
945
|
+
get: function () { return wordpress.UsersListSchema; }
|
|
946
|
+
});
|
|
947
|
+
Object.defineProperty(exports, "WordPressBaseSchema", {
|
|
948
|
+
enumerable: true,
|
|
949
|
+
get: function () { return wordpress.WordPressBaseSchema; }
|
|
950
|
+
});
|
|
951
|
+
Object.defineProperty(exports, "AddressSchema", {
|
|
952
|
+
enumerable: true,
|
|
953
|
+
get: function () { return common.addressSchema; }
|
|
954
|
+
});
|
|
955
|
+
Object.defineProperty(exports, "MoneySchema", {
|
|
956
|
+
enumerable: true,
|
|
957
|
+
get: function () { return common.moneySchema; }
|
|
958
|
+
});
|
|
959
|
+
Object.defineProperty(exports, "PaginationParamsSchema", {
|
|
960
|
+
enumerable: true,
|
|
961
|
+
get: function () { return common.paginationParamsSchema; }
|
|
962
|
+
});
|
|
1211
963
|
exports.BaseError = BaseError;
|
|
1212
|
-
exports.CategoriesListSchema = CategoriesListSchema;
|
|
1213
|
-
exports.CategoryParamsSchema = CategoryParamsSchema;
|
|
1214
|
-
exports.CategorySchema = CategorySchema;
|
|
1215
|
-
exports.CurrentUserSchema = CurrentUserSchema;
|
|
1216
964
|
exports.ENDPOINTS = ENDPOINTS;
|
|
1217
|
-
exports.EmbeddedPostSchema = EmbeddedPostSchema;
|
|
1218
|
-
exports.EmbeddedPostsListSchema = EmbeddedPostsListSchema;
|
|
1219
|
-
exports.GuidSchema = GuidSchema;
|
|
1220
|
-
exports.HalLinkItemSchema = HalLinkItemSchema;
|
|
1221
|
-
exports.HalLinksSchema = HalLinksSchema;
|
|
1222
|
-
exports.ImageMetaSchema = ImageMetaSchema;
|
|
1223
|
-
exports.JwtErrorResponseSchema = JwtErrorResponseSchema;
|
|
1224
|
-
exports.JwtLoginInputSchema = JwtLoginInputSchema;
|
|
1225
|
-
exports.JwtTokenResponseSchema = JwtTokenResponseSchema;
|
|
1226
|
-
exports.JwtValidateResponseSchema = JwtValidateResponseSchema;
|
|
1227
|
-
exports.MediaDetailsSchema = MediaDetailsSchema;
|
|
1228
|
-
exports.MediaListSchema = MediaListSchema;
|
|
1229
|
-
exports.MediaSchema = MediaSchema;
|
|
1230
|
-
exports.MediaSizeSchema = MediaSizeSchema;
|
|
1231
|
-
exports.MediaSizesSchema = MediaSizesSchema;
|
|
1232
|
-
exports.MoneySchema = moneySchema;
|
|
1233
|
-
exports.PaginationParamsSchema = paginationParamsSchema;
|
|
1234
|
-
exports.PostParamsSchema = PostParamsSchema;
|
|
1235
|
-
exports.PostSchema = PostSchema;
|
|
1236
|
-
exports.PostStatusSchema = PostStatusSchema;
|
|
1237
|
-
exports.PostsListSchema = PostsListSchema;
|
|
1238
|
-
exports.RenderedContentSchema = RenderedContentSchema;
|
|
1239
|
-
exports.TagSchema = TagSchema;
|
|
1240
|
-
exports.TagsListSchema = TagsListSchema;
|
|
1241
|
-
exports.UserSchema = UserSchema;
|
|
1242
|
-
exports.UsersListSchema = UsersListSchema;
|
|
1243
965
|
exports.WordPressApiError = WordPressApiError;
|
|
1244
|
-
exports.WordPressBaseSchema = WordPressBaseSchema;
|
|
1245
966
|
exports.WordPressDataValidationError = WordPressDataValidationError;
|
|
1246
967
|
exports.calculatePagination = calculatePagination;
|
|
1247
968
|
exports.createClient = createClient;
|