Paginator

public class Paginator<T> where T : Decodable, T : Encodable

This class handles pagination of the GitLab API.

The pages can be retrieved using subscript. The subscript supports index and also a range. Sample code:

 let paginator = client.users.getUsers()
let usersObservable = p[2...5]
usersObservable.subscribe(onNext: { users in
  // do something with users
})
  • Returns and Observable of the total number pages on given endpoint

    Declaration

    Swift

    public var totalPages: Observable<Int> { get }
  • Returns and Observable of the total number of objects on given endpoint

    Declaration

    Swift

    public var totalItems: Observable<Int> { get }
  • Enables using index for loading a page

    Declaration

    Swift

    public subscript(index: Int) -> Observable<[T]> { get }

    Parameters

    index

    index of the desired page

  • Enables using a range for loading a page

    Declaration

    Swift

    public subscript(range: Range<Int>) -> Observable<[T]> { get }

    Parameters

    range

    Range

  • Enables using a closed range for loading a page

    Declaration

    Swift

    public subscript(closedRange: ClosedRange<Int>) -> Observable<[T]> { get }

    Parameters

    closedRange

    closed range

  • Loads all items from the endpoint

    Declaration

    Swift

    public func loadAll() -> Observable<[T]>