Class: MicrosoftGraph::Sites::SitesRequestBuilder

Inherits:
MicrosoftKiotaAbstractions::BaseRequestBuilder
  • Object
show all
Defined in:
lib/sites/sites_request_builder.rb

Overview

Provides operations to manage the collection of site entities.

Defined Under Namespace

Classes: SitesRequestBuilderGetQueryParameters

Instance Method Summary collapse

Constructor Details

#initialize(path_parameters, request_adapter) ⇒ Object

Instantiates a new SitesRequestBuilder and sets the default values.

Parameters:

  • path_parameters

    Path parameters for the request

  • request_adapter

    The request adapter to use to execute the requests.



55
56
57
# File 'lib/sites/sites_request_builder.rb', line 55

def initialize(path_parameters, request_adapter)
    super(path_parameters, request_adapter, "{+baseurl}/sites{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}")
end

Instance Method Details

#addObject

Provides operations to call the add method.



20
21
22
# File 'lib/sites/sites_request_builder.rb', line 20

def add()
    return MicrosoftGraph::Sites::Add::AddRequestBuilder.new(@path_parameters, @request_adapter)
end

#by_site_id(site_id) ⇒ Object

Provides operations to manage the collection of site entities.

Parameters:

  • site_id

    The unique identifier of site

Returns:

  • a site_item_request_builder

Raises:

  • (StandardError)


43
44
45
46
47
48
# File 'lib/sites/sites_request_builder.rb', line 43

def by_site_id(site_id)
    raise StandardError, 'site_id cannot be null' if site_id.nil?
    url_tpl_params = @path_parameters.clone
    url_tpl_params["site%2Did"] = site_id
    return MicrosoftGraph::Sites::Item::SiteItemRequestBuilder.new(url_tpl_params, @request_adapter)
end

#countObject

Provides operations to count the resources in the collection.



25
26
27
# File 'lib/sites/sites_request_builder.rb', line 25

def count()
    return MicrosoftGraph::Sites::Count::CountRequestBuilder.new(@path_parameters, @request_adapter)
end

#get(request_configuration = nil) ⇒ Object

Search across a SharePoint tenant for [sites][] that match keywords provided. The only property that works for sorting is createdDateTime. The search filter is a free text search that uses multiple properties when retrieving the search results.

Parameters:

  • request_configuration (defaults to: nil)

    Configuration for the request such as headers, query parameters, and middleware options.

Returns:

  • a Fiber of site_collection_response



63
64
65
66
67
68
69
70
71
# File 'lib/sites/sites_request_builder.rb', line 63

def get(request_configuration=nil)
    request_info = self.to_get_request_information(
        request_configuration
    )
    error_mapping = Hash.new
    error_mapping["4XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
    error_mapping["5XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
    return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::SiteCollectionResponse.create_from_discriminator_value(pn) }, error_mapping)
end

#get_all_sitesObject

Provides operations to call the getAllSites method.



30
31
32
# File 'lib/sites/sites_request_builder.rb', line 30

def get_all_sites()
    return MicrosoftGraph::Sites::GetAllSites::GetAllSitesRequestBuilder.new(@path_parameters, @request_adapter)
end

#removeObject

Provides operations to call the remove method.



35
36
37
# File 'lib/sites/sites_request_builder.rb', line 35

def remove()
    return MicrosoftGraph::Sites::Remove::RemoveRequestBuilder.new(@path_parameters, @request_adapter)
end

#to_get_request_information(request_configuration = nil) ⇒ Object

Search across a SharePoint tenant for [sites][] that match keywords provided. The only property that works for sorting is createdDateTime. The search filter is a free text search that uses multiple properties when retrieving the search results.

Parameters:

  • request_configuration (defaults to: nil)

    Configuration for the request such as headers, query parameters, and middleware options.

Returns:

  • a request_information



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/sites/sites_request_builder.rb', line 77

def to_get_request_information(request_configuration=nil)
    request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
    request_info.url_template = @url_template
    request_info.path_parameters = @path_parameters
    request_info.http_method = :GET
    request_info.headers.add('Accept', 'application/json')
    unless request_configuration.nil?
        request_info.add_headers_from_raw_object(request_configuration.headers)
        request_info.set_query_string_parameters_from_raw_object(request_configuration.query_parameters)
        request_info.add_request_options(request_configuration.options)
    end
    return request_info
end