File tree Expand file tree Collapse file tree 5 files changed +80
-0
lines changed
native/swift/Sources/wordpress-api Expand file tree Collapse file tree 5 files changed +80
-0
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,15 @@ public typealias WpUuid = WordPressAPIInternal.WpUuid
14
14
public typealias WpNetworkRequest = WordPressAPIInternal . WpNetworkRequest
15
15
public typealias WpNetworkResponse = WordPressAPIInternal . WpNetworkResponse
16
16
public typealias WpNetworkHeaderMap = WordPressAPIInternal . WpNetworkHeaderMap
17
+ public typealias WpResponseString = WordPressAPIInternal . WpResponseString
17
18
public typealias Middleware = WordPressAPIInternal . WpApiMiddleware
18
19
public typealias MiddlewarePipeline = WordPressAPIInternal . WpApiMiddlewarePipeline
19
20
public typealias MiddlewarePipelineBuilder = WordPressAPIInternal . WpApiMiddlewarePipelineBuilder
20
21
public typealias ApiDiscoveryAuthenticationMiddleware = WordPressAPIInternal . ApiDiscoveryAuthenticationMiddleware
21
22
public typealias RetryAfterMiddleware = WordPressAPIInternal . RetryAfterMiddleware
22
23
public typealias WpApiClientDelegate = WordPressAPIInternal . WpApiClientDelegate
23
24
public typealias WpAppNotifier = WordPressAPIInternal . WpAppNotifier
25
+ public typealias UserAvatarSize = WordPressAPIInternal . UserAvatarSize
24
26
25
27
// MARK: - Login
26
28
Original file line number Diff line number Diff line change @@ -32,3 +32,35 @@ extension MiddlewarePipeline {
32
32
self . init ( middlewares: middlewares)
33
33
}
34
34
}
35
+
36
+ public extension CommentStatus {
37
+ init ( _ status: String ) {
38
+ self = commentStatusFromString ( value: status)
39
+ }
40
+
41
+ var status : String {
42
+ commentStatusToString ( status: self )
43
+ }
44
+ }
45
+
46
+ extension CommentStatus : ExpressibleByStringLiteral {
47
+ public init ( stringLiteral: String ) {
48
+ self . init ( stringLiteral)
49
+ }
50
+ }
51
+
52
+ public extension CommentType {
53
+ init ( _ type: String ) {
54
+ self = commentTypeFromString ( value: type)
55
+ }
56
+
57
+ var type : String {
58
+ commentTypeToString ( commentType: self )
59
+ }
60
+ }
61
+
62
+ extension CommentType : ExpressibleByStringLiteral {
63
+ public init ( stringLiteral: String ) {
64
+ self . init ( stringLiteral)
65
+ }
66
+ }
Original file line number Diff line number Diff line change @@ -248,3 +248,25 @@ extension UsersRequestExecutor: PaginationAwareExecutor {
248
248
public typealias ViewContextResponseType = UsersRequestListWithViewContextResponse
249
249
public typealias EmbedContextResponseType = UsersRequestListWithEmbedContextResponse
250
250
}
251
+
252
+ // MARK: - Comments
253
+ extension CommentsRequestListWithEditContextResponse : PaginatableResponse , @unchecked Sendable {
254
+ public typealias ParamsType = CommentListParams
255
+ public typealias DataType = CommentWithEditContext
256
+ }
257
+
258
+ extension CommentsRequestListWithViewContextResponse : PaginatableResponse , @unchecked Sendable {
259
+ public typealias ParamsType = CommentListParams
260
+ public typealias DataType = CommentWithViewContext
261
+ }
262
+
263
+ extension CommentsRequestListWithEmbedContextResponse : PaginatableResponse , @unchecked Sendable {
264
+ public typealias ParamsType = CommentListParams
265
+ public typealias DataType = CommentWithEmbedContext
266
+ }
267
+
268
+ extension CommentsRequestExecutor : PaginationAwareExecutor {
269
+ public typealias EditContextResponseType = CommentsRequestListWithEditContextResponse
270
+ public typealias ViewContextResponseType = CommentsRequestListWithViewContextResponse
271
+ public typealias EmbedContextResponseType = CommentsRequestListWithEmbedContextResponse
272
+ }
Original file line number Diff line number Diff line change @@ -99,6 +99,10 @@ public actor WordPressAPI {
99
99
self . requestBuilder. posts ( )
100
100
}
101
101
102
+ public var comments : CommentsRequestExecutor {
103
+ self . requestBuilder. comments ( )
104
+ }
105
+
102
106
public var media : MediaRequestExecutor {
103
107
self . requestBuilder. media ( )
104
108
}
Original file line number Diff line number Diff line change @@ -579,6 +579,26 @@ pub enum CommentStatus {
579
579
580
580
impl_as_query_value_from_to_string ! ( CommentStatus ) ;
581
581
582
+ #[ uniffi:: export]
583
+ fn comment_status_from_string ( value : String ) -> CommentStatus {
584
+ CommentStatus :: from_str ( value. as_str ( ) ) . unwrap_or ( CommentStatus :: Custom ( value) )
585
+ }
586
+
587
+ #[ uniffi:: export]
588
+ fn comment_status_to_string ( status : CommentStatus ) -> String {
589
+ status. to_string ( )
590
+ }
591
+
592
+ #[ uniffi:: export]
593
+ fn comment_type_from_string ( value : String ) -> CommentType {
594
+ CommentType :: from_str ( value. as_str ( ) ) . unwrap_or ( CommentType :: Custom ( value) )
595
+ }
596
+
597
+ #[ uniffi:: export]
598
+ fn comment_type_to_string ( comment_type : CommentType ) -> String {
599
+ comment_type. to_string ( )
600
+ }
601
+
582
602
#[ cfg( test) ]
583
603
mod tests {
584
604
use super :: * ;
You can’t perform that action at this time.
0 commit comments