TheM4hd1 / SwiftyInsta

Instagram Private API Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modifying thread_message_limit when requesting the Inbox

mycroftcanner opened this issue · comments

Hi,

I am attempting to increase the number of messages returned per thread when fetching the inbox.

In Swiftagram I see a value set as such with the .query.modifier:

["thread_message_limit": "10"]

How can we add this same functionality to SwiftyInsta?

I tried adding it to the body and headers parameter for the inbox function but that didn't seem to work.

Any ideas?

public final class MessageHandler: Handler {
    /// Get the user's inbox.
    public func inbox(with paginationParameters: PaginationParameters,
                      updateHandler: PaginationUpdateHandler<Thread, AnyPaginatedResponse>?,
                      completionHandler: @escaping PaginationCompletionHandler<Thread>) {
        let body = ["thread_message_limit": "10"]
      
        pages.request(Thread.self,
                      page: AnyPaginatedResponse.self,
                      with: paginationParameters,
                      endpoint: { Endpoint.Direct.inbox.next($0.nextMaxId) },
                      body: { _ in
                        .parameters(body)
                      },
                      headers: { _ in
                        body
                      },
                      next: { $0.inbox.oldestCursor.string },
                      splice: { $0.rawResponse.inbox.threads.array?.compactMap(Thread.init) ?? [] },
                      update: updateHandler,
                      completion: completionHandler)
    }

Hey @mycroftcanner,

This repo is not currenlty maintained.
Please refer to #244 for more info on alternatives or how you can help.

For crashes alone, please reply under this by mentioning @sbertix.
If no exception is ever raised in your code and the feature is simply not behaving as expected or as it used to, this will likely not be fixed at the moment.
Your issue, however, will not be closed, in hopes of SwiftyInsta being maintained again.