Class: TeamBattlesSdk::Generated::Matches::Item::Scores::ScoresRequestBuilder

Inherits:
MicrosoftKiotaAbstractions::BaseRequestBuilder
  • Object
show all
Defined in:
lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb

Overview

Builds and executes requests for operations under #matches#matchId#scores

Instance Method Summary collapse

Constructor Details

#initialize(path_parameters, request_adapter) ⇒ Object

Instantiates a new ScoresRequestBuilder and sets the default values.

Parameters:

  • path_parameters

    Path parameters for the request

  • request_adapter

    The request adapter to use to execute the requests.



27
28
29
# File 'lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb', line 27

def initialize(path_parameters, request_adapter)
    super(path_parameters, request_adapter, "{+baseurl}/matches/{matchId}/scores")
end

Instance Method Details

#get(request_configuration = nil) ⇒ Object

Retrieve every map score for a match plus a series summary. Returns the full unpaginated list of map scores (no cursor or limit) and a seriesScore counting map wins per side, computed only from CONFIRMED maps and awarding a map to the side with the strictly higher score (equal scores count for neither). Each score’s scoreStatus is CONFIRMED or PENDING; submittedBy, confirmedBy, and createdAt may be null. Screenshot URLs are suppressed (empty array) for any score whose API-uploaded image has not passed content moderation. Requires one of matches.user_matches:read, matches.team_matches:read, or matches.org_matches:read. The caller must be an active member of one of the match’s two teams; non-participants receive 403, unless they hold a TeamBattles staff role, which can read any match’s scores.

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of map_scores



35
36
37
38
39
40
41
42
43
44
# File 'lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb', line 35

def get(request_configuration=nil)
    request_info = self.to_get_request_information(
        request_configuration
    )
    error_mapping = Hash.new
    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) }
    return @request_adapter.send_async(request_info, lambda {|pn| TeamBattlesSdk::Generated::Models::MapScores.create_from_discriminator_value(pn) }, error_mapping)
end

#patch(body, request_configuration = nil) ⇒ Object

Confirm a map score submitted by the opposing team. Only the opposing team’s captain can confirm (cannot confirm own team’s submission). Requires the matches.team_matches:read-write permission.

Parameters:

  • body

    Confirmation payload identifying the map score to confirm.

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of score_submission_result

Raises:

  • (StandardError)


51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb', line 51

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) }
    return @request_adapter.send_async(request_info, lambda {|pn| TeamBattlesSdk::Generated::Models::ScoreSubmissionResult.create_from_discriminator_value(pn) }, error_mapping)
end

#post(body, request_configuration = nil) ⇒ Object

Submit or overwrite a map score for a match. Only team captains can submit. Requires the matches.team_matches:read-write permission.

Parameters:

  • body

    Map score submission payload for a single map.

  • request_configuration (defaults to: nil)

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

Returns:

  • a Fiber of score_submission_result

Raises:

  • (StandardError)


69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb', line 69

def post(body, request_configuration=nil)
    raise StandardError, 'body cannot be null' if body.nil?
    request_info = self.to_post_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) }
    return @request_adapter.send_async(request_info, lambda {|pn| TeamBattlesSdk::Generated::Models::ScoreSubmissionResult.create_from_discriminator_value(pn) }, error_mapping)
end

#to_get_request_information(request_configuration = nil) ⇒ Object

Retrieve every map score for a match plus a series summary. Returns the full unpaginated list of map scores (no cursor or limit) and a seriesScore counting map wins per side, computed only from CONFIRMED maps and awarding a map to the side with the strictly higher score (equal scores count for neither). Each score’s scoreStatus is CONFIRMED or PENDING; submittedBy, confirmedBy, and createdAt may be null. Screenshot URLs are suppressed (empty array) for any score whose API-uploaded image has not passed content moderation. Requires one of matches.user_matches:read, matches.team_matches:read, or matches.org_matches:read. The caller must be an active member of one of the match’s two teams; non-participants receive 403, unless they hold a TeamBattles staff role, which can read any match’s scores.

Parameters:

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information



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

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

Confirm a map score submitted by the opposing team. Only the opposing team’s captain can confirm (cannot confirm own team’s submission). Requires the matches.team_matches:read-write permission.

Parameters:

  • body

    Confirmation payload identifying the map score to confirm.

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information

Raises:

  • (StandardError)


104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb', line 104

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

#to_post_request_information(body, request_configuration = nil) ⇒ Object

Submit or overwrite a map score for a match. Only team captains can submit. Requires the matches.team_matches:read-write permission.

Parameters:

  • body

    Map score submission payload for a single map.

  • request_configuration (defaults to: nil)

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

Returns:

  • a request_information

Raises:

  • (StandardError)


124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb', line 124

def to_post_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 = :POST
    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 scores_request_builder

Raises:

  • (StandardError)


143
144
145
146
# File 'lib/teambattles_sdk/generated/matches/item/scores/scores_request_builder.rb', line 143

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