Class: MicrosoftGraph::Drives::Item::DriveItemRequestBuilder

Inherits:
MicrosoftKiotaAbstractions::BaseRequestBuilder
  • Object
show all
Defined in:
lib/drives/item/drive_item_request_builder.rb

Overview

Provides operations to manage the collection of drive entities.

Defined Under Namespace

Classes: DriveItemRequestBuilderGetQueryParameters

Instance Method Summary collapse

Constructor Details

#initialize(path_parameters, request_adapter) ⇒ Object

Instantiates a new DriveItemRequestBuilder and sets the default values.

Parameters:

  • path_parameters

    Path parameters for the request

  • request_adapter

    The request adapter to use to execute the requests.



82
83
84
# File 'lib/drives/item/drive_item_request_builder.rb', line 82

def initialize(path_parameters, request_adapter)
    super(path_parameters, request_adapter, "{+baseurl}/drives/{drive%2Did}{?%24select,%24expand}")
end

Instance Method Details

#bundlesObject

Provides operations to manage the bundles property of the microsoft.graph.drive entity.



28
29
30
# File 'lib/drives/item/drive_item_request_builder.rb', line 28

def bundles()
    return MicrosoftGraph::Drives::Item::Bundles::BundlesRequestBuilder.new(@path_parameters, @request_adapter)
end

#created_by_userObject

Provides operations to manage the createdByUser property of the microsoft.graph.baseItem entity.



33
34
35
# File 'lib/drives/item/drive_item_request_builder.rb', line 33

def created_by_user()
    return MicrosoftGraph::Drives::Item::CreatedByUser::CreatedByUserRequestBuilder.new(@path_parameters, @request_adapter)
end

#delete(request_configuration = nil) ⇒ Object

Delete entity from drives

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of void



90
91
92
93
94
95
96
97
98
# File 'lib/drives/item/drive_item_request_builder.rb', line 90

def delete(request_configuration=nil)
    request_info = self.to_delete_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, nil, error_mapping)
end

#followingObject

Provides operations to manage the following property of the microsoft.graph.drive entity.



38
39
40
# File 'lib/drives/item/drive_item_request_builder.rb', line 38

def following()
    return MicrosoftGraph::Drives::Item::Following::FollowingRequestBuilder.new(@path_parameters, @request_adapter)
end

#get(request_configuration = nil) ⇒ Object

Get entity from drives by key

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of drive



104
105
106
107
108
109
110
111
112
# File 'lib/drives/item/drive_item_request_builder.rb', line 104

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::Drive.create_from_discriminator_value(pn) }, error_mapping)
end

#itemsObject

Provides operations to manage the items property of the microsoft.graph.drive entity.



43
44
45
# File 'lib/drives/item/drive_item_request_builder.rb', line 43

def items()
    return MicrosoftGraph::Drives::Item::Items::ItemsRequestBuilder.new(@path_parameters, @request_adapter)
end

#last_modified_by_userObject

Provides operations to manage the lastModifiedByUser property of the microsoft.graph.baseItem entity.



48
49
50
# File 'lib/drives/item/drive_item_request_builder.rb', line 48

def last_modified_by_user()
    return MicrosoftGraph::Drives::Item::LastModifiedByUser::LastModifiedByUserRequestBuilder.new(@path_parameters, @request_adapter)
end

#listObject

Provides operations to manage the list property of the microsoft.graph.drive entity.



53
54
55
# File 'lib/drives/item/drive_item_request_builder.rb', line 53

def list()
    return MicrosoftGraph::Drives::Item::List::ListRequestBuilder.new(@path_parameters, @request_adapter)
end

#patch(body, request_configuration = nil) ⇒ Object

Update entity in drives

Parameters:

  • body

    The request body

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of drive

Raises:

  • (StandardError)


119
120
121
122
123
124
125
126
127
128
# File 'lib/drives/item/drive_item_request_builder.rb', line 119

def patch(body, request_configuration=nil)
    raise StandardError, 'body cannot be null' if body.nil?
    request_info = self.to_patch_request_information(
        body, 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::Drive.create_from_discriminator_value(pn) }, error_mapping)
end

#recentObject

Provides operations to call the recent method.



58
59
60
# File 'lib/drives/item/drive_item_request_builder.rb', line 58

def recent()
    return MicrosoftGraph::Drives::Item::Recent::RecentRequestBuilder.new(@path_parameters, @request_adapter)
end

#rootObject

Provides operations to manage the root property of the microsoft.graph.drive entity.



63
64
65
# File 'lib/drives/item/drive_item_request_builder.rb', line 63

def root()
    return MicrosoftGraph::Drives::Item::Root::RootRequestBuilder.new(@path_parameters, @request_adapter)
end

#search_with_q(q) ⇒ Object

Provides operations to call the search method.

Parameters:

  • q

    Usage: q=‘q’

Returns:

  • a search_with_q_request_builder

Raises:

  • (StandardError)


134
135
136
137
# File 'lib/drives/item/drive_item_request_builder.rb', line 134

def search_with_q(q)
    raise StandardError, 'q cannot be null' if q.nil?
    return SearchWithQRequestBuilder.new(@path_parameters, @request_adapter, q)
end

#shared_with_meObject

Provides operations to call the sharedWithMe method.



68
69
70
# File 'lib/drives/item/drive_item_request_builder.rb', line 68

def shared_with_me()
    return MicrosoftGraph::Drives::Item::SharedWithMe::SharedWithMeRequestBuilder.new(@path_parameters, @request_adapter)
end

#specialObject

Provides operations to manage the special property of the microsoft.graph.drive entity.



73
74
75
# File 'lib/drives/item/drive_item_request_builder.rb', line 73

def special()
    return MicrosoftGraph::Drives::Item::Special::SpecialRequestBuilder.new(@path_parameters, @request_adapter)
end

#to_delete_request_information(request_configuration = nil) ⇒ Object

Delete entity from drives

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information



143
144
145
146
147
148
149
150
151
152
153
# File 'lib/drives/item/drive_item_request_builder.rb', line 143

def to_delete_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 = :DELETE
    unless request_configuration.nil?
        request_info.add_headers_from_raw_object(request_configuration.headers)
        request_info.add_request_options(request_configuration.options)
    end
    return request_info
end

#to_get_request_information(request_configuration = nil) ⇒ Object

Get entity from drives by key

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information



159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/drives/item/drive_item_request_builder.rb', line 159

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

#to_patch_request_information(body, request_configuration = nil) ⇒ Object

Update entity in drives

Parameters:

  • body

    The request body

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information

Raises:

  • (StandardError)


178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/drives/item/drive_item_request_builder.rb', line 178

def to_patch_request_information(body, request_configuration=nil)
    raise StandardError, 'body cannot be null' if body.nil?
    request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
    request_info.url_template = @url_template
    request_info.path_parameters = @path_parameters
    request_info.http_method = :PATCH
    request_info.headers.add('Accept', 'application/json')
    unless request_configuration.nil?
        request_info.add_headers_from_raw_object(request_configuration.headers)
        request_info.add_request_options(request_configuration.options)
    end
    request_info.set_content_from_parsable(@request_adapter, "application/json", body)
    return request_info
end