@ -115,7 +115,7 @@ public final class OpenGroupAPI: NSObject {
// TODO: L i m i t ?
// TODO: L i m i t ?
// q u e r y P a r a m e t e r s : [ . l i m i t : 2 5 6 ]
// q u e r y P a r a m e t e r s : [ . l i m i t : 2 5 6 ]
) ,
) ,
responseType : [ DirectMessage ] .self
responseType : [ DirectMessage ] ? .self // ' i n b o x S i n c e ' w i l l r e t u r n a ` 3 0 4 ` w i t h a n e m p t y r e s p o n s e i f n o m e s s a g e s
)
)
)
)
@ -507,30 +507,30 @@ public final class OpenGroupAPI: NSObject {
// / m e t h o d , i n o r d e r t o c a l l t h i s d i r e c t l y r e m o v e t h e ` @ a v a i l a b l e ` l i n e a n d m a k e s u r e t o r o u t e t h e r e s p o n s e o f t h i s m e t h o d t o t h e
// / m e t h o d , i n o r d e r t o c a l l t h i s d i r e c t l y r e m o v e t h e ` @ a v a i l a b l e ` l i n e a n d m a k e s u r e t o r o u t e t h e r e s p o n s e o f t h i s m e t h o d t o t h e
// / ` O p e n G r o u p M a n a g e r . h a n d l e I n b o x ` m e t h o d t o e n s u r e t h i n g s a r e p r o c e s s e d c o r r e c t l y
// / ` O p e n G r o u p M a n a g e r . h a n d l e I n b o x ` m e t h o d t o e n s u r e t h i n g s a r e p r o c e s s e d c o r r e c t l y
@ available ( * , unavailable , message : " Avoid using this directly, use the pre-build `poll()` method instead " )
@ available ( * , unavailable , message : " Avoid using this directly, use the pre-build `poll()` method instead " )
public static func inbox ( on server : String , using dependencies : Dependencies = Dependencies ( ) ) -> Promise < ( OnionRequestResponseInfoType , [ DirectMessage ] )> {
public static func inbox ( on server : String , using dependencies : Dependencies = Dependencies ( ) ) -> Promise < ( OnionRequestResponseInfoType , [ DirectMessage ] ? )> {
let request : Request = Request < NoBody > (
let request : Request = Request < NoBody > (
server : server ,
server : server ,
endpoint : . inbox
endpoint : . inbox
)
)
return send ( request , using : dependencies )
return send ( request , using : dependencies )
. decoded ( as : [ DirectMessage ] .self , on : OpenGroupAPI . workQueue , error : Error . parsingFailed , using : dependencies )
. decoded ( as : [ DirectMessage ] ? .self , on : OpenGroupAPI . workQueue , error : Error . parsingFailed , using : dependencies )
}
}
// / P o l l s f o r a n y D M s r e c e i v e d s i n c e t h e g i v e n i d
// / P o l l s f o r a n y D M s r e c e i v e d s i n c e t h e g i v e n i d , t h i s m e t h o d w i l l r e t u r n a ` 3 0 4 ` w i t h a n e m p t y r e s p o n s e i f t h e r e a r e n o m e s s a g e s
// /
// /
// / * * N o t e : * * T h i s i s t h e d i r e c t r e q u e s t t o r e t r i e v e m e s s a g e s r e q u e s t s f o r a s p e c i f i c O p e n G r o u p s i n c e a g i v e n m e s s a g e s s o s h o u l d b e r e t r i e v e d
// / * * N o t e : * * T h i s i s t h e d i r e c t r e q u e s t t o r e t r i e v e m e s s a g e s r e q u e s t s f o r a s p e c i f i c O p e n G r o u p s i n c e a g i v e n m e s s a g e s s o s h o u l d b e r e t r i e v e d
// / a u t o m a t i c a l l y f r o m t h e ` p o l l ( ) ` m e t h o d , i n o r d e r t o c a l l t h i s d i r e c t l y r e m o v e t h e ` @ a v a i l a b l e ` l i n e a n d m a k e s u r e t o r o u t e t h e r e s p o n s e
// / a u t o m a t i c a l l y f r o m t h e ` p o l l ( ) ` m e t h o d , i n o r d e r t o c a l l t h i s d i r e c t l y r e m o v e t h e ` @ a v a i l a b l e ` l i n e a n d m a k e s u r e t o r o u t e t h e r e s p o n s e
// / o f t h i s m e t h o d t o t h e ` O p e n G r o u p M a n a g e r . h a n d l e I n b o x ` m e t h o d t o e n s u r e t h i n g s a r e p r o c e s s e d c o r r e c t l y
// / o f t h i s m e t h o d t o t h e ` O p e n G r o u p M a n a g e r . h a n d l e I n b o x ` m e t h o d t o e n s u r e t h i n g s a r e p r o c e s s e d c o r r e c t l y
@ available ( * , unavailable , message : " Avoid using this directly, use the pre-build `poll()` method instead " )
@ available ( * , unavailable , message : " Avoid using this directly, use the pre-build `poll()` method instead " )
public static func inboxSince ( id : Int64 , on server : String , using dependencies : Dependencies = Dependencies ( ) ) -> Promise < ( OnionRequestResponseInfoType , [ DirectMessage ] )> {
public static func inboxSince ( id : Int64 , on server : String , using dependencies : Dependencies = Dependencies ( ) ) -> Promise < ( OnionRequestResponseInfoType , [ DirectMessage ] ? )> {
let request : Request = Request < NoBody > (
let request : Request = Request < NoBody > (
server : server ,
server : server ,
endpoint : . inboxSince ( id : id )
endpoint : . inboxSince ( id : id )
)
)
return send ( request , using : dependencies )
return send ( request , using : dependencies )
. decoded ( as : [ DirectMessage ] .self , on : OpenGroupAPI . workQueue , error : Error . parsingFailed , using : dependencies )
. decoded ( as : [ DirectMessage ] ? .self , on : OpenGroupAPI . workQueue , error : Error . parsingFailed , using : dependencies )
}
}
// / D e l i v e r s a d i r e c t m e s s a g e t o a u s e r v i a t h e i r b l i n d e d S e s s i o n I D
// / D e l i v e r s a d i r e c t m e s s a g e t o a u s e r v i a t h e i r b l i n d e d S e s s i o n I D