msgraph-sdk-ruby icon indicating copy to clipboard operation
msgraph-sdk-ruby copied to clipboard

Support for $top and $skip

Open rishav opened this issue 5 years ago • 5 comments

Is there a reason that there is lack of support of skip and top parameters? I am guessing it could be overriden with next_link parameters, but providing that ability would be nice.

Also I see that the code doesn't support filtering and ordering at the same time. Is that intentional ? I don't understand why that is, given the lack of documentation.

rishav avatar Aug 23 '18 22:08 rishav

@rishav Unfortunately these shortcomings are mostly due to lack of resources available to work on our Ruby SDK. Our developers are currently prioritized elsewhere.

darrelmiller avatar Aug 23 '18 22:08 darrelmiller

@darrelmiller thanks for the response. Would it be cool if we helped out ? My team and I are definitely considering using this gem and that might mean adding a few features that we need. We might need some minor support in terms answering some architectural / design / product related questions

rishav avatar Aug 23 '18 23:08 rishav

@rishav Absolutely, we welcome community assistance. We are currently doing some architectural re-alignment to try and bring a bit more flexibility into the SDKs. I have been starting to collect together architectural and design requirements for all the SDKs here https://GitHub.com/microsoftgraph/msgraph-sdk-design

darrelmiller avatar Aug 24 '18 02:08 darrelmiller

@rishav have you done some work on your side to get top/skip parameters passed?

kamaradclimber avatar Jan 27 '19 12:01 kamaradclimber

@rishav and @kamaradclimber I had success applying the following MonkeyPatch to the gem in my project:

module MicrosoftGraphExtensions
  module CollectionAssociation
    def all(page_size = 500)
      @page_size = page_size
      to_a
    end

    MicrosoftGraph::CollectionAssociation.send(:alias_method, :original_query_path, :query_path)
    def query_path
      path = original_query_path
      if @page_size.present?
        path += path.include?('?') ? '&' : '?'
        path += "$top=#{@page_size}"
      end
      path
    end

    # Note, removing maximum of 1000 from original line: @loaded || @internal_values.size >= 1000
    def last?
      @loaded
    end
  end
end

class MicrosoftGraph
  class CollectionAssociation
    prepend MicrosoftGraphExtensions::CollectionAssociation
  end
end

amitkoren avatar Feb 23 '19 00:02 amitkoren