Class: TeamBattlesSdk::Generated::Webhooks::Item::WebhooksItemRequestBuilder

Inherits:
MicrosoftKiotaAbstractions::BaseRequestBuilder
  • Object
show all
Defined in:
lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb

Overview

Builds and executes requests for operations under #webhooks#id

Instance Method Summary collapse

Constructor Details

#initialize(path_parameters, request_adapter) ⇒ Object

Instantiates a new WebhooksItemRequestBuilder and sets the default values.

Parameters:

  • path_parameters

    Path parameters for the request

  • request_adapter

    The request adapter to use to execute the requests.



42
43
44
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 42

def initialize(path_parameters, request_adapter)
    super(path_parameters, request_adapter, "{+baseurl}/webhooks/{id}")
end

Instance Method Details

#delete(request_configuration = nil) ⇒ Object

Deletes a webhook endpoint in the caller’s scope, cascading its delivery logs and rate-limit bucket. Requires the webhooks.manage permission and the webhooks feature.

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of webhook_ok



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 50

def delete(request_configuration=nil)
    request_info = self.to_delete_request_information(
        request_configuration
    )
    error_mapping = Hash.new
    error_mapping["400"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["401"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["403"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["404"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["429"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    return @request_adapter.send_async(request_info, lambda {|pn| TeamBattlesSdk::Generated::Models::WebhookOk.create_from_discriminator_value(pn) }, error_mapping)
end

#deliveriesObject

The deliveries property



23
24
25
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 23

def deliveries()
    return TeamBattlesSdk::Generated::Webhooks::Item::Deliveries::DeliveriesRequestBuilder.new(@path_parameters, @request_adapter)
end

#get(request_configuration = nil) ⇒ Object

Returns one webhook endpoint in the caller’s scope (no secret material). A scope/owner mismatch is reported as 404. Requires the webhooks.manage permission and the webhooks feature.

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of webhook_endpoint



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 67

def get(request_configuration=nil)
    request_info = self.to_get_request_information(
        request_configuration
    )
    error_mapping = Hash.new
    error_mapping["400"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["401"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["403"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["404"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["429"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    return @request_adapter.send_async(request_info, lambda {|pn| TeamBattlesSdk::Generated::Models::WebhookEndpoint.create_from_discriminator_value(pn) }, error_mapping)
end

#patch(body, request_configuration = nil) ⇒ Object

Partially updates a webhook endpoint in the caller’s scope. Re-enabling or changing the URL resets the failure count. Requires the webhooks.manage permission and the webhooks feature.

Parameters:

  • body

    Partial update of a webhook endpoint.

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of webhook_ok

Raises:

  • (StandardError)


85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 85

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["400"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["401"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["403"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["404"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    error_mapping["429"] = lambda {|pn| TeamBattlesSdk::Generated::Models::Error.create_from_discriminator_value(pn) }
    return @request_adapter.send_async(request_info, lambda {|pn| TeamBattlesSdk::Generated::Models::WebhookOk.create_from_discriminator_value(pn) }, error_mapping)
end

#rotate_secretObject

The rotateSecret property



28
29
30
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 28

def rotate_secret()
    return TeamBattlesSdk::Generated::Webhooks::Item::RotateSecret::RotateSecretRequestBuilder.new(@path_parameters, @request_adapter)
end

#testObject

The test property



33
34
35
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 33

def test()
    return TeamBattlesSdk::Generated::Webhooks::Item::Test::TestRequestBuilder.new(@path_parameters, @request_adapter)
end

#to_delete_request_information(request_configuration = nil) ⇒ Object

Deletes a webhook endpoint in the caller’s scope, cascading its delivery logs and rate-limit bucket. Requires the webhooks.manage permission and the webhooks feature.

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 103

def to_delete_request_information(request_configuration=nil)
    request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
    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.url_template = @url_template
    request_info.path_parameters = @path_parameters
    request_info.http_method = :DELETE
    request_info.headers.try_add('Accept', 'application/json')
    return request_info
end

#to_get_request_information(request_configuration = nil) ⇒ Object

Returns one webhook endpoint in the caller’s scope (no secret material). A scope/owner mismatch is reported as 404. Requires the webhooks.manage permission and the webhooks feature.

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 120

def to_get_request_information(request_configuration=nil)
    request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
    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.url_template = @url_template
    request_info.path_parameters = @path_parameters
    request_info.http_method = :GET
    request_info.headers.try_add('Accept', 'application/json')
    return request_info
end

#to_patch_request_information(body, request_configuration = nil) ⇒ Object

Partially updates a webhook endpoint in the caller’s scope. Re-enabling or changing the URL resets the failure count. Requires the webhooks.manage permission and the webhooks feature.

Parameters:

  • body

    Partial update of a webhook endpoint.

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information

Raises:

  • (StandardError)


138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 138

def to_patch_request_information(body, request_configuration=nil)
    raise StandardError, 'body cannot be null' if body.nil?
    request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
    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)
    request_info.url_template = @url_template
    request_info.path_parameters = @path_parameters
    request_info.http_method = :PATCH
    request_info.headers.try_add('Accept', 'application/json')
    return request_info
end

#with_url(raw_url) ⇒ Object

Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.

Parameters:

  • raw_url

    The raw URL to use for the request builder.

Returns:

  • a webhooks_item_request_builder

Raises:

  • (StandardError)


157
158
159
160
# File 'lib/teambattles_sdk/generated/webhooks/item/webhooks_item_request_builder.rb', line 157

def with_url(raw_url)
    raise StandardError, 'raw_url cannot be null' if raw_url.nil?
    return WebhooksItemRequestBuilder.new(raw_url, @request_adapter)
end